From 4afafe2d51aa11622d1d9248e716d7c5dc66ca2e Mon Sep 17 00:00:00 2001 From: CoderTim Date: Fri, 22 Aug 2014 21:54:08 -0400 Subject: [PATCH 01/17] Some stats fixes --- .../game/games/castlesiege/CastleSiege.java | 15 ++++- .../games/champions/ChampionsDominate.java | 2 + .../game/games/champions/ChampionsTDM.java | 4 +- .../arcade/game/games/hideseek/HideSeek.java | 2 + .../arcade/stats/BackstabKillStatTracker.java | 43 ++++++++++++++ .../stats/TheLongestShotStatTracker.java | 56 +++++++++++++++++++ 6 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java index 76265b22d..666ec9202 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java @@ -68,7 +68,9 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.stats.AssistsStatTracker; import nautilus.game.arcade.stats.BloodThirstyStatTracker; +import nautilus.game.arcade.stats.KingDamageStatTracker; import nautilus.game.arcade.stats.KingSlayerStatTracker; +import nautilus.game.arcade.stats.WinAsTeamStatTracker; public class CastleSiege extends TeamGame { @@ -190,10 +192,21 @@ public class CastleSiege extends TeamGame _kingName = C.cYellow + C.Bold + "King Sparklez"; + GameTeam notRedTeam = null; + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() != ChatColor.RED) + { + notRedTeam = team; + break; + } + } + registerStatTrackers( + new WinAsTeamStatTracker(this, notRedTeam, "ForTheKing"), new KingSlayerStatTracker(this), new BloodThirstyStatTracker(this), - new AssistsStatTracker(this) + new KingDamageStatTracker(this) ); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index 65ef7a591..4b2aefcfb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -15,6 +15,7 @@ import nautilus.game.arcade.game.games.common.Domination; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker; +import nautilus.game.arcade.stats.TheLongestShotStatTracker; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -56,6 +57,7 @@ public class ChampionsDominate extends Domination registerStatTrackers( new ElectrocutionStatTracker(this), + new TheLongestShotStatTracker(this), new SeismicSlamStatTracker(this) ); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index 5d9b7da24..14aa8629e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -20,6 +20,7 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.KillAllOpposingStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker; +import nautilus.game.arcade.stats.TheLongestShotStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; public class ChampionsTDM extends TeamDeathmatch @@ -48,7 +49,7 @@ public class ChampionsTDM extends TeamDeathmatch "Gold/Iron Weapons deal 6 damage", "Diamond Weapons deal 7 damage", - }; + }; this.Manager.GetDamage().UseSimpleWeaponDamage = false; @@ -56,6 +57,7 @@ public class ChampionsTDM extends TeamDeathmatch new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new KillAllOpposingStatTracker(this), new ElectrocutionStatTracker(this), + new TheLongestShotStatTracker(this), new SeismicSlamStatTracker(this) ); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 544300428..71cd76af2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -81,6 +81,7 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.stats.BadHiderStatTracker; import nautilus.game.arcade.stats.HunterKillerStatTracker; +import nautilus.game.arcade.stats.HunterOfTheYearStatTracker; import nautilus.game.arcade.stats.MeowStatTracker; import net.minecraft.server.v1_7_R4.EntityCreature; @@ -213,6 +214,7 @@ public class HideSeek extends TeamGame new HunterKillerStatTracker(this), new MeowStatTracker(this), new HunterKillerStatTracker(this), + new HunterOfTheYearStatTracker(this), new BadHiderStatTracker(this) ); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java new file mode 100644 index 000000000..dd3dc7e77 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java @@ -0,0 +1,43 @@ +package nautilus.game.arcade.stats; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.Game; + +public class BackstabKillStatTracker extends StatTracker +{ + public BackstabKillStatTracker(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 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 (event.GetLog().GetLastDamager().) + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java new file mode 100644 index 000000000..a3daf2bf7 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java @@ -0,0 +1,56 @@ +package nautilus.game.arcade.stats; + +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageByEntityEvent; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.Game; + +public class TheLongestShotStatTracker extends StatTracker +{ + public TheLongestShotStatTracker(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 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) + { + Arrow arrow = (Arrow) edbee.getDamager(); + + if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64) + getGame().AddStat(killer, "TheLongestShot", 1, false, false); + } + } + } +} From fb90336d4e83334678bf941ad0381b511f1e4ddc Mon Sep 17 00:00:00 2001 From: CoderTim Date: Sat, 23 Aug 2014 16:00:15 -0400 Subject: [PATCH 02/17] Finished stats/achievements --- .../classcombat/Skill/Ranger/Longshot.java | 32 -------------- .../game/arcade/game/games/bridge/Bridge.java | 2 + .../games/champions/ChampionsDominate.java | 2 + .../game/games/champions/ChampionsTDM.java | 2 + .../arcade/stats/BackstabKillStatTracker.java | 34 +++++++++++++- .../stats/FoodForTheMassesStatTracker.java | 44 +++++++++++++++++++ .../stats/TheLongestShotStatTracker.java | 17 ++++--- 7 files changed, 93 insertions(+), 40 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FoodForTheMassesStatTracker.java diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java index 321ca83d8..09921f957 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java @@ -22,36 +22,6 @@ import org.bukkit.event.player.*; 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 _arrows = new HashMap(); public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) @@ -109,8 +79,6 @@ public class Longshot extends Skill double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3); event.AddMod(damager.getName(), GetName(), damage, damage > 0); - - Bukkit.getPluginManager().callEvent(new LongshotHitEvent(projectile, length)); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index bfe10ef35..a4da92276 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -63,6 +63,7 @@ import nautilus.game.arcade.ore.OreObsfucation; import nautilus.game.arcade.stats.BridgesSniperStatTracker; import nautilus.game.arcade.stats.DeathBomberStatTracker; import nautilus.game.arcade.stats.FastKillsStatTracker; +import nautilus.game.arcade.stats.FoodForTheMassesStatTracker; import nautilus.game.arcade.stats.TntMinerStatTracker; public class Bridge extends TeamGame implements OreObsfucation @@ -180,6 +181,7 @@ public class Bridge extends TeamGame implements OreObsfucation _tournament = Manager.IsTournamentServer(); registerStatTrackers( + new FoodForTheMassesStatTracker(this), new BridgesSniperStatTracker(this), new TntMinerStatTracker(this), new FastKillsStatTracker(this, 4, 10, "Rampage"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index 4b2aefcfb..bc9bc0eec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -13,6 +13,7 @@ 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.Domination; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.stats.BackstabKillStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.TheLongestShotStatTracker; @@ -56,6 +57,7 @@ public class ChampionsDominate extends Domination EloStart = 1000; registerStatTrackers( + new BackstabKillStatTracker(this), new ElectrocutionStatTracker(this), new TheLongestShotStatTracker(this), new SeismicSlamStatTracker(this) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index 14aa8629e..88bd67b53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -17,6 +17,7 @@ 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; +import nautilus.game.arcade.stats.BackstabKillStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.KillAllOpposingStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker; @@ -56,6 +57,7 @@ public class ChampionsTDM extends TeamDeathmatch registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new KillAllOpposingStatTracker(this), + new BackstabKillStatTracker(this), new ElectrocutionStatTracker(this), new TheLongestShotStatTracker(this), new SeismicSlamStatTracker(this) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java index dd3dc7e77..f9724ec07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/BackstabKillStatTracker.java @@ -1,15 +1,24 @@ package nautilus.game.arcade.stats; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; public class BackstabKillStatTracker extends StatTracker { + private final Map> _hasDamaged = new HashMap<>(); + public BackstabKillStatTracker(Game game) { super(game); @@ -38,6 +47,29 @@ public class BackstabKillStatTracker extends StatTracker if (player == null) return; - if (event.GetLog().GetLastDamager().) + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Backstab")) + { + Set hasDamaged = _hasDamaged.get(player.getUniqueId()); + + if (hasDamaged == null || !hasDamaged.contains(killer.getUniqueId())) + getGame().AddStat(killer, "Assassination", 1, false, false); + } + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCustomDamage(CustomDamageEvent event) + { + if (event.GetDamageePlayer() != null && event.GetDamagerPlayer(true) != null) + { + Set hasDamaged = _hasDamaged.get(event.GetDamagerPlayer(true).getUniqueId()); + + if (hasDamaged == null) + { + hasDamaged = new HashSet<>(); + _hasDamaged.put(event.GetDamagerPlayer(true).getUniqueId(), hasDamaged); + } + + hasDamaged.add(event.GetDamageePlayer().getUniqueId()); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FoodForTheMassesStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FoodForTheMassesStatTracker.java new file mode 100644 index 000000000..187ebba28 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/FoodForTheMassesStatTracker.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.stats; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.Game; + +public class FoodForTheMassesStatTracker extends StatTracker +{ + public FoodForTheMassesStatTracker(Game game) + { + super(game); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCombatDeathEvent(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 player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + if (player == null) + return; + + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("Apple Thrower")) + getGame().AddStat(killer, "FoodForTheMasses", 1, false, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java index a3daf2bf7..39507e4c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/TheLongestShotStatTracker.java @@ -40,16 +40,19 @@ public class TheLongestShotStatTracker extends StatTracker if (player == null) return; - if (player.getLastDamageCause() instanceof EntityDamageByEntityEvent) + if (event.GetLog().GetLastDamager().GetReason() != null && event.GetLog().GetLastDamager().GetReason().equalsIgnoreCase("longshot")) { - EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause(); - - if (edbee.getDamager() instanceof Arrow) + if (player.getLastDamageCause() instanceof EntityDamageByEntityEvent) { - Arrow arrow = (Arrow) edbee.getDamager(); + EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) player.getLastDamageCause(); - if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64) - getGame().AddStat(killer, "TheLongestShot", 1, false, false); + if (edbee.getDamager() instanceof Arrow) + { + Arrow arrow = (Arrow) edbee.getDamager(); + + if (arrow.getShooter() == killer && killer.getLocation().distanceSquared(player.getLocation()) <= 64 * 64) + getGame().AddStat(killer, "TheLongestShot", 1, false, false); + } } } } From 3f5cff3e21f096d58766f005a34cc99e4c46b144 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sun, 24 Aug 2014 16:45:47 +1000 Subject: [PATCH 03/17] Killing cheaters for a few things in bridges --- .../src/mineplex/mapparser/MapParser.java | 4 +- .../src/nautilus/game/arcade/game/Game.java | 3 + .../game/arcade/game/games/bridge/Bridge.java | 110 +++++++++++++++--- .../arcade/game/games/quiver/QuiverTeams.java | 2 +- 4 files changed, 98 insertions(+), 21 deletions(-) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index 7eb7427da..249baf3b0 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -287,9 +287,9 @@ public class MapParser extends JavaPlugin implements Listener for (Player player : UtilServer.getPlayers()) { player.sendMessage(C.cGold + msg); - - System.out.println("[Announce] " + msg); } + + System.out.println("[Announce] " + msg); } public boolean DoesMapExist(String mapName, GameType gameType) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 8a71d61f6..92257bfee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -680,6 +680,9 @@ public abstract class Game implements Listener public GameTeam GetTeam(Player player) { + if (player == null) + return null; + for (GameTeam team : _teamList) if (team.HasPlayer(player)) return team; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index bfe10ef35..277256c28 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -39,6 +39,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; @@ -48,6 +49,7 @@ import mineplex.core.itemstack.ItemStackFactory; 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.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -343,24 +345,7 @@ public class Bridge extends TeamGame implements OreObsfucation } } - @EventHandler - public void ChestDeny(BlockBreakEvent event) - { - if (_bridgesDown) - return; - - if (event.getBlock().getType() != Material.CHEST) - return; - - for (Location loc : WorldData.GetCustomLocs("54")) - { - if (loc.getBlock().equals(event.getBlock())) - { - event.setCancelled(true); - return; - } - } - } + private void ParseOre(ArrayList teamOre) { @@ -1038,6 +1023,8 @@ public class Bridge extends TeamGame implements OreObsfucation blockIterator.remove(); } } + + @EventHandler(priority = EventPriority.LOW) public void BucketEmpty(PlayerBucketEmptyEvent event) @@ -1363,4 +1350,91 @@ public class Bridge extends TeamGame implements OreObsfucation { return _bridgesDown; } + + @EventHandler + public void CheatChestBreak(BlockBreakEvent event) + { + if (_bridgesDown) + return; + + if (event.getBlock().getType() != Material.CHEST) + return; + + for (Location loc : WorldData.GetCustomLocs("54")) + { + if (loc.getBlock().equals(event.getBlock())) + { + cheaterKill(event.getPlayer()); + event.setCancelled(true); + return; + } + } + } + + @EventHandler + public void CheatChestInteract(PlayerInteractEvent event) + { + if (_bridgesDown) + return; + + if (event.getClickedBlock() == null) + return; + + if (event.getClickedBlock().getType() != Material.CHEST) + return; + + for (Location loc : WorldData.GetCustomLocs("54")) + { + if (loc.getBlock().equals(event.getClickedBlock())) + { + cheaterKill(event.getPlayer()); + event.setCancelled(true); + return; + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void PreBridgeDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (_bridgesDown || event.GetProjectile() != null) + return; + + GameTeam damageeTeam = GetTeam(event.GetDamageePlayer()); + GameTeam damagerTeam = GetTeam(event.GetDamagerPlayer(false)); + + if (damageeTeam == null || damagerTeam == null) + return; + + if (damageeTeam.equals(damagerTeam)) + return; + + Player damagee = event.GetDamageePlayer(); + Player damager = event.GetDamagerPlayer(false); + + //Damagee is closer to Damagers Island + if (UtilMath.offset(damagee.getLocation(), UtilWorld.averageLocation(damageeTeam.GetSpawns())) > + UtilMath.offset(damagee.getLocation(), UtilWorld.averageLocation(damagerTeam.GetSpawns()))) + { + cheaterKill(damagee); + } + + //Damagee is closer to Damagees Island + if (UtilMath.offset(damager.getLocation(), UtilWorld.averageLocation(damagerTeam.GetSpawns())) > + UtilMath.offset(damager.getLocation(), UtilWorld.averageLocation(damageeTeam.GetSpawns()))) + { + cheaterKill(damager); + } + } + + public void cheaterKill(Player player) + { + Announce(C.Bold + player.getName() + " was killed for cheating!"); + _usedLife.add(player.getName()); + player.damage(9999); + + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java index 7d2470059..2dce0cfc5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/QuiverTeams.java @@ -34,7 +34,7 @@ public class QuiverTeams extends TeamGame private HashMap _teamKills = new HashMap(); private HashMap _deathTime = new HashMap(); - private int _reqKills = 6; + private int _reqKills = 60; public QuiverTeams(ArcadeManager manager) { From 2cb87b23e65c769bfa7ee681bdc212bd4e7ff93d Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Sun, 24 Aug 2014 16:08:19 -0500 Subject: [PATCH 04/17] Stat Gui, Start of Treasure Gui (disabled) --- Plugins/.idea/compiler.xml | 1 + .../core/achievement/Achievement.java | 38 +++- .../core/achievement/AchievementCategory.java | 59 ++++++ ...hivementData.java => AchievementData.java} | 4 +- .../core/achievement/AchievementManager.java | 100 ++++++++-- .../achievement/command/StatsCommand.java | 40 ++++ .../core/achievement/ui/AchievementShop.java | 59 ++++++ .../achievement/ui/button/CategoryButton.java | 44 +++++ .../ui/page/AchievementMainPage.java | 101 ++++++++++ .../achievement/ui/page/AchievementPage.java | 164 ++++++++++++++++ .../core/cosmetic/ui/CosmeticShop.java | 17 ++ .../cosmetic/ui/button/TreasureButton.java | 26 +++ .../mineplex/core/cosmetic/ui/page/Menu.java | 67 ++++--- .../core/cosmetic/ui/page/TreasurePage.java | 178 ++++++++++++++++++ .../mineplex/core/shop/page/ShopPageBase.java | 8 +- .../src/mineplex/core/stats/StatsManager.java | 25 +++ .../src/mineplex/hub/HubManager.java | 4 + .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../managers/GameAchievementManager.java | 4 +- 19 files changed, 884 insertions(+), 57 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java rename Plugins/Mineplex.Core/src/mineplex/core/achievement/{AchivementData.java => AchievementData.java} (79%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/achievement/command/StatsCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/AchievementShop.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/button/CategoryButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementMainPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/achievement/ui/page/AchievementPage.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/button/TreasureButton.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/TreasurePage.java diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index 366e72058..c01fc77f0 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -18,6 +18,7 @@ +