UHC fixes
Sneaky Assassin listener leak fix Some map parser stuffs.
This commit is contained in:
parent
6365ec5351
commit
c65712c260
@ -11,6 +11,7 @@ public enum Rank
|
|||||||
OWNER("Owner", ChatColor.DARK_RED),
|
OWNER("Owner", ChatColor.DARK_RED),
|
||||||
DEVELOPER("Dev", ChatColor.RED),
|
DEVELOPER("Dev", ChatColor.RED),
|
||||||
ADMIN("Admin", ChatColor.RED),
|
ADMIN("Admin", ChatColor.RED),
|
||||||
|
SNR_MODERATOR("SnrMod", ChatColor.GOLD),
|
||||||
MODERATOR("Mod", ChatColor.GOLD),
|
MODERATOR("Mod", ChatColor.GOLD),
|
||||||
HELPER("Helper", ChatColor.GREEN),
|
HELPER("Helper", ChatColor.GREEN),
|
||||||
MAPDEV("Mapper", ChatColor.BLUE),
|
MAPDEV("Mapper", ChatColor.BLUE),
|
||||||
|
@ -172,7 +172,7 @@ public class UtilPlayer
|
|||||||
for (String cur : matches)
|
for (String cur : matches)
|
||||||
matchString += cur + " ";
|
matchString += cur + " ";
|
||||||
if (matchString.length() > 1)
|
if (matchString.length() > 1)
|
||||||
matchString = matchString.substring(0 , matchString.length() - 2);
|
matchString = matchString.substring(0 , matchString.length() - 1);
|
||||||
|
|
||||||
message(caller, F.main("Offline Player Search", "" +
|
message(caller, F.main("Offline Player Search", "" +
|
||||||
C.mBody + "Matches [" +
|
C.mBody + "Matches [" +
|
||||||
|
@ -8,11 +8,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -22,10 +25,15 @@ import org.bukkit.WorldType;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.material.Wool;
|
import org.bukkit.material.Wool;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.fusesource.jansi.Ansi.Color;
|
import org.fusesource.jansi.Ansi.Color;
|
||||||
@ -51,7 +59,9 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void Command(PlayerCommandPreprocessEvent event)
|
public void Command(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
if (event.getMessage().startsWith("/copyschematics"))
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (event.getMessage().toLowerCase().startsWith("/copyschematics"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -60,47 +70,57 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
FileUtils.copyDirectory(new File(".." + File.separator + "Build-1" + File.separator + "plugins" + File.separator + "WorldEdit" + File.separator + "schematics"),
|
FileUtils.copyDirectory(new File(".." + File.separator + "Build-1" + File.separator + "plugins" + File.separator + "WorldEdit" + File.separator + "schematics"),
|
||||||
new File("plugins" + File.separator + "WorldEdit" + File.separator + "schematics"));
|
new File("plugins" + File.separator + "WorldEdit" + File.separator + "schematics"));
|
||||||
|
|
||||||
event.getPlayer().sendMessage("Schematics copied.");
|
UtilPlayer.message(player, F.main("Parser", "Schematics Copied."));
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
event.getPlayer().sendMessage("Schematics copy failed!");
|
UtilPlayer.message(player, F.main("Parser", "Schematics Copy Failed! Contact Jonalon."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event.getMessage().startsWith("/createMap"))
|
else if (event.getMessage().toLowerCase().startsWith("/createmap"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
||||||
|
|
||||||
|
UtilPlayer.message(player, F.main("Parser", "Creating World: " + F.elem(args[0])));
|
||||||
|
|
||||||
WorldCreator worldCreator = new WorldCreator(args[0]);
|
WorldCreator worldCreator = new WorldCreator(args[0]);
|
||||||
worldCreator.environment(Environment.NORMAL);
|
worldCreator.environment(Environment.NORMAL);
|
||||||
worldCreator.type(WorldType.FLAT);
|
worldCreator.type(WorldType.FLAT);
|
||||||
worldCreator.generateStructures(false);
|
worldCreator.generateStructures(false);
|
||||||
|
|
||||||
World world = Bukkit.getServer().createWorld(worldCreator);
|
World world = Bukkit.getServer().createWorld(worldCreator);
|
||||||
|
|
||||||
|
UtilPlayer.message(player, F.main("Parser", "Teleporting to World: " + F.elem(args[0])));
|
||||||
|
|
||||||
event.getPlayer().teleport(world.getSpawnLocation());
|
event.getPlayer().teleport(new Location(world, 0, 100, 0));
|
||||||
}
|
}
|
||||||
else if (event.getMessage().startsWith("/loadMap"))
|
else if (event.getMessage().toLowerCase().startsWith("/loadmap"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
||||||
|
|
||||||
|
UtilPlayer.message(player, F.main("Parser", "Loading World: " + F.elem(args[0])));
|
||||||
|
|
||||||
World world = _worldManager.loadPendingParse(event.getPlayer(), args[0]);
|
World world = _worldManager.loadPendingParse(event.getPlayer(), args[0]);
|
||||||
|
|
||||||
event.getPlayer().teleport(world.getSpawnLocation());
|
UtilPlayer.message(player, F.main("Parser", "Teleporting to World: " + F.elem(args[0])));
|
||||||
|
|
||||||
|
event.getPlayer().teleport(new Location(world, 0, 100, 0));
|
||||||
}
|
}
|
||||||
else if (event.getMessage().startsWith("/listMaps"))
|
else if (event.getMessage().toLowerCase().startsWith("/listmaps"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
UtilPlayer.message(player, F.main("Parser", "Listing Worlds;"));
|
||||||
|
|
||||||
_worldManager.listPendingParses(event.getPlayer());
|
_worldManager.listPendingParses(event.getPlayer());
|
||||||
}
|
}
|
||||||
else if (event.getMessage().startsWith("/parse"))
|
else if (event.getMessage().toLowerCase().startsWith("/parse"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -127,7 +147,6 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
|
|
||||||
String msg = event.getMessage().replace(gameType, "").toLowerCase();
|
String msg = event.getMessage().replace(gameType, "").toLowerCase();
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
|
|
||||||
// TODO teleport player to main world
|
// TODO teleport player to main world
|
||||||
@ -556,4 +575,24 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void DisableCreatures(EntitySpawnEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntityType() == EntityType.DROPPED_ITEM || event.getEntity() instanceof LivingEntity)
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Updates(PlayerMoveEvent event)
|
||||||
|
{
|
||||||
|
for (World world : this.getServer().getWorlds())
|
||||||
|
world.setTime(8000);
|
||||||
|
|
||||||
|
if (event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||||
|
event.getPlayer().setGameMode(GameMode.CREATIVE);
|
||||||
|
|
||||||
|
if (!event.getPlayer().isOp())
|
||||||
|
event.getPlayer().setOp(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import net.minecraft.util.org.apache.commons.io.FileUtils;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class WorldManager
|
public class WorldManager
|
||||||
|
@ -946,12 +946,20 @@ public abstract class Game implements Listener
|
|||||||
if (AnnounceSilence)
|
if (AnnounceSilence)
|
||||||
Manager.GetChat().Silence(5000, false);
|
Manager.GetChat().Silence(5000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void Announce(String message)
|
public void Announce(String message)
|
||||||
|
{
|
||||||
|
Announce(message, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Announce(String message, boolean playSound)
|
||||||
{
|
{
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
if (playSound)
|
||||||
|
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
||||||
|
|
||||||
UtilPlayer.message(player, message);
|
UtilPlayer.message(player, message);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public class GameTeam
|
|||||||
ArrayList<Player> alive = new ArrayList<Player>();
|
ArrayList<Player> alive = new ArrayList<Player>();
|
||||||
|
|
||||||
for (Player player : _players.keySet())
|
for (Player player : _players.keySet())
|
||||||
if (!playerIn || _players.get(player) == PlayerState.IN )
|
if (!playerIn || (_players.get(player) == PlayerState.IN && player.isOnline()))
|
||||||
alive.add(player);
|
alive.add(player);
|
||||||
|
|
||||||
return alive;
|
return alive;
|
||||||
@ -250,7 +250,7 @@ public class GameTeam
|
|||||||
if (!_players.containsKey(player))
|
if (!_players.containsKey(player))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return _players.get(player) == PlayerState.IN;
|
return player.isOnline() && _players.get(player) == PlayerState.IN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetColor(ChatColor color)
|
public void SetColor(ChatColor color)
|
||||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
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;
|
||||||
@ -12,6 +13,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -88,7 +91,7 @@ public abstract class TeamGame extends Game
|
|||||||
GetLocationStore().put(player.getName(), player.getLocation());
|
GetLocationStore().put(player.getName(), player.getLocation());
|
||||||
|
|
||||||
//Announcement
|
//Announcement
|
||||||
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin.");
|
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin.", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +106,7 @@ public abstract class TeamGame extends Game
|
|||||||
if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null)
|
if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null)
|
||||||
{
|
{
|
||||||
team.AddPlayer(event.getPlayer());
|
team.AddPlayer(event.getPlayer());
|
||||||
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!");
|
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false);
|
||||||
|
|
||||||
|
|
||||||
Kit kit = RejoinKit.remove(event.getPlayer().getName());
|
Kit kit = RejoinKit.remove(event.getPlayer().getName());
|
||||||
@ -144,7 +147,7 @@ public abstract class TeamGame extends Game
|
|||||||
//Get Team (By Name)
|
//Get Team (By Name)
|
||||||
GameTeam team = RejoinTeam.remove(name);
|
GameTeam team = RejoinTeam.remove(name);
|
||||||
if (team != null)
|
if (team != null)
|
||||||
Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!");
|
Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!", false);
|
||||||
|
|
||||||
RejoinKit.remove(name);
|
RejoinKit.remove(name);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ public class Domination extends TeamGame
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Wipe Last
|
//Wipe Last
|
||||||
Scoreboard.Reset();
|
Scoreboard.Reset();
|
||||||
|
|
||||||
//Scores
|
//Scores
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
@ -251,7 +251,7 @@ public class TeamDeathmatch extends TeamGame
|
|||||||
{
|
{
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
for (Player player : team.GetPlayers(true))
|
for (Player player : team.GetPlayers(false))
|
||||||
{
|
{
|
||||||
int kills = 0;
|
int kills = 0;
|
||||||
if (_kills.containsKey(player))
|
if (_kills.containsKey(player))
|
||||||
|
@ -4,6 +4,8 @@ import mineplex.core.updater.*;
|
|||||||
import mineplex.core.updater.event.*;
|
import mineplex.core.updater.event.*;
|
||||||
import nautilus.game.arcade.events.*;
|
import nautilus.game.arcade.events.*;
|
||||||
import nautilus.game.arcade.game.*;
|
import nautilus.game.arcade.game.*;
|
||||||
|
import nautilus.game.arcade.game.Game.GameState;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.event.*;
|
import org.bukkit.event.*;
|
||||||
import org.bukkit.plugin.*;
|
import org.bukkit.plugin.*;
|
||||||
@ -107,4 +109,14 @@ public class PowerUpManager implements Listener
|
|||||||
for(PowerUp powerUp : getPowerUps())
|
for(PowerUp powerUp : getPowerUps())
|
||||||
powerUp.onUpdate(event);
|
powerUp.onUpdate(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void deregisterSelf(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (game.GetState() == GameState.Dead)
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,10 @@ public class UHC extends TeamGame
|
|||||||
|
|
||||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Health", "health");
|
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Health", "health");
|
||||||
_scoreObj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
_scoreObj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
|
||||||
|
|
||||||
|
//Tournament
|
||||||
|
//this.AutoBalance = false;
|
||||||
|
//this.AutoStart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -186,10 +190,6 @@ public class UHC extends TeamGame
|
|||||||
|
|
||||||
this.DamagePvP = true;
|
this.DamagePvP = true;
|
||||||
}
|
}
|
||||||
else if (_gameMinutes % 15 == 0)
|
|
||||||
{
|
|
||||||
Announce(ChatColor.WHITE + C.Bold + _gameMinutes + " minutes have passed.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -572,6 +572,7 @@ public class UHC extends TeamGame
|
|||||||
event.setLeaveMessage(null);
|
event.setLeaveMessage(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void PlayerQuit(PlayerQuitEvent event)
|
public void PlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
@ -588,7 +589,7 @@ public class UHC extends TeamGame
|
|||||||
if (player.isDead())
|
if (player.isDead())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
//Announcement
|
//Announcement
|
||||||
@ -597,7 +598,7 @@ public class UHC extends TeamGame
|
|||||||
player.damage(5000);
|
player.damage(5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
|
if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000))
|
||||||
{
|
{
|
||||||
@ -608,6 +609,7 @@ public class UHC extends TeamGame
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.MONITOR)
|
@EventHandler(priority=EventPriority.MONITOR)
|
||||||
public void DamageRecord(CustomDamageEvent event)
|
public void DamageRecord(CustomDamageEvent event)
|
||||||
|
@ -352,6 +352,9 @@ public class GamePlayerManager implements Listener
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (Manager.GetClients().Get(player).GetRank().Has(Rank.MODERATOR))
|
||||||
|
return;
|
||||||
|
|
||||||
if (game.IsAlive(player) || player.getGameMode() != GameMode.CREATIVE)
|
if (game.IsAlive(player) || player.getGameMode() != GameMode.CREATIVE)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Game", "Only Spectators can use teleport."));
|
UtilPlayer.message(player, F.main("Game", "Only Spectators can use teleport."));
|
||||||
|
Loading…
Reference in New Issue
Block a user