Skip to content

Commit

Permalink
Merge pull request #47 from GourjonValentin/stable
Browse files Browse the repository at this point in the history
Update Villager Trades
  • Loading branch information
Niilyx authored Sep 15, 2023
2 parents 67a7655 + fa5e8ff commit d1fcbaf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/fr/efreicraft/ludos/core/LudosCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void onEnable() {
getLogger().info("Starting Core.");
new Core(this, ProtocolLibrary.getProtocolManager());

getLogger().info("Adding Redis handler.");
ACP.getClient().addRedisHandler(new RedisHandler());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ public void loadAllGameJars() {
* @throws GameStatusException Exception levée si le jeu ne peut pas être chargé
*/
public void loadGame(String gameName) throws GameStatusException, GameRegisteringException {
Core.get().getLogger().log(Level.INFO, "Loading game {0}...", gameName);

if (status != GameStatus.WAITING) {
throw new GameStatusException("Impossible de charger un jeu en cours de partie !");
}
Expand Down Expand Up @@ -192,6 +194,7 @@ public void loadGame(String gameName) throws GameStatusException, GameRegisterin
* @param defaultGamePluginName Nom du plugin du jeu.
*/
public void changeDefaultGame(String defaultGamePluginName) {
Core.get().getLogger().log(Level.INFO, "Changing default game to {0}...", defaultGamePluginName);
this.defaultGamePluginName = defaultGamePluginName;
Bukkit.getScheduler().runTask(Core.get().getPlugin(), () -> {
try {
Expand All @@ -203,7 +206,7 @@ public void changeDefaultGame(String defaultGamePluginName) {
}

public void registerGamePlugin(GamePlugin gamePlugin) {
System.out.println("Registering game " + gamePlugin.getName());
Core.get().getLogger().log(Level.INFO, "Registering game {0}...", gamePlugin.getName());
gamePlugins.put(gamePlugin.getName(), gamePlugin);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class RedisHandler implements IRedisMessageHandler {

@Override
public void run(String... args) {
System.out.println("Received Redis message: " + args[0]);
switch (args[0]) {
case "changeRequestedGame":
Core.get().getGameManager().changeDefaultGame(args[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void setupMerchants() {
private List<MerchantRecipe> getTradesBatisseur() {
List<MerchantRecipe> recipeList = new ArrayList<>();

ItemStack product = new ItemStack(Material.SANDSTONE, 2);
ItemStack product = new ItemStack(Material.SANDSTONE, 4);
MerchantRecipe sandstone = new MerchantRecipe(product, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
sandstone.addIngredient(new ItemStack(Material.BRICK));
recipeList.add(sandstone);
Expand All @@ -162,7 +162,7 @@ private List<MerchantRecipe> getTradesBatisseur() {
endstone.addIngredient(new ItemStack(Material.BRICK, 4));
recipeList.add(endstone);

ItemStack product2 = new ItemStack(Material.SOUL_SAND);
ItemStack product2 = new ItemStack(Material.SOUL_SAND, 2);
MerchantRecipe soulsand = new MerchantRecipe(product2, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
soulsand.addIngredient(new ItemStack(Material.IRON_INGOT));
recipeList.add(soulsand);
Expand Down Expand Up @@ -215,42 +215,48 @@ private List<MerchantRecipe> getTradesTerroriste() {
product1.addEnchantment(Enchantment.KNOCKBACK, 1);
product1.addEnchantment(Enchantment.DURABILITY, 1);
MerchantRecipe sword1 = new MerchantRecipe(product1, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
sword1.addIngredient(new ItemStack(Material.GOLD_INGOT, 2));
sword1.addIngredient(new ItemStack(Material.GOLD_INGOT, 3));
recipeList.add(sword1);

ItemStack product2 = new ItemStack(Material.DIAMOND_SWORD);
product2.addEnchantment(Enchantment.DAMAGE_ALL, 4);
product2.addEnchantment(Enchantment.KNOCKBACK, 2);
MerchantRecipe sword2 = new MerchantRecipe(product2, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
sword2.addIngredient(new ItemStack(Material.EMERALD, 5));
sword2.addIngredient(new ItemStack(Material.EMERALD, 2));
sword2.addIngredient(new ItemStack(Material.GOLD_INGOT, 2));
recipeList.add(sword2);

ItemStack product3 = new ItemStack(Material.BOW);
product3.addEnchantment(Enchantment.ARROW_INFINITE, 1);
MerchantRecipe bow = new MerchantRecipe(product3, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
bow.addIngredient(new ItemStack(Material.IRON_INGOT, 3));
bow.addIngredient(new ItemStack(Material.IRON_INGOT, 6));
recipeList.add(bow);

ItemStack product4 = new ItemStack(Material.BOW);
product4.addEnchantment(Enchantment.ARROW_INFINITE, 1);
product4.addEnchantment(Enchantment.ARROW_DAMAGE, 2);
MerchantRecipe bow1 = new MerchantRecipe(product4, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
bow1.addIngredient(new ItemStack(Material.GOLD_INGOT, 3));
bow1.addIngredient(new ItemStack(Material.GOLD_INGOT, 6));
recipeList.add(bow1);

ItemStack product5 = new ItemStack(Material.BOW);
product5.addEnchantment(Enchantment.ARROW_INFINITE, 1);
product5.addEnchantment(Enchantment.ARROW_DAMAGE, 4);
MerchantRecipe bow2 = new MerchantRecipe(product5, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
bow2.addIngredient(new ItemStack(Material.EMERALD));
bow2.addIngredient(new ItemStack(Material.GOLD_INGOT, 3));
bow2.addIngredient(new ItemStack(Material.EMERALD, 3));
bow2.addIngredient(new ItemStack(Material.GOLD_INGOT, 6));
recipeList.add(bow2);

ItemStack product6 = new ItemStack(Material.ARROW);
MerchantRecipe arrow = new MerchantRecipe(product6, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
arrow.addIngredient(new ItemStack(Material.GOLD_INGOT));
recipeList.add(arrow);

ItemStack product7 = new ItemStack(Material.SHIELD);
MerchantRecipe shield = new MerchantRecipe(product7, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
shield.addIngredient(new ItemStack(Material.IRON_INGOT, 3));
recipeList.add(shield);


return recipeList;
}
Expand All @@ -260,17 +266,17 @@ private List<MerchantRecipe> getTradesTavernier() {

ItemStack product = new ItemStack(Material.COOKED_BEEF);
MerchantRecipe meat = new MerchantRecipe(product, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
meat.addIngredient(new ItemStack(Material.BRICK, 5));
meat.addIngredient(new ItemStack(Material.BRICK, 2));
recipeList.add(meat);

ItemStack product1 = new ItemStack(Material.GOLDEN_APPLE);
MerchantRecipe gapple = new MerchantRecipe(product1, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
gapple.addIngredient(new ItemStack(Material.IRON_INGOT, 2));
gapple.addIngredient(new ItemStack(Material.IRON_INGOT, 1));
recipeList.add(gapple);

ItemStack product2 = new ItemStack(Material.FISHING_ROD);
MerchantRecipe fishingrod = new MerchantRecipe(product2, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
fishingrod.addIngredient(new ItemStack(Material.IRON_INGOT, 2));
fishingrod.addIngredient(new ItemStack(Material.IRON_INGOT, 4));
recipeList.add(fishingrod);

ItemStack product3 = new ItemStack(Material.COBWEB);
Expand All @@ -286,17 +292,18 @@ private List<MerchantRecipe> getTradesTavernier() {

ItemStack product5 = new ItemStack(Material.FLINT_AND_STEEL);
MerchantRecipe lighter = new MerchantRecipe(product5, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
lighter.addIngredient(new ItemStack(Material.GOLD_INGOT, 3));
lighter.addIngredient(new ItemStack(Material.GOLD_INGOT, 2));
recipeList.add(lighter);

ItemStack product6 = new ItemStack(Material.REDSTONE_TORCH);
MerchantRecipe redstonetorch = new MerchantRecipe(product6, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
redstonetorch.addIngredient(new ItemStack(Material.BRICK, 10));
redstonetorch.addIngredient(new ItemStack(Material.BRICK, 15));
recipeList.add(redstonetorch);

ItemStack product7 = new ItemStack(Material.ENDER_PEARL);
MerchantRecipe enderpearl = new MerchantRecipe(product7, 0, Integer.MAX_VALUE, false, 0, 1, -1, 0, true);
enderpearl.addIngredient(new ItemStack(Material.EMERALD));
enderpearl.addIngredient(new ItemStack(Material.GOLD_INGOT, 5));
recipeList.add(enderpearl);

return recipeList;
Expand Down

0 comments on commit d1fcbaf

Please sign in to comment.