Added broadcast command.

Added Chat to hub.
Disabled /me
Fixed Pets not returning when pushed off into the void.
Prevented eggs from spawning in hub.
This commit is contained in:
Jonathan Williams 2013-09-04 11:35:59 -07:00
parent 55b6bd6e95
commit 34dd5a1af3
12 changed files with 70 additions and 36 deletions

View File

@ -1,7 +1,6 @@
package me.chiss.Core.Server; package me.chiss.Core.Server;
import me.chiss.Core.Events.ServerSaveEvent; 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.ListCommand;
import me.chiss.Core.Server.command.SpawnSetCommand; import me.chiss.Core.Server.command.SpawnSetCommand;
import me.chiss.Core.Server.command.WaterSpreadCommand; 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.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.chat.command.BroadcastCommand;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;

View File

@ -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.MiniPlugin;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.account.CoreClientManager; 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.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -17,27 +17,27 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class Chat extends MiniPlugin public class Chat extends MiniPlugin
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private IChat _chat;
private long _silenced = 0; private long _silenced = 0;
public Chat(JavaPlugin plugin, CoreClientManager clientManager,IChat chat) public Chat(JavaPlugin plugin, CoreClientManager clientManager)
{ {
super("Chat", plugin); super("Chat", plugin);
_clientManager = clientManager; _clientManager = clientManager;
_chat = chat;
} }
@Override @Override
public void AddCommands() public void AddCommands()
{ {
AddCommand(new SilenceCommand(this)); AddCommand(new SilenceCommand(this));
AddCommand(new BroadcastCommand(this));
} }
public void Silence(long duration, boolean inform) 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)) + ".")); 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 @EventHandler
public void SilenceUpdate(UpdateEvent event) public void SilenceUpdate(UpdateEvent event)
{ {
@ -96,7 +106,7 @@ public class Chat extends MiniPlugin
return true; return true;
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.LOWEST)
public void HandleChat(AsyncPlayerChatEvent event) public void HandleChat(AsyncPlayerChatEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
@ -114,10 +124,6 @@ public class Chat extends MiniPlugin
UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast.")); UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast."));
event.setCancelled(true); event.setCancelled(true);
} }
else
{
_chat.HandleChat(event, event.getMessage());
}
} }
public long Silenced() public long Silenced()

View File

@ -1,15 +1,15 @@
package me.chiss.Core.Server.command; package mineplex.core.chat.command;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import me.chiss.Core.Server.Server; import mineplex.core.chat.Chat;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
public class BroadcastCommand extends CommandBase<Server> public class BroadcastCommand extends CommandBase<Chat>
{ {
public BroadcastCommand(Server plugin) public BroadcastCommand(Chat plugin)
{ {
super(plugin, Rank.MODERATOR, "s"); super(plugin, Rank.MODERATOR, "s");
} }

View File

@ -1,8 +1,8 @@
package me.chiss.Core.Chat.command; package mineplex.core.chat.command;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import me.chiss.Core.Chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;

View File

@ -51,6 +51,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -223,11 +224,31 @@ public class PetManager extends MiniClientPlugin<PetClient>
} }
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityDamageEvent event) public void onEntityDamage(EntityDamageEvent event)
{ {
if (event.getEntity() instanceof Creature && _activePetOwners.containsValue((Creature)event.getEntity())) if (event.getEntity() instanceof Creature && _activePetOwners.containsValue((Creature)event.getEntity()))
{ {
if (event.getCause() == DamageCause.VOID)
{
String playerName = null;
for (Entry<String,Creature> 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); event.setCancelled(true);
} }
} }

View File

@ -3,6 +3,7 @@ package mineplex.hub;
import me.chiss.Core.MemoryFix.MemoryFix; import me.chiss.Core.MemoryFix.MemoryFix;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager; 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 HubManager(this, clientManager, donationManager, new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress()));
new Stacker(this); new Stacker(this);
new ServerManager(this, clientManager, donationManager, portal); new ServerManager(this, clientManager, donationManager, portal);
new Chat(this, clientManager);
new MemoryFix(this); new MemoryFix(this);
new FileUpdater(this, portal); new FileUpdater(this, portal);
new LagMeter(this, clientManager); new LagMeter(this, clientManager);

View File

