Queueing now works with less players than teams.
Added DragonName text-input for hub Fixed smash bug, where spectators were causing lightning effect
This commit is contained in:
parent
30c5267da2
commit
72bec77237
@ -34,6 +34,9 @@ public class Dragon extends MiniPlugin
|
|||||||
public double RangeBest = 1000;
|
public double RangeBest = 1000;
|
||||||
public long RangeTime = 0;
|
public long RangeTime = 0;
|
||||||
|
|
||||||
|
public int textA = 0;
|
||||||
|
public int textB = 0;
|
||||||
|
|
||||||
public Dragon(HubManager manager)
|
public Dragon(HubManager manager)
|
||||||
{
|
{
|
||||||
super("Dragon Manager", manager.GetPlugin());
|
super("Dragon Manager", manager.GetPlugin());
|
||||||
@ -98,15 +101,21 @@ public class Dragon extends MiniPlugin
|
|||||||
if (Dragon == null || !Dragon.isValid())
|
if (Dragon == null || !Dragon.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ChatColor color = ChatColor.RED;
|
ChatColor aCol = ChatColor.RED;
|
||||||
double r = Math.random();
|
if (textA == 1) aCol = ChatColor.GOLD;
|
||||||
if (r > 0.83) color = ChatColor.GOLD;
|
else if (textA == 2) aCol = ChatColor.YELLOW;
|
||||||
else if (r > 0.66) color = ChatColor.YELLOW;
|
else if (textA == 3) aCol = ChatColor.GREEN;
|
||||||
else if (r > 0.49) color = ChatColor.GREEN;
|
else if (textA == 4) aCol = ChatColor.AQUA;
|
||||||
else if (r > 0.32) color = ChatColor.AQUA;
|
else if (textA == 5) aCol = ChatColor.LIGHT_PURPLE;
|
||||||
else if (r > 0.16) color = ChatColor.LIGHT_PURPLE;
|
|
||||||
|
|
||||||
Dragon.setCustomName(color + C.Bold + C.Line + "Welcome to Mineplex - Home of Premium Quality Minigames");
|
textA = (textA+1)%6;
|
||||||
|
|
||||||
|
ChatColor bCol = ChatColor.GREEN;
|
||||||
|
if (textB > 6) bCol = ChatColor.WHITE;
|
||||||
|
|
||||||
|
textB = (textB+1)%14;
|
||||||
|
|
||||||
|
Dragon.setCustomName(aCol + C.Bold + C.Line + Manager.DragonTextA +ChatColor.RESET + " - " + bCol + C.Bold + C.Line + Manager.DragonTextB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Turn()
|
private void Turn()
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
package mineplex.hub;
|
package mineplex.hub;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
@ -64,82 +71,130 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
|
|
||||||
private Location _spawn;
|
private Location _spawn;
|
||||||
private int _scoreboardTick = 0;
|
private int _scoreboardTick = 0;
|
||||||
|
|
||||||
private String _pigStacker = "0 - Nobody";
|
private String _pigStacker = "0 - Nobody";
|
||||||
|
|
||||||
|
public String DragonTextA = "Mineplex";
|
||||||
|
public String DragonTextB = "";
|
||||||
|
|
||||||
private HashSet<LivingEntity> _mobs = new HashSet<LivingEntity>();
|
private HashSet<LivingEntity> _mobs = new HashSet<LivingEntity>();
|
||||||
|
|
||||||
public HubManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager)
|
public HubManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager)
|
||||||
{
|
{
|
||||||
super("Hub Manager", plugin);
|
super("Hub Manager", plugin);
|
||||||
|
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_disguiseManager = disguiseManager;
|
_disguiseManager = disguiseManager;
|
||||||
|
|
||||||
_spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5);
|
_spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5);
|
||||||
|
|
||||||
new TextCreator(this);
|
new TextCreator(this);
|
||||||
new Dragon(this);
|
new Dragon(this);
|
||||||
|
|
||||||
|
DragonTextB = GetDragonText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String GetDragonText()
|
||||||
|
{
|
||||||
|
File file = new File("DragonText.dat");
|
||||||
|
|
||||||
|
//Write If Blank
|
||||||
|
if (!file.exists())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileWriter fstream = new FileWriter(file);
|
||||||
|
BufferedWriter out = new BufferedWriter(fstream);
|
||||||
|
|
||||||
|
out.write("Home of Premium Game Modes");
|
||||||
|
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Error: Game World GetId Write Exception");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String line = "Home of Premium Game Modes";
|
||||||
|
|
||||||
|
//Read
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileInputStream fstream = new FileInputStream(file);
|
||||||
|
DataInputStream in = new DataInputStream(fstream);
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||||
|
line = br.readLine();
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Error: Game World GetId Read Exception");
|
||||||
|
}
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerRespawn(PlayerRespawnEvent event)
|
public void PlayerRespawn(PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
event.setRespawnLocation(GetSpawn());
|
event.setRespawnLocation(GetSpawn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void OnChunkLoad(ChunkLoadEvent event)
|
public void OnChunkLoad(ChunkLoadEvent event)
|
||||||
{
|
{
|
||||||
for (Entity entity : event.getChunk().getEntities())
|
for (Entity entity : event.getChunk().getEntities())
|
||||||
{
|
{
|
||||||
if (entity instanceof LivingEntity)
|
if (entity instanceof LivingEntity)
|
||||||
{
|
{
|
||||||
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
if (((LivingEntity)entity).isCustomNameVisible() && ((LivingEntity)entity).getCustomName() != null)
|
||||||
{
|
{
|
||||||
if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("minekartrider"))
|
if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("minekartrider"))
|
||||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Play " + ChatColor.YELLOW + "MineKart"));
|
_disguiseManager.Disguise(new DisguisePlayer(entity, "Play " + ChatColor.YELLOW + "MineKart"));
|
||||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("defek7"))
|
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("defek7"))
|
||||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "defek7"));
|
_disguiseManager.Disguise(new DisguisePlayer(entity, "defek7"));
|
||||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("chiss"))
|
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("chiss"))
|
||||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Chiss"));
|
_disguiseManager.Disguise(new DisguisePlayer(entity, "Chiss"));
|
||||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Sterling_"))
|
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Sterling_"))
|
||||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "sterling_"));
|
_disguiseManager.Disguise(new DisguisePlayer(entity, "sterling_"));
|
||||||
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Spu_"))
|
else if (((LivingEntity)entity).getCustomName().equalsIgnoreCase("Spu_"))
|
||||||
_disguiseManager.Disguise(new DisguisePlayer(entity, "Spu_"));
|
_disguiseManager.Disguise(new DisguisePlayer(entity, "Spu_"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void PlayerJoin(PlayerJoinEvent event)
|
public void PlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
//Survival
|
//Survival
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
player.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
//Public Message
|
//Public Message
|
||||||
event.setJoinMessage(null);
|
event.setJoinMessage(null);
|
||||||
|
|
||||||
//Teleport
|
//Teleport
|
||||||
player.teleport(GetSpawn());
|
player.teleport(GetSpawn());
|
||||||
|
|
||||||
//Allow Double Jump
|
//Allow Double Jump
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
|
|
||||||
UtilInv.Clear(player);
|
UtilInv.Clear(player);
|
||||||
|
|
||||||
//Scoreboard
|
//Scoreboard
|
||||||
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
|
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||||
player.setScoreboard(board);
|
player.setScoreboard(board);
|
||||||
|
|
||||||
//Objective
|
//Objective
|
||||||
Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy");
|
Objective obj = board.registerNewObjective(C.Bold + "Player Data", "dummy");
|
||||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||||
|
|
||||||
for (Rank rank : Rank.values())
|
for (Rank rank : Rank.values())
|
||||||
{
|
{
|
||||||
if (rank != Rank.ALL)
|
if (rank != Rank.ALL)
|
||||||
@ -152,61 +207,61 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
{
|
{
|
||||||
//Add Other to Self
|
//Add Other to Self
|
||||||
board.getTeam(_clientManager.Get(otherPlayer).GetRank().Name).addPlayer(otherPlayer);
|
board.getTeam(_clientManager.Get(otherPlayer).GetRank().Name).addPlayer(otherPlayer);
|
||||||
|
|
||||||
//Add Self to Other
|
//Add Self to Other
|
||||||
otherPlayer.getScoreboard().getTeam(_clientManager.Get(player).GetRank().Name).addPlayer(player);
|
otherPlayer.getScoreboard().getTeam(_clientManager.Get(player).GetRank().Name).addPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerQuit(PlayerQuitEvent event)
|
public void PlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
event.setQuitMessage(null);
|
event.setQuitMessage(null);
|
||||||
|
|
||||||
event.getPlayer().leaveVehicle();
|
event.getPlayer().leaveVehicle();
|
||||||
event.getPlayer().eject();
|
event.getPlayer().eject();
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
player.getScoreboard().resetScores(event.getPlayer());
|
player.getScoreboard().resetScores(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerChat(AsyncPlayerChatEvent event)
|
public void PlayerChat(AsyncPlayerChatEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
Rank rank = GetClients().Get(player).GetRank();
|
Rank rank = GetClients().Get(player).GetRank();
|
||||||
|
|
||||||
String rankStr = "";
|
String rankStr = "";
|
||||||
if (rank != Rank.ALL)
|
if (rank != Rank.ALL)
|
||||||
rankStr = rank.Color + C.Bold + GetClients().Get(player).GetRank().Name.toUpperCase() + " ";
|
rankStr = rank.Color + C.Bold + GetClients().Get(player).GetRank().Name.toUpperCase() + " ";
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
UtilPlayer.message(other, rankStr + C.cYellow + player.getName() + " " + C.cWhite + event.getMessage());
|
UtilPlayer.message(other, rankStr + C.cYellow + player.getName() + " " + C.cWhite + event.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Damage(EntityDamageEvent event)
|
public void Damage(EntityDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Player && event.getCause() == DamageCause.VOID)
|
if (event.getEntity() instanceof Player && event.getCause() == DamageCause.VOID)
|
||||||
event.getEntity().teleport(GetSpawn());
|
event.getEntity().teleport(GetSpawn());
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void ItemPickup(PlayerPickupItemEvent event)
|
public void ItemPickup(PlayerPickupItemEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,31 +270,31 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
{
|
{
|
||||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BlockBreak(BlockBreakEvent event)
|
public void BlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void LeaveDecay(LeavesDecayEvent event)
|
public void LeaveDecay(LeavesDecayEvent event)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BlockPlace(BlockPlaceEvent event)
|
public void BlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,23 +302,23 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
public void FlightHop(PlayerToggleFlightEvent event)
|
public void FlightHop(PlayerToggleFlightEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
|
|
||||||
//Disable Flight
|
//Disable Flight
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
|
|
||||||
//Velocity
|
//Velocity
|
||||||
UtilAction.velocity(player, 1.4, 0.2, 1, true);
|
UtilAction.velocity(player, 1.4, 0.2, 1, true);
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void FlightUpdate(UpdateEvent event)
|
public void FlightUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -274,63 +329,63 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
{
|
{
|
||||||
if (player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void FoodHealthUpdate(UpdateEvent event)
|
public void FoodHealthUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
player.setFoodLevel(20);
|
player.setFoodLevel(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void UpdateWeather(UpdateEvent event)
|
public void UpdateWeather(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SEC)
|
if (event.getType() != UpdateType.SEC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
World world = UtilWorld.getWorld("world");
|
World world = UtilWorld.getWorld("world");
|
||||||
world.setTime(6000);
|
world.setTime(6000);
|
||||||
world.setStorm(false);
|
world.setStorm(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void UpdateScoreboard(UpdateEvent event)
|
public void UpdateScoreboard(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_scoreboardTick = (_scoreboardTick + 1)%3;
|
_scoreboardTick = (_scoreboardTick + 1)%3;
|
||||||
|
|
||||||
if (_scoreboardTick != 0)
|
if (_scoreboardTick != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int bestPig = 0;
|
int bestPig = 0;
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
if (player.getVehicle() != null)
|
if (player.getVehicle() != null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
Entity ent = player;
|
Entity ent = player;
|
||||||
while (ent.getPassenger() != null)
|
while (ent.getPassenger() != null)
|
||||||
{
|
{
|
||||||
ent = ent.getPassenger();
|
ent = ent.getPassenger();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > bestPig)
|
if (count > bestPig)
|
||||||
{
|
{
|
||||||
_pigStacker = player.getName();
|
_pigStacker = player.getName();
|
||||||
@ -344,40 +399,40 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_pigStacker = bestPig + " - " + _pigStacker;
|
_pigStacker = bestPig + " - " + _pigStacker;
|
||||||
|
|
||||||
if (_pigStacker.length() > 16)
|
if (_pigStacker.length() > 16)
|
||||||
_pigStacker = _pigStacker.substring(0, 16);
|
_pigStacker = _pigStacker.substring(0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
//Objective
|
//Objective
|
||||||
Objective obj = player.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
|
Objective obj = player.getScoreboard().getObjective(DisplaySlot.SIDEBAR);
|
||||||
|
|
||||||
//Title
|
//Title
|
||||||
obj.setDisplayName(C.cWhite + C.Bold + Get(player).GetScoreboardText());
|
obj.setDisplayName(C.cWhite + C.Bold + Get(player).GetScoreboardText());
|
||||||
|
|
||||||
int line = 15;
|
int line = 15;
|
||||||
|
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cGreen + C.Bold + "Gems")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cGreen + C.Bold + "Gems")).setScore(line--);
|
||||||
|
|
||||||
// Remove Old
|
// Remove Old
|
||||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player.getName()).GetLastGemCount() + ""));
|
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player.getName()).GetLastGemCount() + ""));
|
||||||
// Add New
|
// Add New
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(GetDonation().Get(player.getName()).GetGems() + "")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(GetDonation().Get(player.getName()).GetGems() + "")).setScore(line--);
|
||||||
|
|
||||||
Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).GetGems());
|
Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).GetGems());
|
||||||
|
|
||||||
//Space
|
//Space
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//News
|
//News
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Latest News")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Latest News")).setScore(line--);
|
||||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetNewsText(false)));
|
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetNewsText(false)));
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetNewsText(true))).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetNewsText(true))).setScore(line--);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Stacker
|
//Stacker
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Stacker")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cGray + C.Bold + "Stacker")).setScore(line--);
|
||||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).BestPig));
|
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).BestPig));
|
||||||
@ -386,90 +441,90 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
|
|
||||||
//Space
|
//Space
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
||||||
|
|
||||||
//Display Rank
|
//Display Rank
|
||||||
if (GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
if (GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
||||||
{
|
{
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cPurple + C.Bold + "Ultra Rank")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cPurple + C.Bold + "Ultra Rank")).setScore(line--);
|
||||||
|
|
||||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetUltraText(false)));
|
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetUltraText(false)));
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetUltraText(true))).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetUltraText(true))).setScore(line--);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cRed + C.Bold + "No Rank")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cRed + C.Bold + "No Rank")).setScore(line--);
|
||||||
|
|
||||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetPurchaseText(false)));
|
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetPurchaseText(false)));
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetPurchaseText(true))).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetPurchaseText(true))).setScore(line--);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Space
|
//Space
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
||||||
|
|
||||||
//Display Staff
|
//Display Staff
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cGold + C.Bold + "Online Staff")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cGold + C.Bold + "Online Staff")).setScore(line--);
|
||||||
String staff = "";
|
String staff = "";
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
Rank rank = GetClients().Get(other).GetRank();
|
Rank rank = GetClients().Get(other).GetRank();
|
||||||
|
|
||||||
if (!rank.Has(Rank.HELPER))
|
if (!rank.Has(Rank.HELPER))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
staff += other.getName() + " ";
|
staff += other.getName() + " ";
|
||||||
}
|
}
|
||||||
if (staff.length() == 0)
|
if (staff.length() == 0)
|
||||||
staff = "None";
|
staff = "None";
|
||||||
|
|
||||||
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetStaffText(false)));
|
player.getScoreboard().resetScores(Bukkit.getOfflinePlayer(Get(player).GetStaffText(false)));
|
||||||
Get(player).StaffString = staff;
|
Get(player).StaffString = staff;
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetStaffText(true))).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(Get(player).GetStaffText(true))).setScore(line--);
|
||||||
|
|
||||||
//Space
|
//Space
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(" ")).setScore(line--);
|
||||||
|
|
||||||
//Website
|
//Website
|
||||||
obj.getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Website")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer(C.cYellow + C.Bold + "Website")).setScore(line--);
|
||||||
obj.getScore(Bukkit.getOfflinePlayer("www.mineplex.com")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer("www.mineplex.com")).setScore(line--);
|
||||||
obj.getScore(Bukkit.getOfflinePlayer("----------------")).setScore(line--);
|
obj.getScore(Bukkit.getOfflinePlayer("----------------")).setScore(line--);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HubClient AddPlayer(String player)
|
protected HubClient AddPlayer(String player)
|
||||||
{
|
{
|
||||||
return new HubClient(player);
|
return new HubClient(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreClientManager GetClients()
|
public CoreClientManager GetClients()
|
||||||
{
|
{
|
||||||
return _clientManager;
|
return _clientManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DonationManager GetDonation()
|
public DonationManager GetDonation()
|
||||||
{
|
{
|
||||||
return _donationManager;
|
return _donationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location GetSpawn()
|
public Location GetSpawn()
|
||||||
{
|
{
|
||||||
return _spawn.clone();
|
return _spawn.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void UpdateVisibility(UpdateEvent event)
|
public void UpdateVisibility(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
if (player.equals(other))
|
if (player.equals(other))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (UtilMath.offset(player.getLocation(), GetSpawn()) < 4)
|
if (UtilMath.offset(player.getLocation(), GetSpawn()) < 4)
|
||||||
{
|
{
|
||||||
other.hidePlayer(player);
|
other.hidePlayer(player);
|
||||||
@ -481,34 +536,34 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SpawnAnimals(UpdateEvent event)
|
public void SpawnAnimals(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Iterator<LivingEntity> entIterator = _mobs.iterator();
|
Iterator<LivingEntity> entIterator = _mobs.iterator();
|
||||||
|
|
||||||
while (entIterator.hasNext())
|
while (entIterator.hasNext())
|
||||||
{
|
{
|
||||||
LivingEntity ent = entIterator.next();
|
LivingEntity ent = entIterator.next();
|
||||||
|
|
||||||
if (!ent.isValid())
|
if (!ent.isValid())
|
||||||
{
|
{
|
||||||
ent.remove();
|
ent.remove();
|
||||||
entIterator.remove();
|
entIterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mobs.size() > 24)
|
if (_mobs.size() > 24)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Loc
|
//Loc
|
||||||
double r = Math.random();
|
double r = Math.random();
|
||||||
|
|
||||||
Location loc = GetSpawn();
|
Location loc = GetSpawn();
|
||||||
|
|
||||||
if (r > 0.75) loc.add(32, 0.5, 0);
|
if (r > 0.75) loc.add(32, 0.5, 0);
|
||||||
else if (r > 0.5) loc.add(0, 0.5, 32);
|
else if (r > 0.5) loc.add(0, 0.5, 32);
|
||||||
else if (r > 0.25) loc.add(-32, 0.5, 0);
|
else if (r > 0.25) loc.add(-32, 0.5, 0);
|
||||||
@ -522,7 +577,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Sheep.class));
|
else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Sheep.class));
|
||||||
else _mobs.add(loc.getWorld().spawn(loc, Chicken.class));
|
else _mobs.add(loc.getWorld().spawn(loc, Chicken.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void Explosion(EntityExplodeEvent event)
|
public void Explosion(EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
|
@ -739,7 +739,7 @@ public abstract class Game implements Listener
|
|||||||
|
|
||||||
public boolean CanJoinTeam(GameTeam team)
|
public boolean CanJoinTeam(GameTeam team)
|
||||||
{
|
{
|
||||||
return team.GetSize() < UtilServer.getPlayers().length/GetTeamList().size();
|
return team.GetSize() < Math.max(1, UtilServer.getPlayers().length/GetTeamList().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameTeam GetTeamPreference(Player player)
|
public GameTeam GetTeamPreference(Player player)
|
||||||
|
@ -162,6 +162,9 @@ public class SuperSmash extends SoloGame
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void FallDamage(CustomDamageEvent event)
|
public void FallDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
|
if (event.IsCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.GetCause() == DamageCause.FALL)
|
if (event.GetCause() == DamageCause.FALL)
|
||||||
event.SetCancelled("No Fall Damage");
|
event.SetCancelled("No Fall Damage");
|
||||||
}
|
}
|
||||||
@ -169,9 +172,19 @@ public class SuperSmash extends SoloGame
|
|||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void Knockback(CustomDamageEvent event)
|
public void Knockback(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
|
if (event.IsCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.GetDamageePlayer() != null)
|
if (event.GetDamageePlayer() != null)
|
||||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void ArenaWalls(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.IsCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
|
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
|
||||||
{
|
{
|
||||||
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
|
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
|
||||||
|
@ -141,7 +141,7 @@ public class GameManager implements Listener
|
|||||||
if (game.GetCountdown() == -1)
|
if (game.GetCountdown() == -1)
|
||||||
{
|
{
|
||||||
game.InformQueuePositions();
|
game.InformQueuePositions();
|
||||||
game.AnnounceGame();
|
//game.AnnounceGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initialise Countdown
|
//Initialise Countdown
|
||||||
@ -263,7 +263,7 @@ public class GameManager implements Listener
|
|||||||
|
|
||||||
if (!game.CanJoinTeam(team))
|
if (!game.CanJoinTeam(team))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
queueIterator.remove();
|
queueIterator.remove();
|
||||||
|
|
||||||
if (!game.IsPlaying(player))
|
if (!game.IsPlaying(player))
|
||||||
|
Loading…
Reference in New Issue
Block a user