Monitoring for josh + the mods
This commit is contained in:
parent
2ccd7a5de0
commit
5ff9d1985b
@ -0,0 +1,101 @@
|
||||
package nautilus.game.arcade.game.games.typewars;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.typewars.TypeWars.KillType;
|
||||
|
||||
public class StaffKillMonitorManager implements Listener
|
||||
{
|
||||
/**
|
||||
* Created by: Mysticate
|
||||
* Timestamp: December 30, 2015
|
||||
*/
|
||||
|
||||
private TypeWars _host;
|
||||
private String _command = "/words";
|
||||
|
||||
private NautHashMap<Player, Player> _monitoring = new NautHashMap<Player, Player>();
|
||||
|
||||
public StaffKillMonitorManager(TypeWars host)
|
||||
{
|
||||
_host = host;
|
||||
|
||||
host.Manager.registerEvents(this);;
|
||||
}
|
||||
|
||||
public TypeWars getHost()
|
||||
{
|
||||
return _host;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEnd(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.End)
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKill(MinionKillEvent event)
|
||||
{
|
||||
if (event.getType() == KillType.SPELL)
|
||||
return;
|
||||
|
||||
for (Player staff : _monitoring.keySet())
|
||||
{
|
||||
if (_monitoring.get(staff) == event.getPlayer())
|
||||
{
|
||||
UtilPlayer.message(staff, F.elem(C.cRedB + ">>") + F.name(event.getPlayer().getName()) + " killed " + F.elem(C.cGold + event.getMinion().getName()) + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!_host.IsLive())
|
||||
return;
|
||||
|
||||
if (!_host.Manager.GetClients().hasRank(event.getPlayer(), Rank.HELPER))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
String[] message = event.getMessage().toLowerCase().split(" ");
|
||||
if (message.length == 0 || !message[0].equalsIgnoreCase(_command))
|
||||
return;
|
||||
|
||||
if (message.length == 1)
|
||||
{
|
||||
if (_monitoring.containsKey(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("TypeWars", "You are no longer monitoring " + F.name(_monitoring.remove(event.getPlayer()).getName()) + "."));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("TypeWars", "Please enter a player to monitor!"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
String playerName = message[1];
|
||||
|
||||
Player player = UtilPlayer.searchOnline(event.getPlayer(), playerName, true);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
_monitoring.put(event.getPlayer(), player);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("TypeWars", "You are now monitoring " + F.name(player.getName()) + ". Type " + F.elem(_command) + " to stop."));
|
||||
}
|
||||
}
|
@ -5,6 +5,27 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -45,33 +66,10 @@ import nautilus.game.arcade.game.games.typewars.tutorial.TutorialTypeWars;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.stats.TimeInGameStatTracker;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class TypeWars extends TeamGame
|
||||
{
|
||||
|
||||
{
|
||||
private ArrayList<Minion> _activeMinions;
|
||||
private ArrayList<Minion> _deadMinions;
|
||||
private ArrayList<Minion> _finishedMinions;
|
||||
@ -114,6 +112,8 @@ public class TypeWars extends TeamGame
|
||||
"Kill your enemies Giant before they kill yours!"
|
||||
});
|
||||
|
||||
new StaffKillMonitorManager(this);
|
||||
|
||||
this.DeathOut = false;
|
||||
this.DamageTeamSelf = false;
|
||||
this.DamageSelf = false;
|
||||
|
Loading…
Reference in New Issue
Block a user