diff --git a/Plugins/Core/src/me/chiss/Core/Server/Server.java b/Plugins/Core/src/me/chiss/Core/Server/Server.java index ada33dff4..072971ded 100644 --- a/Plugins/Core/src/me/chiss/Core/Server/Server.java +++ b/Plugins/Core/src/me/chiss/Core/Server/Server.java @@ -1,7 +1,6 @@ package me.chiss.Core.Server; import me.chiss.Core.Events.ServerSaveEvent; -import me.chiss.Core.Server.command.BroadcastCommand; import me.chiss.Core.Server.command.ListCommand; import me.chiss.Core.Server.command.SpawnSetCommand; import me.chiss.Core.Server.command.WaterSpreadCommand; @@ -9,6 +8,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.command.BroadcastCommand; import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; diff --git a/Plugins/Core/src/me/chiss/Core/Chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java similarity index 81% rename from Plugins/Core/src/me/chiss/Core/Chat/Chat.java rename to Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index b8b185437..e1f84e4a8 100644 --- a/Plugins/Core/src/me/chiss/Core/Chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -1,12 +1,12 @@ -package me.chiss.Core.Chat; +package mineplex.core.chat; -import me.chiss.Core.Chat.command.SilenceCommand; -import me.chiss.Core.Plugin.IChat; import mineplex.core.MiniPlugin; import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.account.CoreClientManager; +import mineplex.core.chat.command.BroadcastCommand; +import mineplex.core.chat.command.SilenceCommand; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -17,27 +17,27 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; public class Chat extends MiniPlugin { private CoreClientManager _clientManager; - private IChat _chat; private long _silenced = 0; - public Chat(JavaPlugin plugin, CoreClientManager clientManager,IChat chat) + public Chat(JavaPlugin plugin, CoreClientManager clientManager) { super("Chat", plugin); _clientManager = clientManager; - _chat = chat; } @Override public void AddCommands() { AddCommand(new SilenceCommand(this)); + AddCommand(new BroadcastCommand(this)); } public void Silence(long duration, boolean inform) @@ -60,6 +60,16 @@ public class Chat extends MiniPlugin UtilServer.broadcast(F.main("Chat", "Chat has been silenced for " + F.time(UtilTime.MakeStr(duration, 1)) + ".")); } + @EventHandler + public void preventMe(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().startsWith("/me")) + { + event.getPlayer().sendMessage(F.main(GetName(), "Quite full of yourself aren't you? Nobody cares.")); + event.setCancelled(true); + } + } + @EventHandler public void SilenceUpdate(UpdateEvent event) { @@ -96,7 +106,7 @@ public class Chat extends MiniPlugin return true; } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.LOWEST) public void HandleChat(AsyncPlayerChatEvent event) { if (event.isCancelled()) @@ -114,10 +124,6 @@ public class Chat extends MiniPlugin UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); event.setCancelled(true); } - else - { - _chat.HandleChat(event, event.getMessage()); - } } public long Silenced() diff --git a/Plugins/Core/src/me/chiss/Core/Server/command/BroadcastCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/command/BroadcastCommand.java similarity index 75% rename from Plugins/Core/src/me/chiss/Core/Server/command/BroadcastCommand.java rename to Plugins/Mineplex.Core/src/mineplex/core/chat/command/BroadcastCommand.java index 0498bb08e..5f2cdd1c2 100644 --- a/Plugins/Core/src/me/chiss/Core/Server/command/BroadcastCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/command/BroadcastCommand.java @@ -1,15 +1,15 @@ -package me.chiss.Core.Server.command; +package mineplex.core.chat.command; import org.bukkit.entity.Player; -import me.chiss.Core.Server.Server; +import mineplex.core.chat.Chat; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.UtilServer; -public class BroadcastCommand extends CommandBase +public class BroadcastCommand extends CommandBase { - public BroadcastCommand(Server plugin) + public BroadcastCommand(Chat plugin) { super(plugin, Rank.MODERATOR, "s"); } diff --git a/Plugins/Core/src/me/chiss/Core/Chat/command/SilenceCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/command/SilenceCommand.java similarity index 92% rename from Plugins/Core/src/me/chiss/Core/Chat/command/SilenceCommand.java rename to Plugins/Mineplex.Core/src/mineplex/core/chat/command/SilenceCommand.java index 5b6501898..d1206f8c1 100644 --- a/Plugins/Core/src/me/chiss/Core/Chat/command/SilenceCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/command/SilenceCommand.java @@ -1,8 +1,8 @@ -package me.chiss.Core.Chat.command; +package mineplex.core.chat.command; import org.bukkit.entity.Player; -import me.chiss.Core.Chat.Chat; +import mineplex.core.chat.Chat; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; import mineplex.core.common.util.F; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index e23135af1..1107d1a0e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -51,6 +51,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -223,11 +224,31 @@ public class PetManager extends MiniClientPlugin } } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void onEntityDamage(EntityDamageEvent event) { if (event.getEntity() instanceof Creature && _activePetOwners.containsValue((Creature)event.getEntity())) { + if (event.getCause() == DamageCause.VOID) + { + String playerName = null; + + for (Entry entry : _activePetOwners.entrySet()) + { + if (entry.getValue() == event.getEntity()) + playerName = entry.getKey(); + } + + if (playerName != null) + { + Player player = Bukkit.getPlayerExact(playerName); + + if (player != null && player.isOnline()) + { + RemovePet(player, true, true); + } + } + } event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 905dee24c..65382669d 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -3,6 +3,7 @@ package mineplex.hub; import me.chiss.Core.MemoryFix.MemoryFix; import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; import mineplex.core.creature.Creature; import mineplex.core.disguise.DisguiseManager; @@ -76,6 +77,7 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation new HubManager(this, clientManager, donationManager, new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress())); new Stacker(this); new ServerManager(this, clientManager, donationManager, portal); + new Chat(this, clientManager); new MemoryFix(this); new FileUpdater(this, portal); new LagMeter(this, clientManager); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index ca5a70108..d9275df92 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -20,6 +20,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.entity.Chicken; import org.bukkit.entity.Cow; +import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Pig; @@ -33,6 +34,7 @@ import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerDropItemEvent; @@ -147,6 +149,14 @@ public class HubManager extends MiniClientPlugin return line; } + @EventHandler + public void preventEggSpawn(ItemSpawnEvent event) + { + if (event.getEntity() instanceof Egg) + { + event.setCancelled(true); + } + } @EventHandler public void PlayerRespawn(PlayerRespawnEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index e7daa2c08..55da2dc66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -20,7 +20,6 @@ import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -32,13 +31,12 @@ import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; -import me.chiss.Core.Chat.Chat; import mineplex.core.MiniPlugin; import mineplex.core.itemstack.ItemStackFactory; import me.chiss.Core.Modules.Blood; -import me.chiss.Core.Plugin.IChat; import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.chat.Chat; import mineplex.core.common.util.*; import mineplex.core.creature.Creature; import mineplex.core.disguise.DisguiseManager; @@ -48,7 +46,7 @@ import mineplex.core.explosion.Explosion; import mineplex.core.portal.Portal; import mineplex.core.projectile.ProjectileManager; -public class ArcadeManager extends MiniPlugin implements IRelation, IChat +public class ArcadeManager extends MiniPlugin implements IRelation { //Modules private BlockRestore _blockRestore; @@ -70,7 +68,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat //Managers private GameFactory _gameFactory; - private GameChatManager _gameChatManager; private GameCreationManager _gameCreationManager; private GameGemManager _gameGemManager; private GameManager _gameManager; @@ -101,7 +98,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat _clientManager = clientManager; - _chat = new Chat(plugin, _clientManager, this); + _chat = new Chat(plugin, _clientManager); _creature = creature; @@ -127,7 +124,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat _gameFactory = new GameFactory(this); //Managers - _gameChatManager = new GameChatManager(this); + new GameChatManager(this); _gameCreationManager = new GameCreationManager(this); _gameGemManager = new GameGemManager(this); _gameManager = new GameManager(this); @@ -274,12 +271,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat return team.GetColor(); } - @Override - public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) - { - _gameChatManager.HandleChat(event, filteredMessage); - } - @Override public boolean CanHurt(String a, String b) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java index bb85fc387..0cdd78697 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameChatManager.java @@ -37,8 +37,12 @@ public class GameChatManager implements Listener } } - public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage) + @EventHandler + public void HandleChat(AsyncPlayerChatEvent event) { + if (event.isCancelled()) + return; + Player sender = event.getPlayer(); //Dead Prefix diff --git a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java index 7b46aa0ab..36dedc85e 100644 --- a/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java +++ b/Plugins/Nautilus.Game.CaptureThePig/src/nautilus/game/capturethepig/CaptureThePig.java @@ -2,9 +2,9 @@ package nautilus.game.capturethepig; import org.bukkit.entity.Player; -import me.chiss.Core.Chat.Chat; import me.chiss.Core.PlayerTagNamer.INameColorer; import me.chiss.Core.Plugin.IRelation; +import mineplex.core.chat.Chat; import nautilus.game.capturethepig.arena.CaptureThePigArenaParser; import nautilus.game.capturethepig.arena.ICaptureThePigArena; import nautilus.game.capturethepig.engine.CaptureThePigGameEngine; diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java index 04b1fcd07..838f5addf 100644 --- a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/Dominate.java @@ -2,7 +2,7 @@ package nautilus.game.dominate; import org.bukkit.entity.Player; -import me.chiss.Core.Chat.Chat; +import mineplex.core.chat.Chat; import nautilus.game.core.GamePlugin; import nautilus.game.core.arena.ArenaManager; import nautilus.game.dominate.arena.DominateArenaParser; diff --git a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java index 068182756..149e03802 100644 --- a/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java +++ b/Plugins/Nautilus.Game.PvP/src/nautilus/game/pvp/PvP.java @@ -2,7 +2,6 @@ package nautilus.game.pvp; import java.util.HashSet; -import me.chiss.Core.Chat.Chat; import me.chiss.Core.Class.ClassFactory; import me.chiss.Core.Config.Config; import me.chiss.Core.Field.Field; @@ -31,6 +30,7 @@ import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.antistack.AntiStack; import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; import mineplex.core.common.util.C; import mineplex.core.common.util.F;