From 4500c4d407c170102adc44170aa6e6cce8305058 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 14:58:32 -0800 Subject: [PATCH 01/18] Attempting to fix dupe bug with certain plugins and Super Breaker. --- .../java/com/gmail/nossr50/listeners/BlockListener.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 21b9c3a2e..e8039edc5 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -294,6 +294,14 @@ public class BlockListener implements Listener { Block block = event.getBlock(); Material material = block.getType(); + FakeBlockBreakEvent fakeEvent = new FakeBlockBreakEvent(block, player); + mcMMO.p.getServer().getPluginManager().callEvent(fakeEvent); + + if(fakeEvent.isCancelled()) + return; + else + fakeEvent.setCancelled(true); + Config configInstance = Config.getInstance(); Permissions permInstance = Permissions.getInstance(); From 3a467b3da49b91d9d15502c63cb0e99671ecfb42 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 16:18:27 -0800 Subject: [PATCH 02/18] Adding Fishermans Diet ability to fishing. --- .../commands/skills/FishingCommand.java | 27 +++++++++++++ .../nossr50/listeners/EntityListener.java | 38 ++++++++++++++++--- .../com/gmail/nossr50/util/Permissions.java | 4 ++ .../resources/locale/locale_cs_CZ.properties | 3 ++ .../resources/locale/locale_cy.properties | 3 ++ .../resources/locale/locale_da.properties | 3 ++ .../resources/locale/locale_de.properties | 3 ++ .../resources/locale/locale_en_US.properties | 7 +++- .../resources/locale/locale_es.properties | 3 ++ .../resources/locale/locale_fi.properties | 3 ++ .../resources/locale/locale_fr.properties | 3 ++ .../resources/locale/locale_it.properties | 3 ++ .../resources/locale/locale_ko.properties | 3 ++ .../resources/locale/locale_lv.properties | 3 ++ .../resources/locale/locale_nl.properties | 3 ++ .../resources/locale/locale_no.properties | 3 ++ .../resources/locale/locale_pl.properties | 3 ++ .../resources/locale/locale_pt_BR.properties | 3 ++ .../resources/locale/locale_ru.properties | 3 ++ .../resources/locale/locale_sv.properties | 3 ++ .../resources/locale/locale_tr_TR.properties | 3 ++ .../resources/locale/locale_zh_CN.properties | 3 ++ src/main/resources/plugin.yml | 3 ++ 23 files changed, 126 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index dcc33ef24..e7f095d6c 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -10,10 +10,12 @@ public class FishingCommand extends SkillCommand { private int lootTier; private String magicChance; private String shakeChance; + private String fishermansDietRank; private boolean canTreasureHunt; private boolean canMagicHunt; private boolean canShake; + private boolean canFishermansDiet; public FishingCommand() { super(SkillType.FISHING); @@ -24,6 +26,22 @@ public class FishingCommand extends SkillCommand { lootTier = Fishing.getFishingLootTier(profile); magicChance = percent.format((float) lootTier / 15); shakeChance = String.valueOf(Fishing.getShakeChance(lootTier)); + + if (skillValue >= 1000) { + fishermansDietRank = "5"; + } + else if (skillValue >= 800) { + fishermansDietRank = "4"; + } + else if (skillValue >= 600) { + fishermansDietRank = "3"; + } + else if (skillValue >= 400) { + fishermansDietRank = "2"; + } + else { + fishermansDietRank = "1"; + } } @Override @@ -31,6 +49,7 @@ public class FishingCommand extends SkillCommand { canTreasureHunt = permInstance.fishingTreasures(player); canMagicHunt = permInstance.fishingMagic(player); canShake = permInstance.shakeMob(player); + canFishermansDiet = permInstance.fishermansDiet(player); } @Override @@ -51,6 +70,10 @@ public class FishingCommand extends SkillCommand { if (canShake) { player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.4"), LocaleLoader.getString("Fishing.Effect.5") })); } + + if (canFishermansDiet) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Fishing.Effect.6"), LocaleLoader.getString("Fishing.Effect.7") })); + } } @Override @@ -76,5 +99,9 @@ public class FishingCommand extends SkillCommand { player.sendMessage(LocaleLoader.getString("Fishing.Ability.Shake", new Object[] { shakeChance })); } } + + if (canFishermansDiet) { + player.sendMessage(LocaleLoader.getString("Fishing.Ability.FD", new Object[] { fishermansDietRank })); + } } } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 739099d4c..133f86c6d 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -261,10 +261,6 @@ public class EntityListener implements Listener { int currentFoodLevel = player.getFoodLevel(); int newFoodLevel = event.getFoodLevel(); - if (!Permissions.getInstance().farmersDiet(player)) { - return; - } - /* * Some foods have 3 ranks * Some foods have 5 ranks @@ -275,65 +271,97 @@ public class EntityListener implements Listener { if (newFoodLevel > currentFoodLevel) { Material food = player.getItemInHand().getType(); int herbLevel = profile.getSkillLevel(SkillType.HERBALISM); + int fishLevel = profile.getSkillLevel(SkillType.FISHING); int foodChange = newFoodLevel - currentFoodLevel; int rankChange = 0; + boolean fish = false; + boolean herb = false; switch (food) { case BREAD: /* BREAD RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */ rankChange = 200; + herb = true; break; case COOKIE: /* COOKIE RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ rankChange = 400; + herb = true; break; case MELON: /* MELON RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ rankChange = 400; + herb = true; break; case MUSHROOM_SOUP: /* MUSHROOM SOUP RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */ rankChange = 200; + herb = true; break; case CARROT_ITEM: /* CARROT RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @ 1000 */ rankChange = 200; + herb = true; break; case POTATO_ITEM: /* POTATO RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ rankChange = 400; + herb = true; break; case BAKED_POTATO: /* BAKED POTATO RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */ rankChange = 200; + herb = true; break; case POISONOUS_POTATO: /* POISONOUS POTATO RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ rankChange = 400; + herb = true; break; case GOLDEN_CARROT: /* GOLDEN CARROT RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */ rankChange = 200; + herb = true; break; case PUMPKIN_PIE: /* PUMPKIN PIE RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */ rankChange = 200; + herb = true; + break; + + case RAW_FISH: + /* RAW FISH RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ + rankChange = 400; + fish = true; + break; + + case COOKED_FISH: + /* COOKED FISH RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */ + rankChange = 200; + fish = true; break; default: return; } + if (herb && !Permissions.getInstance().farmersDiet(player)) { + return; + } + else if (fish && !Permissions.getInstance().fishermansDiet(player)) { + return; + } + for (int i = 200; i <= 1000; i += rankChange) { - if (herbLevel >= i) { + if ((herb && herbLevel >= i) || (fish && fishLevel >= i)) { foodChange++; } } diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index d72f4bbb8..daeb486c3 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -120,6 +120,10 @@ public class Permissions { return player.hasPermission("mcmmo.ability.fishing.magic"); } + public boolean fishermansDiet(Player player) { + return player.hasPermission("mcmmo.ability.fishing.fishermansdiet"); + } + /* * MCMMO.ABILITY.MINING.* */ diff --git a/src/main/resources/locale/locale_cs_CZ.properties b/src/main/resources/locale/locale_cs_CZ.properties index d9a8dea6b..c4fc31971 100644 --- a/src/main/resources/locale/locale_cs_CZ.properties +++ b/src/main/resources/locale/locale_cs_CZ.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=UZAMKNUTO DO UROVNE DOVEDNOSTI 150+ (SHAKE) Fishing.Ability.Rank=[[RED]]Lovec Poklad\u016f Level: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magicky Lovec Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Nasel si poklad! Fishing.Listener=Rybareni: diff --git a/src/main/resources/locale/locale_cy.properties b/src/main/resources/locale/locale_cy.properties index 74176bce8..0f70eaf61 100644 --- a/src/main/resources/locale/locale_cy.properties +++ b/src/main/resources/locale/locale_cy.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=DAN GLO HYD 150 + SKILL (YSGYTLAETH) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_da.properties b/src/main/resources/locale/locale_da.properties index 057436ece..523a46604 100644 --- a/src/main/resources/locale/locale_da.properties +++ b/src/main/resources/locale/locale_da.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=L\u00c5ST INDTIL 150+ I F\u00c6RDIGHED (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]Du har fundet en skat! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_de.properties b/src/main/resources/locale/locale_de.properties index a1f14ed4c..d69b147d5 100644 --- a/src/main/resources/locale/locale_de.properties +++ b/src/main/resources/locale/locale_de.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magiej\u00e4ger: [[GRAY]] **Verbessert sich mit Scha Fishing.Ability.Locked.0=Gesperrt bis Level 150+ (SHAKE) Fishing.Ability.Rank=[[RED]]Schatzj\u00e4ger Rang: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Schatzj\u00e4ger (Passiv) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magiej\u00e4ger Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[AQUA]]Du hast einen Schatz gefunden! Fishing.Listener=Angeln: diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 0bd4b8bf1..333d0d0a7 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -103,12 +103,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake Chance: [[YELLOW]]{0}% +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: @@ -122,14 +125,14 @@ Herbalism.Ability.FD=[[RED]]Farmers Diet: [[YELLOW]]Rank {0} Herbalism.Ability.GTe.Length=[[RED]]Green Terra Length: [[YELLOW]]{0}s Herbalism.Ability.GTh.Chance=[[RED]]Green Thumb Chance: [[YELLOW]]{0} Herbalism.Ability.GTh.Fail=[[RED]]**GREEN THUMB FAIL** -Herbalism.Ability.GTh.Stage=[[RED]]Green Thumb Stage: [[YELLOW]] Wheat grows in stage {0} +Herbalism.Ability.GTh.Stage=[[RED]]Green Thumb Stage: [[YELLOW]] Crops grow in stage {0} Herbalism.Ability.GTh=[[GREEN]]**GREEN THUMB** Herbalism.Ability.Lower=[[GRAY]]**YOU LOWER YOUR HOE** Herbalism.Ability.Ready=[[GREEN]]**YOU READY YOUR HOE** Herbalism.Effect.0=Green Terra (ABILITY) Herbalism.Effect.1=Spread the Terra, 3x Drops Herbalism.Effect.2=Green Thumb (Wheat) -Herbalism.Effect.3=Auto-Plants wheat when harvesting +Herbalism.Effect.3=Auto-Plants crops when harvesting Herbalism.Effect.4=Green Thumb (Cobble/Stone Brick/Dirt) Herbalism.Effect.5=Make bricks mossy, or make grass grow Herbalism.Effect.6=Farmer's Diet diff --git a/src/main/resources/locale/locale_es.properties b/src/main/resources/locale/locale_es.properties index 4cb81acd1..a955457ec 100644 --- a/src/main/resources/locale/locale_es.properties +++ b/src/main/resources/locale/locale_es.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Cazador M\u00e1gico: [[GRAY]] **Mejora con Rango de Fishing.Ability.Locked.0=BLOQUEADO HASTA HABILIDAD 150+ (SACUDIDA) Fishing.Ability.Rank=[[RED]]Cazador de Tesoros: [[YELLOW]]Rango {0}/5 Fishing.Ability.Shake=[[RED]]Sacudida: [[YELLOW]]Arrancar items de monstruos, mutilandolos en el proceso. +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Cazador de Tesoros (Pasivo) Fishing.Effect.1=Pescar objetos miscel\u00e1neos Fishing.Effect.2=Cazador M\u00e1gico Fishing.Effect.3=Encuentra Objetos Encantados Fishing.Effect.4=Sacudir (contra Entidades) Fishing.Effect.5=Sacudir los items fuera de los monstruos con la ca\u00f1a de pescar +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Probabilidad de Cazador M\u00e1gico: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]\u00a1Tesoro encontrado! Fishing.Listener=Pescador: diff --git a/src/main/resources/locale/locale_fi.properties b/src/main/resources/locale/locale_fi.properties index cdfcb5373..841f6bcad 100644 --- a/src/main/resources/locale/locale_fi.properties +++ b/src/main/resources/locale/locale_fi.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_fr.properties b/src/main/resources/locale/locale_fr.properties index bdbe1daac..abd381a91 100644 --- a/src/main/resources/locale/locale_fr.properties +++ b/src/main/resources/locale/locale_fr.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]P\u00eache magique : [[GRAY]] **S\'am\u00e9liore via Fishing.Ability.Locked.0=VERROUILL\u00c9 AVANT 150+ (Secousse) Fishing.Ability.Rank=[[RED]]Chasseur de tr\u00e9sors : [[YELLOW]] Rang {0}/5 Fishing.Ability.Shake=[[RED]]Secousse : [[YELLOW]]Arrache des objets des monstres, les mutilant par la m\u00eame occasion ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Chasseur de tr\u00e9sors Fishing.Effect.1=Remonte des objets inhabituels Fishing.Effect.2=P\u00eache magique Fishing.Effect.3=Remonte des objets magiques Fishing.Effect.4=Secousse (sur monstres) Fishing.Effect.5=Fait tomber des objets des monstres avec une canne \u00e0 p\u00eache +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Tr\u00e9sor d\u00e9couvert ! Fishing.Listener=P\u00eache : diff --git a/src/main/resources/locale/locale_it.properties b/src/main/resources/locale/locale_it.properties index 9ff6da42f..37ca87dbe 100644 --- a/src/main/resources/locale/locale_it.properties +++ b/src/main/resources/locale/locale_it.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Cacciatore di Magia: [[GRAY]] **Migliora insieme al Fishing.Ability.Locked.0=BLOCCATO FINO AD ABILITA\' 150+ (SCUOTERE) Fishing.Ability.Rank=[[RED]]Grado di Cacciatore di Tesori: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Scuotere: [[YELLOW]]Strappa oggetti dai mob, mutilandoli durante il procedimento ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Cacciatore di Tesori (Passivo) Fishing.Effect.1=Ripesca oggetti vari Fishing.Effect.2=Cacciatore di Magia Fishing.Effect.3=Trova Oggetti Incantati Fishing.Effect.4=Scuotere (contro Entit\u00e0) Fishing.Effect.5=Scrolla oggetti di dosso ai mob con una canna da pesca +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Possibilit\u00e0 di Cacciatore di Magia: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Hai trovato un tesoro! Fishing.Listener=Pesca: diff --git a/src/main/resources/locale/locale_ko.properties b/src/main/resources/locale/locale_ko.properties index d51a095ab..941885361 100644 --- a/src/main/resources/locale/locale_ko.properties +++ b/src/main/resources/locale/locale_ko.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_lv.properties b/src/main/resources/locale/locale_lv.properties index 5ecc030df..3303a4344 100644 --- a/src/main/resources/locale/locale_lv.properties +++ b/src/main/resources/locale/locale_lv.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Zvejo\u0161ana: diff --git a/src/main/resources/locale/locale_nl.properties b/src/main/resources/locale/locale_nl.properties index 0cb73a4ae..c341339a3 100644 --- a/src/main/resources/locale/locale_nl.properties +++ b/src/main/resources/locale/locale_nl.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Vissen: diff --git a/src/main/resources/locale/locale_no.properties b/src/main/resources/locale/locale_no.properties index 2c35bb21a..81a675121 100644 --- a/src/main/resources/locale/locale_no.properties +++ b/src/main/resources/locale/locale_no.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=L\u00e5st til 150 + ferdighet (Shake) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_pl.properties b/src/main/resources/locale/locale_pl.properties index 2bc8dc523..38fe0e5e5 100644 --- a/src/main/resources/locale/locale_pl.properties +++ b/src/main/resources/locale/locale_pl.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Ranga lowienia skarbow: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Lowca Skarbow (Pasywna) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magiczny Lowca Fishing.Effect.3=Znajdowanie Zakletych Przedmiotow Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_pt_BR.properties b/src/main/resources/locale/locale_pt_BR.properties index e5cf84b80..0d44ffd66 100644 --- a/src/main/resources/locale/locale_pt_BR.properties +++ b/src/main/resources/locale/locale_pt_BR.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_ru.properties b/src/main/resources/locale/locale_ru.properties index 111f4472a..f128209a5 100644 --- a/src/main/resources/locale/locale_ru.properties +++ b/src/main/resources/locale/locale_ru.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]\u041e\u0445\u043e\u0442\u043d\u0438\u043a \u0417\u0 Fishing.Ability.Locked.0=\u0417\u0410\u0411\u041b\u041e\u041a\u0418\u0420\u041e\u0412\u0410\u041d\u041e \u0414\u041e 150+ \u0423\u0420\u041e\u0412\u041d\u042f \u041d\u0410\u0412\u042b\u041a\u0410 (\u0412\u0421\u0422\u0420\u042f\u0421\u041a\u0410) Fishing.Ability.Rank=[[RED]]\u0420\u0430\u043d\u0433 \u041e\u0445\u043e\u0442\u043d\u0438\u043a\u0430 \u0437\u0430 \u0421\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0430\u043c\u0438: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]\u0412\u0441\u0442\u0440\u044f\u0441\u043a\u0430: [[YELLOW]]\u0412\u044b\u0442\u0440\u044f\u0445\u0438\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0449\u0438 \u0438\u0437 \u043c\u043e\u0431\u043e\u0432, \u043a\u0430\u043b\u0435\u0447\u0430 \u0438\u0445 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=\u041e\u0445\u043e\u0442\u043d\u0438\u043a \u0437\u0430 \u0421\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0430\u043c\u0438 (\u041f\u0430\u0441\u0441\u0438\u0432\u043d\u043e\u0435) Fishing.Effect.1=\u041b\u043e\u0432\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 Fishing.Effect.2=\u041e\u0445\u043e\u0442\u043d\u0438\u043a \u0417\u0430 \u041c\u0430\u0433\u0438\u0435\u0439 Fishing.Effect.3=\u041d\u0430\u0445\u043e\u0434\u043a\u0430 \u0417\u0430\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u044b\u0445 \u041f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u0432 Fishing.Effect.4=\u0412\u0441\u0442\u0440\u044f\u0441\u043a\u0430 (\u0421\u0443\u0449\u0435\u0441\u0442\u0432) Fishing.Effect.5=\u0412\u044b\u0442\u0440\u044f\u0445\u0438\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0449\u0438 \u0438\u0437 \u043c\u043e\u0431\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0434\u043e\u0447\u043a\u0438 +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]\u0428\u0430\u043d\u0441 \u041e\u0445\u043e\u0442\u043d\u0438\u043a\u0430 \u0417\u0430 \u041c\u0430\u0433\u0438\u0435\u0439: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]\u041d\u0430\u0439\u0434\u0435\u043d\u043e \u0441\u043e\u043a\u0440\u043e\u0432\u0438\u0449\u0435! Fishing.Listener=\u0420\u044b\u0431\u043e\u043b\u043e\u0432\u0441\u0442\u0432\u043e: diff --git a/src/main/resources/locale/locale_sv.properties b/src/main/resources/locale/locale_sv.properties index d7d7b3e55..ebf607c83 100644 --- a/src/main/resources/locale/locale_sv.properties +++ b/src/main/resources/locale/locale_sv.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_tr_TR.properties b/src/main/resources/locale/locale_tr_TR.properties index be09bc72d..c42fbea39 100644 --- a/src/main/resources/locale/locale_tr_TR.properties +++ b/src/main/resources/locale/locale_tr_TR.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunt Fishing.Ability.Locked.0=LOCKED UNTIL 150+ SKILL (SHAKE) Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=Treasure Hunter (Passive) Fishing.Effect.1=Fish up misc. objects Fishing.Effect.2=Magic Hunter Fishing.Effect.3=Find Enchanted Items Fishing.Effect.4=Shake (vs. Entities) Fishing.Effect.5=Shake items off of mobs w/ fishing pole +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]Treasure found! Fishing.Listener=Fishing: diff --git a/src/main/resources/locale/locale_zh_CN.properties b/src/main/resources/locale/locale_zh_CN.properties index 7dbe27468..f14da1636 100644 --- a/src/main/resources/locale/locale_zh_CN.properties +++ b/src/main/resources/locale/locale_zh_CN.properties @@ -77,12 +77,15 @@ Fishing.Ability.Info=[[RED]]\u9b54\u6cd5\u730e\u4eba: [[GRAY]] ** \u968f\u7740\u Fishing.Ability.Locked.0=\u6280\u80fd 150+ \u89e3\u9501 (\u6643\u52a8\u602a\u7269) Fishing.Ability.Rank=[[RED]]\u5b9d\u7269\u730e\u4eba\u7b49\u7ea7: [[YELLOW]]{0}/5 Fishing.Ability.Shake=[[RED]]\u6643\u52a8\u602a\u7269: [[YELLOW]]\u5411\u602a\u7269\u6325\u52a8\u9c7c\u7aff\u4f7f\u5b83\u4eec\u8eab\u4e0a\u7684\u7269\u54c1\u6389\u843d, \u540c\u65f6\u51cf\u5c11\u5b83\u4eec\u7684\u8840\u91cf ;_; +Fishing.Ability.FD=[[RED]]Fisherman''s Diet: [[YELLOW]]Rank {0} Fishing.Effect.0=\u5b9d\u7269\u730e\u4eba (\u88ab\u52a8\u6280\u80fd) Fishing.Effect.1=\u9493\u5230\u6742\u7269 Fishing.Effect.2=\u9b54\u6cd5\u730e\u4eba Fishing.Effect.3=\u627e\u5230\u9644\u9b54\u7269\u54c1 Fishing.Effect.4=\u6643\u52a8\u602a\u7269 (\u5bf9\u602a\u7269\u4f7f\u7528) Fishing.Effect.5=\u7528\u9c7c\u7aff\u628a\u602a\u7269\u8eab\u4e0a\u7684\u4e1c\u897f\u6447\u4e0b\u6765 +Fishing.Effect.6=Fisherman's Diet +Fishing.Effect.7=Improves hunger restored from fished foods Fishing.Enchant.Chance=[[RED]]\u9b54\u6cd5\u730e\u4eba\u51e0\u7387: [[YELLOW]]{0} Fishing.ItemFound=[[GRAY]]\u53d1\u73b0\u5b9d\u7269\u4e86\uff01 Fishing.Listener=\u9493\u9c7c: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e231df3e4..5fb56fcf1 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -333,12 +333,15 @@ permissions: mcmmo.ability.fishing.shakemob: true mcmmo.ability.fishing.treasures: true mcmmo.ability.fishing.magic: true + mcmmo.ability.fishing.fishermansdiet: true mcmmo.ability.fishing.shakemob: description: Allows access to the Shake Mob ability mcmmo.ability.fishing.treasures: description: Allows treasure drops from Fishing mcmmo.ability.fishing.magic: description: Allows enchanted drops from Fishing + mcmmo.ability.fishing.fishermansdiet: + description: Allows access to the Fishermans's Diet ability mcmmo.ability.mining.*: description: Allows access to all Mining abilities children: From a56f805787b83e8abb4a0dc206757f410c4092a2 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 16:33:37 -0800 Subject: [PATCH 03/18] Modified drop rates for Fishing's Shake ability. Also reverted spacing to match the rest of the project. --- .../nossr50/skills/gathering/Fishing.java | 350 +++++++++--------- 1 file changed, 177 insertions(+), 173 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java index 2fd1f1301..2ea0e5c6f 100755 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Fishing.java @@ -209,12 +209,12 @@ public class Fishing { final Player player = event.getPlayer(); final PlayerProfile profile = Users.getProfile(player); - int lootTier = getFishingLootTier(profile); + int lootTier = getFishingLootTier(profile); int dropChance = getShakeChance(lootTier); if (event.getPlayer().hasPermission("mcmmo.perks.lucky.fishing")) { - dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100% + dropChance = (int) (dropChance * 1.25); //With lucky perk on max level tier, its 100% } final int DROP_CHANCE = random.nextInt(100); @@ -226,200 +226,204 @@ public class Fishing { if (DROP_CHANCE < dropChance) { - switch (type) { - case BLAZE: - Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD)); - break; + switch (type) { + case BLAZE: + Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD)); + break; - case CAVE_SPIDER: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); - } else { - Misc.dropItem(location, new ItemStack(Material.STRING)); - } - break; + case CAVE_SPIDER: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); + } else { + Misc.dropItem(location, new ItemStack(Material.STRING)); + } + break; - case CHICKEN: - if (DROP_NUMBER > 66) { - Misc.dropItem(location, new ItemStack(Material.FEATHER)); - } else if (DROP_NUMBER > 33) { - Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN)); - } else { - Misc.dropItem(location, new ItemStack(Material.EGG)); - } - break; + case CHICKEN: + if (DROP_NUMBER > 66) { + Misc.dropItem(location, new ItemStack(Material.FEATHER)); + } else if (DROP_NUMBER > 33) { + Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN)); + } else { + Misc.dropItem(location, new ItemStack(Material.EGG)); + } + break; - case COW: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); - } else if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.LEATHER)); - } else { - Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); - } - break; + case COW: + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); + } else if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.LEATHER)); + } else { + Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); + } + break; - case CREEPER: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); - } else { - Misc.dropItem(location, new ItemStack(Material.SULPHUR)); - } - break; + case CREEPER: + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4)); + } else { + Misc.dropItem(location, new ItemStack(Material.SULPHUR)); + } + break; - case ENDERMAN: - Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL)); - break; + case ENDERMAN: + Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL)); + break; - case GHAST: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.SULPHUR)); - } else { - Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR)); - } - break; + case GHAST: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.SULPHUR)); + } else { + Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR)); + } + break; - case IRON_GOLEM: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); - } else if (DROP_NUMBER > 90) { - Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); - } else { - Misc.dropItem(location, new ItemStack(Material.RED_ROSE)); - } - break; + case IRON_GOLEM: + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); + } else if (DROP_NUMBER > 85) { + Misc.dropItem(location, new ItemStack(Material.IRON_INGOT)); + } else { + Misc.dropItem(location, new ItemStack(Material.RED_ROSE)); + } + break; - case MAGMA_CUBE: - Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM)); - break; + case MAGMA_CUBE: + Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM)); + break; - case MUSHROOM_COW: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); - } else if (DROP_NUMBER > 98) { - Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); - } else if (DROP_NUMBER > 66) { - Misc.dropItem(location, new ItemStack(Material.LEATHER)); - } else if (DROP_NUMBER > 33) { - Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); - } else { - Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3); - } - break; + case MUSHROOM_COW: + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET)); + } else if (DROP_NUMBER > 90) { + Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP)); + } else if (DROP_NUMBER > 60) { + Misc.dropItem(location, new ItemStack(Material.LEATHER)); + } else if (DROP_NUMBER > 30) { + Misc.dropItem(location, new ItemStack(Material.RAW_BEEF)); + } else { + Misc.dropItem(location, new ItemStack(Material.RED_MUSHROOM)); + Misc.randomDropItems(location, new ItemStack(Material.RED_MUSHROOM), 50, 2); + } + break; - case PIG: - Misc.dropItem(location, new ItemStack(Material.PORK)); - break; + case PIG: + Misc.dropItem(location, new ItemStack(Material.PORK)); + break; - case PIG_ZOMBIE: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); - } else { - Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); - } - break; + case PIG_ZOMBIE: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); + } else { + Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET)); + } + break; - case SHEEP: - final Sheep sheep = (Sheep) le; + case SHEEP: + final Sheep sheep = (Sheep) le; - if (!sheep.isSheared()) { - final Wool wool = new Wool(); - wool.setColor(sheep.getColor()); + if (!sheep.isSheared()) { + final Wool wool = new Wool(); + wool.setColor(sheep.getColor()); - final ItemStack theWool = wool.toItemStack(); - theWool.setAmount(1 + random.nextInt(6)); + final ItemStack theWool = wool.toItemStack(); + theWool.setAmount(1 + random.nextInt(6)); - Misc.dropItem(location, theWool); - sheep.setSheared(true); - } - break; + Misc.dropItem(location, theWool); + sheep.setSheared(true); + } + break; - case SKELETON: - if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) { - if (DROP_NUMBER > 97) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); - } else if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.BONE)); - } else { - Misc.dropItems(location, new ItemStack(Material.COAL), 3); - } - } else { - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); - } else if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.BONE)); - } else { - Misc.dropItems(location, new ItemStack(Material.ARROW), 3); - } - } - break; + case SKELETON: + if (((CraftSkeleton) le).getHandle().getSkeletonType() == 1) { + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1)); + } else if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.BONE)); + } else { + Misc.dropItem(location, new ItemStack(Material.COAL)); + Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2); + } + } else { + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM)); + } else if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.BONE)); + } else { + Misc.dropItem(location, new ItemStack(Material.ARROW)); + Misc.randomDropItems(location, new ItemStack(Material.ARROW), 50, 2); + } + } + break; - case SLIME: - Misc.dropItem(location, new ItemStack(Material.SLIME_BALL)); - break; + case SLIME: + Misc.dropItem(location, new ItemStack(Material.SLIME_BALL)); + break; - case SNOWMAN: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); - } else { - Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5); - } - break; + case SNOWMAN: + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.PUMPKIN)); + } else { + Misc.dropItem(location, new ItemStack(Material.SNOW_BALL)); + Misc.randomDropItems(location, new ItemStack(Material.SNOW_BALL), 50, 4); + } + break; - case SPIDER: - if (DROP_NUMBER > 50) { - Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); - } else { - Misc.dropItem(location, new ItemStack(Material.STRING)); - } - break; + case SPIDER: + if (DROP_NUMBER > 50) { + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); + } else { + Misc.dropItem(location, new ItemStack(Material.STRING)); + } + break; - case SQUID: - Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); - break; + case SQUID: + Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); + break; - case WITCH: - final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; - if (DROP_NUMBER > 97) { - if (DROP_NUMBER_2 > 66) { - Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); - } else if (DROP_NUMBER_2 > 33) { - Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); - } else { - Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); - } - } else { - if (DROP_NUMBER_2 > 88) { - Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); - } else if (DROP_NUMBER_2 > 75) { - Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); - } else if (DROP_NUMBER_2 > 63) { - Misc.dropItem(location, new ItemStack(Material.SULPHUR)); - } else if (DROP_NUMBER_2 > 50) { - Misc.dropItem(location, new ItemStack(Material.REDSTONE)); - } else if (DROP_NUMBER_2 > 38) { - Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); - } else if (DROP_NUMBER_2 > 25) { - Misc.dropItem(location, new ItemStack(Material.STICK)); - } else if (DROP_NUMBER_2 > 13) { - Misc.dropItem(location, new ItemStack(Material.SUGAR)); - } else { - Misc.dropItem(location, new ItemStack(Material.POTION)); - } - } - break; + case WITCH: + final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1; + if (DROP_NUMBER > 95) { + if (DROP_NUMBER_2 > 66) { + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197)); + } else if (DROP_NUMBER_2 > 33) { + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195)); + } else { + Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194)); + } + } else { + if (DROP_NUMBER_2 > 88) { + Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE)); + } else if (DROP_NUMBER_2 > 75) { + Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST)); + } else if (DROP_NUMBER_2 > 63) { + Misc.dropItem(location, new ItemStack(Material.SULPHUR)); + } else if (DROP_NUMBER_2 > 50) { + Misc.dropItem(location, new ItemStack(Material.REDSTONE)); + } else if (DROP_NUMBER_2 > 38) { + Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE)); + } else if (DROP_NUMBER_2 > 25) { + Misc.dropItem(location, new ItemStack(Material.STICK)); + } else if (DROP_NUMBER_2 > 13) { + Misc.dropItem(location, new ItemStack(Material.SUGAR)); + } else { + Misc.dropItem(location, new ItemStack(Material.POTION)); + } + } + break; - case ZOMBIE: - if (DROP_NUMBER > 99) { - Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); - } else { - Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); - } - break; + case ZOMBIE: + if (DROP_NUMBER > 95) { + Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2)); + } else { + Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH)); + } + break; - default: - break; - } + default: + break; + } } Combat.dealDamage(le, 1); From 4a52135a0bf96145edb56fb2c6350e9b18f1527f Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 19:10:14 -0800 Subject: [PATCH 04/18] Nerfing overpowered Herbalism double drops for melons and netherwart. --- .../java/com/gmail/nossr50/skills/gathering/Herbalism.java | 7 ++----- src/main/java/com/gmail/nossr50/util/Misc.java | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index 73a5f61c8..77c4dd969 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -267,7 +267,6 @@ public class Herbalism { else if (mat == Material.POTATO) { is = new ItemStack(Material.POTATO_ITEM, 1, (short) 0); } - else { is = new ItemStack(mat); } @@ -297,15 +296,13 @@ public class Herbalism { case MELON_BLOCK: if (configInstance.getMelonsDoubleDropsEnabled()) { - Misc.dropItems(location, is, 3); - Misc.randomDropItems(location, is, 50, 4); + Misc.dropItem(location, is); } break; case NETHER_WARTS: if (configInstance.getNetherWartsDoubleDropsEnabled()) { - Misc.dropItems(location, is, 2); - Misc.randomDropItems(location, is, 50, 3); + Misc.dropItem(location, is); } break; diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index 318585f46..e77177bd3 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -217,7 +217,7 @@ public class Misc { * @param is The item to drop * @param chance The percentage chance for the item to drop */ - public static void randomDropItem(Location location, ItemStack is, double chance) { + public static void randomDropItem(Location location, ItemStack is, int chance) { if (random.nextInt(100) < chance) { dropItem(location, is); } From c3c7fe08b64acc3571d0118a3ac8da2bd2c45f11 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 19:53:55 -0800 Subject: [PATCH 05/18] Fixing a bug where an entity dealing 0 damage still earned experience. --- .../java/com/gmail/nossr50/listeners/EntityListener.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 133f86c6d..e26fa5438 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -57,9 +57,11 @@ public class EntityListener implements Listener { */ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { - if (event instanceof FakeEntityDamageByEntityEvent) { + if (event instanceof FakeEntityDamageByEntityEvent) + return; + + if(event.getDamage() <= 0) return; - } Entity attacker = event.getDamager(); Entity defender = event.getEntity(); From adbb20d7c961fdb1733da746dfc3a4961ef97fd8 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 21:43:43 -0800 Subject: [PATCH 06/18] Displaying all perks upon login, and adding them to the locale files. --- .../nossr50/listeners/PlayerListener.java | 69 ++++++++++++++++++- .../resources/locale/locale_cs_CZ.properties | 8 +++ .../resources/locale/locale_cy.properties | 8 +++ .../resources/locale/locale_da.properties | 8 +++ .../resources/locale/locale_de.properties | 8 +++ .../resources/locale/locale_en_US.properties | 12 +++- .../resources/locale/locale_es.properties | 8 +++ .../resources/locale/locale_fi.properties | 8 +++ .../resources/locale/locale_fr.properties | 8 +++ .../resources/locale/locale_it.properties | 8 +++ .../resources/locale/locale_ko.properties | 8 +++ .../resources/locale/locale_lv.properties | 8 +++ .../resources/locale/locale_nl.properties | 8 +++ .../resources/locale/locale_no.properties | 8 +++ .../resources/locale/locale_pl.properties | 8 +++ .../resources/locale/locale_pt_BR.properties | 8 +++ .../resources/locale/locale_ru.properties | 8 +++ .../resources/locale/locale_sv.properties | 8 +++ .../resources/locale/locale_tr_TR.properties | 8 +++ .../resources/locale/locale_zh_CN.properties | 8 +++ 20 files changed, 221 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 165b3425f..f4322d84f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -196,13 +196,76 @@ public class PlayerListener implements Listener { } if (player.hasPermission("mcmmo.perks.xp.quadruple")) { - player.sendMessage(perkPrefix + ChatColor.DARK_AQUA + "Quadruple XP - Receive 4x XP."); + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 4 }) })); } else if (player.hasPermission("mcmmo.perks.xp.triple")) { - player.sendMessage(perkPrefix + ChatColor.DARK_AQUA + "Triple XP - Receive 3x XP."); + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 3 }) })); + } + else if (player.hasPermission("mcmmo.perks.xp.150percentboost")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 2.5 }) })); } else if (player.hasPermission("mcmmo.perks.xp.double")) { - player.sendMessage(perkPrefix + ChatColor.DARK_AQUA + "Double XP - Receive 2x XP."); + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 2 }) })); + } + else if (player.hasPermission("mcmmo.perks.xp.50percentboost")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 1.5 }) })); + } + + if (player.hasPermission("mcmmo.perks.cooldowns.halved")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/2" }) })); + } + else if (player.hasPermission("mcmmo.perks.cooldowns.thirded")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/3" }) })); + } + else if (player.hasPermission("mcmmo.perks.cooldowns.quartered")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/4" }) })); + } + + if (player.hasPermission("mcmmo.perks.activationtime.twelveseconds")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 12 }) })); + } + else if (player.hasPermission("mcmmo.perks.activationtime.eightseconds")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 8 }) })); + } + else if (player.hasPermission("mcmmo.perks.activationtime.fourseconds")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 4 }) })); + } + + if (player.hasPermission("mcmmo.perks.lucky.acrobatics")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Acrobatics" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.archery")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Archery" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.axes")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Axes" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.excavation")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Excavation" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.fishing")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Fishing" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.herbalism")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Herbalism" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.mining")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Mining" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.repair")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Repair" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.swords")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Swords" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.taming")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Taming" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.unarmed")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Unarmed" }) })); + } + if (player.hasPermission("mcmmo.perks.lucky.woodcutting")) { + player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc", new Object[] { "Woodcutting" }) })); } player.sendMessage(ChatColor.GOLD+"[mcMMO] " + ChatColor.GREEN + "http://www.mcmmo.info" + ChatColor.YELLOW + " - mcMMO Website & Forums"); //TODO: Locale diff --git a/src/main/resources/locale/locale_cs_CZ.properties b/src/main/resources/locale/locale_cs_CZ.properties index c4fc31971..a45df4579 100644 --- a/src/main/resources/locale/locale_cs_CZ.properties +++ b/src/main/resources/locale/locale_cs_CZ.properties @@ -447,3 +447,11 @@ Stats.Header.Combat=[[GOLD]]-=BOJOVE DOVEDNOSTI=- Stats.Header.Gathering=[[GOLD]]-=SHROMAZDOVACI DOVEDNOSTI=- Stats.Header.Misc=Ostatni schopnosti Stats.Own.Stats=[[GREEN]][mcMMO] Statistiky +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_cy.properties b/src/main/resources/locale/locale_cy.properties index 0f70eaf61..1f36c3cc2 100644 --- a/src/main/resources/locale/locale_cy.properties +++ b/src/main/resources/locale/locale_cy.properties @@ -447,3 +447,11 @@ Stats.Header.Combat=[[AUR]] - = GWRTHSEFYLL SGILIAU = - Stats.Header.Gathering=[[AUR]] -= CASGLU SGILIAU = = - Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GWYRDD]][mcMMO] Ystadegau +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_da.properties b/src/main/resources/locale/locale_da.properties index 523a46604..2fc49a8ad 100644 --- a/src/main/resources/locale/locale_da.properties +++ b/src/main/resources/locale/locale_da.properties @@ -447,3 +447,11 @@ Stats.Header.Combat=[[GOLD]]-=KAMP EVNER=- Stats.Header.Gathering=[[GOLD]]-=INDSAMLINGS EVNER=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] F\u00e6rdigheder +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_de.properties b/src/main/resources/locale/locale_de.properties index d69b147d5..60562c187 100644 --- a/src/main/resources/locale/locale_de.properties +++ b/src/main/resources/locale/locale_de.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=KAMPF F\u00c4HIGKEITEN=- Stats.Header.Gathering=[[GOLD]]-=Sammel-Fertigkeit=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 333d0d0a7..7b98654a6 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -521,4 +521,14 @@ Skills.TooTired=[[RED]]You are too tired to use that ability again. Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- -Stats.Own.Stats=[[GREEN]][mcMMO] Stats \ No newline at end of file +Stats.Own.Stats=[[GREEN]][mcMMO] Stats + +#PERKS +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. \ No newline at end of file diff --git a/src/main/resources/locale/locale_es.properties b/src/main/resources/locale/locale_es.properties index a955457ec..42e4f71df 100644 --- a/src/main/resources/locale/locale_es.properties +++ b/src/main/resources/locale/locale_es.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=HABILIDADES DE COMBATE=- Stats.Header.Gathering=[[GOLD]]-=HABILIDADES DE RECOLECCI\u00d3N=- Stats.Header.Misc=[[GOLD]]-=HABILIDADES VARIAS=- Stats.Own.Stats=[[GREEN]][mcMMO] Estad\u00edsticas +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_fi.properties b/src/main/resources/locale/locale_fi.properties index 841f6bcad..c67687664 100644 --- a/src/main/resources/locale/locale_fi.properties +++ b/src/main/resources/locale/locale_fi.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=TAISTELUTAIDOT=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_fr.properties b/src/main/resources/locale/locale_fr.properties index abd381a91..a2a51e8c4 100644 --- a/src/main/resources/locale/locale_fr.properties +++ b/src/main/resources/locale/locale_fr.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=TALENTS DE COMBAT=- Stats.Header.Gathering=[[GOLD]]-=COMP\u00c9TENCES DE R\u00c9COLTE=- Stats.Header.Misc=[[GOLD]]-=AUTRES TALENTS=- Stats.Own.Stats=[[GREEN]][mcMMO] Statistiques +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_it.properties b/src/main/resources/locale/locale_it.properties index 37ca87dbe..746248479 100644 --- a/src/main/resources/locale/locale_it.properties +++ b/src/main/resources/locale/locale_it.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=ABILITA\' DI COMBATTIMENTO=- Stats.Header.Gathering=[[GOLD]]-=ABILITA\' DI RACCOLTA=- Stats.Header.Misc=[[GOLD]]-=ABILITA\' VARIE=- Stats.Own.Stats=[[GREEN]]Statistiche [mcMMO] +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_ko.properties b/src/main/resources/locale/locale_ko.properties index 941885361..864d0c576 100644 --- a/src/main/resources/locale/locale_ko.properties +++ b/src/main/resources/locale/locale_ko.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_lv.properties b/src/main/resources/locale/locale_lv.properties index 3303a4344..bcfb54450 100644 --- a/src/main/resources/locale/locale_lv.properties +++ b/src/main/resources/locale/locale_lv.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_nl.properties b/src/main/resources/locale/locale_nl.properties index c341339a3..ba29dc644 100644 --- a/src/main/resources/locale/locale_nl.properties +++ b/src/main/resources/locale/locale_nl.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=Strijd Ervaring=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_no.properties b/src/main/resources/locale/locale_no.properties index 81a675121..0cde5e639 100644 --- a/src/main/resources/locale/locale_no.properties +++ b/src/main/resources/locale/locale_no.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=Kampferdigheter=- Stats.Header.Gathering=[[GOLD]]- = SAMLER FERDIGHETER = - Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_pl.properties b/src/main/resources/locale/locale_pl.properties index 38fe0e5e5..e37642bf3 100644 --- a/src/main/resources/locale/locale_pl.properties +++ b/src/main/resources/locale/locale_pl.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_pt_BR.properties b/src/main/resources/locale/locale_pt_BR.properties index 0d44ffd66..8e2503107 100644 --- a/src/main/resources/locale/locale_pt_BR.properties +++ b/src/main/resources/locale/locale_pt_BR.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_ru.properties b/src/main/resources/locale/locale_ru.properties index f128209a5..a73d5510d 100644 --- a/src/main/resources/locale/locale_ru.properties +++ b/src/main/resources/locale/locale_ru.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=\u0411\u041e\u0415\u0412\u042b\u0415 \u041d\u0410\ Stats.Header.Gathering=[[GOLD]]-=\u041d\u0410\u0412\u042b\u041a\u0418 \u0421\u0411\u041e\u0420\u0410=- Stats.Header.Misc=[[GOLD]]-=\u0420\u0410\u0417\u041d\u042b\u0415 \u041d\u0410\u0412\u042b\u041a\u0418=- Stats.Own.Stats=[[GREEN]][mcMMO] \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_sv.properties b/src/main/resources/locale/locale_sv.properties index ebf607c83..6c181d226 100644 --- a/src/main/resources/locale/locale_sv.properties +++ b/src/main/resources/locale/locale_sv.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=Stridsf\u00e4rdigheter=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_tr_TR.properties b/src/main/resources/locale/locale_tr_TR.properties index c42fbea39..a32b0df94 100644 --- a/src/main/resources/locale/locale_tr_TR.properties +++ b/src/main/resources/locale/locale_tr_TR.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=COMBAT SKILLS=- Stats.Header.Gathering=[[GOLD]]-=GATHERING SKILLS=- Stats.Header.Misc=[[GOLD]]-=MISC SKILLS=- Stats.Own.Stats=[[GREEN]][mcMMO] Stats +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. diff --git a/src/main/resources/locale/locale_zh_CN.properties b/src/main/resources/locale/locale_zh_CN.properties index f14da1636..242a0fd78 100644 --- a/src/main/resources/locale/locale_zh_CN.properties +++ b/src/main/resources/locale/locale_zh_CN.properties @@ -448,3 +448,11 @@ Stats.Header.Combat=[[GOLD]]-=\u683c\u6597\u6280\u80fd=- Stats.Header.Gathering=[[GOLD]]-=\u91c7\u96c6\u6280\u80fd=- Stats.Header.Misc=[[GOLD]]-=\u6742\u9879\u6280\u80fd=- Stats.Own.Stats=[[GREEN]][mcMMO] \u7edf\u8ba1\u4fe1\u606f +Perks.xp.name=Experience +Perks.xp.desc=Receive {0}x XP. +Perks.lucky.name=Luck +Perks.lucky.desc=Gives {0} skills and abilities a 33.3% better chance to activate. +Perks.cooldowns.name=Fast Recovery +Perks.cooldowns.desc=Cuts cooldown duration by {0}. +Perks.activationtime.name=Endurance +Perks.activationtime.desc=Increases ability activation time by {0} seconds. From 01f38537de90565c9818591a37c45c1e1c2c4b10 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Mon, 12 Nov 2012 21:57:57 -0800 Subject: [PATCH 07/18] Fixing cooldown timers so that they display the proper cooldown for players with perks. --- .../nossr50/skills/gathering/BlastMining.java | 2 +- .../java/com/gmail/nossr50/util/Item.java | 2 +- .../java/com/gmail/nossr50/util/Skills.java | 21 +++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java index 36fa41306..a1760c042 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java @@ -292,7 +292,7 @@ public class BlastMining { /* Check Cooldown */ if (!Skills.cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { - player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)"); + player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + Skills.calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)"); return; } diff --git a/src/main/java/com/gmail/nossr50/util/Item.java b/src/main/java/com/gmail/nossr50/util/Item.java index 1eb4aa9b9..6e421be15 100644 --- a/src/main/java/com/gmail/nossr50/util/Item.java +++ b/src/main/java/com/gmail/nossr50/util/Item.java @@ -53,7 +53,7 @@ public class Item { player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass")); } else if (!Skills.cooldownOver(profile.getRecentlyHurt(), 60, player) && amount >= Config.getInstance().getChimaeraCost()) { - player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(profile.getRecentlyHurt(), 60)})); + player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(profile.getRecentlyHurt(), 60, player)})); } else if (amount <= Config.getInstance().getChimaeraCost()) { player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getChimaeraItemId())); diff --git a/src/main/java/com/gmail/nossr50/util/Skills.java b/src/main/java/com/gmail/nossr50/util/Skills.java index b90ccffba..6a677c517 100644 --- a/src/main/java/com/gmail/nossr50/util/Skills.java +++ b/src/main/java/com/gmail/nossr50/util/Skills.java @@ -68,8 +68,21 @@ public class Skills { * @param cooldown The length of the cooldown * @return the number of seconds remaining before the cooldown expires */ - public static int calculateTimeLeft(long deactivatedTimeStamp, int cooldown) { - return (int) (((deactivatedTimeStamp + (cooldown * TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / TIME_CONVERSION_FACTOR); + public static int calculateTimeLeft(long deactivatedTimeStamp, int cooldown, Player player) { + int adjustedCooldown = cooldown; + + //Reduced Cooldown Donor Perks + if (player.hasPermission("mcmmo.perks.cooldowns.halved")) { + adjustedCooldown = (int) (adjustedCooldown * 0.5); + } + else if (player.hasPermission("mcmmo.perks.cooldowns.thirded")) { + adjustedCooldown = (int) (adjustedCooldown * 0.66); + } + else if (player.hasPermission("mcmmo.perks.cooldowns.quartered")) { + adjustedCooldown = (int) (adjustedCooldown * 0.75); + } + + return (int) (((deactivatedTimeStamp + (adjustedCooldown * TIME_CONVERSION_FACTOR)) - System.currentTimeMillis()) / TIME_CONVERSION_FACTOR); } /** @@ -130,7 +143,7 @@ public class Skills { if (ability.getPermissions(player) && tool.inHand(inHand) && !profile.getToolPreparationMode(tool)) { if (skill != SkillType.WOODCUTTING && skill != SkillType.AXES) { if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { - player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)"); + player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)"); return; } } @@ -417,7 +430,7 @@ public class Skills { */ if (type == SkillType.WOODCUTTING || type == SkillType.AXES) { if (!profile.getAbilityMode(ability) && !cooldownOver(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { - player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown()) + "s)"); + player.sendMessage(LocaleLoader.getString("Skills.TooTired") + ChatColor.YELLOW + " (" + calculateTimeLeft(profile.getSkillDATS(ability) * TIME_CONVERSION_FACTOR, ability.getCooldown(), player) + "s)"); return; } } From 1bf0cd1d154940c7a128759b91d75d21bf24cf05 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 10:08:05 +0100 Subject: [PATCH 08/18] /fishing command will now also display the bonus gained from lucky perk --- .../com/gmail/nossr50/commands/skills/FishingCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index dcc33ef24..27dc93cae 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -23,7 +23,11 @@ public class FishingCommand extends SkillCommand { protected void dataCalculations() { lootTier = Fishing.getFishingLootTier(profile); magicChance = percent.format((float) lootTier / 15); - shakeChance = String.valueOf(Fishing.getShakeChance(lootTier)); + int dropChance = Fishing.getShakeChance(lootTier); + if (player.hasPermission("mcmmo.perks.lucky.fishing")) { + dropChance = (int) (dropChance * 1.25); + } + shakeChance = String.valueOf(dropChance); } @Override From b0681c10b90fe84922091f2ab9ab9ff28ea0c061 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 16:47:59 +0100 Subject: [PATCH 09/18] About time that this got changed to 1.3.12 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9bf4a8c55..e009a0400 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 1.3.11 + 1.3.12 mcMMO https://github.com/mcMMO-Dev/mcMMO From f8b44cd8ceb0209e952792bd90087ceeff844409 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 16:50:00 +0100 Subject: [PATCH 10/18] New Salvage ability for Repair! Added a fully working ability to Repair. With this ability you can salvage items and get bars in return. - Added new permission node for Salvage ability - Added new config options for Salvage - Added new locale strings for Salvage - Added a check to make sure that Repair Anvil != Salvage Anvil --- .../commands/skills/RepairCommand.java | 11 +- .../java/com/gmail/nossr50/config/Config.java | 5 + .../nossr50/datatypes/PlayerProfile.java | 13 +- .../nossr50/listeners/BlockListener.java | 4 + .../nossr50/listeners/PlayerListener.java | 11 + src/main/java/com/gmail/nossr50/mcMMO.java | 5 + .../gmail/nossr50/skills/repair/Salvage.java | 219 ++++++++++++++++++ .../com/gmail/nossr50/util/BlockChecks.java | 2 +- .../com/gmail/nossr50/util/Permissions.java | 5 + src/main/resources/config.yml | 5 + .../resources/locale/locale_en_US.properties | 6 + src/main/resources/plugin.yml | 3 + 12 files changed, 286 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/gmail/nossr50/skills/repair/Salvage.java diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 89aab4651..d4b17bad4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -16,6 +16,7 @@ public class RepairCommand extends SkillCommand { private boolean canSuperRepair; private boolean canMasterRepair; private boolean canArcaneForge; + private boolean canSalvage; private boolean canRepairStone; private boolean canRepairIron; private boolean canRepairGold; @@ -24,6 +25,7 @@ public class RepairCommand extends SkillCommand { private boolean canRepairLeather; private boolean canRepairWood; + private int salvageLevel; private int diamondLevel; private int goldLevel; private int ironLevel; @@ -45,6 +47,8 @@ public class RepairCommand extends SkillCommand { goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel(); ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel(); stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel(); + + salvageLevel = Config.getInstance().getSalvageUnlockLevel(); repairMasteryBonus = percent.format(skillValue / 500); @@ -63,6 +67,7 @@ public class RepairCommand extends SkillCommand { canSuperRepair = permInstance.repairBonus(player); canMasterRepair = permInstance.repairMastery(player); canArcaneForge = permInstance.arcaneForging(player); + canSalvage = permInstance.salvage(player); canRepairDiamond = permInstance.diamondRepair(player); canRepairGold = permInstance.goldRepair(player); canRepairIron = permInstance.ironRepair(player); @@ -74,7 +79,7 @@ public class RepairCommand extends SkillCommand { @Override protected boolean effectsHeaderPermissions() { - return canArcaneForge || canRepairDiamond || canRepairGold || canRepairIron || canMasterRepair || canRepairStone || canSuperRepair || canRepairString || canRepairWood || canRepairLeather; + return canArcaneForge || canSalvage || canRepairDiamond || canRepairGold || canRepairIron || canMasterRepair || canRepairStone || canSuperRepair || canRepairString || canRepairWood || canRepairLeather; } @Override @@ -107,6 +112,10 @@ public class RepairCommand extends SkillCommand { player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.6", new Object[] { diamondLevel }), LocaleLoader.getString("Repair.Effect.7") })); } + if (canSalvage && salvageLevel > 0) { + player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.16", new Object[] { salvageLevel }), LocaleLoader.getString("Repair.Effect.17") })); + } + if (canArcaneForge) { player.sendMessage(LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Repair.Effect.8"), LocaleLoader.getString("Repair.Effect.9") })); } diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 06051229a..bc24028d0 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -270,6 +270,11 @@ public class Config extends ConfigLoader { /* Repair */ public boolean getRepairAnvilMessagesEnabled() { return config.getBoolean("Skills.Repair.Anvil_Messages", true); } public int getRepairAnvilId() { return config.getInt("Skills.Repair.Anvil_ID", 42); } + public boolean getSalvageEnabled() { return config.getBoolean("Skills.Repair.Salvage_enabled", true); } + public int getSalvageAnvilId() { return config.getInt("Skills.Repair.Salvage_Anvil_ID", 41); } + public int getSalvageUnlockLevel() { return config.getInt("Skills.Repair.Salvage_UnlockLevel", 600); } + public boolean getSalvageTools() { return config.getBoolean("Skills.Repair.Salvage_tools", true); } + public boolean getSalvageArmor() { return config.getBoolean("Skills.Repair.Salvage_armor", true); } /* Taming */ public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); } diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index b0b0c4f50..4806fc2ec 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -31,6 +31,7 @@ public class PlayerProfile { private boolean loaded; private boolean placedAnvil; + private boolean placedSalvageAnvil; private boolean partyChatMode, adminChatMode; private boolean godMode; private boolean greenTerraMode, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, skullSplitterMode, berserkMode; @@ -491,7 +492,7 @@ public class PlayerProfile { } /* - * Anvil Placement + * Repair Anvil Placement */ public void togglePlacedAnvil() { @@ -501,6 +502,16 @@ public class PlayerProfile { public Boolean getPlacedAnvil() { return placedAnvil; } + /* + * Salvage Anvil Placement + */ + public void togglePlacedSalvageAnvil() { + placedSalvageAnvil = !placedSalvageAnvil; + } + + public Boolean getPlacedSalvageAnvil() { + return placedSalvageAnvil; + } /* * HUD Stuff diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 21b9c3a2e..6acd9edbb 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -34,6 +34,7 @@ import com.gmail.nossr50.skills.gathering.Herbalism; import com.gmail.nossr50.skills.gathering.Mining; import com.gmail.nossr50.skills.gathering.WoodCutting; import com.gmail.nossr50.skills.repair.Repair; +import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.spout.SpoutSounds; import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.ItemChecks; @@ -154,6 +155,9 @@ public class BlockListener implements Listener { if (id == configInstance.getRepairAnvilId() && configInstance.getRepairAnvilMessagesEnabled()) { Repair.placedAnvilCheck(player, id); } + if (id == configInstance.getSalvageAnvilId() && configInstance.getRepairAnvilMessagesEnabled()) { + Salvage.placedAnvilCheck(player, id); + } } /** diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 165b3425f..750366516 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -1,6 +1,7 @@ package com.gmail.nossr50.listeners; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.LivingEntity; @@ -36,6 +37,7 @@ import com.gmail.nossr50.runnables.BleedTimer; import com.gmail.nossr50.skills.gathering.BlastMining; import com.gmail.nossr50.skills.gathering.Fishing; import com.gmail.nossr50.skills.gathering.Herbalism; +import com.gmail.nossr50.skills.repair.Salvage; import com.gmail.nossr50.skills.taming.TamingManager; import com.gmail.nossr50.util.BlockChecks; import com.gmail.nossr50.util.Item; @@ -259,6 +261,15 @@ public class PlayerListener implements Listener { player.updateInventory(); } } + /* SALVAGE CHECKS */ + if (Permissions.getInstance().salvage(player) && block.getTypeId() == Config.getInstance().getSalvageAnvilId()) { + if (Salvage.isSalvageable(inHand)) { + final Location location = block.getLocation(); + Salvage.handleSalvage(player, location, inHand); + event.setCancelled(true); + player.updateInventory(); + } + } /* ACTIVATION CHECKS */ if (Config.getInstance().getAbilitiesEnabled() && BlockChecks.abilityBlockCheck(block)) { diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 7286b9dd5..1fad77781 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -145,6 +145,11 @@ public class mcMMO extends JavaPlugin { repairables.addAll(rManager.getLoadedRepairables()); repairManager = RepairManagerFactory.getRepairManager(repairables.size()); repairManager.registerRepairables(repairables); + + //Check if Repair Anvil and Salvage Anvil have different itemID's + if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()){ + System.out.println("[WARNING!] Can't use the same itemID for Repair/Salvage Anvils!" ); + } if (!configInstance.getUseMySQL()) { Users.loadUsers(); diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java new file mode 100644 index 000000000..2ab52d136 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -0,0 +1,219 @@ +package com.gmail.nossr50.skills.repair; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.getspout.spoutapi.SpoutManager; +import org.getspout.spoutapi.player.SpoutPlayer; + +import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.Config; +import com.gmail.nossr50.datatypes.PlayerProfile; +import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.util.ItemChecks; +import com.gmail.nossr50.util.Permissions; +import com.gmail.nossr50.util.Users; + +public class Salvage { + + private static Config configInstance = Config.getInstance(); + private static Permissions permInstance = Permissions.getInstance(); + + public static void handleSalvage(final Player player, final Location location, final ItemStack inHand) { + if (!permInstance.salvage(player) || !configInstance.getSalvageEnabled()) { + return; + } + + final PlayerProfile profile = Users.getProfile(player); + final int skillLevel = profile.getSkillLevel(SkillType.REPAIR); + final int unlockLevel = configInstance.getSalvageUnlockLevel(); + + if (skillLevel >= unlockLevel) { + final World world = player.getWorld(); + final float currentdura = inHand.getDurability(); + + if (currentdura == 0) { + final int salvagedAmount = getSalvagedAmount(inHand); + final int itemID = getSalvagedItemID(inHand); + + player.setItemInHand(new ItemStack(0)); + location.setY(location.getY() + 1); + world.dropItem(location, new ItemStack(itemID, salvagedAmount)); + player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess")); + } else { + player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability")); + } + } else { + player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage")); + } + } + + public static int getSalvagedItemID(final ItemStack inHand) { + int salvagedItem = 0; + switch (inHand.getType()) { + case DIAMOND_PICKAXE: + case DIAMOND_SPADE: + case DIAMOND_AXE: + case DIAMOND_SWORD: + case DIAMOND_HOE: + case DIAMOND_HELMET: + case DIAMOND_CHESTPLATE: + case DIAMOND_LEGGINGS: + case DIAMOND_BOOTS: + salvagedItem = 264; + break; + case GOLD_PICKAXE: + case GOLD_SPADE: + case GOLD_AXE: + case GOLD_SWORD: + case GOLD_HOE: + case GOLD_HELMET: + case GOLD_CHESTPLATE: + case GOLD_LEGGINGS: + case GOLD_BOOTS: + salvagedItem = 266; + break; + case IRON_PICKAXE: + case IRON_SPADE: + case IRON_AXE: + case IRON_SWORD: + case IRON_HOE: + case IRON_HELMET: + case IRON_CHESTPLATE: + case IRON_LEGGINGS: + case IRON_BOOTS: + salvagedItem = 265; + break; + case STONE_PICKAXE: + case STONE_SPADE: + case STONE_AXE: + case STONE_SWORD: + case STONE_HOE: + salvagedItem = 4; + break; + case WOOD_PICKAXE: + case WOOD_SPADE: + case WOOD_AXE: + case WOOD_SWORD: + case WOOD_HOE: + salvagedItem = 5; + break; + case LEATHER_HELMET: + case LEATHER_CHESTPLATE: + case LEATHER_LEGGINGS: + case LEATHER_BOOTS: + salvagedItem = 334; + break; + default: + break; + } + return salvagedItem; + } + + public static int getSalvagedAmount(final ItemStack inHand) { + int salvagedAmount = 0; + switch (inHand.getType()) { + case DIAMOND_PICKAXE: + case GOLD_PICKAXE: + case IRON_PICKAXE: + case STONE_PICKAXE: + case WOOD_PICKAXE: + case DIAMOND_AXE: + case GOLD_AXE: + case IRON_AXE: + case STONE_AXE: + case WOOD_AXE: + salvagedAmount = 3; + break; + case DIAMOND_SPADE: + case GOLD_SPADE: + case IRON_SPADE: + case STONE_SPADE: + case WOOD_SPADE: + salvagedAmount = 1; + break; + case DIAMOND_SWORD: + case GOLD_SWORD: + case IRON_SWORD: + case STONE_SWORD: + case WOOD_SWORD: + case DIAMOND_HOE: + case GOLD_HOE: + case IRON_HOE: + case STONE_HOE: + case WOOD_HOE: + salvagedAmount = 2; + break; + case DIAMOND_HELMET: + case GOLD_HELMET: + case IRON_HELMET: + case LEATHER_HELMET: + salvagedAmount = 5; + break; + case DIAMOND_CHESTPLATE: + case GOLD_CHESTPLATE: + case IRON_CHESTPLATE: + case LEATHER_CHESTPLATE: + salvagedAmount = 8; + break; + case DIAMOND_LEGGINGS: + case GOLD_LEGGINGS: + case IRON_LEGGINGS: + case LEATHER_LEGGINGS: + salvagedAmount = 7; + break; + case DIAMOND_BOOTS: + case GOLD_BOOTS: + case IRON_BOOTS: + case LEATHER_BOOTS: + salvagedAmount = 4; + break; + default: + break; + } + return salvagedAmount; + } + + /** + * Handles notifications for placing an anvil. + * + * @param player The player placing the anvil + * @param anvilID The item ID of the anvil block + */ + public static void placedAnvilCheck(final Player player, final int anvilID) { + final PlayerProfile profile = Users.getProfile(player); + + if (!profile.getPlacedSalvageAnvil()) { + if (mcMMO.spoutEnabled) { + final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player); + + if (spoutPlayer.isSpoutCraftEnabled()) { + spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID)); + } + } else { + player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil2")); + } + + profile.togglePlacedSalvageAnvil(); + } + } + + /** + * Checks if the item is salvageable. + * + * @param is Item to check + * @return true if the item is salvageable, false otherwise + */ + public static boolean isSalvageable(final ItemStack is) { + if (configInstance.getSalvageTools() && ItemChecks.isTool(is)) { + return true; + } + if (configInstance.getSalvageArmor() && ItemChecks.isArmor(is)) { + return true; + } + return false; + } +} diff --git a/src/main/java/com/gmail/nossr50/util/BlockChecks.java b/src/main/java/com/gmail/nossr50/util/BlockChecks.java index 82b055eeb..18c6c35eb 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/util/BlockChecks.java @@ -105,7 +105,7 @@ public class BlockChecks { return false; default: - if (block.getTypeId() == Config.getInstance().getRepairAnvilId()) { + if (block.getTypeId() == Config.getInstance().getRepairAnvilId() | block.getTypeId() == Config.getInstance().getSalvageAnvilId()) { return false; } else { diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index d72f4bbb8..7cad1b6f6 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -208,6 +208,11 @@ public class Permissions { return player.hasPermission("mcmmo.ability.repair.stringrepair"); } + public boolean salvage(Player player) { + return player.hasPermission("mcmmo.ability.repair.salvage"); + } + + /* * MCMMO.ABILITY.UNARMED.* */ diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f0d202226..0335674a6 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -172,6 +172,11 @@ Skills: Level_Cap: 0 Anvil_Messages: true Anvil_ID: 42 + Salvage_enabled: true + Salvage_Anvil_ID: 41 + Salvage_UnlockLevel: 600 + Salvage_tools: true + Salvage_armor: true Swords: Enabled_For_PVP: true Enabled_For_PVE: true diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 0bd4b8bf1..f7dcbf626 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -205,9 +205,13 @@ Repair.Effect.6=Diamond Repair ({0}+ SKILL) Repair.Effect.7=Repair Diamond Tools & Armor Repair.Effect.8=Arcane Forging Repair.Effect.9=Repair magic items +Repair.Effect.16=Salvage ({0}+ SKILL) +Repair.Effect.17=Salvage Tools & Armor Repair.Listener.Anvil=[[DARK_RED]]You have placed an anvil, anvils can repair tools and armor. +Repair.Listener.Anvil2=[[DARK_RED]]You have placed a Salvage anvil, use this to Salvage tools and armor. Repair.Listener=Repair: Repair.SkillName=REPAIR +Repair.Skills.AdeptSalvage=[[DARK_RED]]You're not skilled enough to Salvage items. Repair.Skills.AdeptDiamond=[[DARK_RED]]You're not skilled enough to repair Diamond. Repair.Skills.AdeptGold=[[DARK_RED]]You're not skilled enough to repair Gold. Repair.Skills.AdeptIron=[[DARK_RED]]You're not skilled enough to repair Iron. @@ -215,6 +219,8 @@ Repair.Skills.AdeptStone=[[DARK_RED]]You're not skilled enough to repair Stone. Repair.Skills.Adept=[[RED]]You must be level [[YELLOW]]{0}[[RED]] to repair [[YELLOW]]{1} Repair.Skills.FeltEasy=[[GRAY]]That felt easy. Repair.Skills.FullDurability=[[GRAY]]That is at full durability. +Repair.Skills.SalvageSuccess=[[GRAY]]Item salvaged! +Repair.Skills.NotFullDurability=[[DARK_RED]]You can't salvage damaged items. Repair.Skills.Mastery=[[RED]]Repair Mastery: [[YELLOW]]Extra {0} durability restored Repair.Skills.StackedItems=[[DARK_RED]]You can't repair stacked items. Repair.Skills.Super.Chance=[[RED]]Super Repair Chance: [[YELLOW]]{0} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e231df3e4..7cfc84091 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -366,6 +366,7 @@ permissions: mcmmo.ability.repair.repairbonus: true mcmmo.ability.repair.repairmastery: true mcmmo.ability.repair.arcaneforging: true + mcmmo.ability.repair.salvage: true mcmmo.ability.repair.woodrepair: true mcmmo.ability.repair.stonerepair: true mcmmo.ability.repair.leatherrepair: true @@ -383,6 +384,8 @@ permissions: description: Allows access to Repair Mastery mcmmo.ability.repair.arcaneforging: description: Allows access to the Arcane Forging ability + mcmmo.ability.repair.salvage: + description: Allows access to the Salvage ability mcmmo.ability.repair.woodrepair: description: Allows ability to repair Wood tools mcmmo.ability.repair.stonerepair: From 1e7fef455742e3ef4c4cf394eeb08c29af8d4c0d Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 16:55:06 +0100 Subject: [PATCH 11/18] Revert "/fishing command will now also display the bonus gained from lucky perk" This reverts commit 1bf0cd1d154940c7a128759b91d75d21bf24cf05. --- .../com/gmail/nossr50/commands/skills/FishingCommand.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 27dc93cae..dcc33ef24 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -23,11 +23,7 @@ public class FishingCommand extends SkillCommand { protected void dataCalculations() { lootTier = Fishing.getFishingLootTier(profile); magicChance = percent.format((float) lootTier / 15); - int dropChance = Fishing.getShakeChance(lootTier); - if (player.hasPermission("mcmmo.perks.lucky.fishing")) { - dropChance = (int) (dropChance * 1.25); - } - shakeChance = String.valueOf(dropChance); + shakeChance = String.valueOf(Fishing.getShakeChance(lootTier)); } @Override From a582b075491d60ce731715c5b8fbc95618c8f844 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 22:14:26 +0100 Subject: [PATCH 12/18] Small error fix - As mentioned by Glitchfinder --- .gitignore | 5 ++++- src/main/java/com/gmail/nossr50/util/BlockChecks.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9ceb119ca..3fa62546b 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,7 @@ *.jar # Atlassian Stuff -/atlassian-ide-plugin.xml \ No newline at end of file +/atlassian-ide-plugin.xml +src/.DS_Store + +src/main/.DS_Store diff --git a/src/main/java/com/gmail/nossr50/util/BlockChecks.java b/src/main/java/com/gmail/nossr50/util/BlockChecks.java index 18c6c35eb..f109378fa 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/util/BlockChecks.java @@ -105,7 +105,7 @@ public class BlockChecks { return false; default: - if (block.getTypeId() == Config.getInstance().getRepairAnvilId() | block.getTypeId() == Config.getInstance().getSalvageAnvilId()) { + if (block.getTypeId() == Config.getInstance().getRepairAnvilId() || block.getTypeId() == Config.getInstance().getSalvageAnvilId()) { return false; } else { From ff279bf63388788c0d6f684a4a2f6b5af212c80e Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 22:17:34 +0100 Subject: [PATCH 13/18] Moved Salvage check to ItemChecks --- .../gmail/nossr50/skills/repair/Salvage.java | 130 +----------------- .../com/gmail/nossr50/util/ItemChecks.java | 126 +++++++++++++++++ 2 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index 2ab52d136..7a973e267 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -36,8 +36,8 @@ public class Salvage { final float currentdura = inHand.getDurability(); if (currentdura == 0) { - final int salvagedAmount = getSalvagedAmount(inHand); - final int itemID = getSalvagedItemID(inHand); + final int salvagedAmount = ItemChecks.getSalvagedAmount(inHand); + final int itemID = ItemChecks.getSalvagedItemID(inHand); player.setItemInHand(new ItemStack(0)); location.setY(location.getY() + 1); @@ -51,132 +51,6 @@ public class Salvage { } } - public static int getSalvagedItemID(final ItemStack inHand) { - int salvagedItem = 0; - switch (inHand.getType()) { - case DIAMOND_PICKAXE: - case DIAMOND_SPADE: - case DIAMOND_AXE: - case DIAMOND_SWORD: - case DIAMOND_HOE: - case DIAMOND_HELMET: - case DIAMOND_CHESTPLATE: - case DIAMOND_LEGGINGS: - case DIAMOND_BOOTS: - salvagedItem = 264; - break; - case GOLD_PICKAXE: - case GOLD_SPADE: - case GOLD_AXE: - case GOLD_SWORD: - case GOLD_HOE: - case GOLD_HELMET: - case GOLD_CHESTPLATE: - case GOLD_LEGGINGS: - case GOLD_BOOTS: - salvagedItem = 266; - break; - case IRON_PICKAXE: - case IRON_SPADE: - case IRON_AXE: - case IRON_SWORD: - case IRON_HOE: - case IRON_HELMET: - case IRON_CHESTPLATE: - case IRON_LEGGINGS: - case IRON_BOOTS: - salvagedItem = 265; - break; - case STONE_PICKAXE: - case STONE_SPADE: - case STONE_AXE: - case STONE_SWORD: - case STONE_HOE: - salvagedItem = 4; - break; - case WOOD_PICKAXE: - case WOOD_SPADE: - case WOOD_AXE: - case WOOD_SWORD: - case WOOD_HOE: - salvagedItem = 5; - break; - case LEATHER_HELMET: - case LEATHER_CHESTPLATE: - case LEATHER_LEGGINGS: - case LEATHER_BOOTS: - salvagedItem = 334; - break; - default: - break; - } - return salvagedItem; - } - - public static int getSalvagedAmount(final ItemStack inHand) { - int salvagedAmount = 0; - switch (inHand.getType()) { - case DIAMOND_PICKAXE: - case GOLD_PICKAXE: - case IRON_PICKAXE: - case STONE_PICKAXE: - case WOOD_PICKAXE: - case DIAMOND_AXE: - case GOLD_AXE: - case IRON_AXE: - case STONE_AXE: - case WOOD_AXE: - salvagedAmount = 3; - break; - case DIAMOND_SPADE: - case GOLD_SPADE: - case IRON_SPADE: - case STONE_SPADE: - case WOOD_SPADE: - salvagedAmount = 1; - break; - case DIAMOND_SWORD: - case GOLD_SWORD: - case IRON_SWORD: - case STONE_SWORD: - case WOOD_SWORD: - case DIAMOND_HOE: - case GOLD_HOE: - case IRON_HOE: - case STONE_HOE: - case WOOD_HOE: - salvagedAmount = 2; - break; - case DIAMOND_HELMET: - case GOLD_HELMET: - case IRON_HELMET: - case LEATHER_HELMET: - salvagedAmount = 5; - break; - case DIAMOND_CHESTPLATE: - case GOLD_CHESTPLATE: - case IRON_CHESTPLATE: - case LEATHER_CHESTPLATE: - salvagedAmount = 8; - break; - case DIAMOND_LEGGINGS: - case GOLD_LEGGINGS: - case IRON_LEGGINGS: - case LEATHER_LEGGINGS: - salvagedAmount = 7; - break; - case DIAMOND_BOOTS: - case GOLD_BOOTS: - case IRON_BOOTS: - case LEATHER_BOOTS: - salvagedAmount = 4; - break; - default: - break; - } - return salvagedAmount; - } - /** * Handles notifications for placing an anvil. * diff --git a/src/main/java/com/gmail/nossr50/util/ItemChecks.java b/src/main/java/com/gmail/nossr50/util/ItemChecks.java index 3e195b922..715088e74 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemChecks.java +++ b/src/main/java/com/gmail/nossr50/util/ItemChecks.java @@ -474,4 +474,130 @@ public class ItemChecks { public static boolean isEnchantable(ItemStack is) { return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) || (is.getType() == Material.BOW); } + + public static int getSalvagedItemID(final ItemStack inHand) { + int salvagedItem = 0; + switch (inHand.getType()) { + case DIAMOND_PICKAXE: + case DIAMOND_SPADE: + case DIAMOND_AXE: + case DIAMOND_SWORD: + case DIAMOND_HOE: + case DIAMOND_HELMET: + case DIAMOND_CHESTPLATE: + case DIAMOND_LEGGINGS: + case DIAMOND_BOOTS: + salvagedItem = 264; + break; + case GOLD_PICKAXE: + case GOLD_SPADE: + case GOLD_AXE: + case GOLD_SWORD: + case GOLD_HOE: + case GOLD_HELMET: + case GOLD_CHESTPLATE: + case GOLD_LEGGINGS: + case GOLD_BOOTS: + salvagedItem = 266; + break; + case IRON_PICKAXE: + case IRON_SPADE: + case IRON_AXE: + case IRON_SWORD: + case IRON_HOE: + case IRON_HELMET: + case IRON_CHESTPLATE: + case IRON_LEGGINGS: + case IRON_BOOTS: + salvagedItem = 265; + break; + case STONE_PICKAXE: + case STONE_SPADE: + case STONE_AXE: + case STONE_SWORD: + case STONE_HOE: + salvagedItem = 4; + break; + case WOOD_PICKAXE: + case WOOD_SPADE: + case WOOD_AXE: + case WOOD_SWORD: + case WOOD_HOE: + salvagedItem = 5; + break; + case LEATHER_HELMET: + case LEATHER_CHESTPLATE: + case LEATHER_LEGGINGS: + case LEATHER_BOOTS: + salvagedItem = 334; + break; + default: + break; + } + return salvagedItem; + } + + public static int getSalvagedAmount(final ItemStack inHand) { + int salvagedAmount = 0; + switch (inHand.getType()) { + case DIAMOND_PICKAXE: + case GOLD_PICKAXE: + case IRON_PICKAXE: + case STONE_PICKAXE: + case WOOD_PICKAXE: + case DIAMOND_AXE: + case GOLD_AXE: + case IRON_AXE: + case STONE_AXE: + case WOOD_AXE: + salvagedAmount = 3; + break; + case DIAMOND_SPADE: + case GOLD_SPADE: + case IRON_SPADE: + case STONE_SPADE: + case WOOD_SPADE: + salvagedAmount = 1; + break; + case DIAMOND_SWORD: + case GOLD_SWORD: + case IRON_SWORD: + case STONE_SWORD: + case WOOD_SWORD: + case DIAMOND_HOE: + case GOLD_HOE: + case IRON_HOE: + case STONE_HOE: + case WOOD_HOE: + salvagedAmount = 2; + break; + case DIAMOND_HELMET: + case GOLD_HELMET: + case IRON_HELMET: + case LEATHER_HELMET: + salvagedAmount = 5; + break; + case DIAMOND_CHESTPLATE: + case GOLD_CHESTPLATE: + case IRON_CHESTPLATE: + case LEATHER_CHESTPLATE: + salvagedAmount = 8; + break; + case DIAMOND_LEGGINGS: + case GOLD_LEGGINGS: + case IRON_LEGGINGS: + case LEATHER_LEGGINGS: + salvagedAmount = 7; + break; + case DIAMOND_BOOTS: + case GOLD_BOOTS: + case IRON_BOOTS: + case LEATHER_BOOTS: + salvagedAmount = 4; + break; + default: + break; + } + return salvagedAmount; + } } From 8e3320ad72070a601d05a8babc1889aa3b2b3ec6 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Tue, 13 Nov 2012 22:28:56 +0100 Subject: [PATCH 14/18] Hehe, you were soo right. This is MUCH cleaner to look at. :) --- .../gmail/nossr50/skills/repair/Salvage.java | 26 +++- .../com/gmail/nossr50/util/ItemChecks.java | 126 ------------------ 2 files changed, 24 insertions(+), 128 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index 7a973e267..e67ae5ea7 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -36,8 +36,8 @@ public class Salvage { final float currentdura = inHand.getDurability(); if (currentdura == 0) { - final int salvagedAmount = ItemChecks.getSalvagedAmount(inHand); - final int itemID = ItemChecks.getSalvagedItemID(inHand); + final int salvagedAmount = getSalvagedAmount(inHand); + final int itemID = getSalvagedItemID(inHand); player.setItemInHand(new ItemStack(0)); location.setY(location.getY() + 1); @@ -75,6 +75,28 @@ public class Salvage { } } + public static int getSalvagedItemID(final ItemStack inHand) { + int salvagedItem = 0; + if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) { salvagedItem = 264; } + else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) { salvagedItem = 266; } + else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)){ salvagedItem = 265; } + else if (ItemChecks.isStoneTool(inHand)){ salvagedItem = 4; } + else if (ItemChecks.isWoodTool(inHand)){ salvagedItem = 5; } + else if ( ItemChecks.isLeatherArmor(inHand)){ salvagedItem = 334; } + return salvagedItem; + } + + public static int getSalvagedAmount(final ItemStack inHand) { + int salvagedAmount = 0; + if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) { salvagedAmount = 3; } + else if (ItemChecks.isShovel(inHand)) { salvagedAmount = 1; } + else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) { salvagedAmount = 2; } + else if (ItemChecks.isHelmet(inHand)) { salvagedAmount = 5; } + else if (ItemChecks.isChestplate(inHand)) { salvagedAmount = 8; } + else if (ItemChecks.isPants(inHand)) { salvagedAmount = 7; } + else if (ItemChecks.isBoots(inHand)) { salvagedAmount = 4; } + return salvagedAmount; + } /** * Checks if the item is salvageable. * diff --git a/src/main/java/com/gmail/nossr50/util/ItemChecks.java b/src/main/java/com/gmail/nossr50/util/ItemChecks.java index 715088e74..3e195b922 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemChecks.java +++ b/src/main/java/com/gmail/nossr50/util/ItemChecks.java @@ -474,130 +474,4 @@ public class ItemChecks { public static boolean isEnchantable(ItemStack is) { return isArmor(is) || isSword(is) || isAxe(is) || isShovel(is) || isPickaxe(is) || (is.getType() == Material.BOW); } - - public static int getSalvagedItemID(final ItemStack inHand) { - int salvagedItem = 0; - switch (inHand.getType()) { - case DIAMOND_PICKAXE: - case DIAMOND_SPADE: - case DIAMOND_AXE: - case DIAMOND_SWORD: - case DIAMOND_HOE: - case DIAMOND_HELMET: - case DIAMOND_CHESTPLATE: - case DIAMOND_LEGGINGS: - case DIAMOND_BOOTS: - salvagedItem = 264; - break; - case GOLD_PICKAXE: - case GOLD_SPADE: - case GOLD_AXE: - case GOLD_SWORD: - case GOLD_HOE: - case GOLD_HELMET: - case GOLD_CHESTPLATE: - case GOLD_LEGGINGS: - case GOLD_BOOTS: - salvagedItem = 266; - break; - case IRON_PICKAXE: - case IRON_SPADE: - case IRON_AXE: - case IRON_SWORD: - case IRON_HOE: - case IRON_HELMET: - case IRON_CHESTPLATE: - case IRON_LEGGINGS: - case IRON_BOOTS: - salvagedItem = 265; - break; - case STONE_PICKAXE: - case STONE_SPADE: - case STONE_AXE: - case STONE_SWORD: - case STONE_HOE: - salvagedItem = 4; - break; - case WOOD_PICKAXE: - case WOOD_SPADE: - case WOOD_AXE: - case WOOD_SWORD: - case WOOD_HOE: - salvagedItem = 5; - break; - case LEATHER_HELMET: - case LEATHER_CHESTPLATE: - case LEATHER_LEGGINGS: - case LEATHER_BOOTS: - salvagedItem = 334; - break; - default: - break; - } - return salvagedItem; - } - - public static int getSalvagedAmount(final ItemStack inHand) { - int salvagedAmount = 0; - switch (inHand.getType()) { - case DIAMOND_PICKAXE: - case GOLD_PICKAXE: - case IRON_PICKAXE: - case STONE_PICKAXE: - case WOOD_PICKAXE: - case DIAMOND_AXE: - case GOLD_AXE: - case IRON_AXE: - case STONE_AXE: - case WOOD_AXE: - salvagedAmount = 3; - break; - case DIAMOND_SPADE: - case GOLD_SPADE: - case IRON_SPADE: - case STONE_SPADE: - case WOOD_SPADE: - salvagedAmount = 1; - break; - case DIAMOND_SWORD: - case GOLD_SWORD: - case IRON_SWORD: - case STONE_SWORD: - case WOOD_SWORD: - case DIAMOND_HOE: - case GOLD_HOE: - case IRON_HOE: - case STONE_HOE: - case WOOD_HOE: - salvagedAmount = 2; - break; - case DIAMOND_HELMET: - case GOLD_HELMET: - case IRON_HELMET: - case LEATHER_HELMET: - salvagedAmount = 5; - break; - case DIAMOND_CHESTPLATE: - case GOLD_CHESTPLATE: - case IRON_CHESTPLATE: - case LEATHER_CHESTPLATE: - salvagedAmount = 8; - break; - case DIAMOND_LEGGINGS: - case GOLD_LEGGINGS: - case IRON_LEGGINGS: - case LEATHER_LEGGINGS: - salvagedAmount = 7; - break; - case DIAMOND_BOOTS: - case GOLD_BOOTS: - case IRON_BOOTS: - case LEATHER_BOOTS: - salvagedAmount = 4; - break; - default: - break; - } - return salvagedAmount; - } } From a61423aa990a029afc83ab7beeda5490b223f1a7 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Tue, 13 Nov 2012 14:27:58 -0800 Subject: [PATCH 15/18] Dealing with a few minor issues. --- .../com/gmail/nossr50/commands/skills/FishingCommand.java | 6 +++++- .../java/com/gmail/nossr50/runnables/ChunkletUnloader.java | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index e7f095d6c..b324d0ad4 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -25,7 +25,11 @@ public class FishingCommand extends SkillCommand { protected void dataCalculations() { lootTier = Fishing.getFishingLootTier(profile); magicChance = percent.format((float) lootTier / 15); - shakeChance = String.valueOf(Fishing.getShakeChance(lootTier)); + int dropChance = Fishing.getShakeChance(lootTier); + if (player.hasPermission("mcmmo.perks.lucky.fishing")) { + dropChance = (int) (dropChance * 1.25); + } + shakeChance = String.valueOf(dropChance); if (skillValue >= 1000) { fishermansDietRank = "5"; diff --git a/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java b/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java index de7e33d8f..8460d9ce1 100644 --- a/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java +++ b/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java @@ -42,7 +42,10 @@ public class ChunkletUnloader implements Runnable { //Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime if (inactiveTime >= minimumInactiveTime) { - mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); + if(mcMMO.p.placeStore == null) + continue; + + mcMMO.p.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); it.remove(); continue; } From d2493e89cac8d6731743f5a007a9878b4f40c686 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Tue, 13 Nov 2012 14:31:02 -0800 Subject: [PATCH 16/18] A few more minor things. --- .../gmail/nossr50/skills/repair/Salvage.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index e67ae5ea7..6cf8640d4 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -77,24 +77,24 @@ public class Salvage { public static int getSalvagedItemID(final ItemStack inHand) { int salvagedItem = 0; - if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) { salvagedItem = 264; } - else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) { salvagedItem = 266; } - else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)){ salvagedItem = 265; } - else if (ItemChecks.isStoneTool(inHand)){ salvagedItem = 4; } - else if (ItemChecks.isWoodTool(inHand)){ salvagedItem = 5; } - else if ( ItemChecks.isLeatherArmor(inHand)){ salvagedItem = 334; } + if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) salvagedItem = 264; + else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) salvagedItem = 266; + else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)) salvagedItem = 265; + else if (ItemChecks.isStoneTool(inHand)) salvagedItem = 4; + else if (ItemChecks.isWoodTool(inHand)) salvagedItem = 5; + else if ( ItemChecks.isLeatherArmor(inHand)) salvagedItem = 334; return salvagedItem; } public static int getSalvagedAmount(final ItemStack inHand) { int salvagedAmount = 0; - if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) { salvagedAmount = 3; } - else if (ItemChecks.isShovel(inHand)) { salvagedAmount = 1; } - else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) { salvagedAmount = 2; } - else if (ItemChecks.isHelmet(inHand)) { salvagedAmount = 5; } - else if (ItemChecks.isChestplate(inHand)) { salvagedAmount = 8; } - else if (ItemChecks.isPants(inHand)) { salvagedAmount = 7; } - else if (ItemChecks.isBoots(inHand)) { salvagedAmount = 4; } + if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) salvagedAmount = 3; + else if (ItemChecks.isShovel(inHand)) salvagedAmount = 1; + else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) salvagedAmount = 2; + else if (ItemChecks.isHelmet(inHand)) salvagedAmount = 5; + else if (ItemChecks.isChestplate(inHand)) salvagedAmount = 8; + else if (ItemChecks.isPants(inHand)) salvagedAmount = 7; + else if (ItemChecks.isBoots(inHand)) salvagedAmount = 4; return salvagedAmount; } /** From 2b269ebf5455233d77559356c425b5912f1ec92f Mon Sep 17 00:00:00 2001 From: "U-YUE\\Sean" Date: Thu, 15 Nov 2012 12:40:20 -0800 Subject: [PATCH 17/18] Adding missing permissions. --- src/main/resources/plugin.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a9727d817..cbf70746c 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -448,6 +448,9 @@ permissions: mcmmo.ability.herbalism.greenterra: true mcmmo.ability.herbalism.greenthumbblocks: true mcmmo.ability.herbalism.greenthumbwheat: true + mcmmo.ability.herbalism.greenthumbcarrots: true + mcmmo.ability.herbalism.greenthumbpotatoes: true + mcmmo.ability.herbalism.greenthumbnetherwart: true mcmmo.ability.herbalism.farmersdiet: true mcmmo.ability.herbalism.doubledrops: description: Allows double drop chance from Herbalism @@ -457,6 +460,12 @@ permissions: description: Allows access to the Green Thumb ability for blocks mcmmo.ability.herbalism.greenthumbwheat: description: Allows access to the Green Thumb ability for wheat + mcmmo.ability.herbalism.greenthumbcarrots: + description: Allows access to the Green Thumb ability for carrots + mcmmo.ability.herbalism.greenthumbpotatoes: + description: Allows access to the Green Thumb ability for potatoes + mcmmo.ability.herbalism.greenthumbnetherwart: + description: Allows access to the Green Thumb ability for netherwart mcmmo.ability.herbalism.farmersdiet: description: Allows access to the Farmer's Diet ability mcmmo.ability.excavation.*: From 6d42d14575accc8c2f76f0f661556b5559f5c5f7 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Thu, 15 Nov 2012 16:34:57 -0800 Subject: [PATCH 18/18] Fixed a bug where Herablism magically converted potatoes to carrots. --- .../nossr50/skills/gathering/Herbalism.java | 2 +- .../gmail/nossr50/skills/repair/Salvage.java | 156 +++++++++--------- .../blockmeta/chunkmeta/HashChunkManager.java | 2 +- 3 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index 77c4dd969..cc600198c 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -446,7 +446,7 @@ public class Herbalism { case CARROT: Misc.dropItem(location, new ItemStack(Material.CARROT_ITEM)); Misc.randomDropItems(location, new ItemStack(Material.CARROT_ITEM), 50, 3); - inventory.removeItem(new ItemStack(Material.POTATO_ITEM)); + inventory.removeItem(new ItemStack(Material.CARROT_ITEM)); break; case POTATO: Misc.dropItem(location, new ItemStack(Material.POTATO_ITEM)); diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index 6cf8640d4..6da4df75c 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -19,97 +19,97 @@ import com.gmail.nossr50.util.Users; public class Salvage { - private static Config configInstance = Config.getInstance(); - private static Permissions permInstance = Permissions.getInstance(); + private static Config configInstance = Config.getInstance(); + private static Permissions permInstance = Permissions.getInstance(); - public static void handleSalvage(final Player player, final Location location, final ItemStack inHand) { - if (!permInstance.salvage(player) || !configInstance.getSalvageEnabled()) { - return; - } + public static void handleSalvage(final Player player, final Location location, final ItemStack inHand) { + if (!permInstance.salvage(player) || !configInstance.getSalvageEnabled()) { + return; + } - final PlayerProfile profile = Users.getProfile(player); - final int skillLevel = profile.getSkillLevel(SkillType.REPAIR); - final int unlockLevel = configInstance.getSalvageUnlockLevel(); + final PlayerProfile profile = Users.getProfile(player); + final int skillLevel = profile.getSkillLevel(SkillType.REPAIR); + final int unlockLevel = configInstance.getSalvageUnlockLevel(); - if (skillLevel >= unlockLevel) { - final World world = player.getWorld(); - final float currentdura = inHand.getDurability(); + if (skillLevel >= unlockLevel) { + final World world = player.getWorld(); + final float currentdura = inHand.getDurability(); - if (currentdura == 0) { - final int salvagedAmount = getSalvagedAmount(inHand); - final int itemID = getSalvagedItemID(inHand); + if (currentdura == 0) { + final int salvagedAmount = getSalvagedAmount(inHand); + final int itemID = getSalvagedItemID(inHand); - player.setItemInHand(new ItemStack(0)); - location.setY(location.getY() + 1); - world.dropItem(location, new ItemStack(itemID, salvagedAmount)); + player.setItemInHand(new ItemStack(0)); + location.setY(location.getY() + 1); + world.dropItem(location, new ItemStack(itemID, salvagedAmount)); player.sendMessage(LocaleLoader.getString("Repair.Skills.SalvageSuccess")); - } else { + } else { player.sendMessage(LocaleLoader.getString("Repair.Skills.NotFullDurability")); - } - } else { + } + } else { player.sendMessage(LocaleLoader.getString("Repair.Skills.AdeptSalvage")); - } - } + } + } - /** - * Handles notifications for placing an anvil. - * - * @param player The player placing the anvil - * @param anvilID The item ID of the anvil block - */ - public static void placedAnvilCheck(final Player player, final int anvilID) { - final PlayerProfile profile = Users.getProfile(player); + /** + * Handles notifications for placing an anvil. + * + * @param player The player placing the anvil + * @param anvilID The item ID of the anvil block + */ + public static void placedAnvilCheck(final Player player, final int anvilID) { + final PlayerProfile profile = Users.getProfile(player); - if (!profile.getPlacedSalvageAnvil()) { - if (mcMMO.spoutEnabled) { - final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player); + if (!profile.getPlacedSalvageAnvil()) { + if (mcMMO.spoutEnabled) { + final SpoutPlayer spoutPlayer = SpoutManager.getPlayer(player); - if (spoutPlayer.isSpoutCraftEnabled()) { - spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID)); - } - } else { + if (spoutPlayer.isSpoutCraftEnabled()) { + spoutPlayer.sendNotification("[mcMMO] Anvil Placed", "Right click to salvage!", Material.getMaterial(anvilID)); + } + } else { player.sendMessage(LocaleLoader.getString("Repair.Listener.Anvil2")); - } + } - profile.togglePlacedSalvageAnvil(); - } - } + profile.togglePlacedSalvageAnvil(); + } + } - public static int getSalvagedItemID(final ItemStack inHand) { - int salvagedItem = 0; - if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) salvagedItem = 264; - else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) salvagedItem = 266; - else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)) salvagedItem = 265; - else if (ItemChecks.isStoneTool(inHand)) salvagedItem = 4; - else if (ItemChecks.isWoodTool(inHand)) salvagedItem = 5; - else if ( ItemChecks.isLeatherArmor(inHand)) salvagedItem = 334; - return salvagedItem; - } + public static int getSalvagedItemID(final ItemStack inHand) { + int salvagedItem = 0; + if (ItemChecks.isDiamondTool(inHand) || ItemChecks.isDiamondArmor(inHand)) salvagedItem = 264; + else if (ItemChecks.isGoldTool(inHand) || ItemChecks.isGoldArmor(inHand)) salvagedItem = 266; + else if (ItemChecks.isIronTool(inHand) || ItemChecks.isIronArmor(inHand)) salvagedItem = 265; + else if (ItemChecks.isStoneTool(inHand)) salvagedItem = 4; + else if (ItemChecks.isWoodTool(inHand)) salvagedItem = 5; + else if ( ItemChecks.isLeatherArmor(inHand)) salvagedItem = 334; + return salvagedItem; + } - public static int getSalvagedAmount(final ItemStack inHand) { - int salvagedAmount = 0; - if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) salvagedAmount = 3; - else if (ItemChecks.isShovel(inHand)) salvagedAmount = 1; - else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) salvagedAmount = 2; - else if (ItemChecks.isHelmet(inHand)) salvagedAmount = 5; - else if (ItemChecks.isChestplate(inHand)) salvagedAmount = 8; - else if (ItemChecks.isPants(inHand)) salvagedAmount = 7; - else if (ItemChecks.isBoots(inHand)) salvagedAmount = 4; - return salvagedAmount; - } - /** - * Checks if the item is salvageable. - * - * @param is Item to check - * @return true if the item is salvageable, false otherwise - */ - public static boolean isSalvageable(final ItemStack is) { - if (configInstance.getSalvageTools() && ItemChecks.isTool(is)) { - return true; - } - if (configInstance.getSalvageArmor() && ItemChecks.isArmor(is)) { - return true; - } - return false; - } + public static int getSalvagedAmount(final ItemStack inHand) { + int salvagedAmount = 0; + if (ItemChecks.isPickaxe(inHand) || ItemChecks.isAxe(inHand)) salvagedAmount = 3; + else if (ItemChecks.isShovel(inHand)) salvagedAmount = 1; + else if (ItemChecks.isSword(inHand) || ItemChecks.isHoe(inHand)) salvagedAmount = 2; + else if (ItemChecks.isHelmet(inHand)) salvagedAmount = 5; + else if (ItemChecks.isChestplate(inHand)) salvagedAmount = 8; + else if (ItemChecks.isPants(inHand)) salvagedAmount = 7; + else if (ItemChecks.isBoots(inHand)) salvagedAmount = 4; + return salvagedAmount; + } + /** + * Checks if the item is salvageable. + * + * @param is Item to check + * @return true if the item is salvageable, false otherwise + */ + public static boolean isSalvageable(final ItemStack is) { + if (configInstance.getSalvageTools() && ItemChecks.isTool(is)) { + return true; + } + if (configInstance.getSalvageArmor() && ItemChecks.isArmor(is)) { + return true; + } + return false; + } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index c449e7681..cb74a379e 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -208,7 +208,7 @@ public class HashChunkManager implements ChunkManager { if(world == null) return; - ChunkletUnloader.addToList(cx, cx, world); + ChunkletUnloader.addToList(cx, cz, world); } @Override