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;
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;

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.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()

View File

@ -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<Server>
public class BroadcastCommand extends CommandBase<Chat>
{
public BroadcastCommand(Server plugin)
public BroadcastCommand(Chat plugin)
{
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 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;

View File

@ -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<PetClient>
}
}
@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<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);
}
}

View File

@ -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);

View File

@ -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<HubClient>
return line;
}
@EventHandler
public void preventEggSpawn(ItemSpawnEvent event)
{
if (event.getEntity() instanceof Egg)
{
event.setCancelled(true);
}
}
@EventHandler
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.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)
{

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();
//Dead Prefix

View File

@ -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;

View File

@ -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;

View File

@ -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;