@ -20,6 +20,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.entity.Chicken; import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow; import org.bukkit.entity.Cow;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig; 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.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
@ -147,6 +149,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
return line; return line;
} }
@EventHandler
public void preventEggSpawn(ItemSpawnEvent event)
{
if (event.getEntity() instanceof Egg)
{
event.setCancelled(true);
}
}
@EventHandler @EventHandler
public void PlayerRespawn(PlayerRespawnEvent event) public void PlayerRespawn(PlayerRespawnEvent event)

View File

@ -20,7 +20,6 @@ import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; 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.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
import me.chiss.Core.Chat.Chat;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import me.chiss.Core.Modules.Blood; import me.chiss.Core.Modules.Blood;
import me.chiss.Core.Plugin.IChat;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
@ -48,7 +46,7 @@ import mineplex.core.explosion.Explosion;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
public class ArcadeManager extends MiniPlugin implements IRelation, IChat public class ArcadeManager extends MiniPlugin implements IRelation
{ {
//Modules //Modules
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
@ -70,7 +68,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
//Managers //Managers
private GameFactory _gameFactory; private GameFactory _gameFactory;
private GameChatManager _gameChatManager;
private GameCreationManager _gameCreationManager; private GameCreationManager _gameCreationManager;
private GameGemManager _gameGemManager; private GameGemManager _gameGemManager;
private GameManager _gameManager; private GameManager _gameManager;
@ -101,7 +98,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
_clientManager = clientManager; _clientManager = clientManager;
_chat = new Chat(plugin, _clientManager, this); _chat = new Chat(plugin, _clientManager);
_creature = creature; _creature = creature;
@ -127,7 +124,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
_gameFactory = new GameFactory(this); _gameFactory = new GameFactory(this);
//Managers //Managers
_gameChatManager = new GameChatManager(this); new GameChatManager(this);
_gameCreationManager = new GameCreationManager(this); _gameCreationManager = new GameCreationManager(this);
_gameGemManager = new GameGemManager(this); _gameGemManager = new GameGemManager(this);
_gameManager = new GameManager(this); _gameManager = new GameManager(this);
@ -274,12 +271,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation, IChat
return team.GetColor(); return team.GetColor();
} }
@Override
public void HandleChat(AsyncPlayerChatEvent event, String filteredMessage)
{
_gameChatManager.HandleChat(event, filteredMessage);
}
@Override @Override
public boolean CanHurt(String a, String b) public boolean CanHurt(String a, String b)
{ {

View File

@ -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(); Player sender = event.getPlayer();
//Dead Prefix //Dead Prefix

View File

@ -2,9 +2,9 @@ package nautilus.game.capturethepig;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import me.chiss.Core.Chat.Chat;
import me.chiss.Core.PlayerTagNamer.INameColorer; import me.chiss.Core.PlayerTagNamer.INameColorer;
import me.chiss.Core.Plugin.IRelation; import me.chiss.Core.Plugin.IRelation;
import mineplex.core.chat.Chat;
import nautilus.game.capturethepig.arena.CaptureThePigArenaParser; import nautilus.game.capturethepig.arena.CaptureThePigArenaParser;
import nautilus.game.capturethepig.arena.ICaptureThePigArena; import nautilus.game.capturethepig.arena.ICaptureThePigArena;
import nautilus.game.capturethepig.engine.CaptureThePigGameEngine; import nautilus.game.capturethepig.engine.CaptureThePigGameEngine;

View File

@ -2,7 +2,7 @@ package nautilus.game.dominate;
import org.bukkit.entity.Player; 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.GamePlugin;
import nautilus.game.core.arena.ArenaManager; import nautilus.game.core.arena.ArenaManager;
import nautilus.game.dominate.arena.DominateArenaParser; import nautilus.game.dominate.arena.DominateArenaParser;

View File

@ -2,7 +2,6 @@ package nautilus.game.pvp;
import java.util.HashSet; import java.util.HashSet;
import me.chiss.Core.Chat.Chat;
import me.chiss.Core.Class.ClassFactory; import me.chiss.Core.Class.ClassFactory;
import me.chiss.Core.Config.Config; import me.chiss.Core.Config.Config;
import me.chiss.Core.Field.Field; import me.chiss.Core.Field.Field;
@ -31,6 +30,7 @@ import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.antistack.AntiStack; import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;