diff --git a/Changelog.txt b/Changelog.txt index 591be7fe6..aa17a08db 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -9,6 +9,7 @@ Key: Version 2.0.00-dev + Added Ocelots to Taming XP tables + + Added ability to summon Ocelots with Call of the Wild Version 1.3.02 + Added in game guides for Mining, Excavation, and Acrobatics. Simply type /skillname ? to access them diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index e1094b2c2..155824400 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -62,7 +62,7 @@ public class LoadProperties { levelCapSwords, levelCapTaming, levelCapUnarmed, levelCapWoodcutting, anvilID, saveInterval, fishingTier1, fishingTier2, fishingTier3, fishingTier4, fishingTier5, repairStoneLevel, repairIronLevel, repairGoldLevel, arcaneRank1, arcaneRank2, arcaneRank3, arcaneRank4, - detonatorID; + detonatorID, fishConsumedByCOTW; public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, @@ -153,6 +153,7 @@ public class LoadProperties { xpGainsMobSpawners = readBoolean("Experience.Gains.Mobspawners.Enabled", false); bonesConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); + fishConsumedByCOTW = readInteger("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); xpbar = readBoolean("Spout.XP.Bar.Enabled", true); xpicon = readBoolean("Spout.XP.Icon.Enabled", true); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index 5da217b59..020a3ae29 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -22,13 +22,11 @@ import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; -import org.bukkit.entity.Wolf; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -63,6 +61,7 @@ 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.skills.Taming; public class mcPlayerListener implements Listener @@ -261,25 +260,8 @@ public class mcPlayerListener implements Listener if(player.isSneaking() && mcPermissions.getInstance().taming(player) && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) { - if(is.getType().equals(Material.BONE) && is.getAmount() >= LoadProperties.bonesConsumedByCOTW) - { - 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(), EntityType.WOLF); - - int bones = is.getAmount(); - bones = bones - LoadProperties.bonesConsumedByCOTW; - player.setItemInHand(new ItemStack(Material.BONE, bones)); - player.sendMessage(mcLocale.getString("m.TamingSummon")); - } + Taming.animalSummon(EntityType.WOLF, player); + Taming.animalSummon(EntityType.OCELOT, player); } //BLAST MINING diff --git a/src/main/java/com/gmail/nossr50/skills/Taming.java b/src/main/java/com/gmail/nossr50/skills/Taming.java index 3631b4dbd..82e67602a 100644 --- a/src/main/java/com/gmail/nossr50/skills/Taming.java +++ b/src/main/java/com/gmail/nossr50/skills/Taming.java @@ -16,16 +16,21 @@ */ package com.gmail.nossr50.skills; +import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; import com.gmail.nossr50.Combat; import com.gmail.nossr50.Users; import com.gmail.nossr50.mcMMO; +import com.gmail.nossr50.config.LoadProperties; import com.gmail.nossr50.datatypes.PlayerProfile; import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.locale.mcLocale; @@ -156,4 +161,41 @@ public class Taming break; } } + + public static void animalSummon(EntityType type, Player player) + { + ItemStack item = player.getItemInHand(); + Material summonItem = null; + int summonAmount = 0; + + switch(type) + { + case WOLF: + summonItem = Material.BONE; + summonAmount = LoadProperties.bonesConsumedByCOTW; + case OCELOT: + summonItem = Material.RAW_FISH; + summonAmount = LoadProperties.fishConsumedByCOTW; + } + + if(item.getType().equals(summonItem) && item.getAmount() >= summonAmount) + { + for(Entity x : player.getNearbyEntities(40, 40, 40)) + { + if(x.getType().equals(type)) + { + player.sendMessage(mcLocale.getString("m.TamingSummonFailed")); + return; + } + } + + World world = player.getWorld(); + world.spawnCreature(player.getLocation(), type); + + int amount = item.getAmount(); + amount =- summonAmount; + player.setItemInHand(new ItemStack(summonItem, amount)); + player.sendMessage(mcLocale.getString("m.TamingSummon")); + } + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index b905a1d68..af9ff012f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -164,6 +164,7 @@ Skills: Level_Cap: 0 Call_Of_The_Wild: Bones_Required: 10 + Fish_Required: 10 Unarmed: Level_Cap: 0 Woodcutting: