Work on achievements
This commit is contained in:
parent
508ef65fcf
commit
05686cb584
@ -1,18 +1,16 @@
|
|||||||
package mineplex.minecraft.game.classcombat.Skill.Brute;
|
package mineplex.minecraft.game.classcombat.Skill.Brute;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.event.*;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
@ -33,6 +31,36 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|||||||
|
|
||||||
public class SeismicSlam extends SkillActive
|
public class SeismicSlam extends SkillActive
|
||||||
{
|
{
|
||||||
|
public static class SeismicSlamEvent extends PlayerEvent
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final List<LivingEntity> _targets;
|
||||||
|
|
||||||
|
public SeismicSlamEvent(Player who, Collection<LivingEntity> targets)
|
||||||
|
{
|
||||||
|
super(who);
|
||||||
|
|
||||||
|
_targets = new ArrayList<>(targets);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LivingEntity> getTargets()
|
||||||
|
{
|
||||||
|
return _targets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
||||||
|
|
||||||
public SeismicSlam(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
public SeismicSlam(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||||
@ -141,6 +169,8 @@ public class SeismicSlam extends SkillActive
|
|||||||
|
|
||||||
//Event
|
//Event
|
||||||
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, targets.keySet()));
|
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, targets.keySet()));
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new SeismicSlamEvent(player, targets.keySet()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package mineplex.minecraft.game.classcombat.Skill.Mage;
|
package mineplex.minecraft.game.classcombat.Skill.Mage;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.*;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
@ -24,9 +23,40 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
public class LightningOrb extends SkillActive implements IThrown
|
public class LightningOrb extends SkillActive implements IThrown
|
||||||
{
|
{
|
||||||
|
public static class LightningOrbEvent extends PlayerEvent
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final List<Player> _struck;
|
||||||
|
|
||||||
|
public LightningOrbEvent(Player who, List<Player> struck)
|
||||||
|
{
|
||||||
|
super(who);
|
||||||
|
|
||||||
|
_struck = struck;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Player> getStruck()
|
||||||
|
{
|
||||||
|
return _struck;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public LightningOrb(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
public LightningOrb(SkillFactory skills, String name, ClassType classType, SkillType skillType,
|
||||||
int cost, int levels,
|
int cost, int levels,
|
||||||
int energy, int energyMod,
|
int energy, int energyMod,
|
||||||
@ -121,6 +151,8 @@ public class LightningOrb extends SkillActive implements IThrown
|
|||||||
Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true);
|
Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Player> struck = new ArrayList<>();
|
||||||
|
|
||||||
//Lightning
|
//Lightning
|
||||||
for (Player cur : hit.keySet())
|
for (Player cur : hit.keySet())
|
||||||
{
|
{
|
||||||
@ -132,6 +164,8 @@ public class LightningOrb extends SkillActive implements IThrown
|
|||||||
|
|
||||||
//Lightning
|
//Lightning
|
||||||
cur.getWorld().strikeLightning(cur.getLocation());
|
cur.getWorld().strikeLightning(cur.getLocation());
|
||||||
|
|
||||||
|
struck.add(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply Conditions
|
//Apply Conditions
|
||||||
@ -142,6 +176,8 @@ public class LightningOrb extends SkillActive implements IThrown
|
|||||||
|
|
||||||
Factory.Condition().Factory().Slow(GetName(), cur, player, 2 + (1 * level), 2, false, true, true, true);
|
Factory.Condition().Factory().Slow(GetName(), cur, player, 2 + (1 * level), 2, false, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -3,13 +3,12 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.*;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.*;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
@ -19,9 +18,40 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
public class Longshot extends Skill
|
public class Longshot extends Skill
|
||||||
{
|
{
|
||||||
|
public static class LongshotHitEvent extends ProjectileHitEvent
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final double _length;
|
||||||
|
|
||||||
|
public LongshotHitEvent(Projectile projectile, double length)
|
||||||
|
{
|
||||||
|
super(projectile);
|
||||||
|
|
||||||
|
_length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getLength()
|
||||||
|
{
|
||||||
|
return _length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>();
|
private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>();
|
||||||
|
|
||||||
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||||
@ -79,6 +109,8 @@ public class Longshot extends Skill
|
|||||||
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
|
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
|
||||||
|
|
||||||
event.AddMod(damager.getName(), GetName(), damage, damage > 0);
|
event.AddMod(damager.getName(), GetName(), damage, damage > 0);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new LongshotHitEvent(projectile, length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package nautilus.game.arcade.game;
|
package nautilus.game.arcade.game;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -898,7 +896,7 @@ public abstract class Game implements Listener
|
|||||||
Manager.GetChat().Silence(5000, false);
|
Manager.GetChat().Silence(5000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AnnounceEnd(ArrayList<Player> places)
|
public void AnnounceEnd(List<Player> places)
|
||||||
{
|
{
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
@ -1074,9 +1072,13 @@ public abstract class Game implements Listener
|
|||||||
if (_stats.get(player).containsKey(stat))
|
if (_stats.get(player).containsKey(stat))
|
||||||
past = _stats.get(player).get(stat);
|
past = _stats.get(player).get(stat);
|
||||||
|
|
||||||
_stats.get(player).put(stat, limitTo1 ? Math.max(1, past + amount) : past + amount);
|
_stats.get(player).put(stat, limitTo1 ? Math.min(1, past + amount) : past + amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract List<Player> getWinners();
|
||||||
|
|
||||||
|
public abstract List<Player> getLosers();
|
||||||
|
|
||||||
public NautHashMap<Player, HashMap<String, Integer>> GetStats()
|
public NautHashMap<Player, HashMap<String, Integer>> GetStats()
|
||||||
{
|
{
|
||||||
return _stats;
|
return _stats;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package nautilus.game.arcade.game;
|
package nautilus.game.arcade.game;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -123,4 +123,38 @@ public abstract class SoloGame extends Game
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Player> getWinners()
|
||||||
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (GetPlayers(true).size() <= 1)
|
||||||
|
{
|
||||||
|
List<Player> places = _players.GetPlacements(true);
|
||||||
|
|
||||||
|
if (places.isEmpty())
|
||||||
|
return Arrays.asList();
|
||||||
|
else
|
||||||
|
return Arrays.asList(places.get(0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Player> getLosers()
|
||||||
|
{
|
||||||
|
List<Player> winners = getWinners();
|
||||||
|
|
||||||
|
if (winners == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<Player> losers = _players.GetPlayers(false);
|
||||||
|
|
||||||
|
losers.removeAll(winners);
|
||||||
|
|
||||||
|
return losers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,75 +1,64 @@
|
|||||||
package nautilus.game.arcade.game;
|
package nautilus.game.arcade.game;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import mineplex.core.common.util.*;
|
||||||
import java.util.Iterator;
|
import mineplex.core.common.util.UtilTime.*;
|
||||||
|
import mineplex.core.updater.*;
|
||||||
|
import mineplex.core.updater.event.*;
|
||||||
|
import nautilus.game.arcade.*;
|
||||||
|
import nautilus.game.arcade.events.*;
|
||||||
|
import nautilus.game.arcade.game.GameTeam.*;
|
||||||
|
import nautilus.game.arcade.kit.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
import java.util.*;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.event.player.PlayerLoginEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
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.TimeUnit;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
|
||||||
import nautilus.game.arcade.GameType;
|
|
||||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
|
||||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
|
||||||
import nautilus.game.arcade.kit.Kit;
|
|
||||||
|
|
||||||
public abstract class TeamGame extends Game
|
public abstract class TeamGame extends Game
|
||||||
{
|
{
|
||||||
protected ArrayList<GameTeam> _places = new ArrayList<GameTeam>();
|
protected ArrayList<GameTeam> _places = new ArrayList<GameTeam>();
|
||||||
|
|
||||||
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
|
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
|
||||||
protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
|
protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
|
||||||
protected NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
|
protected NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
|
||||||
|
|
||||||
protected long RejoinTime = 180000;
|
protected long RejoinTime = 180000;
|
||||||
|
|
||||||
public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
|
public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
|
||||||
{
|
{
|
||||||
super(manager, gameType, kits, gameDesc);
|
super(manager, gameType, kits, gameDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void EndStateChange(PlayerStateChangeEvent event)
|
public void EndStateChange(PlayerStateChangeEvent event)
|
||||||
{
|
{
|
||||||
GameTeam team = this.GetTeam(event.GetPlayer());
|
GameTeam team = this.GetTeam(event.GetPlayer());
|
||||||
if (team == null)
|
if (team == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.GetState() == PlayerState.OUT)
|
if (event.GetState() == PlayerState.OUT)
|
||||||
if (!team.IsTeamAlive())
|
if (!team.IsTeamAlive())
|
||||||
_places.add(0, team);
|
_places.add(0, team);
|
||||||
|
|
||||||
else
|
else
|
||||||
_places.remove(team);
|
_places.remove(team);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<GameTeam> GetPlaces()
|
public ArrayList<GameTeam> GetPlaces()
|
||||||
{
|
{
|
||||||
return _places;
|
return _places;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void PlayerQuit(PlayerQuitEvent event)
|
public void PlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
if (!InProgress())
|
if (!InProgress())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
GameTeam team = GetTeam(player);
|
GameTeam team = GetTeam(player);
|
||||||
if (team == null) return;
|
if (team == null) return;
|
||||||
|
|
||||||
if (!team.IsAlive(player))
|
if (!team.IsAlive(player))
|
||||||
return;
|
return;
|
||||||
@ -84,35 +73,35 @@ public abstract class TeamGame extends Game
|
|||||||
//Store
|
//Store
|
||||||
_rejoinTime.put(player.getName(), System.currentTimeMillis());
|
_rejoinTime.put(player.getName(), System.currentTimeMillis());
|
||||||
RejoinTeam.put(player.getName(), team);
|
RejoinTeam.put(player.getName(), team);
|
||||||
|
|
||||||
if (GetKit(player) != null)
|
if (GetKit(player) != null)
|
||||||
RejoinKit.put(player.getName(), GetKit(player));
|
RejoinKit.put(player.getName(), GetKit(player));
|
||||||
|
|
||||||
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.", false);
|
Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin.", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void PlayerLoginAllow(PlayerLoginEvent event)
|
public void PlayerLoginAllow(PlayerLoginEvent event)
|
||||||
{
|
{
|
||||||
if (!InProgress() || QuitOut)
|
if (!InProgress() || QuitOut)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Rejoined
|
//Rejoined
|
||||||
GameTeam team = RejoinTeam.remove(event.getPlayer().getName());
|
GameTeam team = RejoinTeam.remove(event.getPlayer().getName());
|
||||||
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!", false);
|
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());
|
||||||
if (kit != null)
|
if (kit != null)
|
||||||
_playerKit.put(event.getPlayer(), kit);
|
_playerKit.put(event.getPlayer(), kit);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,11 +137,11 @@ public abstract class TeamGame extends Game
|
|||||||
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!", false);
|
Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!", false);
|
||||||
|
|
||||||
RejoinKit.remove(name);
|
RejoinKit.remove(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void RejoinCommand(PlayerCommandPreprocessEvent event)
|
public void RejoinCommand(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
@ -173,7 +162,7 @@ public abstract class TeamGame extends Game
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
@ -191,13 +180,13 @@ public abstract class TeamGame extends Game
|
|||||||
for (GameTeam team : RejoinTeam.values())
|
for (GameTeam team : RejoinTeam.values())
|
||||||
teamsAlive.add(team);
|
teamsAlive.add(team);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (teamsAlive.size() <= 1)
|
if (teamsAlive.size() <= 1)
|
||||||
{
|
{
|
||||||
//Announce
|
//Announce
|
||||||
if (teamsAlive.size() > 0)
|
if (teamsAlive.size() > 0)
|
||||||
AnnounceEnd(teamsAlive.get(0));
|
AnnounceEnd(teamsAlive.get(0));
|
||||||
|
|
||||||
for (GameTeam team : GetTeamList())
|
for (GameTeam team : GetTeamList())
|
||||||
{
|
{
|
||||||
if (WinnerTeam != null && team.equals(WinnerTeam))
|
if (WinnerTeam != null && team.equals(WinnerTeam))
|
||||||
@ -205,52 +194,78 @@ public abstract class TeamGame extends Game
|
|||||||
for (Player player : team.GetPlayers(false))
|
for (Player player : team.GetPlayers(false))
|
||||||
AddGems(player, 10, "Winning Team", false);
|
AddGems(player, 10, "Winning Team", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : team.GetPlayers(false))
|
for (Player player : team.GetPlayers(false))
|
||||||
if (player.isOnline())
|
if (player.isOnline())
|
||||||
AddGems(player, 10, "Participation", false);
|
AddGems(player, 10, "Participation", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//End
|
//End
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ScoreboardUpdate(UpdateEvent event)
|
public void ScoreboardUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event != null && event.getType() != UpdateType.FAST)
|
if (event != null && event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Scoreboard.Reset();
|
Scoreboard.Reset();
|
||||||
|
|
||||||
for (GameTeam team : this.GetTeamList())
|
for (GameTeam team : this.GetTeamList())
|
||||||
{
|
{
|
||||||
//Display Individual Players
|
//Display Individual Players
|
||||||
if (this.GetPlayers(true).size() < 13)
|
if (this.GetPlayers(true).size() < 13)
|
||||||
{
|
{
|
||||||
if (!team.IsTeamAlive())
|
if (!team.IsTeamAlive())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
for (Player player : team.GetPlayers(true))
|
for (Player player : team.GetPlayers(true))
|
||||||
{
|
{
|
||||||
Scoreboard.Write(team.GetColor() + player.getName());
|
Scoreboard.Write(team.GetColor() + player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Display Players Alive
|
//Display Players Alive
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
|
|
||||||
Scoreboard.Write(team.GetColor() + team.GetName());
|
Scoreboard.Write(team.GetColor() + team.GetName());
|
||||||
Scoreboard.Write(team.GetPlayers(true).size() + "" + team.GetColor() + " Alive");
|
Scoreboard.Write(team.GetPlayers(true).size() + "" + team.GetColor() + " Alive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Player> getWinners()
|
||||||
|
{
|
||||||
|
if (WinnerTeam == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return WinnerTeam.GetPlayers(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Player> getLosers()
|
||||||
|
{
|
||||||
|
if (WinnerTeam == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<Player> players = new ArrayList<>();
|
||||||
|
|
||||||
|
for (GameTeam team : GetTeamList())
|
||||||
|
{
|
||||||
|
if (team != WinnerTeam)
|
||||||
|
players.addAll(team.GetPlayers(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
return players;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1347,4 +1347,9 @@ public class Bridge extends TeamGame implements OreObsfucation
|
|||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBridgesDown()
|
||||||
|
{
|
||||||
|
return _bridgesDown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package nautilus.game.arcade.game.games.survivalgames;
|
||||||
|
|
||||||
|
import org.bukkit.block.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
|
public class SupplyChestOpenEvent extends PlayerEvent
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Block _chest;
|
||||||
|
|
||||||
|
public SupplyChestOpenEvent(Player who, Block chest)
|
||||||
|
{
|
||||||
|
super(who);
|
||||||
|
|
||||||
|
_chest = chest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getChest()
|
||||||
|
{
|
||||||
|
return _chest;
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,11 @@
|
|||||||
package nautilus.game.arcade.game.games.survivalgames;
|
package nautilus.game.arcade.game.games.survivalgames;
|
||||||
|
|
||||||
import java.util.AbstractMap;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import mineplex.core.achievement.*;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.FireworkEffect;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
@ -391,8 +382,8 @@ public class SurvivalGames extends SoloGame
|
|||||||
chest.getBlockInventory().setItem(UtilMath.r(27), GetChestItem(_supplyChests.contains(event.getClickedBlock())));
|
chest.getBlockInventory().setItem(UtilMath.r(27), GetChestItem(_supplyChests.contains(event.getClickedBlock())));
|
||||||
|
|
||||||
_supplyChests.remove(event.getClickedBlock());
|
_supplyChests.remove(event.getClickedBlock());
|
||||||
|
|
||||||
//Manager.GetStatsManager().addStat(event.getPlayer(), GetName(), "chestsOpened", 1);
|
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(event.getPlayer(), event.getClickedBlock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack GetChestItem(boolean superChest)
|
private ItemStack GetChestItem(boolean superChest)
|
||||||
@ -1689,6 +1680,4 @@ public class SurvivalGames extends SoloGame
|
|||||||
|
|
||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,8 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.FireworkEffect;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
@ -394,8 +388,8 @@ public class SurvivalGamesTeams extends TeamGame
|
|||||||
chest.getBlockInventory().setItem(UtilMath.r(27), GetChestItem(_supplyChests.contains(event.getClickedBlock())));
|
chest.getBlockInventory().setItem(UtilMath.r(27), GetChestItem(_supplyChests.contains(event.getClickedBlock())));
|
||||||
|
|
||||||
_supplyChests.remove(event.getClickedBlock());
|
_supplyChests.remove(event.getClickedBlock());
|
||||||
|
|
||||||
//Manager.GetStatsManager().addStat(event.getPlayer(), GetName(), "chestsOpened", 1);
|
Bukkit.getPluginManager().callEvent(new SupplyChestOpenEvent(event.getPlayer(), event.getClickedBlock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack GetChestItem(boolean superChest)
|
private ItemStack GetChestItem(boolean superChest)
|
||||||
|
@ -1,59 +1,78 @@
|
|||||||
package nautilus.game.arcade.kit.perks;
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import mineplex.core.common.util.*;
|
||||||
import java.util.HashSet;
|
import mineplex.core.itemstack.*;
|
||||||
|
import mineplex.core.recharge.*;
|
||||||
|
import mineplex.core.updater.*;
|
||||||
|
import mineplex.core.updater.event.*;
|
||||||
|
import nautilus.game.arcade.kit.*;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.block.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
import org.bukkit.event.block.*;
|
||||||
|
import org.bukkit.event.entity.*;
|
||||||
|
import org.bukkit.event.inventory.*;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import java.util.*;
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.core.common.util.UtilInv;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import nautilus.game.arcade.kit.Perk;
|
|
||||||
|
|
||||||
public class PerkBomber extends Perk
|
public class PerkBomber extends Perk
|
||||||
{
|
{
|
||||||
|
public static class BomberExplodeDiamondBlock extends PlayerEvent
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Block _block;
|
||||||
|
|
||||||
|
public BomberExplodeEntityEvent(Player who, Block block)
|
||||||
|
{
|
||||||
|
super(who);
|
||||||
|
|
||||||
|
_block = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Block getBlock()
|
||||||
|
{
|
||||||
|
return _block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private HashMap<Entity, Player> _tntMap = new HashMap<Entity, Player>();
|
private HashMap<Entity, Player> _tntMap = new HashMap<Entity, Player>();
|
||||||
|
|
||||||
private int _spawnRate;
|
private int _spawnRate;
|
||||||
private int _max;
|
private int _max;
|
||||||
private int _fuse;
|
private int _fuse;
|
||||||
|
|
||||||
public PerkBomber(int spawnRate, int max, int fuse)
|
public PerkBomber(int spawnRate, int max, int fuse)
|
||||||
{
|
{
|
||||||
super("Bomber", new String[]
|
super("Bomber", new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Receive 1 TNT every " + spawnRate + " seconds. Maximum of " + max + ".",
|
C.cGray + "Receive 1 TNT every " + spawnRate + " seconds. Maximum of " + max + ".",
|
||||||
C.cYellow + "Click" + C.cGray + " with TNT to " + C.cGreen + "Throw TNT"
|
C.cYellow + "Click" + C.cGray + " with TNT to " + C.cGreen + "Throw TNT"
|
||||||
});
|
});
|
||||||
|
|
||||||
_spawnRate = spawnRate;
|
_spawnRate = spawnRate;
|
||||||
_max = max;
|
_max = max;
|
||||||
_fuse = fuse;
|
_fuse = fuse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Apply(Player player)
|
public void Apply(Player player)
|
||||||
{
|
{
|
||||||
Recharge.Instance.use(player, GetName(), _spawnRate*1000, false, false);
|
Recharge.Instance.use(player, GetName(), _spawnRate * 1000, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TNTSpawn(UpdateEvent event)
|
public void TNTSpawn(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -64,18 +83,18 @@ public class PerkBomber extends Perk
|
|||||||
{
|
{
|
||||||
if (!Kit.HasKit(cur))
|
if (!Kit.HasKit(cur))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Manager.GetGame().IsAlive(cur))
|
if (!Manager.GetGame().IsAlive(cur))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Recharge.Instance.use(cur, GetName(), _spawnRate*1000, false, false))
|
if (!Recharge.Instance.use(cur, GetName(), _spawnRate * 1000, false, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (UtilInv.contains(cur, Material.TNT, (byte)0, _max))
|
if (UtilInv.contains(cur, Material.TNT, (byte) 0, _max))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Add
|
//Add
|
||||||
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")));
|
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte) 0, 1, F.item("Throwing TNT")));
|
||||||
|
|
||||||
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
|
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
|
||||||
}
|
}
|
||||||
@ -86,8 +105,8 @@ public class PerkBomber extends Perk
|
|||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte)0))
|
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.TNT, (byte) 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Cancel
|
//Cancel
|
||||||
@ -99,11 +118,11 @@ public class PerkBomber extends Perk
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TNTDeathRemove(PlayerDeathEvent event)
|
public void TNTDeathRemove(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
HashSet<org.bukkit.inventory.ItemStack> remove = new HashSet<org.bukkit.inventory.ItemStack>();
|
HashSet<org.bukkit.inventory.ItemStack> remove = new HashSet<org.bukkit.inventory.ItemStack>();
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack item : event.getDrops())
|
for (org.bukkit.inventory.ItemStack item : event.getDrops())
|
||||||
if (UtilInv.IsItem(item, Material.TNT, (byte)0))
|
if (UtilInv.IsItem(item, Material.TNT, (byte) 0))
|
||||||
remove.add(item);
|
remove.add(item);
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack item : remove)
|
for (org.bukkit.inventory.ItemStack item : remove)
|
||||||
@ -113,57 +132,84 @@ public class PerkBomber extends Perk
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void TNTInvClick(InventoryClickEvent event)
|
public void TNTInvClick(InventoryClickEvent event)
|
||||||
{
|
{
|
||||||
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte)0, true);
|
UtilInv.DisallowMovementOf(event, "Throwing TNT", Material.TNT, (byte) 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void TNTThrow(PlayerInteractEvent event)
|
public void TNTThrow(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
|
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
|
||||||
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
|
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte)0))
|
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Kit.HasKit(player))
|
if (!Kit.HasKit(player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if (!Manager.GetGame().CanThrowTNT(player.getLocation()))
|
if (!Manager.GetGame().CanThrowTNT(player.getLocation()))
|
||||||
{
|
{
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throwing TNT") + " here."));
|
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot use " + F.item("Throwing TNT") + " here."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilInv.remove(player, Material.TNT, (byte)0, 1);
|
UtilInv.remove(player, Material.TNT, (byte) 0, 1);
|
||||||
UtilInv.Update(player);
|
UtilInv.Update(player);
|
||||||
|
|
||||||
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
||||||
|
|
||||||
if (_fuse != -1)
|
if (_fuse != -1)
|
||||||
tnt.setFuseTicks(_fuse);
|
tnt.setFuseTicks(_fuse);
|
||||||
|
|
||||||
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false);
|
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false);
|
||||||
|
|
||||||
_tntMap.put(tnt, player);
|
_tntMap.put(tnt, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ExplosionPrime(ExplosionPrimeEvent event)
|
public void ExplosionPrime(ExplosionPrimeEvent event)
|
||||||
{
|
{
|
||||||
if (!_tntMap.containsKey(event.getEntity()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = _tntMap.remove(event.getEntity());
|
Player player = _tntMap.remove(event.getEntity());
|
||||||
|
if (player != null)
|
||||||
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
|
|
||||||
{
|
{
|
||||||
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
|
for (Player other : UtilPlayer.getNearby(event.getEntity().getLocation(), 14))
|
||||||
|
{
|
||||||
|
Manager.GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onEntityExplode(EntityExplodeEvent event)
|
||||||
|
{
|
||||||
|
Player player = _tntMap.remove(event.getEntity());
|
||||||
|
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
for (Iterator<Block> it = event.blockList().iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
Block block = it.next();
|
||||||
|
|
||||||
|
if (block.getType() == Material.DIAMOND_ORE)
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
|
||||||
|
if (Math.random() < event.getYield())
|
||||||
|
{
|
||||||
|
block.breakNaturally();
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new BomberExplodeDiamondBlock(player, block));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,48 +1,66 @@
|
|||||||
package nautilus.game.arcade.kit.perks;
|
package nautilus.game.arcade.kit.perks;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import mineplex.core.common.util.*;
|
||||||
import java.util.HashMap;
|
import mineplex.core.updater.*;
|
||||||
import java.util.Iterator;
|
import mineplex.core.updater.event.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
import org.bukkit.Location;
|
import mineplex.minecraft.game.core.damage.*;
|
||||||
|
import nautilus.game.arcade.kit.*;
|
||||||
|
import net.minecraft.server.v1_7_R4.*;
|
||||||
|
import org.bukkit.*;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.*;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftSkeleton;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.event.*;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.event.entity.*;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.player.*;
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import java.util.*;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
import nautilus.game.arcade.kit.Perk;
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_7_R4.Navigation;
|
|
||||||
|
|
||||||
public class PerkSkeletons extends Perk
|
public class PerkSkeletons extends Perk
|
||||||
{
|
{
|
||||||
|
public static class MinionSpawnEvent extends PlayerEvent
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final PerkSkeletons _perkSkeletons;
|
||||||
|
|
||||||
|
public MinionSpawnEvent(Player who, PerkSkeletons perkSkeletons)
|
||||||
|
{
|
||||||
|
super(who);
|
||||||
|
|
||||||
|
_perkSkeletons = perkSkeletons;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return getHandlerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PerkSkeletons getPerkSkeletons()
|
||||||
|
{
|
||||||
|
return _perkSkeletons;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private HashMap<Player, ArrayList<Skeleton>> _minions = new HashMap<Player, ArrayList<Skeleton>>();
|
private HashMap<Player, ArrayList<Skeleton>> _minions = new HashMap<Player, ArrayList<Skeleton>>();
|
||||||
|
|
||||||
private boolean _name;
|
private boolean _name;
|
||||||
private int _maxDist = 8;
|
private int _maxDist = 8;
|
||||||
|
|
||||||
public PerkSkeletons(boolean name)
|
public PerkSkeletons(boolean name)
|
||||||
{
|
{
|
||||||
super("Skeleton Minons", new String[]
|
super("Skeleton Minons", new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Killing an opponent summons a skeletal minion."
|
C.cGray + "Killing an opponent summons a skeletal minion."
|
||||||
});
|
});
|
||||||
|
|
||||||
_name = name;
|
_name = name;
|
||||||
@ -64,7 +82,7 @@ public class PerkSkeletons extends Perk
|
|||||||
if (!Kit.HasKit(killer))
|
if (!Kit.HasKit(killer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player killed = (Player)event.GetEvent().getEntity();
|
Player killed = (Player) event.GetEvent().getEntity();
|
||||||
|
|
||||||
Manager.GetGame().CreatureAllowOverride = true;
|
Manager.GetGame().CreatureAllowOverride = true;
|
||||||
Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class);
|
Skeleton skel = killer.getWorld().spawn(killed.getLocation(), Skeleton.class);
|
||||||
@ -105,6 +123,8 @@ public class PerkSkeletons extends Perk
|
|||||||
_minions.get(killer).add(skel);
|
_minions.get(killer).add(skel);
|
||||||
|
|
||||||
killer.playSound(killer.getLocation(), Sound.SKELETON_HURT, 1f, 1f);
|
killer.playSound(killer.getLocation(), Sound.SKELETON_HURT, 1f, 1f);
|
||||||
|
|
||||||
|
Bukkit.getPluginManager().callEvent(new MinionSpawnEvent(killer, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -124,7 +144,7 @@ public class PerkSkeletons extends Perk
|
|||||||
{
|
{
|
||||||
if (UtilMath.offset(skel, player) > _maxDist)
|
if (UtilMath.offset(skel, player) > _maxDist)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,11 +170,11 @@ public class PerkSkeletons extends Perk
|
|||||||
{
|
{
|
||||||
skelIterator.remove();
|
skelIterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return to Owner
|
//Return to Owner
|
||||||
double range = 4;
|
double range = 4;
|
||||||
if (skel.getTarget() != null || ((CraftSkeleton)skel).getHandle().getGoalTarget() != null)
|
if (skel.getTarget() != null || ((CraftSkeleton) skel).getHandle().getGoalTarget() != null)
|
||||||
{
|
{
|
||||||
range = _maxDist;
|
range = _maxDist;
|
||||||
}
|
}
|
||||||
@ -168,12 +188,12 @@ public class PerkSkeletons extends Perk
|
|||||||
//Move
|
//Move
|
||||||
Location target = skel.getLocation().add(UtilAlg.getTrajectory(skel, player).multiply(3));
|
Location target = skel.getLocation().add(UtilAlg.getTrajectory(skel, player).multiply(3));
|
||||||
|
|
||||||
EntityCreature ec = ((CraftCreature)skel).getHandle();
|
EntityCreature ec = ((CraftCreature) skel).getHandle();
|
||||||
Navigation nav = ec.getNavigation();
|
Navigation nav = ec.getNavigation();
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), speed);
|
nav.a(target.getX(), target.getY(), target.getZ(), speed);
|
||||||
|
|
||||||
skel.setTarget(null);
|
skel.setTarget(null);
|
||||||
((CraftSkeleton)skel).getHandle().setGoalTarget(null);
|
((CraftSkeleton) skel).getHandle().setGoalTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +210,7 @@ public class PerkSkeletons extends Perk
|
|||||||
for (Skeleton skel : skels)
|
for (Skeleton skel : skels)
|
||||||
{
|
{
|
||||||
if (skel.getHealth() > 0)
|
if (skel.getHealth() > 0)
|
||||||
skel.setHealth(Math.min(skel.getMaxHealth(), skel.getHealth()+1));
|
skel.setHealth(Math.min(skel.getMaxHealth(), skel.getHealth() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,18 +251,18 @@ public class PerkSkeletons extends Perk
|
|||||||
|
|
||||||
if (event.GetDamagerEntity(true) instanceof Skeleton)
|
if (event.GetDamagerEntity(true) instanceof Skeleton)
|
||||||
{
|
{
|
||||||
Skeleton skel = (Skeleton)event.GetDamagerEntity(true);
|
Skeleton skel = (Skeleton) event.GetDamagerEntity(true);
|
||||||
|
|
||||||
if (skel.getEquipment().getItemInHand() != null)
|
if (skel.getEquipment().getItemInHand() != null)
|
||||||
{
|
{
|
||||||
if (skel.getEquipment().getItemInHand().getType() == Material.STONE_SWORD) damage = 5;
|
if (skel.getEquipment().getItemInHand().getType() == Material.STONE_SWORD) damage = 5;
|
||||||
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_SWORD) damage = 6;
|
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_SWORD) damage = 6;
|
||||||
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_SWORD) damage = 6;
|
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_SWORD) damage = 6;
|
||||||
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_SWORD) damage = 7;
|
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_SWORD) damage = 7;
|
||||||
|
|
||||||
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_AXE) damage = 5;
|
else if (skel.getEquipment().getItemInHand().getType() == Material.IRON_AXE) damage = 5;
|
||||||
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_AXE) damage = 5;
|
else if (skel.getEquipment().getItemInHand().getType() == Material.GOLD_AXE) damage = 5;
|
||||||
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_AXE) damage = 6;
|
else if (skel.getEquipment().getItemInHand().getType() == Material.DIAMOND_AXE) damage = 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,18 +272,23 @@ public class PerkSkeletons extends Perk
|
|||||||
event.AddMod("Skeleton Minion", "Negate", -event.GetDamageInitial(), false);
|
event.AddMod("Skeleton Minion", "Negate", -event.GetDamageInitial(), false);
|
||||||
event.AddMod("Skeleton Minion", "Damage", damage, false);
|
event.AddMod("Skeleton Minion", "Damage", damage, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerDeath(PlayerDeathEvent event)
|
public void PlayerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
ArrayList<Skeleton> skels = _minions.remove(event.getEntity());
|
ArrayList<Skeleton> skels = _minions.remove(event.getEntity());
|
||||||
|
|
||||||
if (skels == null)
|
if (skels == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Skeleton skel : skels)
|
for (Skeleton skel : skels)
|
||||||
skel.remove();
|
skel.remove();
|
||||||
|
|
||||||
skels.clear();
|
skels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Skeleton> getSkeletons(Player player)
|
||||||
|
{
|
||||||
|
return _minions.get(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class AssistsStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public AssistsStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
for (CombatComponent log : event.GetLog().GetAttackers())
|
||||||
|
{
|
||||||
|
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Player player = UtilPlayer.searchExact(log.GetName());
|
||||||
|
|
||||||
|
getGame().AddStat(player, "Assists", 1, false, false);
|
||||||
|
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Assists", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
|
import nautilus.game.arcade.game.games.bridge.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
import org.bukkit.event.entity.*;
|
||||||
|
|
||||||
|
public class BridgesSniperStatTracker extends StatTracker<Bridge>
|
||||||
|
{
|
||||||
|
public BridgesSniperStatTracker(Bridge game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
if (getGame().isBridgesDown())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.GetLog().GetKiller() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetKiller().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||||
|
if (killer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.GetLog().GetPlayer() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetPlayer().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (player.getLastDamageCause() instanceof EntityDamageByEntityEvent)
|
||||||
|
{
|
||||||
|
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause();
|
||||||
|
|
||||||
|
if (edbee.getDamager() instanceof Arrow)
|
||||||
|
getGame().AddStat(killer, "Sniper", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.core.damage.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class DamageDealtStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public DamageDealtStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCustomDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
Player damager = event.GetDamagerPlayer(false);
|
||||||
|
if (damager == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
getGame().AddStat(damager, "Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||||
|
getGame().AddStat(damager, getGame().GetKit(damager).GetName() + " Damage Dealt", (int) Math.round(event.GetDamage()), false, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.core.damage.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class DamageTakenStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public DamageTakenStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCustomDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
Player damagee = event.GetDamageePlayer();
|
||||||
|
if (damagee == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
getGame().AddStat(damagee, "Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||||
|
getGame().AddStat(damagee, getGame().GetKit(damagee).GetName() + " Damage Taken", (int) Math.round(event.GetDamage()), false, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class DeathsStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public DeathsStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetLog().GetPlayer() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetPlayer().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
getGame().AddStat(player, "Deaths", 1, false, false);
|
||||||
|
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Deaths", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Mage.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class ElectrocutionStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public ElectrocutionStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onLightningOrb(LightningOrb.LightningOrbEvent event)
|
||||||
|
{
|
||||||
|
if (event.getStruck().size() >= 4)
|
||||||
|
getGame().AddStat(event.getPlayer(), "MassElectrocution", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import nautilus.game.arcade.game.games.survivalgames.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class FirstSupplyDropOpenStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
private boolean first = true;
|
||||||
|
|
||||||
|
public FirstSupplyDropOpenStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onSupplyChestOpen(SupplyChestOpenEvent event)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
getGame().AddStat(event.getPlayer(), "SupplyDropsOpened", 1, false, false);
|
||||||
|
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
|
import nautilus.game.arcade.events.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class KillAllOpposingStatTracker extends StatTracker<TeamGame>
|
||||||
|
{
|
||||||
|
private final Map<UUID, Set<UUID>> _kills = new HashMap<>();
|
||||||
|
|
||||||
|
public KillAllOpposingStatTracker(TeamGame game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetLog().GetKiller() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetKiller().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||||
|
if (killer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.GetLog().GetPlayer() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetPlayer().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player killed = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||||
|
if (killed == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Set<UUID> kills = _kills.get(killer.getUniqueId());
|
||||||
|
if (kills == null)
|
||||||
|
{
|
||||||
|
kills = new HashSet<>();
|
||||||
|
_kills.put(killer.getUniqueId(), kills);
|
||||||
|
}
|
||||||
|
|
||||||
|
kills.add(killed.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onGameStateChange(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() == Game.GameState.End)
|
||||||
|
{
|
||||||
|
for (GameTeam team : getGame().GetTeamList())
|
||||||
|
{
|
||||||
|
for (Player player : team.GetPlayers(false))
|
||||||
|
{
|
||||||
|
Set<UUID> kills = _kills.get(player.getUniqueId());
|
||||||
|
if (kills == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (GameTeam otherTeam : getGame().GetTeamList())
|
||||||
|
{
|
||||||
|
if (otherTeam == team)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
boolean killedAll = true;
|
||||||
|
|
||||||
|
for (Player otherPlayer : otherTeam.GetPlayers(true))
|
||||||
|
{
|
||||||
|
if (!kills.contains(otherPlayer.getUniqueId()))
|
||||||
|
{
|
||||||
|
killedAll = false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (killedAll)
|
||||||
|
getGame().AddStat(player, "Ace", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class KillsStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public KillsStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetLog().GetKiller() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetKiller().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
getGame().AddStat(player, "Kills", 1, false, false);
|
||||||
|
getGame().AddStat(player, getGame().GetKit(player).GetName() + " Kills", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.*;
|
||||||
|
import mineplex.minecraft.game.core.combat.event.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class KillsWithinTimeLimitStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
private final int _killCount;
|
||||||
|
private final int _timeLimit;
|
||||||
|
|
||||||
|
private final Map<UUID, Integer> _kills = new HashMap<>();
|
||||||
|
|
||||||
|
public KillsWithinTimeLimitStatTracker(Game game, int killCount, int timeLimit)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
|
||||||
|
_killCount = killCount;
|
||||||
|
_timeLimit = timeLimit * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKillCount()
|
||||||
|
{
|
||||||
|
return _killCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTimeLimit()
|
||||||
|
{
|
||||||
|
return _timeLimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onCombatDeath(CombatDeathEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetLog().GetKiller() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.GetLog().GetKiller().IsPlayer())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Integer killCount = _kills.get(player.getUniqueId());
|
||||||
|
|
||||||
|
killCount = (killCount == null ? 0 : killCount) + 1;
|
||||||
|
|
||||||
|
_kills.put(player.getUniqueId(), killCount);
|
||||||
|
|
||||||
|
if (killCount == getKillCount() && System.currentTimeMillis() - getGame().GetStateTime() < getTimeLimit())
|
||||||
|
getGame().AddStat(player, "Bloodlust", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Ranger.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class LongshotStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public LongshotStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onLongshotHit(Longshot.LongshotHitEvent event)
|
||||||
|
{
|
||||||
|
if (event.getLength() >= 64 && event.getEntity().getShooter() instanceof Player)
|
||||||
|
getGame().AddStat((Player) event.getEntity().getShooter(), "TheLongestShot", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.events.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class LoseStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public LoseStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onGameStateChange(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() == Game.GameState.End)
|
||||||
|
{
|
||||||
|
List<Player> losers = getGame().getLosers();
|
||||||
|
|
||||||
|
if (losers != null)
|
||||||
|
{
|
||||||
|
for (Player loser : losers)
|
||||||
|
{
|
||||||
|
getGame().AddStat(loser, "Losses", 1, false, false);
|
||||||
|
getGame().AddStat(loser, getGame().GetKit(loser).GetName() + " Losses", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Brute.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class SeismicSlamStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public SeismicSlamStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onLongshotHit(SeismicSlam.SeismicSlamEvent event)
|
||||||
|
{
|
||||||
|
if (event.getTargets().size() >= 5)
|
||||||
|
getGame().AddStat(event.getPlayer(), "Earthquake", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import nautilus.game.arcade.kit.perks.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class SimultaneousSkeletonStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
private final int _requiredCount;
|
||||||
|
|
||||||
|
public SimultaneousSkeletonStatTracker(Game game, int requiredCount)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
|
||||||
|
_requiredCount = requiredCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMinionSpawn(PerkSkeletons.MinionSpawnEvent event)
|
||||||
|
{
|
||||||
|
List<Skeleton> skeletons = event.getPerkSkeletons().getSkeletons(event.getPlayer());
|
||||||
|
|
||||||
|
if (skeletons != null)
|
||||||
|
{
|
||||||
|
int aliveCount = 0;
|
||||||
|
|
||||||
|
for (Skeleton skeleton : skeletons)
|
||||||
|
{
|
||||||
|
if (!skeleton.isDead())
|
||||||
|
aliveCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aliveCount >= getRequiredCount())
|
||||||
|
getGame().AddStat(event.getPlayer(), "Skeletons", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRequiredCount()
|
||||||
|
{
|
||||||
|
return _requiredCount;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class StatTracker<G extends Game> implements Listener
|
||||||
|
{
|
||||||
|
private final G game;
|
||||||
|
|
||||||
|
public StatTracker(G game)
|
||||||
|
{
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
|
public G getGame()
|
||||||
|
{
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import nautilus.game.arcade.kit.perks.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class TntMinerStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public TntMinerStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onEntityExplode(PerkBomber.BomberExplodeDiamondBlock event)
|
||||||
|
{
|
||||||
|
getGame().AddStat(event.getPlayer(), "FortuneBomber", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.events.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class WinStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
public WinStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onGameStateChange(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() == Game.GameState.End)
|
||||||
|
{
|
||||||
|
List<Player> winners = getGame().getWinners();
|
||||||
|
|
||||||
|
if (winners != null)
|
||||||
|
{
|
||||||
|
for (Player winner : winners)
|
||||||
|
{
|
||||||
|
getGame().AddStat(winner, "Wins", 1, false, false);
|
||||||
|
getGame().AddStat(winner, getGame().GetKit(winner).GetName() + " Wins", 1, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import nautilus.game.arcade.events.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
|
||||||
|
public class WinWithoutLosingTeammateStatTracker extends StatTracker<TeamGame>
|
||||||
|
{
|
||||||
|
public WinWithoutLosingTeammateStatTracker(TeamGame game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onGameStateChange(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() == Game.GameState.End)
|
||||||
|
{
|
||||||
|
GameTeam winner = getGame().WinnerTeam;
|
||||||
|
|
||||||
|
if (winner.GetPlayers(true).size() == winner.GetPlayers(false).size())
|
||||||
|
{
|
||||||
|
for (Player player : winner.GetPlayers(true))
|
||||||
|
getGame().AddStat(player, "FlawlessVictory", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package nautilus.game.arcade.stats;
|
||||||
|
|
||||||
|
import mineplex.core.updater.*;
|
||||||
|
import mineplex.core.updater.event.*;
|
||||||
|
import nautilus.game.arcade.events.*;
|
||||||
|
import nautilus.game.arcade.game.*;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.*;
|
||||||
|
import org.bukkit.inventory.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class WinWithoutWearingArmorStatTracker extends StatTracker<Game>
|
||||||
|
{
|
||||||
|
private final Set<UUID> _armorWearers = new HashSet<>();
|
||||||
|
|
||||||
|
public WinWithoutWearingArmorStatTracker(Game game)
|
||||||
|
{
|
||||||
|
super(game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() == UpdateType.TICK && getGame().GetState() == Game.GameState.Live)
|
||||||
|
{
|
||||||
|
for (Player player : getGame().GetPlayers(true))
|
||||||
|
{
|
||||||
|
if (_armorWearers.contains(player.getUniqueId()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (ItemStack armor : player.getInventory().getArmorContents())
|
||||||
|
{
|
||||||
|
if (armor != null && armor.getType() != Material.AIR)
|
||||||
|
{
|
||||||
|
_armorWearers.add(player.getUniqueId());
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||||
|
public void onGameStateChange(GameStateChangeEvent event)
|
||||||
|
{
|
||||||
|
if (event.GetState() == Game.GameState.End)
|
||||||
|
{
|
||||||
|
List<Player> winners = getGame().getWinners();
|
||||||
|
|
||||||
|
if (winners != null)
|
||||||
|
{
|
||||||
|
for (Player winner : winners)
|
||||||
|
{
|
||||||
|
if (!_armorWearers.contains(winner.getUniqueId()))
|
||||||
|
getGame().AddStat(winner, "NoArmor", 1, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user