diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java index 4aea877fd..391fb18fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java @@ -40,7 +40,8 @@ public class PetFactory _pets.put(EntityType.CHICKEN, new Pet("Chicken", EntityType.CHICKEN, 7000)); _pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 8000)); _pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000)); - _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); + _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); + //_pets.put(EntityType.WITHER, new Pet("Widder", EntityType.SHEEP, 5)); List petTokens = new ArrayList(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 129c8678d..3554a08a9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -1,6 +1,5 @@ package mineplex.core.pet; -import java.lang.reflect.Field; import java.util.Iterator; import java.util.Map.Entry; @@ -15,35 +14,25 @@ import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import net.minecraft.server.v1_7_R4.EntityCreature; -import net.minecraft.server.v1_7_R4.EntityHuman; -import net.minecraft.server.v1_7_R4.EntityInsentient; -import net.minecraft.server.v1_7_R4.EntitySnowman; import net.minecraft.server.v1_7_R4.Navigation; -import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer; -import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround; -import net.minecraft.server.v1_7_R4.PathfinderGoalSelector; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.libs.com.google.gson.Gson; -import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSnowman; import org.bukkit.entity.Ageable; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.entity.Snowman; import org.bukkit.entity.Villager; import org.bukkit.entity.Zombie; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.EntityBlockFormEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; @@ -59,6 +48,7 @@ public class PetManager extends MiniClientPlugin private static Object _petOwnerSynch = new Object(); private static Object _petRenameSynch = new Object(); + private DisguiseManager _disguiseManager; private mineplex.core.creature.Creature _creatureModule; private PetRepository _repository; private PetFactory _petFactory; @@ -66,18 +56,16 @@ public class PetManager extends MiniClientPlugin private NautHashMap _activePetOwners; private NautHashMap _failedAttempts; - - private Field _goalSelector; - private Field _targetSelector; private NautHashMap _petOwnerQueue = new NautHashMap(); private NautHashMap _petRenameQueue = new NautHashMap(); - public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) + public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) { super("Pet Manager", plugin); _creatureModule = creatureModule; + _disguiseManager = disguiseManager; _repository = new PetRepository(webAddress); _petFactory = new PetFactory(_repository); _blockRestore = restore; @@ -163,11 +151,21 @@ public class PetManager extends MiniClientPlugin pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); UtilEnt.silence(pet, true); } - if (pet instanceof Villager) + else if (pet instanceof Villager) { ((Villager) pet).setBaby(); ((Villager) pet).setAgeLock(true); } + /* + else if (pet instanceof Sheep) + { + DisguiseWither disguise = new DisguiseWither(pet); + disguise.s(350); + + _disguiseManager.disguise(disguise); + UtilEnt.silence(pet, true); + } + */ _activePetOwners.put(player.getName(), pet); _failedAttempts.put(player.getName(), 0); @@ -178,7 +176,7 @@ public class PetManager extends MiniClientPlugin ((Ageable)pet).setAgeLock(true); } - ClearPetGoals(pet); + UtilEnt.Vegetate(pet); } public Creature GetPet(Player player) @@ -324,43 +322,6 @@ public class PetManager extends MiniClientPlugin } } } - - private void ClearPetGoals(Creature pet) - { - try - { - _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector"); - _goalSelector.setAccessible(true); - _targetSelector = EntityInsentient.class.getDeclaredField("targetSelector"); - _targetSelector.setAccessible(true); - - EntityCreature creature = ((CraftCreature)pet).getHandle(); - - PathfinderGoalSelector goalSelector = new PathfinderGoalSelector(((CraftWorld)pet.getWorld()).getHandle().methodProfiler); - - goalSelector.a(0, new PathfinderGoalLookAtPlayer(creature, EntityHuman.class, 6.0F)); - goalSelector.a(1, new PathfinderGoalRandomLookaround(creature)); - - _goalSelector.set(creature, goalSelector); - _targetSelector.set(creature, new PathfinderGoalSelector(((CraftWorld)pet.getWorld()).getHandle().methodProfiler)); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } @EventHandler public void OnClientWebResponse(ClientWebResponseEvent event) @@ -401,16 +362,4 @@ public class PetManager extends MiniClientPlugin for (Player player : UtilServer.getPlayers()) RemovePet(player, true); } - -// @EventHandler -// public void snowmanTrailClean(EntityBlockFormEvent event) -// { -// if (event.isCancelled()) -// return; -// -// if (event.getEntity() instanceof Snowman) -// { -// _blockRestore.Add(event.getBlock(), 78, (byte)0, 0, (byte)0, 6000); -// } -// } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 9c709a989..b6134f98b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -66,7 +66,7 @@ public class Clans extends JavaPlugin PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); new MessageManager(this, _clientManager, preferenceManager); - ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager)); + ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); new Spawn(this, serverStatusManager.getCurrentServerName()); Teleport teleport = new Teleport(this); Portal portal = new Portal(this, serverStatusManager.getCurrentServerName()); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index e850b3e05..52fe65a00 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -85,21 +85,21 @@ public class Hub extends JavaPlugin implements IRelation new ServerConfiguration(this); //Other Modules + PacketHandler packetHandler = new PacketHandler(this); + DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); preferenceManager.GiveItem = true; new MessageManager(this, clientManager, preferenceManager); Creature creature = new Creature(this); NpcManager npcManager = new NpcManager(this, creature); - PetManager petManager = new PetManager(this, clientManager, donationManager, creature, blockRestore, webServerAddress); + PetManager petManager = new PetManager(this, clientManager, donationManager, disguiseManager, creature, blockRestore, webServerAddress); PollManager pollManager = new PollManager(this, clientManager, donationManager); //Main Modules - ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager)); + ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); PartyManager partyManager = new PartyManager(this, clientManager, preferenceManager); Portal portal = new Portal(this, serverStatusManager.getCurrentServerName()); AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager); - PacketHandler packetHandler = new PacketHandler(this); - DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler); StatsManager statsManager = new StatsManager(this, clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager); HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this)); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 26100ffc2..4e78dedf0 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -48,7 +48,7 @@ public class StaffServer extends JavaPlugin new Punish(this, webServerAddress, clientManager); new NpcManager(this, new Creature(this)); - ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager)); + ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager)); PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); preferenceManager.GiveItem = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java index 6ebdd8f01..e74bf1bc3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -90,7 +90,7 @@ public class Arcade extends JavaPlugin new MessageManager(this, _clientManager, preferenceManager); Creature creature = new Creature(this); - ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager)); + ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); new Spawn(this, serverStatusManager.getCurrentServerName()); Teleport teleport = new Teleport(this); Portal portal = new Portal(this, serverStatusManager.getCurrentServerName()); @@ -112,7 +112,7 @@ public class Arcade extends JavaPlugin //Inventory InventoryManager inventoryManager = new InventoryManager(this, _clientManager); - PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, blockRestore, webServerAddress); + PetManager petManager = new PetManager(this, _clientManager, _donationManager, disguiseManager, creature, blockRestore, webServerAddress); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null);