From a814b57311bc7734661109f0e77fc8bab3a0bd29 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 1 Dec 2011 09:46:46 -0800 Subject: [PATCH] Release of 1.2.00 --- src/Changelog.txt | 8 +- src/com/gmail/nossr50/Database.java | 10 + src/com/gmail/nossr50/Leaderboard.java | 5 + src/com/gmail/nossr50/command/Commands.java | 37 +- .../nossr50/datatypes/PlayerProfile.java | 43 +- .../nossr50/listeners/mcBlockListener.java | 3 +- .../nossr50/listeners/mcEntityListener.java | 3 - .../nossr50/listeners/mcPlayerListener.java | 60 +- .../gmail/nossr50/locale/locale_de.properties | 21 +- .../nossr50/locale/locale_en_us.properties | 21 +- .../nossr50/locale/locale_es_es.properties | 21 +- .../gmail/nossr50/locale/locale_fi.properties | 21 +- .../gmail/nossr50/locale/locale_fr.properties | 21 +- .../gmail/nossr50/locale/locale_nl.properties | 21 +- .../gmail/nossr50/locale/locale_pl.properties | 21 +- .../nossr50/locale/locale_pt_br.properties | 22 +- .../gmail/nossr50/locale/locale_ru.properties | 21 +- src/com/gmail/nossr50/m.java | 2 + src/com/gmail/nossr50/skills/Archery.java | 1 - src/com/gmail/nossr50/skills/Fishing.java | 757 ++++++++++++++++-- src/com/gmail/nossr50/skills/Repair.java | 8 +- src/plugin.yml | 4 +- 22 files changed, 1019 insertions(+), 112 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index 3bbf2035b..ae3c12efd 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -1,11 +1,13 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code Version 1.2.00 -New mobs added to xp tables -Party leaders can now give bonus xp to nearby party members when grouped provided they are more skilled than their underlings +Added Fishing Skill +Added Call Of The Wild to Taming +Added Arcane Forging to Repair +Added new mobs to XP tables +Added Master/Apprentice system to the Party system Animals now give xp to combat skills (those poor sheep ;_;) Removed unnecessary sorcery permissions from plugin.yml -Added 'Arcane Forging' subskill to Repair Version 1.1.17 XP gained in combat is now softcapped by the remaining health of the entity you are damaging, preventing many exploits. diff --git a/src/com/gmail/nossr50/Database.java b/src/com/gmail/nossr50/Database.java index 7dfb1a05e..0a7f8fb1a 100644 --- a/src/com/gmail/nossr50/Database.java +++ b/src/com/gmail/nossr50/Database.java @@ -85,6 +85,11 @@ public class Database { + "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "skills2` (`user_id` int(10) unsigned NOT NULL," + + "`fishing` int(10) unsigned NOT NULL DEFAULT '0'," + + "`enchanting` int(10) unsigned NOT NULL DEFAULT '0'," + + "`alchemy` int(10) unsigned NOT NULL DEFAULT '0'," + + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "experience` (`user_id` int(10) unsigned NOT NULL," + "`taming` int(10) unsigned NOT NULL DEFAULT '0'," + "`mining` int(10) unsigned NOT NULL DEFAULT '0'," @@ -98,6 +103,11 @@ public class Database { + "`axes` int(10) unsigned NOT NULL DEFAULT '0'," + "`acrobatics` int(10) unsigned NOT NULL DEFAULT '0'," + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); + Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "experience2` (`user_id` int(10) unsigned NOT NULL," + + "`fishing` int(10) unsigned NOT NULL DEFAULT '0'," + + "`enchanting` int(10) unsigned NOT NULL DEFAULT '0'," + + "`alchemy` int(10) unsigned NOT NULL DEFAULT '0'," + + "PRIMARY KEY (`user_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;"); Write("CREATE TABLE IF NOT EXISTS `" + LoadProperties.MySQLtablePrefix + "spawn` (`user_id` int(10) NOT NULL," + "`x` int(64) NOT NULL DEFAULT '0'," + "`y` int(64) NOT NULL DEFAULT '0'," diff --git a/src/com/gmail/nossr50/Leaderboard.java b/src/com/gmail/nossr50/Leaderboard.java index c3baea519..e61ab7d4f 100644 --- a/src/com/gmail/nossr50/Leaderboard.java +++ b/src/com/gmail/nossr50/Leaderboard.java @@ -122,6 +122,11 @@ public class Leaderboard Taming.add(p, Integer.valueOf(character[24])); Plvl += Integer.valueOf(character[24]); } + if(character.length > 34 && m.isInt(character[34])) + { + Fishing.add(p, Integer.valueOf(character[34])); + Plvl += Integer.valueOf(character[34]); + } PowerLevel.add(p, Plvl); } diff --git a/src/com/gmail/nossr50/command/Commands.java b/src/com/gmail/nossr50/command/Commands.java index caee3d638..e766f5a43 100644 --- a/src/com/gmail/nossr50/command/Commands.java +++ b/src/com/gmail/nossr50/command/Commands.java @@ -42,6 +42,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.party.Party; +import com.gmail.nossr50.skills.Fishing; import com.gmail.nossr50.skills.Repair; import com.gmail.nossr50.skills.Skills; import com.gmail.nossr50.spout.SpoutStuff; @@ -104,6 +105,8 @@ public class Commands player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming4_0"), mcLocale.getString("m.EffectsTaming4_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming5_0"), mcLocale.getString("m.EffectsTaming5_1")})); player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming6_0"), mcLocale.getString("m.EffectsTaming6_1")})); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsTaming7_0"), mcLocale.getString("m.EffectsTaming7_1")})); + player.sendMessage(mcLocale.getString("m.EffectsTaming7_2")); player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); if(PP.getSkillLevel(SkillType.TAMING) < 100) player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockTaming1")})); @@ -324,6 +327,24 @@ public class Commands player.sendMessage(mcLocale.getString("m.ArcaneForgingMilestones2")); } + else if(label.equals("fishing")){ + //float skillvalue = (float)PP.getSkillLevel(SkillType.FISHING); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.SkillFishing")})); + player.sendMessage(mcLocale.getString("m.XPGain", new Object[] {mcLocale.getString("m.XPGainFishing")})); + if(mcPermissions.getInstance().fishing(player)) + player.sendMessage(mcLocale.getString("m.LVL", new Object[] {PP.getSkillLevel(SkillType.FISHING), PP.getSkillXpLevel(SkillType.FISHING), PP.getXpToLevel(SkillType.FISHING)})); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.Effects")})); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsFishing1_0"), mcLocale.getString("m.EffectsFishing1_1")})); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsFishing2_0"), mcLocale.getString("m.EffectsFishing2_1")})); + player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] {mcLocale.getString("m.EffectsFishing3_0"), mcLocale.getString("m.EffectsFishing3_1")})); + player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] {mcLocale.getString("m.YourStats")})); + player.sendMessage(mcLocale.getString("m.FishingRank", new Object[] {Fishing.getFishingLootTier(PP)})); + player.sendMessage(mcLocale.getString("m.FishingMagicInfo")); + if(PP.getSkillLevel(SkillType.FISHING) < 150) + player.sendMessage(mcLocale.getString("m.AbilityLockTemplate", new Object[] {mcLocale.getString("m.AbilLockFishing1")})); + else + player.sendMessage(mcLocale.getString("m.ShakeInfo", new Object[] {Fishing.getFishingLootTier(PP)})); + } else if(label.equalsIgnoreCase("unarmed")){ String percentage, arrowpercentage; float skillvalue = (float)PP.getSkillLevel(SkillType.UNARMED); @@ -1074,10 +1095,10 @@ public class Commands player.sendMessage(ChatColor.GOLD+"-=MISC SKILLS=-"); if(mcPermissions.getInstance().acrobatics(target)) player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PPt.getSkillLevel(SkillType.ACROBATICS), PPt.getSkillXpLevel(SkillType.ACROBATICS), PPt.getXpToLevel(SkillType.ACROBATICS))); - if(mcPermissions.getInstance().alchemy(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PPt.getSkillLevel(SkillType.ALCHEMY), PPt.getSkillXpLevel(SkillType.ALCHEMY), PPt.getXpToLevel(SkillType.ALCHEMY))); - if(mcPermissions.getInstance().enchanting(target)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PPt.getSkillLevel(SkillType.ENCHANTING), PPt.getSkillXpLevel(SkillType.ENCHANTING), PPt.getXpToLevel(SkillType.ENCHANTING))); + //if(mcPermissions.getInstance().alchemy(target)) + //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PPt.getSkillLevel(SkillType.ALCHEMY), PPt.getSkillXpLevel(SkillType.ALCHEMY), PPt.getXpToLevel(SkillType.ALCHEMY))); + //if(mcPermissions.getInstance().enchanting(target)) + //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PPt.getSkillLevel(SkillType.ENCHANTING), PPt.getSkillXpLevel(SkillType.ENCHANTING), PPt.getXpToLevel(SkillType.ENCHANTING))); if(mcPermissions.getInstance().repair(target)) player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PPt.getSkillLevel(SkillType.REPAIR), PPt.getSkillXpLevel(SkillType.REPAIR), PPt.getXpToLevel(SkillType.REPAIR))); @@ -1130,10 +1151,10 @@ public class Commands player.sendMessage(header+"-=MISC SKILLS=-"); if(mcPermissions.getInstance().acrobatics(player)) player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AcrobaticsSkill"), PP.getSkillLevel(SkillType.ACROBATICS), PP.getSkillXpLevel(SkillType.ACROBATICS), PP.getXpToLevel(SkillType.ACROBATICS))); - if(mcPermissions.getInstance().alchemy(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PP.getSkillLevel(SkillType.ALCHEMY), PP.getSkillXpLevel(SkillType.ALCHEMY), PP.getXpToLevel(SkillType.ALCHEMY))); - if(mcPermissions.getInstance().enchanting(player)) - player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PP.getSkillLevel(SkillType.ENCHANTING), PP.getSkillXpLevel(SkillType.ENCHANTING), PP.getXpToLevel(SkillType.ENCHANTING))); + //if(mcPermissions.getInstance().alchemy(player)) + //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.AlchemySkill"), PP.getSkillLevel(SkillType.ALCHEMY), PP.getSkillXpLevel(SkillType.ALCHEMY), PP.getXpToLevel(SkillType.ALCHEMY))); + //if(mcPermissions.getInstance().enchanting(player)) + //player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.EnchantingSkill"), PP.getSkillLevel(SkillType.ENCHANTING), PP.getSkillXpLevel(SkillType.ENCHANTING), PP.getXpToLevel(SkillType.ENCHANTING))); if(mcPermissions.getInstance().repair(player)) player.sendMessage(Skills.getSkillStats(mcLocale.getString("mcPlayerListener.RepairSkill"), PP.getSkillLevel(SkillType.REPAIR), PP.getSkillXpLevel(SkillType.REPAIR), PP.getXpToLevel(SkillType.REPAIR))); } diff --git a/src/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/com/gmail/nossr50/datatypes/PlayerProfile.java index 9c0a311c6..1ece9b04b 100644 --- a/src/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -176,6 +176,15 @@ public class PlayerProfile skills.put(SkillType.SWORDS, Integer.valueOf(stats.get(1).get(8))); skills.put(SkillType.AXES, Integer.valueOf(stats.get(1).get(9))); skills.put(SkillType.ACROBATICS, Integer.valueOf(stats.get(1).get(10))); + HashMap> stats2 = mcMMO.database.Read("SELECT fishing, enchanting, alchemy FROM "+LoadProperties.MySQLtablePrefix+"skills2 WHERE user_id = " + id); + if(stats2.get(1) == null) + { + mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills2 (user_id) VALUES ("+id+")"); + } else { + skills.put(SkillType.FISHING, Integer.valueOf(stats2.get(1).get(0))); + skills.put(SkillType.ENCHANTING, Integer.valueOf(stats2.get(1).get(1))); + skills.put(SkillType.ALCHEMY, Integer.valueOf(stats2.get(1).get(2))); + } HashMap> experience = mcMMO.database.Read("SELECT taming, mining, repair, woodcutting, unarmed, herbalism, excavation, archery, swords, axes, acrobatics FROM "+LoadProperties.MySQLtablePrefix+"experience WHERE user_id = " + id); skillsXp.put(SkillType.TAMING, Integer.valueOf(experience.get(1).get(0))); skillsXp.put(SkillType.MINING, Integer.valueOf(experience.get(1).get(1))); @@ -188,6 +197,15 @@ public class PlayerProfile skillsXp.put(SkillType.SWORDS, Integer.valueOf(experience.get(1).get(8))); skillsXp.put(SkillType.AXES, Integer.valueOf(experience.get(1).get(9))); skillsXp.put(SkillType.ACROBATICS, Integer.valueOf(experience.get(1).get(10))); + HashMap> experience2 = mcMMO.database.Read("SELECT fishing, enchanting, alchemy FROM "+LoadProperties.MySQLtablePrefix+"experience2 WHERE user_id = " + id); + if(experience2.get(1) == null) + { + mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience2 (user_id) VALUES ("+id+")"); + } else { + skillsXp.put(SkillType.FISHING, Integer.valueOf(experience2.get(1).get(0))); + skillsXp.put(SkillType.ENCHANTING, Integer.valueOf(experience2.get(1).get(1))); + skillsXp.put(SkillType.ALCHEMY, Integer.valueOf(experience2.get(1).get(2))); + } return true; } else { @@ -201,7 +219,9 @@ public class PlayerProfile mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"cooldowns (user_id) VALUES ("+id+")"); mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"spawn (user_id) VALUES ("+id+")"); mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills (user_id) VALUES ("+id+")"); + mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"skills2 (user_id) VALUES ("+id+")"); mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience (user_id) VALUES ("+id+")"); + mcMMO.database.Write("INSERT INTO "+LoadProperties.MySQLtablePrefix+"experience2 (user_id) VALUES ("+id+")"); this.userid = id; } @@ -297,6 +317,10 @@ public class PlayerProfile } } } + if(character.length > 34) + skills.put(SkillType.FISHING, Integer.valueOf(character[34])); + if(character.length > 35) + skillsXp.put(SkillType.FISHING, Integer.valueOf(character[35])); in.close(); return true; } @@ -341,6 +365,11 @@ public class PlayerProfile +", axes = "+skills.get(SkillType.AXES) +", acrobatics = "+skills.get(SkillType.ACROBATICS) +" WHERE user_id = "+this.userid); + mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"skills2 SET " + +" fishing = "+skills.get(SkillType.TAMING) + +", enchanting = "+skills.get(SkillType.MINING) + +", alchemy = "+skills.get(SkillType.REPAIR) + +" WHERE user_id = "+this.userid); mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience SET " +" taming = "+skillsXp.get(SkillType.TAMING) +", mining = "+skillsXp.get(SkillType.MINING) @@ -354,7 +383,11 @@ public class PlayerProfile +", axes = "+skillsXp.get(SkillType.AXES) +", acrobatics = "+skillsXp.get(SkillType.ACROBATICS) +" WHERE user_id = "+this.userid); - + mcMMO.database.Write("UPDATE "+LoadProperties.MySQLtablePrefix+"experience2 SET " + +" fishing = "+skills.get(SkillType.TAMING) + +", enchanting = "+skills.get(SkillType.MINING) + +", alchemy = "+skills.get(SkillType.REPAIR) + +" WHERE user_id = "+this.userid); } else { // otherwise save to flatfile @@ -412,6 +445,8 @@ public class PlayerProfile writer.append(String.valueOf(skullSplitterDATS)+":"); writer.append(String.valueOf(superBreakerDATS)+":"); writer.append(hud.toString()+":"); + writer.append(skills.get(SkillType.FISHING) + ":"); + writer.append(skillsXp.get(SkillType.FISHING) + ":"); writer.append("\r\n"); } } @@ -467,6 +502,8 @@ public class PlayerProfile out.append(0+":"); //DATS out.append(0+":"); //DATS out.append(LoadProperties.defaulthud.toString()+":");//HUD + out.append(0+":"); //Fishing + out.append(0+":"); //FishingXP //Add more in the same format as the line above @@ -1032,8 +1069,8 @@ public class PlayerProfile if(bonusModifier > 0) { - if(bonusModifier >= 3) - bonusModifier = 3; + if(bonusModifier >= 2) + bonusModifier = 2; double trueBonus = bonusModifier * xp; double oldxp = xp; diff --git a/src/com/gmail/nossr50/listeners/mcBlockListener.java b/src/com/gmail/nossr50/listeners/mcBlockListener.java index 6be03f8f4..22fbb2d69 100644 --- a/src/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/com/gmail/nossr50/listeners/mcBlockListener.java @@ -24,6 +24,7 @@ import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.spout.SpoutStuff; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; + import org.bukkit.Material; import org.bukkit.Statistic; import org.bukkit.block.Block; @@ -440,8 +441,6 @@ public class mcBlockListener extends BlockListener public void onBlockFromTo(BlockFromToEvent event) { - - Block blockFrom = event.getBlock(); Block blockTo = event.getToBlock(); if(m.shouldBeWatched(blockFrom) && blockFrom.getData() == (byte)5) diff --git a/src/com/gmail/nossr50/listeners/mcEntityListener.java b/src/com/gmail/nossr50/listeners/mcEntityListener.java index 64fbe4c61..4f9ad9177 100644 --- a/src/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/com/gmail/nossr50/listeners/mcEntityListener.java @@ -52,8 +52,6 @@ public class mcEntityListener extends EntityListener public void onEntityDamage(EntityDamageEvent event) { - - if(event.isCancelled()) return; //Check for world pvp flag @@ -185,7 +183,6 @@ public class mcEntityListener extends EntityListener public void onCreatureSpawn(CreatureSpawnEvent event) { - SpawnReason reason = event.getSpawnReason(); if(reason == SpawnReason.SPAWNER && !LoadProperties.xpGainsMobSpawners) diff --git a/src/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/com/gmail/nossr50/listeners/mcPlayerListener.java index 7b79cf921..77a27c5c6 100644 --- a/src/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -23,12 +23,16 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.craftbukkit.command.ColouredConsoleSender; import org.bukkit.craftbukkit.entity.CraftItem; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Fish; +import org.bukkit.entity.AnimalTamer; +import org.bukkit.entity.CreatureType; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Wolf; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerFishEvent; @@ -41,8 +45,6 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.material.MaterialData; - import com.gmail.nossr50.Item; import com.gmail.nossr50.Users; import com.gmail.nossr50.m; @@ -60,6 +62,7 @@ import com.gmail.nossr50.skills.Fishing; import com.gmail.nossr50.skills.Herbalism; import com.gmail.nossr50.skills.Repair; import com.gmail.nossr50.skills.Skills; +import com.gmail.nossr50.skills.Taming; public class mcPlayerListener extends PlayerListener @@ -73,17 +76,21 @@ public class mcPlayerListener extends PlayerListener plugin = instance; } - //Fishing stuff public void onPlayerFish(PlayerFishEvent event) { - Player player = event.getPlayer(); - if(mcPermissions.getInstance().fishing(player)) + if(mcPermissions.getInstance().fishing(event.getPlayer())) { if(event.getState() == State.CAUGHT_FISH) { if(event.getCaught() instanceof CraftItem) { - Fishing.getFishingResults(player, event); + Fishing.processResults(event); + } + } else if (event.getState() == State.CAUGHT_ENTITY) + { + if(Users.getProfile(event.getPlayer()).getSkillLevel(SkillType.FISHING) >= 150 && event.getCaught() instanceof LivingEntity) + { + Fishing.shakeMob(event); } } } @@ -249,6 +256,43 @@ public class mcPlayerListener extends PlayerListener if(m.abilityBlockCheck(event.getClickedBlock())) Item.itemchecks(player, plugin); } + + if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) + { + if(player.getItemInHand().getType() == Material.BONE && player.getItemInHand().getAmount() > 9) + { + for(Entity x : player.getNearbyEntities(40, 40, 40)) + { + if(x instanceof Wolf) + { + player.sendMessage(mcLocale.getString("m.TamingSummonFailed")); + return; + } + } + World world = player.getWorld(); + world.spawnCreature(player.getLocation(), CreatureType.WOLF); + + ItemStack[] inventory = player.getInventory().getContents(); + for(ItemStack x : inventory){ + if(x != null && x.getType() == Material.BONE){ + if(x.getAmount() >= 10) + { + x.setAmount(x.getAmount() - 10); + player.getInventory().setContents(inventory); + player.updateInventory(); + break; + } else { + x.setAmount(0); + x.setTypeId(0); + player.getInventory().setContents(inventory); + player.updateInventory(); + break; + } + } + } + player.sendMessage(mcLocale.getString("m.TamingSummon")); + } + } } public void onPlayerChat(PlayerChatEvent event) diff --git a/src/com/gmail/nossr50/locale/locale_de.properties b/src/com/gmail/nossr50/locale/locale_de.properties index 8cf4f6151..7a2d01b2e 100644 --- a/src/com/gmail/nossr50/locale/locale_de.properties +++ b/src/com/gmail/nossr50/locale/locale_de.properties @@ -374,4 +374,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_en_us.properties b/src/com/gmail/nossr50/locale/locale_en_us.properties index 888d140a7..93d513c42 100644 --- a/src/com/gmail/nossr50/locale/locale_en_us.properties +++ b/src/com/gmail/nossr50/locale/locale_en_us.properties @@ -368,4 +368,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_es_es.properties b/src/com/gmail/nossr50/locale/locale_es_es.properties index ce453a117..7b03fffbb 100644 --- a/src/com/gmail/nossr50/locale/locale_es_es.properties +++ b/src/com/gmail/nossr50/locale/locale_es_es.properties @@ -368,4 +368,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_fi.properties b/src/com/gmail/nossr50/locale/locale_fi.properties index 42f0f84b6..79d7d4b05 100644 --- a/src/com/gmail/nossr50/locale/locale_fi.properties +++ b/src/com/gmail/nossr50/locale/locale_fi.properties @@ -347,4 +347,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_fr.properties b/src/com/gmail/nossr50/locale/locale_fr.properties index b50d974e2..350e2e3ea 100644 --- a/src/com/gmail/nossr50/locale/locale_fr.properties +++ b/src/com/gmail/nossr50/locale/locale_fr.properties @@ -368,4 +368,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_nl.properties b/src/com/gmail/nossr50/locale/locale_nl.properties index 5c7c3f875..6d3151cea 100644 --- a/src/com/gmail/nossr50/locale/locale_nl.properties +++ b/src/com/gmail/nossr50/locale/locale_nl.properties @@ -374,4 +374,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_pl.properties b/src/com/gmail/nossr50/locale/locale_pl.properties index ad2cadf85..83130b169 100644 --- a/src/com/gmail/nossr50/locale/locale_pl.properties +++ b/src/com/gmail/nossr50/locale/locale_pl.properties @@ -368,4 +368,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_pt_br.properties b/src/com/gmail/nossr50/locale/locale_pt_br.properties index 799ac7f33..e276c58c3 100644 --- a/src/com/gmail/nossr50/locale/locale_pt_br.properties +++ b/src/com/gmail/nossr50/locale/locale_pt_br.properties @@ -39,7 +39,6 @@ m.AbilityLockTemplate=[[GRAY]]{0} m.AbilityBonusTemplate=[[RED]]{0}: [[YELLOW]]{1} m.Effects=EFEITOS m.YourStats=SUAS ESTATISTICAS - m.SkillTaming=DOMESTICAR m.XPGainTaming=Ataque com um lobo m.EffectsTaming1_0=Conhecimento de Feras @@ -383,4 +382,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/locale/locale_ru.properties b/src/com/gmail/nossr50/locale/locale_ru.properties index 0629f86a1..716c045e6 100644 --- a/src/com/gmail/nossr50/locale/locale_ru.properties +++ b/src/com/gmail/nossr50/locale/locale_ru.properties @@ -360,4 +360,23 @@ m.ArcaneForgingRank=[[RED]]Arcane Forging: [[YELLOW]]Rank {0}/4 m.ArcaneEnchantKeepChance=[[GRAY]]AF Success Rate: [[YELLOW]]{0}% m.ArcaneEnchantDowngradeChance=[[GRAY]]AF Downgrade Chance: [[YELLOW]]{0}% m.ArcaneForgingMilestones=[[GOLD]][TIP] AF Rank Ups: [[GRAY]]Rank 1 = 100+, Rank 2 = 250+, -m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ \ No newline at end of file +m.ArcaneForgingMilestones2=[[GRAY]] Rank 3 = 500+, Rank 4 = 750+ +Fishing.MagicFound=[[GRAY]]You feel a touch of magic with this catch... +Fishing.ItemFound=[[GRAY]]Treasure found! +m.SkillFishing=FISHING +m.XPGainFishing=Fishing (Go figure!) +m.EffectsFishing1_0=Treasure Hunter (Passive) +m.EffectsFishing1_1=Fish up misc objects +m.EffectsFishing2_0=Magic Hunter +m.EffectsFishing2_1=Find Enchanted Items +m.EffectsFishing3_0=Shake (vs. Entities) +m.EffectsFishing3_1=Shake items off of mobs w/ fishing pole +m.FishingRank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5 +m.FishingMagicInfo=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank** +m.ShakeInfo=[[RED]]Shake: [[YELLOW]]Tear items off mobs, mutilating them in the process ;_; +m.AbilLockFishing1=LOCKED UNTIL 150+ SKILL (SHAKE) +m.TamingSummon=[[GREEN]]Summoning complete +m.TamingSummonFailed=[[RED]]You have too many wolves nearby to summon any more. +m.EffectsTaming7_0=Call of the Wild +m.EffectsTaming7_1=Summon a wolf to your side +m.EffectsTaming7_2=[[GRAY]]COTW HOW-TO: Crouch and right click with 10 Bones in hand \ No newline at end of file diff --git a/src/com/gmail/nossr50/m.java b/src/com/gmail/nossr50/m.java index b5bbf51b4..83543e26c 100644 --- a/src/com/gmail/nossr50/m.java +++ b/src/com/gmail/nossr50/m.java @@ -117,6 +117,8 @@ public class m x+=PP.getSkillLevel(SkillType.ACROBATICS); if(mcPermissions.getInstance().repair(player)) x+=PP.getSkillLevel(SkillType.REPAIR); + if(mcPermissions.getInstance().fishing(player)) + x+=PP.getSkillLevel(SkillType.FISHING); return x; } diff --git a/src/com/gmail/nossr50/skills/Archery.java b/src/com/gmail/nossr50/skills/Archery.java index 9e71a6bca..490ea9db0 100644 --- a/src/com/gmail/nossr50/skills/Archery.java +++ b/src/com/gmail/nossr50/skills/Archery.java @@ -17,7 +17,6 @@ package com.gmail.nossr50.skills; import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageByEntityEvent; diff --git a/src/com/gmail/nossr50/skills/Fishing.java b/src/com/gmail/nossr50/skills/Fishing.java index d81e3433a..88875495d 100644 --- a/src/com/gmail/nossr50/skills/Fishing.java +++ b/src/com/gmail/nossr50/skills/Fishing.java @@ -1,14 +1,26 @@ package com.gmail.nossr50.skills; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.craftbukkit.entity.CraftItem; +import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Cow; +import org.bukkit.entity.Creeper; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Pig; import org.bukkit.entity.Player; +import org.bukkit.entity.Sheep; +import org.bukkit.entity.Skeleton; +import org.bukkit.entity.Spider; import org.bukkit.event.player.PlayerFishEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.material.Wool; import com.gmail.nossr50.Users; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; +import com.gmail.nossr50.locale.mcLocale; public class Fishing { @@ -37,24 +49,8 @@ public class Fishing { public static short getItemMaxDurability(Material mat) { - //Return the max durability of an item - - //KEY - //TOOLS - //GOLD = 33, WOOD = 60, STONE = 132, IRON = 251, DIAMOND = 1562 - //HELMETS - //LEATHER = 34, CHAINMAIL = 67, GOLD = 68, IRON = 136, DIAMOND = 272 - //CHESTPLATES - //LEATHER = 49, CHAINMAIL = 96, GOLD = 96, IRON = 192, DIAMOND = 384 - //LEGGINGS - //LEATHER = 46, CHAINMAIL = 92, GOLD = 92, IRON = 184, DIAMOND = 368 - //BOOTS - //LEATHER = 40, CHAINMAIL = 79, GOLD = 80, IRON = 160, DIAMOND = 320 - - switch(mat) { - //Leather Items case LEATHER_BOOTS: return (short) 40; case LEATHER_LEGGINGS: @@ -63,8 +59,90 @@ public class Fishing { return (short) 34; case LEATHER_CHESTPLATE: return (short) 49; + case CHAINMAIL_BOOTS: + return (short) 79; + case CHAINMAIL_LEGGINGS: + return (short) 92; + case CHAINMAIL_HELMET: + return (short) 67; + case CHAINMAIL_CHESTPLATE: + return (short) 96; + case GOLD_BOOTS: + return (short) 80; + case GOLD_LEGGINGS: + return (short) 92; + case GOLD_HELMET: + return (short) 68; + case GOLD_CHESTPLATE: + return (short) 96; + case IRON_BOOTS: + return (short) 160; + case IRON_LEGGINGS: + return (short) 184; + case IRON_HELMET: + return (short) 136; + case IRON_CHESTPLATE: + return (short) 192; + case DIAMOND_BOOTS: + return (short) 320; + case DIAMOND_LEGGINGS: + return (short) 368; + case DIAMOND_HELMET: + return (short) 272; + case DIAMOND_CHESTPLATE: + return (short) 384; + case GOLD_AXE: + return (short) 33; + case GOLD_SWORD: + return (short) 33; + case GOLD_HOE: + return (short) 33; + case GOLD_SPADE: + return (short) 33; + case GOLD_PICKAXE: + return (short) 33; + case WOOD_AXE: + return (short) 60; + case WOOD_SWORD: + return (short) 60; + case WOOD_HOE: + return (short) 60; + case WOOD_SPADE: + return (short) 60; + case WOOD_PICKAXE: + return (short) 60; + case STONE_AXE: + return (short) 132; + case STONE_SWORD: + return (short) 132; + case STONE_HOE: + return (short) 132; + case STONE_SPADE: + return (short) 132; + case STONE_PICKAXE: + return (short) 132; + case IRON_AXE: + return (short) 251; + case IRON_SWORD: + return (short) 251; + case IRON_HOE: + return (short) 251; + case IRON_SPADE: + return (short) 251; + case IRON_PICKAXE: + return (short) 251; + case DIAMOND_AXE: + return (short) 1562; + case DIAMOND_SWORD: + return (short) 1562; + case DIAMOND_HOE: + return (short) 1562; + case DIAMOND_SPADE: + return (short) 1562; + case DIAMOND_PICKAXE: + return (short) 1562; default: - return 0; + return (short) 0; } } @@ -74,27 +152,27 @@ public class Fishing { { case 1: getFishingResultsTier1(player, event); - Users.getProfile(player).addXP(SkillType.FISHING, 200, player); + Users.getProfile(player).addXP(SkillType.FISHING, 1500, player); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 1)); break; case 2: getFishingResultsTier2(player, event); - Users.getProfile(player).addXP(SkillType.FISHING, 400, player); + Users.getProfile(player).addXP(SkillType.FISHING, 1500, player); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 2)); break; case 3: getFishingResultsTier3(player, event); - Users.getProfile(player).addXP(SkillType.FISHING, 600, player); + Users.getProfile(player).addXP(SkillType.FISHING, 1500, player); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 3)); break; case 4: getFishingResultsTier4(player, event); - Users.getProfile(player).addXP(SkillType.FISHING, 800, player); + Users.getProfile(player).addXP(SkillType.FISHING, 1500, player); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 4)); break; case 5: getFishingResultsTier5(player, event); - Users.getProfile(player).addXP(SkillType.FISHING, 1000, player); + Users.getProfile(player).addXP(SkillType.FISHING, 1500, player); player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 5)); break; } @@ -103,58 +181,59 @@ public class Fishing { private static void getFishingResultsTier1(Player player, PlayerFishEvent event) { - //About 12 items for Tier 1 int randomNum = (int)(Math.random() * 14); CraftItem theCatch = (CraftItem)event.getCaught(); - switch(randomNum) + if(Math.random() * 100 < 20) { - //Armors - case 1: - theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); - break; - case 2: - theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); - break; - case 3: - theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); - break; - case 4: - theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); - break; - //Tools - //WOOD TOOLS - case 5: - theCatch.setItemStack(new ItemStack(Material.WOOD_AXE, 1)); - break; - case 6: - theCatch.setItemStack(new ItemStack(Material.WOOD_PICKAXE, 1)); - break; - case 7: - theCatch.setItemStack(new ItemStack(Material.WOOD_SWORD, 1)); - break; - case 8: - theCatch.setItemStack(new ItemStack(Material.WOOD_HOE, 1)); - break; - case 9: - theCatch.setItemStack(new ItemStack(Material.WOOD_SPADE, 1)); - break; - //STONE TOOLS - case 10: - theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); - break; - case 11: - theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); - break; - case 12: - theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); - break; - case 13: - theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); - break; - case 14: - theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); - break; + switch(randomNum) + { + case 1: + theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); + break; + case 2: + theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); + break; + case 3: + theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); + break; + case 4: + theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); + break; + case 5: + theCatch.setItemStack(new ItemStack(Material.WOOD_AXE, 1)); + break; + case 6: + theCatch.setItemStack(new ItemStack(Material.WOOD_PICKAXE, 1)); + break; + case 7: + theCatch.setItemStack(new ItemStack(Material.WOOD_SWORD, 1)); + break; + case 8: + theCatch.setItemStack(new ItemStack(Material.WOOD_HOE, 1)); + break; + case 9: + theCatch.setItemStack(new ItemStack(Material.WOOD_SPADE, 1)); + break; + case 10: + theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); + break; + case 11: + theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); + break; + case 12: + theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); + break; + case 13: + theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); + break; + case 14: + theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); + break; + } + } else + { + theCatch.setItemStack(new ItemStack(Material.RAW_FISH)); } //Change durability to random value theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); //Change the damage value @@ -163,21 +242,559 @@ public class Fishing { private static void getFishingResultsTier2(Player player, PlayerFishEvent event) { + int randomNum = (int)(Math.random() * 19); + CraftItem theCatch = (CraftItem)event.getCaught(); + if(Math.random() * 100 < 25) + { + switch(randomNum) + { + case 1: + theCatch.setItemStack(new ItemStack(Material.LEATHER_BOOTS, 1)); + break; + case 2: + theCatch.setItemStack(new ItemStack(Material.LEATHER_HELMET, 1)); + break; + case 3: + theCatch.setItemStack(new ItemStack(Material.LEATHER_LEGGINGS, 1)); + break; + case 4: + theCatch.setItemStack(new ItemStack(Material.LEATHER_CHESTPLATE, 1)); + break; + case 5: + theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); + break; + case 6: + theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); + break; + case 7: + theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); + break; + case 8: + theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); + break; + case 9: + theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); + break; + case 10: + theCatch.setItemStack(new ItemStack(Material.STONE_AXE, 1)); + break; + case 11: + theCatch.setItemStack(new ItemStack(Material.STONE_PICKAXE, 1)); + break; + case 12: + theCatch.setItemStack(new ItemStack(Material.STONE_SWORD, 1)); + break; + case 13: + theCatch.setItemStack(new ItemStack(Material.STONE_HOE, 1)); + break; + case 14: + theCatch.setItemStack(new ItemStack(Material.STONE_SPADE, 1)); + break; + case 15: + theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); + break; + case 16: + theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); + break; + case 17: + theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); + break; + case 18: + theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); + break; + case 19: + theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); + break; + } + } else + { + theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + } + + //Change durability to random value + theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); } private static void getFishingResultsTier3(Player player, PlayerFishEvent event) { + int randomNum = (int)(Math.random() * 23); + CraftItem theCatch = (CraftItem)event.getCaught(); + if(Math.random() * 100 < 30) + { + switch(randomNum) + { + case 1: + theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); + break; + case 2: + theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); + break; + case 3: + theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); + break; + case 4: + theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); + break; + case 5: + theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); + break; + case 6: + theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); + break; + case 7: + theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); + break; + case 8: + theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); + break; + case 9: + theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); + break; + case 10: + theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); + break; + case 11: + theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); + break; + case 12: + theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); + break; + case 13: + theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); + break; + case 14: + theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); + break; + case 15: + theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); + break; + case 16: + theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); + break; + case 17: + theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); + break; + case 18: + theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); + break; + case 19: + theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); + break; + case 20: + theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); + break; + case 21: + theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); + break; + case 22: + theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); + break; + case 23: + theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); + break; + } + } + else + { + theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + } + //Change durability to random value + theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); } private static void getFishingResultsTier4(Player player, PlayerFishEvent event) { + int randomNum = (int)(Math.random() * 40); + CraftItem theCatch = (CraftItem)event.getCaught(); + if(Math.random() * 100 < 35) + { + switch(randomNum) + { + case 1: + theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); + break; + case 2: + theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); + break; + case 3: + theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); + break; + case 4: + theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); + break; + case 5: + theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); + break; + case 6: + theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); + break; + case 7: + theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); + break; + case 8: + theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); + break; + case 9: + theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); + break; + case 10: + theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); + break; + case 11: + theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); + break; + case 12: + theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); + break; + case 13: + theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); + break; + case 14: + theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); + break; + case 15: + theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); + break; + case 16: + theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); + break; + case 17: + theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); + break; + case 18: + theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); + break; + case 19: + theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); + break; + case 20: + theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); + break; + case 21: + theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); + break; + case 22: + theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); + break; + case 23: + theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); + break; + case 24: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); + break; + case 25: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); + break; + case 26: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); + break; + case 27: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); + break; + case 28: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); + break; + case 29: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); + break; + case 30: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); + break; + case 31: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); + break; + case 32: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); + break; + case 33: + theCatch.setItemStack(new ItemStack(Material.RECORD_6, 1)); + break; + case 34: + theCatch.setItemStack(new ItemStack(Material.RECORD_7, 1)); + break; + case 35: + theCatch.setItemStack(new ItemStack(Material.RECORD_8, 1)); + break; + case 36: + theCatch.setItemStack(new ItemStack(Material.RECORD_9, 1)); + break; + case 37: + theCatch.setItemStack(new ItemStack(Material.RECORD_10, 1)); + break; + case 38: + theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); + break; + case 39: + theCatch.setItemStack(new ItemStack(Material.REDSTONE_WIRE, 64)); + break; + case 40: + theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 10))); + break; + } + } else + { + theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + } + //Change durability to random value + theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); } private static void getFishingResultsTier5(Player player, PlayerFishEvent event) { + int randomNum = (int)(Math.random() * 49); + CraftItem theCatch = (CraftItem)event.getCaught(); + if(Math.random() * 100 < 40) + { + switch(randomNum) + { + case 1: + theCatch.setItemStack(new ItemStack(Material.GOLD_BOOTS, 1)); + break; + case 2: + theCatch.setItemStack(new ItemStack(Material.GOLD_HELMET, 1)); + break; + case 3: + theCatch.setItemStack(new ItemStack(Material.GOLD_LEGGINGS, 1)); + break; + case 4: + theCatch.setItemStack(new ItemStack(Material.GOLD_CHESTPLATE, 1)); + break; + case 5: + theCatch.setItemStack(new ItemStack(Material.IRON_AXE, 1)); + break; + case 6: + theCatch.setItemStack(new ItemStack(Material.IRON_PICKAXE, 1)); + break; + case 7: + theCatch.setItemStack(new ItemStack(Material.IRON_SWORD, 1)); + break; + case 8: + theCatch.setItemStack(new ItemStack(Material.IRON_HOE, 1)); + break; + case 9: + theCatch.setItemStack(new ItemStack(Material.IRON_SPADE, 1)); + break; + case 10: + theCatch.setItemStack(new ItemStack(Material.GOLD_AXE, 1)); + break; + case 11: + theCatch.setItemStack(new ItemStack(Material.GOLD_PICKAXE, 1)); + break; + case 12: + theCatch.setItemStack(new ItemStack(Material.GOLD_SWORD, 1)); + break; + case 13: + theCatch.setItemStack(new ItemStack(Material.GOLD_HOE, 1)); + break; + case 14: + theCatch.setItemStack(new ItemStack(Material.GOLD_SPADE, 1)); + break; + case 15: + theCatch.setItemStack(new ItemStack(Material.IRON_BOOTS, 1)); + break; + case 16: + theCatch.setItemStack(new ItemStack(Material.IRON_LEGGINGS, 1)); + break; + case 17: + theCatch.setItemStack(new ItemStack(Material.IRON_CHESTPLATE, 1)); + break; + case 18: + theCatch.setItemStack(new ItemStack(Material.IRON_HELMET, 1)); + break; + case 19: + theCatch.setItemStack(new ItemStack(Material.ENDER_PEARL, 1)); + break; + case 20: + theCatch.setItemStack(new ItemStack(Material.BLAZE_ROD, 1)); + break; + case 21: + theCatch.setItemStack(new ItemStack(Material.RECORD_3, 1)); + break; + case 22: + theCatch.setItemStack(new ItemStack(Material.RECORD_4, 1)); + break; + case 23: + theCatch.setItemStack(new ItemStack(Material.RECORD_5, 1)); + break; + case 24: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); + break; + case 25: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); + break; + case 26: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); + break; + case 27: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); + break; + case 28: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); + break; + case 29: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); + break; + case 30: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); + break; + case 31: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); + break; + case 32: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); + break; + case 33: + theCatch.setItemStack(new ItemStack(Material.RECORD_6, 1)); + break; + case 34: + theCatch.setItemStack(new ItemStack(Material.RECORD_7, 1)); + break; + case 35: + theCatch.setItemStack(new ItemStack(Material.RECORD_8, 1)); + break; + case 36: + theCatch.setItemStack(new ItemStack(Material.RECORD_9, 1)); + break; + case 37: + theCatch.setItemStack(new ItemStack(Material.RECORD_10, 1)); + break; + case 38: + theCatch.setItemStack(new ItemStack(Material.RECORD_11, 1)); + break; + case 39: + theCatch.setItemStack(new ItemStack(Material.REDSTONE_WIRE, 64)); + break; + case 40: + theCatch.setItemStack(new ItemStack(Material.DIAMOND, (int)(Math.random() * 20))); + break; + case 41: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_BOOTS, 1)); + break; + case 42: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_HELMET, 1)); + break; + case 43: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_LEGGINGS, 1)); + break; + case 44: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_CHESTPLATE, 1)); + break; + case 45: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_AXE, 1)); + break; + case 46: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_PICKAXE, 1)); + break; + case 47: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_SWORD, 1)); + break; + case 48: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_HOE, 1)); + break; + case 49: + theCatch.setItemStack(new ItemStack(Material.DIAMOND_SPADE, 1)); + break; + } + } else { + theCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1)); + } + //Change durability to random value + theCatch.getItemStack().setDurability((short) (Math.random() * Fishing.getItemMaxDurability(theCatch.getItemStack().getType()))); + } + public static void processResults(PlayerFishEvent event) + { + Player player = event.getPlayer(); + PlayerProfile PP = Users.getProfile(player); + + Fishing.getFishingResults(player, event); + CraftItem theCatch = (CraftItem)event.getCaught(); + + if(theCatch.getItemStack().getType() != Material.RAW_FISH) + { + //Inform the player they retrieved a treasure... + player.sendMessage(mcLocale.getString("Fishing.ItemFound")); + + //Keep track of whether or not the treasure is enchanted + boolean enchanted = false; + + ItemStack fishingResults = theCatch.getItemStack(); + if(Repair.isArmor(fishingResults) || Repair.isTools(fishingResults)) + { + //Fishing up items will have a 10% chance to enter them into random enchantment lottery + if(Math.random() * 100 < 10) + { + for(Enchantment x : Enchantment.values()) + { + if(x.canEnchantItem(fishingResults)) + { + //Actual chance to have an enchantment is related to your fishing skill + if(Math.random() * 15 < Fishing.getFishingLootTier(PP)) + { + enchanted = true; + fishingResults.addEnchantment(x, (int)(Math.random() * x.getMaxLevel())); + } + } + } + } + } + //Inform the player of magical properties + if(enchanted) + { + player.sendMessage(mcLocale.getString("Fishing.MagicFound")); + } + } + } + public static void shakeMob(PlayerFishEvent event) + { + LivingEntity le = (LivingEntity)event.getCaught(); + if(le instanceof Player) + return; + le.damage(1); + World world = le.getWorld(); + + if(le instanceof Sheep) + { + Sheep sheep = (Sheep)le; + if(!sheep.isSheared()) + { + Wool wool = new Wool(); + wool.setColor(sheep.getColor()); + ItemStack theWool = wool.toItemStack(); + theWool.setAmount((int)(Math.random() * 6)); + world.dropItemNaturally(le.getLocation(), theWool); + sheep.setSheared(true); + } + } else if(le instanceof Pig) + { + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.PORK, 1)); + } else if(le instanceof Skeleton) + { + if(Math.random() * 10 < 5) + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.BONE, 1)); + else + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.ARROW, 3)); + } else if(le instanceof Cow) + { + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.LEATHER, 1)); + } else if(le instanceof Spider) + { + if(Math.random() * 10 < 5) + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SPIDER_EYE, 1)); + else + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.STRING, 1)); + } else if(le instanceof Chicken) + { + if(Math.random() * 10 < 5) + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.FEATHER, 1)); + else + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.EGG, 1)); + } else if(le instanceof Creeper) + { + world.dropItemNaturally(le.getLocation(), new ItemStack(Material.SULPHUR, 1)); + } } } diff --git a/src/com/gmail/nossr50/skills/Repair.java b/src/com/gmail/nossr50/skills/Repair.java index 9c209d470..47b1ca2ac 100644 --- a/src/com/gmail/nossr50/skills/Repair.java +++ b/src/com/gmail/nossr50/skills/Repair.java @@ -69,8 +69,6 @@ public class Repair { pos++; } - System.out.println("[mcMMO] Enchantments stored!"); - if(block != null && mcPermissions.getInstance().repair(player)){ if(player.getItemInHand().getDurability() > 0 && player.getItemInHand().getAmount() < 2){ /* @@ -296,9 +294,13 @@ public class Repair { } boolean failure = false, downgrade = false; - + for(Enchantment x : enchants) { + //Remove enchant + if(is.getEnchantments().containsKey(x)) + is.removeEnchantment(x); + if(x.canEnchantItem(is)) { if(Math.random() * 100 <= getEnchantChance(rank)) diff --git a/src/plugin.yml b/src/plugin.yml index bedbbbe63..67578a97b 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 1.2.00 WIP #1 +version: 1.2.00 softdepend: [Spout] author: nossr50 description: mcMMO takes core Minecraft game mechanics and expands them to add an extensive RPG experience, the goal of the project has always been a quality RPG experience. Everything in mcMMO is carefully thought out and is constantly improving. mcMMO adds eleven skills to train in and level in, while also offering a high level of customization for server admins. There are countless features, including custom sounds, graphical elements, and more added when running mcMMO in conjunction with Spout. I carefully read feedback and evaluate the mechanics of mcMMO in every update to provide an ever-evolving experience. @@ -82,6 +82,8 @@ commands: description: Detailed skill info repair: description: Detailed skill info + fishing: + description: Detailed skill info a: description: Toggle Admin chat or send admin chat messages permission: mcmmo.chat.adminchat