Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
f6ad5c5549
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/bin/craftbukkit.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
|
@ -9,12 +9,16 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -29,6 +33,8 @@ public class Portal extends MiniPlugin
|
||||
private List<String> _transfers = new ArrayList<String>();
|
||||
private boolean _retrieve = true;
|
||||
|
||||
private CoreClientManager _clientier;
|
||||
|
||||
public Portal(JavaPlugin plugin)
|
||||
{
|
||||
super("Portal", plugin);
|
||||
@ -36,6 +42,7 @@ public class Portal extends MiniPlugin
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
|
||||
|
||||
_repository.initialize(plugin.getConfig().getBoolean("serverstatus.us"));
|
||||
_clientier = CoreClientManager.Initialize(plugin, plugin.getConfig().getString("webServer"));
|
||||
}
|
||||
|
||||
public void SendAllPlayers(String serverName)
|
||||
@ -146,4 +153,69 @@ public class Portal extends MiniPlugin
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPreCommand(PlayerCommandPreprocessEvent e)
|
||||
{
|
||||
String[] baseArgs = e.getMessage().split(" ");
|
||||
String command = baseArgs[0];
|
||||
String[] args = new String[baseArgs.length - 1];
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
args[i] = baseArgs[i + 1];
|
||||
}
|
||||
|
||||
Player player = e.getPlayer();
|
||||
|
||||
if (command.equalsIgnoreCase("/server"))
|
||||
{
|
||||
e.setCancelled(true);
|
||||
|
||||
if(args.length == 0)
|
||||
{
|
||||
player.sendMessage(ChatColor.YELLOW + "You are currently on server: " + Bukkit.getServerName());
|
||||
return;
|
||||
}
|
||||
else if(args.length == 1)
|
||||
{
|
||||
// NEED TO IMPLEMENT OTHER PERMISSION LEVELS!!!
|
||||
if(_clientier.Get(player).GetRank().Has(Rank.MAPDEV))
|
||||
{
|
||||
SendPlayerToServer(player, args[1]);
|
||||
player.sendMessage(ChatColor.YELLOW + "You have been sent to server: " + args[1] + "!");
|
||||
return;
|
||||
}
|
||||
player.sendMessage(ChatColor.DARK_PURPLE + "Your arrrguments are not allowed for this command!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(ChatColor.DARK_PURPLE + "Your arrrguments are inappropriate for this command!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (command.equalsIgnoreCase("/send"))
|
||||
{
|
||||
e.setCancelled(true);
|
||||
|
||||
if(args.length == 2)
|
||||
{
|
||||
// NEED TO ADD OTHER PERMISSION LEVELS!!!
|
||||
if(_clientier.Get(player).GetRank().Has(Rank.ADMIN))
|
||||
{
|
||||
// ADD TRANSFER RECORD IN Queue.playerServerTransfer!!!
|
||||
player.sendMessage(ChatColor.BOLD + "Functionality not implemented, yet...");
|
||||
return;
|
||||
}
|
||||
player.sendMessage(ChatColor.DARK_PURPLE + "Your arrrguments are not allowed for this command!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(ChatColor.DARK_PURPLE + "Your arrrguments are inappropriate for this command!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Nautilus.Core.CraftBukkit"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar" sourcepath="/REPO_DIR/GitHubLibraries/CraftBukkit/src"/>
|
||||
|
@ -500,10 +500,54 @@ public class Bridge extends TeamGame implements OreObsfucation
|
||||
{
|
||||
attempts--;
|
||||
|
||||
loc.add(1 - UtilMath.r(3), 1 - UtilMath.r(3), 1 - UtilMath.r(3));
|
||||
|
||||
if (loc.getBlock().getTypeId() != 1)
|
||||
BlockFace faceXZ = BlockFace.SELF;
|
||||
BlockFace faceY = BlockFace.SELF;
|
||||
|
||||
if (Math.random() > 0.20)
|
||||
{
|
||||
int rFace = UtilMath.r(6);
|
||||
|
||||
if (rFace == 0) faceY = BlockFace.UP;
|
||||
else if (rFace == 1) faceY = BlockFace.DOWN;
|
||||
else if (rFace == 2) faceXZ = BlockFace.NORTH;
|
||||
else if (rFace == 3) faceXZ = BlockFace.SOUTH;
|
||||
else if (rFace == 4) faceXZ = BlockFace.EAST;
|
||||
else faceXZ = BlockFace.WEST;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Height
|
||||
int rFace = UtilMath.r(3);
|
||||
|
||||
if (rFace == 0) faceY = BlockFace.SELF;
|
||||
else if (rFace == 1) faceY = BlockFace.UP;
|
||||
else faceY = BlockFace.DOWN;
|
||||
|
||||
//Flat
|
||||
if (faceY == BlockFace.SELF)
|
||||
{
|
||||
rFace = UtilMath.r(4);
|
||||
|
||||
if (rFace == 0) faceXZ = BlockFace.NORTH_EAST;
|
||||
else if (rFace == 1) faceXZ = BlockFace.NORTH_WEST;
|
||||
else if (rFace == 2) faceXZ = BlockFace.SOUTH_EAST;
|
||||
else faceXZ = BlockFace.SOUTH_WEST;
|
||||
}
|
||||
else
|
||||
{
|
||||
rFace = UtilMath.r(4);
|
||||
|
||||
if (rFace == 0) faceXZ = BlockFace.NORTH;
|
||||
else if (rFace == 1) faceXZ = BlockFace.SOUTH;
|
||||
else if (rFace == 2) faceXZ = BlockFace.EAST;
|
||||
else faceXZ = BlockFace.WEST;
|
||||
}
|
||||
}
|
||||
|
||||
if (loc.getBlock().getRelative(faceY).getRelative(faceXZ).getType() != Material.STONE)
|
||||
continue;
|
||||
|
||||
loc = loc.getBlock().getRelative(faceY).getRelative(faceXZ).getLocation();
|
||||
|
||||
_ore.AddOre(loc, type);
|
||||
|
||||
|
@ -1,41 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.champions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitMage;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
|
||||
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class ChampionsTDM extends TeamGame
|
||||
public class ChampionsTDM extends TeamDeathmatch
|
||||
{
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
private HashMap<Player, Integer> _kills = new HashMap<Player, Integer>();
|
||||
|
||||
private Objective _healthObj;
|
||||
|
||||
public ChampionsTDM(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.ChampionsTDM,
|
||||
@ -47,86 +33,23 @@ public class ChampionsTDM extends TeamGame
|
||||
new KitKnight(manager),
|
||||
new KitMage(manager),
|
||||
new KitAssassin(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Each player has " + C.cRed + C.Bold + "ONE LIFE",
|
||||
"Kill the other team to win!",
|
||||
|
||||
});
|
||||
|
||||
this.DeathOut = true;
|
||||
this.HungerSet = 20;
|
||||
this.WorldTimeSet = 2000;
|
||||
this.CompassEnabled = true;
|
||||
});
|
||||
|
||||
_help = new String[]
|
||||
{
|
||||
"Capture Beacons faster with more people!",
|
||||
"Make sure you use all of your Skill/Item Tokens",
|
||||
"Collect Resupply Chests to restock your inventory",
|
||||
"Customize your Class to suit your play style",
|
||||
"Gold Sword boosts Sword Skill by 1 Level",
|
||||
"Gold Axe boosts Axe Skill by 1 Level",
|
||||
"Gold/Iron Weapons deal 6 damage",
|
||||
"Diamond Weapons deal 7 damage",
|
||||
|
||||
};
|
||||
|
||||
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
|
||||
//_healthObj = GetScoreboard().registerNewObjective("HP", "dummy");
|
||||
//_healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerKillAward(CombatDeathEvent event)
|
||||
{
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player killed = (Player)event.GetEvent().getEntity();
|
||||
SetPlayerState(killed, PlayerState.OUT);
|
||||
|
||||
GameTeam killedTeam = GetTeam(killed);
|
||||
if (killedTeam == null)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() != null)
|
||||
{
|
||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
|
||||
if (killer != null && !killer.equals(killed))
|
||||
{
|
||||
GameTeam killerTeam = GetTeam(killer);
|
||||
if (killerTeam == null)
|
||||
return;
|
||||
|
||||
int kills = 1;
|
||||
if (killedTeam.equals(killerTeam))
|
||||
kills = -1;
|
||||
|
||||
if (_kills.containsKey(killer))
|
||||
kills += _kills.get(killer);
|
||||
|
||||
_kills.put(killer, kills);
|
||||
|
||||
ScoreboardUpdate(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Health(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
player.setMaxHealth(30);
|
||||
player.setHealth(player.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public String GetMode()
|
||||
{
|
||||
return "Team Deathmatch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ValidateKit(Player player, GameTeam team)
|
||||
@ -136,6 +59,7 @@ public class ChampionsTDM extends TeamGame
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
System.out.println("Closing inventory from validate kit");
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,13 +69,6 @@ public class ChampionsTDM extends TeamGame
|
||||
return DeathMessageType.Detailed;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DisplayHealth(UpdateEvent event)
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
_healthObj.getScore(player.getName()).setScore((int)player.getHealth());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void WaterArrowCancel(EntityShootBowEvent event)
|
||||
{
|
||||
@ -161,4 +78,14 @@ public class ChampionsTDM extends TeamGame
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void InventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
if (event.getWhoClicked().getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getWhoClicked().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,399 @@
|
||||
package nautilus.game.arcade.game.games.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.elo.EloPlayer;
|
||||
import mineplex.core.elo.EloTeam;
|
||||
import mineplex.core.elo.GameResult;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitMage;
|
||||
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
|
||||
import nautilus.game.arcade.game.games.common.dominate_data.CapturePoint;
|
||||
import nautilus.game.arcade.game.games.common.dominate_data.CapturePointTDM;
|
||||
import nautilus.game.arcade.game.games.common.dominate_data.Emerald;
|
||||
import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class TeamDeathmatch extends TeamGame
|
||||
{
|
||||
private ArrayList<CapturePointTDM> _points = new ArrayList<CapturePointTDM>();
|
||||
private ArrayList<Resupply> _resupply = new ArrayList<Resupply>();
|
||||
|
||||
private HashMap<Player, Integer> _kills = new HashMap<Player, Integer>();
|
||||
|
||||
private Objective _healthObj;
|
||||
|
||||
private boolean _beaconEnabled = false;
|
||||
private long _beaconTime = 180000;
|
||||
|
||||
//Scores
|
||||
private int _victoryScore = 120;
|
||||
private int _redScore = 0;
|
||||
private int _blueScore = 0;
|
||||
|
||||
public TeamDeathmatch(ArcadeManager manager, GameType type, Kit[] kits)
|
||||
{
|
||||
super(manager, type, kits,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Each player has " + C.cRed + C.Bold + "ONE LIFE",
|
||||
"Kill the other team to win!",
|
||||
|
||||
});
|
||||
|
||||
this.DeathOut = true;
|
||||
this.HungerSet = 20;
|
||||
this.WorldTimeSet = 2000;
|
||||
this.CompassEnabled = true;
|
||||
|
||||
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
|
||||
//_healthObj = GetScoreboard().registerNewObjective("HP", "dummy");
|
||||
//_healthObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
for (String pointName : WorldData.GetAllCustomLocs().keySet())
|
||||
{
|
||||
_points.add(new CapturePointTDM(this, pointName, WorldData.GetAllCustomLocs().get(pointName).get(0)));
|
||||
}
|
||||
|
||||
for (Location loc : WorldData.GetDataLocs("YELLOW"))
|
||||
{
|
||||
_resupply.add(new Resupply(this, loc));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerKillAward(CombatDeathEvent event)
|
||||
{
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player killed = (Player)event.GetEvent().getEntity();
|
||||
SetPlayerState(killed, PlayerState.OUT);
|
||||
|
||||
GameTeam killedTeam = GetTeam(killed);
|
||||
if (killedTeam == null)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() != null)
|
||||
{
|
||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
|
||||
if (killer != null && !killer.equals(killed))
|
||||
{
|
||||
GameTeam killerTeam = GetTeam(killer);
|
||||
if (killerTeam == null)
|
||||
return;
|
||||
|
||||
int kills = 1;
|
||||
if (killedTeam.equals(killerTeam))
|
||||
kills = -1;
|
||||
|
||||
if (_kills.containsKey(killer))
|
||||
kills += _kills.get(killer);
|
||||
|
||||
_kills.put(killer, kills);
|
||||
|
||||
ScoreboardUpdate(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Health(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
player.setMaxHealth(30);
|
||||
player.setHealth(player.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public String GetMode()
|
||||
{
|
||||
return "Team Deathmatch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ValidateKit(Player player, GameTeam team)
|
||||
{
|
||||
//Set to Default Knight
|
||||
if (GetKit(player) == null)
|
||||
{
|
||||
SetKit(player, GetKits()[2], true);
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeathMessageType GetDeathMessageType()
|
||||
{
|
||||
return DeathMessageType.Detailed;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DisplayHealth(UpdateEvent event)
|
||||
{
|
||||
if (_healthObj != null)
|
||||
for (Player player : GetPlayers(true))
|
||||
_healthObj.getScore(player.getName()).setScore((int)player.getHealth());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void WaterArrowCancel(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.getEntity().getLocation().getBlock().isLiquid())
|
||||
{
|
||||
UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot use your Bow while swimming."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Updates(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
for (CapturePointTDM cur : _points)
|
||||
cur.Update();
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
for (Resupply cur : _resupply)
|
||||
cur.Update();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BeaconUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (_beaconEnabled)
|
||||
return;
|
||||
|
||||
if (UtilTime.elapsed(GetStateTime(), _beaconTime))
|
||||
{
|
||||
_beaconEnabled = true;
|
||||
|
||||
Announce(C.cWhite + C.Bold + "Capture Point is active!");
|
||||
|
||||
_points.get(UtilMath.r(_points.size())).Enable();
|
||||
|
||||
GetObjectiveSide().setDisplayName(
|
||||
ChatColor.WHITE + "§lFirst to " + C.cGreen + "§l" + _victoryScore);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
long timeLeft = _beaconTime - (System.currentTimeMillis() - GetStateTime());
|
||||
|
||||
GetObjectiveSide().setDisplayName(
|
||||
ChatColor.WHITE + "§lBeacon: " + C.cGreen + "§l"
|
||||
+ UtilTime.MakeStr(timeLeft));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event != null && event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
ScoreboardWrite();
|
||||
}
|
||||
|
||||
public void ScoreboardWrite()
|
||||
{
|
||||
Scoreboard.Reset();
|
||||
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
//Display Individual Players
|
||||
if (this.GetPlayers(true).size() < 11)
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
Scoreboard.Write(team.GetColor() + player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
//Display Players Alive
|
||||
else
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||
Scoreboard.Write("" + team.GetPlayers(true).size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_beaconEnabled)
|
||||
{
|
||||
for (GameTeam team : this.GetTeamList())
|
||||
{
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
Scoreboard.Write("" + _redScore);
|
||||
else
|
||||
Scoreboard.Write("" + _blueScore + " ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
|
||||
public void AddScore(GameTeam team, int score)
|
||||
{
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
{
|
||||
_redScore = Math.min(_victoryScore, _redScore + score);
|
||||
}
|
||||
else
|
||||
{
|
||||
_blueScore = Math.min(_victoryScore, _blueScore + score);
|
||||
}
|
||||
|
||||
EndCheckScore();
|
||||
}
|
||||
|
||||
public void EndCheckScore()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
GameTeam winner = null;
|
||||
|
||||
if (_redScore >= _victoryScore)
|
||||
winner = GetTeam(ChatColor.RED);
|
||||
else if (_blueScore >= _victoryScore)
|
||||
winner = GetTeam(ChatColor.AQUA);
|
||||
|
||||
if (winner == null)
|
||||
return;
|
||||
|
||||
ScoreboardWrite();
|
||||
|
||||
//Announce
|
||||
AnnounceEnd(winner);
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
AddGems(player, 10, "Winning Team", false);
|
||||
}
|
||||
|
||||
for (Player player : team.GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false);
|
||||
}
|
||||
|
||||
if (EloRanking)
|
||||
{
|
||||
EloTeam teamWinner = new EloTeam();
|
||||
EloTeam teamLoser = new EloTeam();
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||
{
|
||||
for (Player player : WinnerTeam.GetPlayers(false))
|
||||
{
|
||||
EloPlayer eloPlayer = new EloPlayer();
|
||||
eloPlayer.UniqueId = player.getUniqueId().toString();
|
||||
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
|
||||
|
||||
teamWinner.addPlayer(eloPlayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : team.GetPlayers(false))
|
||||
{
|
||||
EloPlayer eloPlayer = new EloPlayer();
|
||||
eloPlayer.UniqueId = player.getUniqueId().toString();
|
||||
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
|
||||
|
||||
teamLoser.addPlayer(eloPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers())
|
||||
{
|
||||
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
|
||||
}
|
||||
|
||||
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers())
|
||||
{
|
||||
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
|
||||
}
|
||||
}
|
||||
|
||||
//End
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
@ -0,0 +1,190 @@
|
||||
package nautilus.game.arcade.game.games.common.dominate_data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.common.TeamDeathmatch;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CapturePointTDM
|
||||
{
|
||||
private TeamDeathmatch Host;
|
||||
|
||||
private String _name;
|
||||
|
||||
//Locations
|
||||
private ArrayList<Block> _floor = new ArrayList<Block>();
|
||||
private ArrayList<Block> _indicators = new ArrayList<Block>();
|
||||
private Location _loc;
|
||||
|
||||
|
||||
private int _indicatorTick = 0;
|
||||
|
||||
private boolean _enabled = false;
|
||||
|
||||
|
||||
public CapturePointTDM(TeamDeathmatch host, String name, Location loc)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
_name = name;
|
||||
|
||||
for (int x=-3 ; x<= 3 ; x++)
|
||||
{
|
||||
for (int z=-3 ; z<= 3 ; z++)
|
||||
{
|
||||
//Indicators
|
||||
if (Math.abs(x) == 3 && Math.abs(z) == 3)
|
||||
{
|
||||
Block ind = loc.getBlock().getRelative(x, 3, z);
|
||||
ind.setType(Material.WOOL);
|
||||
_indicators.add(ind);
|
||||
}
|
||||
|
||||
//Floors
|
||||
if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
|
||||
{
|
||||
|
||||
Block floor = loc.getBlock().getRelative(x, -2, z);
|
||||
floor.setType(Material.WOOL);
|
||||
_floor.add(floor);
|
||||
|
||||
}
|
||||
|
||||
//Glass
|
||||
if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
|
||||
{
|
||||
Block block = loc.getBlock().getRelative(x, -1, z);
|
||||
block.setType(Material.GLASS);
|
||||
}
|
||||
|
||||
//Iron
|
||||
if (Math.abs(x) <= 1 && Math.abs(z) <= 1)
|
||||
{
|
||||
Block block = loc.getBlock().getRelative(x, -3, z);
|
||||
block.setType(Material.IRON_BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Firework
|
||||
_loc = loc;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (_enabled)
|
||||
CaptureUpdate();
|
||||
}
|
||||
|
||||
private void CaptureUpdate()
|
||||
{
|
||||
//Who's on the CP?
|
||||
GameTeam teamA = null;
|
||||
ArrayList<Player> playersA = new ArrayList<Player>();
|
||||
|
||||
GameTeam teamB = null;
|
||||
ArrayList<Player> playersB = new ArrayList<Player>();
|
||||
|
||||
for (GameTeam team : Host.GetTeamList())
|
||||
{
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
if (player.getGameMode() != GameMode.SURVIVAL)
|
||||
continue;
|
||||
|
||||
if (Math.abs(_loc.getX() - player.getLocation().getX()) > 2.5)
|
||||
continue;
|
||||
|
||||
if (Math.abs(_loc.getY() - player.getLocation().getY()) > 2.5)
|
||||
continue;
|
||||
|
||||
if (Math.abs(_loc.getZ() - player.getLocation().getZ()) > 2.5)
|
||||
continue;
|
||||
|
||||
if (teamA == null || teamA.equals(team))
|
||||
{
|
||||
teamA = team;
|
||||
playersA.add(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
teamB = team;
|
||||
playersB.add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Capture
|
||||
if (teamB == null && teamA != null)
|
||||
Capture(teamA, playersA.size(), playersA);
|
||||
|
||||
else if (teamA == null && teamB != null)
|
||||
Capture(teamB, playersB.size(), playersB);
|
||||
|
||||
else if (playersA.size() > playersB.size())
|
||||
Capture(teamA, playersA.size()-playersB.size(), playersA);
|
||||
|
||||
else if (playersB.size() > playersA.size())
|
||||
Capture(teamB, playersB.size()-playersA.size(), playersB);
|
||||
}
|
||||
|
||||
public void Capture(GameTeam team, int count, Collection<Player> capturers)
|
||||
{
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Score Add
|
||||
Host.AddScore(team, 1);
|
||||
|
||||
//Color
|
||||
Color color = Color.BLUE;
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
color = Color.RED;
|
||||
|
||||
Indicate(color);
|
||||
}
|
||||
|
||||
public void Firework(Location loc, Color color, boolean major)
|
||||
{
|
||||
if (!major)
|
||||
UtilFirework.playFirework(loc, FireworkEffect.builder().flicker(false).withColor(color).with(Type.BURST).trail(false).build());
|
||||
else
|
||||
UtilFirework.playFirework(loc, FireworkEffect.builder().flicker(true).withColor(color).with(Type.BALL_LARGE).trail(true).build());
|
||||
}
|
||||
|
||||
public void Indicate(Color color)
|
||||
{
|
||||
//Effect
|
||||
for (Block block : _indicators)
|
||||
if (color == Color.RED)
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 152);
|
||||
else
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 22);
|
||||
|
||||
//for (Block block : _indicators)
|
||||
//Firework(_indicators.get(_indicatorTick).getLocation().add(0.5, 0.5, 0.5), color, false);
|
||||
|
||||
_indicatorTick = (_indicatorTick + 1)%_indicators.size();
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
Block block = _loc.getBlock().getRelative(0, -2, 0);
|
||||
block.setType(Material.BEACON);
|
||||
|
||||
_enabled = true;
|
||||
}
|
||||
}
|
@ -4,9 +4,8 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.common.Domination;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
@ -22,14 +21,14 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class Resupply
|
||||
{
|
||||
private Domination Host;
|
||||
private Game Host;
|
||||
|
||||
private Location _loc;
|
||||
|
||||
private long _time;
|
||||
private Item _ent;
|
||||
|
||||
public Resupply(Domination host, Location loc)
|
||||
public Resupply(Game host, Location loc)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user