diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index 55261f281..94ef466d3 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -22,6 +22,11 @@ public class UtilAlg return sortedSet; } + public static Location getMidpoint(Location a, Location b) + { + return a.add(b.subtract(a).multiply(0.5)); + } + public static Vector getTrajectory(Entity from, Entity to) { return getTrajectory(from.getLocation().toVector(), to.getLocation().toVector()); @@ -179,4 +184,6 @@ public class UtilAlg { return cross(vec, getRight(vec)); } + + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 878413ae9..fd0509900 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -172,7 +172,7 @@ public enum Achievement DRAW_MY_THING_PURE_LUCK("Pure Luck", 800, new String[]{"Draw My Thing.PureLuck"}, - new String[]{"Guess a word in the first 5 seconds"}, + new String[]{"Guess a word in the first 8 seconds"}, new int[]{1}, AchievementCategory.DRAW_MY_THING), @@ -492,14 +492,14 @@ public enum Achievement SNEAK_ASSASSINS_INCOMPETENCE("Incompetence", 600, new String[]{"Sneaky Assassins.Incompetence"}, - new String[]{"Kill 500 NPCs."}, - new int[]{500}, + new String[]{"Kill 200 NPCs."}, + new int[]{200}, AchievementCategory.SNEAKY_ASSASSINS), SNEAK_ASSASSINS_I_SEE_YOU("I See You", 800, new String[]{"Sneaky Assassins.ISeeYou"}, - new String[]{"Reveal 250 players."}, - new int[]{250}, + new String[]{"Reveal 50 players."}, + new int[]{50}, AchievementCategory.SNEAKY_ASSASSINS), //Micro Battle diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 3ffa6c4b9..7bf06e59a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -45,7 +45,7 @@ public class AntiHack extends MiniPlugin public static AntiHack Instance; private boolean _enabled = true; - private boolean _strict = true; + private boolean _strict = false; private boolean _kick = true; public Punish Punish; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/data/BlockData.java b/Plugins/Mineplex.Core/src/mineplex/core/data/BlockData.java new file mode 100644 index 000000000..7e9847e0e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/data/BlockData.java @@ -0,0 +1,25 @@ +package mineplex.core.data; + +import org.bukkit.block.Block; +import org.bukkit.Material; + +public class BlockData +{ + public Block Block; + public Material Material; + public byte Data; + public long Time; + + public BlockData(Block block) + { + Block = block; + Material = block.getType(); + Data = block.getData(); + Time = System.currentTimeMillis(); + } + + public void restore() + { + Block.setTypeIdAndData(Material.getId(), Data, true); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java index d8bbbea36..68e783503 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java @@ -3,6 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Mage; import java.util.HashMap; import java.util.HashSet; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -10,6 +11,7 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerDropItemEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; @@ -18,6 +20,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -127,7 +130,6 @@ public class ArcticArmor extends Skill Remove(cur); continue; } - //Check Allowed SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType()); @@ -176,6 +178,44 @@ public class ArcticArmor extends Skill Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 1, false, true, true); } } + + @EventHandler + public void Damage(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (cur.getGameMode() != GameMode.SURVIVAL) + continue; + + if (cur.getEyeLocation().getBlock().getType() == Material.ICE) + { + Player damager = null; + double closest = 0; + + for (Player player : _active) + { + if (player.equals(cur)) + continue; + + double dist = UtilMath.offset(player, cur); + + if (dist < 5 && (damager == null || dist < closest)) + { + damager = player; + closest = dist; + } + } + + //Damage Event + Factory.Damage().NewDamageEvent(cur, damager, null, + DamageCause.CUSTOM, 2, false, true, false, + damager == null ? null : damager.getName(), "Arctic Ice"); + } + } + } @EventHandler public void Slow(UpdateEvent event) 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 dca7ed57c..bba5f08b7 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 @@ -13,6 +13,7 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; +import org.bukkit.entity.Boat; import org.bukkit.entity.Chicken; import org.bukkit.entity.Cow; import org.bukkit.entity.Entity; @@ -28,11 +29,13 @@ import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.ItemStack; import org.bukkit.metadata.FixedMetadataValue; @@ -42,6 +45,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.UtilGear; import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilMath; @@ -1567,6 +1571,42 @@ public class Bridge extends TeamGame implements OreObsfucation { if (!_bridgesDown) { + if (!event.getToBlock().getRelative(BlockFace.UP).equals(event.getBlock())) + { + event.setCancelled(true); + } + } + } + +// @EventHandler +// public void liquidBlockDeny(BlockBreakEvent event) +// { +// if (_bridgesDown) +// return; +// +// if (!IsAlive(event.getPlayer())) +// return; +// +// if (event.getBlock().getRelative(BlockFace.UP).isLiquid() || event.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP).isLiquid()) +// { +// UtilPlayer.message(event.getPlayer(), F.main("Game", +// "Cannot tunnel under liquids.")); +// +// event.setCancelled(true); +// } +// } + + @EventHandler + public void boatDeny(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOAT)) + { + UtilPlayer.message(event.getPlayer(), F.main("Game", + "You cannot place boats.")); + event.setCancelled(true); } } 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 ed09bf2dd..f262eeee2 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 @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.champions; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.GameTeam; @@ -20,7 +21,9 @@ import nautilus.game.arcade.stats.TheLongestShotStatTracker; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.inventory.InventoryType; public class ChampionsDominate extends Domination { @@ -59,6 +62,8 @@ public class ChampionsDominate extends Domination EloRanking = false; EloStart = 1000; + + this.DisableKillCommand = false; registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination"), @@ -94,4 +99,24 @@ public class ChampionsDominate extends Domination event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.HIGHEST) + public void InventoryDamageCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player player = event.GetDamageePlayer(); + if (player == null) + return; + + if (!IsAlive(player)) + return; + + if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null) + return; + + if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST) + player.closeInventory(); + } } 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 259a03ac9..d3228c0e3 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 @@ -2,11 +2,14 @@ package nautilus.game.arcade.game.games.champions; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.inventory.InventoryType; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.core.combat.DeathMessageType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.GameTeam; @@ -58,6 +61,8 @@ public class ChampionsTDM extends TeamDeathmatch InventoryOpenChest = true; + this.DisableKillCommand = false; + registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new KillAllOpposingStatTracker(this), @@ -94,4 +99,24 @@ public class ChampionsTDM extends TeamDeathmatch event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.HIGHEST) + public void InventoryDamageCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + Player player = event.GetDamageePlayer(); + if (player == null) + return; + + if (!IsAlive(player)) + return; + + if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null) + return; + + if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST) + player.closeInventory(); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/CapturePoint.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/CapturePoint.java index 81fd78b0f..ebe807521 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/CapturePoint.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/CapturePoint.java @@ -22,6 +22,7 @@ import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; public class CapturePoint @@ -43,9 +44,9 @@ public class CapturePoint private boolean _captured = false; private ArrayList _captureFloor = new ArrayList(); private long _decayDelay = 0; - + private int _indicatorTick = 0; - + private ChatColor _scoreboardColor = ChatColor.WHITE; private int _scoreboardTick = 0; @@ -82,14 +83,14 @@ public class CapturePoint block.setType(Material.BEACON); } } - + //Glass if (Math.abs(x) <= 2 && Math.abs(z) <= 2) { Block block = loc.getBlock().getRelative(x, -1, z); - block.setType(Material.GLASS); + block.setType(Material.STAINED_GLASS); } - + //Iron if (Math.abs(x) <= 1 && Math.abs(z) <= 1) { @@ -132,7 +133,7 @@ public class CapturePoint { if (player.getGameMode() != GameMode.SURVIVAL) continue; - + if (Math.abs(_loc.getX() - player.getLocation().getX()) > 2.5) continue; @@ -163,7 +164,6 @@ public class CapturePoint return; } - //Capture if (teamB == null) @@ -180,7 +180,7 @@ public class CapturePoint { if (!UtilTime.elapsed(_decayDelay, 2000)) return; - + //Degen if (!_captured) { @@ -193,13 +193,12 @@ public class CapturePoint _floor.add(block); - block.setData((byte)0); + setWoolColor(block, null, false); } //Set Uncaptured if (_captureAmount == 0) { - _captured = false; _owner = null; //Indicators @@ -208,7 +207,7 @@ public class CapturePoint block.setData((byte)0); } } - + //Effect for (Block block : _indicators) block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 35); @@ -225,10 +224,9 @@ public class CapturePoint _captureFloor.add(block); - if (_owner.GetColor() == ChatColor.RED) block.setData((byte)14); - else block.setData((byte)11); + setWoolColor(block, _owner.GetColor(), false); } - + //Effect for (Block block : _indicators) { @@ -237,21 +235,21 @@ public class CapturePoint else block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 22); } - + } } public void Capture(GameTeam team, int count, Collection capturers) { _scoreboardColor = team.GetColor(); - + //Decay Delay _decayDelay = System.currentTimeMillis(); - + //Defend Score //if (_captured) // Host.AddScore(_owner, count); - + //Color Color color = Color.RED; if (team.GetColor() == ChatColor.BLUE) @@ -264,7 +262,7 @@ public class CapturePoint int bonus = 0; if (_captured) bonus = 1; - + _captureAmount = Math.min(_captureMax, (_captureAmount + ((_captureRate*count)+bonus))); //Floor Color @@ -274,8 +272,7 @@ public class CapturePoint _captureFloor.add(block); - if (team.GetColor() == ChatColor.RED) block.setData((byte)14); - else block.setData((byte)11); + setWoolColor(block, team.GetColor(), false); } //Set Fully Captured @@ -284,7 +281,6 @@ public class CapturePoint _captured = true; //Firework - Firework(_loc, color, true); //Indicators @@ -293,7 +289,10 @@ public class CapturePoint if (team.GetColor() == ChatColor.RED) block.setData((byte)14); else block.setData((byte)11); } - + + //Center + setWoolColor(_loc.getBlock().getRelative(0, -2, 0), _owner.GetColor(), true); + //Reward Gems if (capturers != null) { @@ -311,7 +310,7 @@ public class CapturePoint int bonus = 0; if (!_captured) bonus = 1; - + _captureAmount = Math.max(0, (_captureAmount - ((_captureRate*count)+bonus))); //Announce @@ -323,7 +322,7 @@ public class CapturePoint player.playSound(player.getLocation(), Sound.GHAST_SCREAM2, 0.6f, 0.6f); } } - + //Floor Color while ((double)_captureFloor.size()/((double)_captureFloor.size() + (double)_floor.size()) > _captureAmount/_captureMax) { @@ -331,7 +330,7 @@ public class CapturePoint _floor.add(block); - block.setData((byte)0); + setWoolColor(block, null, false); } //Set Uncaptured @@ -339,6 +338,9 @@ public class CapturePoint { _captured = false; _owner = team; + + //Center + setWoolColor(_loc.getBlock().getRelative(0, -2, 0), null, true); //Indicators for (Block block : _indicators) @@ -358,10 +360,32 @@ public class CapturePoint RewardCapture(player, 1); } } - + Indicate(color); } - + + } + + private void setWoolColor(Block block, ChatColor color, boolean glassOnly) + { + if (color == null) + { + if (!glassOnly) + block.setData((byte)0); + block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)0, true); + } + else if (color == ChatColor.RED) + { + if (!glassOnly) + block.setData((byte)14); + block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)14, true); + } + else + { + if (!glassOnly) + block.setData((byte)11); + block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)11, true); + } } public void Firework(Location loc, Color color, boolean major) @@ -380,24 +404,24 @@ public class CapturePoint block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 152); else block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 22); - + //for (Block block : _indicators) //Firework(_indicators.get(_indicatorTick).getLocation().add(0.5, 0.5, 0.5), color, false); - + _indicatorTick = (_indicatorTick + 1)%_indicators.size(); } public String GetScoreboardName() { _scoreboardTick = (_scoreboardTick + 1)%2; - + String out = ""; - + if (_scoreboardColor != null && _scoreboardTick == 0) { if (_scoreboardColor == ChatColor.BLUE) _scoreboardColor = ChatColor.AQUA; - + out = _scoreboardColor + C.Bold + _name; _scoreboardColor = null; } @@ -410,17 +434,17 @@ public class CapturePoint else out = _owner.GetColor() + _name; } - + else out = _name; } - + if (out.length() > 16) out = out.substring(0, 16); return out; } - + public void RewardCapture(Player player, int amount) { Host.AddGems(player, amount / 25d, "Control Point Score", true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 3461347a2..9cc735e03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.dragonescape; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.Set; @@ -35,12 +36,14 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; +import mineplex.core.data.BlockData; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -93,6 +96,8 @@ public class DragonEscape extends SoloGame private Player _winner = null; private double _speedMult = 1; + + private HashMap _tunneled = new HashMap(); public DragonEscape(ArcadeManager manager) { @@ -103,7 +108,7 @@ public class DragonEscape extends SoloGame new KitLeaper(manager), new KitDisruptor(manager), new KitWarper(manager), - new KitTunneler(manager), + new KitDigger(manager), }, new String[] @@ -553,6 +558,12 @@ public class DragonEscape extends SoloGame if (!player.getInventory().contains(Material.DIAMOND_PICKAXE)) return; + if (!UtilTime.elapsed(GetStateTime(), 10000)) + { + UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + "."))); + return; + } + if (!Recharge.Instance.use(player, "Tunneler", 100, false, false)) return; @@ -560,8 +571,10 @@ public class DragonEscape extends SoloGame player.getInventory().addItem(new ItemStack(event.getBlock().getType())); - Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 3000); - + _tunneled.put(new BlockData(event.getBlock()), player); + + Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 2400); + UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte)0, 1); } @@ -570,9 +583,31 @@ public class DragonEscape extends SoloGame { if (event.isCancelled()) return; - + Manager.GetBlockRestore().Add(event.getBlock(), event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(), - event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 3000); + event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400); + } + + @EventHandler + public void TunnelerUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator tunnelIterator = _tunneled.keySet().iterator(); + + while (tunnelIterator.hasNext()) + { + BlockData data = tunnelIterator.next(); + + if (data.Block.getType() != Material.AIR || UtilTime.elapsed(data.Time, 2400)) + tunnelIterator.remove(); + + else + for (Player other : UtilServer.getPlayers()) + if (!other.equals(_tunneled.get(data))) + other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitTunneler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitTunneler.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java index a481a6f6e..eed4d1731 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitTunneler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitDigger.java @@ -12,9 +12,9 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -public class KitTunneler extends Kit +public class KitDigger extends Kit { - public KitTunneler(ArcadeManager manager) + public KitDigger(ArcadeManager manager) { super(manager, "Digger", KitAvailability.Achievement, 5000, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java index b96abfe88..da0eb3874 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/Draw.java @@ -1,9 +1,11 @@ package nautilus.game.arcade.game.games.draw; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -16,6 +18,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; @@ -25,6 +28,8 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; @@ -43,8 +48,10 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.GameScore; -import nautilus.game.arcade.game.games.draw.kits.KitPlayer; +import nautilus.game.arcade.game.games.draw.kits.*; +import nautilus.game.arcade.game.games.draw.tools.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.KeenEyeStatTracker; import nautilus.game.arcade.stats.MrSquiggleStatTracker; @@ -76,6 +83,7 @@ public class Draw extends SoloGame private Collection _textBlocks = null; + private HashSet _tools; private String[] _words; private HashSet _usedWords = new HashSet(); @@ -85,7 +93,9 @@ public class Draw extends SoloGame new Kit[] { - new KitPlayer(manager), + new KitSlowAndSteady(manager), + new KitSelector(manager), + new KitTools(manager), }, new String[] @@ -104,6 +114,11 @@ public class Draw extends SoloGame { "Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Crack", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin", }; + + _tools = new HashSet(); + _tools.add(new ToolLine(this)); + _tools.add(new ToolSquare(this)); + _tools.add(new ToolCircle(this)); registerStatTrackers( new MrSquiggleStatTracker(this), @@ -192,6 +207,10 @@ public class Draw extends SoloGame if (event.getType() != UpdateType.FAST) return; + + //Word Selection + if (_round != null && !_round.ChooseWordUpdate()) + return; //End Round if (_round != null && (_round.IsDone() || _drawers.GetPlayers(true).isEmpty() || _round.AllGuessed(_guessers.GetPlayers(true)))) @@ -223,6 +242,7 @@ public class Draw extends SoloGame EndCheck(); } + //Reset Round if ((_round == null && UtilTime.elapsed(_roundTime, 5000) && !_roundPlayer.isEmpty())) { Reset(); @@ -232,13 +252,8 @@ public class Draw extends SoloGame _guessers.RemovePlayer(drawer); _drawers.AddPlayer(drawer, true); - //Get Word - String word = _words[UtilMath.r(_words.length)]; - while (!_usedWords.add(word)) - word = _words[UtilMath.r(_words.length)]; - //Create Round - _round = new DrawRound(this, drawer, word); + _round = new DrawRound(this, drawer); //Prep Drawer drawer.teleport(_drawerLocation); @@ -249,15 +264,31 @@ public class Draw extends SoloGame drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Thin Paint Brush")); drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Thick Paint Brush")); + + if (GetKit(drawer) instanceof KitTools) + { + drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte)0, 1, "Line Tool")); + drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool")); + drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool")); + } + drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket")); drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas")); Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!"); - - UtilPlayer.message(drawer, C.cWhite + C.Bold + "You must draw: " + C.cGreen + C.Bold + _round.Word); } } + public String GetWord() + { + //Get Word + String word = _words[UtilMath.r(_words.length)]; + while (!_usedWords.add(word)) + word = _words[UtilMath.r(_words.length)]; + + return word; + } + @EventHandler(priority = EventPriority.LOWEST) public void Guess(AsyncPlayerChatEvent event) { @@ -267,6 +298,9 @@ public class Draw extends SoloGame if (_round == null) return; + if (!_round.IsReady()) + return; + Player player = event.getPlayer(); if (event.getMessage().toLowerCase().contains(_round.Word.toLowerCase())) @@ -317,16 +351,22 @@ public class Draw extends SoloGame if (_round == null) return; - + + if (!_round.IsReady()) + { + UtilTextBottom.displayProgress(C.Bold + "Word Selection", _round.GetTimePercent(), _round.GetTimeString(), UtilServer.getPlayers()); + return; + } + for (Player player : UtilServer.getPlayers()) { if (_drawers.HasPlayer(player)) { - UtilTextBottom.displayProgress(C.Bold + "Draw " + _round.Word, _round.GetTimePercent(), player); + UtilTextBottom.displayProgress(C.cYellow + C.Bold + "Draw: " + ChatColor.RESET + _round.Word, _round.GetTimePercent(), _round.GetTimeString(), player); } else { - UtilTextBottom.displayProgress(C.cYellow + C.Bold + "Clue " + ChatColor.RESET + C.Bold + _round.GetRevealedWord(), _round.GetTimePercent(), player); + UtilTextBottom.display(_round.GetRevealedWord() + C.cYellow + C.Bold + " HINT " + ChatColor.RESET + _round.GetTimeString(), player); } } } @@ -357,6 +397,29 @@ public class Draw extends SoloGame } } + @EventHandler + public void toolStart(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + for (Tool tool : _tools) + tool.start(event); + } + + @EventHandler + public void toolUpdate(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + for (Tool tool : _tools) + tool.update(); + } + @EventHandler public void Paint(UpdateEvent event) { @@ -368,6 +431,9 @@ public class Draw extends SoloGame for (Player player : _drawers.GetPlayers(true)) { + if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD) && !UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD)) + continue; + if (!player.isBlocking()) { _brushPrevious = null; @@ -432,7 +498,6 @@ public class Draw extends SoloGame _brushPrevious = block.getLocation().add(0.5, 0.5, 0.5); } } - @EventHandler public void PaintReset(PlayerInteractEvent event) @@ -581,6 +646,40 @@ public class Draw extends SoloGame } } } + + @Override + public List getWinners() + { + if (GetState().ordinal() >= GameState.End.ordinal()) + { + SortScores(); + + //Set Places + ArrayList places = new ArrayList(); + for (int i=0 ; i<_ranks.size() ; i++) + places.add(i, _ranks.get(i).Player); + + if (places.isEmpty() || !places.get(0).isOnline()) + return Arrays.asList(); + else + return Arrays.asList(places.get(0)); + } + else + return null; + } + + @Override + public List getLosers() + { + List losers = getWinners(); + + if (losers == null) + return null; + + losers.remove(0); + + return losers; + } @Override public void EndCheck() @@ -653,4 +752,44 @@ public class Draw extends SoloGame Scoreboard.Draw(); } + + @EventHandler + public void selectionInput(PlayerCommandPreprocessEvent event) + { + if (!event.getMessage().startsWith("/selectword ")) + return; + + event.setCancelled(true); + + if (_round == null) + return; + + if (!_round.Drawer.equals(event.getPlayer())) + return; + + if (event.getMessage().length() <= 12) + return; + + _round.WordClicked(event.getMessage().substring(12)); + } + + public ArrayList getCanvas() + { + return _canvas; + } + + public boolean isDrawer(Player player) + { + return _drawers.HasPlayer(player); + } + + public byte getColor() + { + return _brushColor; + } + + public void setLock(boolean b) + { + _lockDrawer = b; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/DrawRound.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/DrawRound.java index 617a8252c..32e19384c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/DrawRound.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/DrawRound.java @@ -3,13 +3,23 @@ package nautilus.game.arcade.game.games.draw; import java.util.ArrayList; import java.util.HashSet; +import nautilus.game.arcade.game.games.draw.kits.KitSelector; +import nautilus.game.arcade.game.games.draw.kits.KitSlowAndSteady; +import nautilus.game.arcade.kit.Kit; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Sound; import org.bukkit.entity.Player; +import mineplex.core.common.jsonchat.ChildJsonMessage; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; public class DrawRound @@ -21,22 +31,70 @@ public class DrawRound public int Revealed = 0; public boolean[] WordReveal; public long Time; - public double TimeMax = 50; + public double TimeMax; + public double TimeChooseMax = 10; public HashSet Guessed = new HashSet(); + public ArrayList WordChoices; - public DrawRound(Draw draw, Player player, String word) + public DrawRound(Draw draw, Player player) { Host = draw; Drawer = player; - Word = word; + Time = System.currentTimeMillis(); + + //Kit Modification + Kit kit = draw.GetKit(player); + + //Time + if (kit != null && kit instanceof KitSlowAndSteady) + TimeMax = 60; + else + TimeMax = 50; + + //Word + if (kit != null && kit instanceof KitSelector) + { + WordChoices = new ArrayList(); + + while (WordChoices.size() < 3) + WordChoices.add(draw.GetWord()); + + //Inform + UtilTextMiddle.display("Select Your Word", "Click on a word in Chat", 20, 60, 10, player); + + UtilPlayer.message(player, " "); + UtilPlayer.message(player, C.cGreen + C.Bold + "Select Your Word"); + for (int i=0 ; i players) @@ -131,4 +200,37 @@ public class DrawRound { return Drawer; } + + public boolean ChooseWordUpdate() + { + if (Word == null && UtilTime.elapsed(Time, (long)(TimeChooseMax*1000))) + { + if (WordChoices.isEmpty()) + { + SetWord(Host.GetWord()); + } + else + { + SetWord(UtilAlg.Random(WordChoices)); + } + } + + return IsReady(); + } + + public boolean IsReady() + { + return Word != null; + } + + public void WordClicked(String string) + { + if (IsReady()) + return; + + if (WordChoices.contains(string)) + { + SetWord(string); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java similarity index 72% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitPlayer.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java index b3955afd0..803108f77 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSelector.java @@ -8,15 +8,15 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; -public class KitPlayer extends Kit +public class KitSelector extends Kit { - public KitPlayer(ArcadeManager manager) + public KitSelector(ArcadeManager manager) { - super(manager, "Player", KitAvailability.Free, + super(manager, "Selector", KitAvailability.Gem, 4000, new String[] { - "" + "Choose from one of three words to draw!" }, new Perk[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java new file mode 100644 index 000000000..f60acb333 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitSlowAndSteady.java @@ -0,0 +1,38 @@ +package nautilus.game.arcade.game.games.draw.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +public class KitSlowAndSteady extends Kit +{ + public KitSlowAndSteady(ArcadeManager manager) + { + super(manager, "Extra Time", KitAvailability.Free, + + new String[] + { + "Receive +10 Seconds to draw!" + }, + + new Perk[] + { + + }, + EntityType.SKELETON, + new ItemStack(Material.WATCH)); + + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitTools.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitTools.java new file mode 100644 index 000000000..50d68d4f9 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/kits/KitTools.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.game.games.draw.kits; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +import mineplex.core.achievement.Achievement; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +public class KitTools extends Kit +{ + public KitTools(ArcadeManager manager) + { + super(manager, "Tools", KitAvailability.Achievement, + + new String[] + { + "Can draw lines, circles and squares!" + }, + + new Perk[] + { + + }, + EntityType.SKELETON, + null); + + this.setAchievementRequirements(new Achievement[] + { + Achievement.DRAW_MY_THING_KEEN_EYE, + Achievement.DRAW_MY_THING_MR_SQUIGGLE, + Achievement.DRAW_MY_THING_PURE_LUCK, + Achievement.DRAW_MY_THING_WINS, + }); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java new file mode 100644 index 000000000..3974212b0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/Tool.java @@ -0,0 +1,94 @@ +package nautilus.game.arcade.game.games.draw.tools; + + +import java.util.HashMap; + +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilEvent.ActionType; +import nautilus.game.arcade.game.games.draw.Draw; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerInteractEvent; + +public abstract class Tool +{ + protected Draw Host; + + protected Player _drawer; + protected Block _start; + + protected Material _material; + + protected HashMap _past = new HashMap(); + protected HashMap _new = new HashMap(); + + public Tool(Draw host, Material mat) + { + Host = host; + _material = mat; + } + + public void start(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + Block block = event.getPlayer().getTargetBlock(null, 60); + + if (block == null) + return; + + if (!Host.getCanvas().contains(block)) + return; + + if (!UtilGear.isMat(event.getPlayer().getItemInHand(), _material)) + return; + + _drawer = event.getPlayer(); + _start = block; + + Host.setLock(false); + } + + public void update() + { + if (_start == null || _drawer == null) + return; + + if (!_drawer.isOnline() || !Host.isDrawer(_drawer) || !_drawer.isBlocking()) + { + _drawer = null; + _start = null; + _past.clear(); + return; + } + + _new = new HashMap(); + + //Calculate New + Block end = _drawer.getTargetBlock(null, 64); + if (end != null && Host.getCanvas().contains(end)) + { + customDraw(end); + } + + //Remove Old + for (Block block : _past.keySet()) + { + if (!_new.containsKey(block)) + block.setData(_past.get(block)); + } + + _past = _new; + _new = null; + + for (Player other : UtilServer.getPlayers()) + other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f); + } + + public abstract void customDraw(Block end); +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/ToolCircle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/ToolCircle.java new file mode 100644 index 000000000..b1403520d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/ToolCircle.java @@ -0,0 +1,57 @@ +package nautilus.game.arcade.game.games.draw.tools; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import nautilus.game.arcade.game.games.draw.Draw; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; + +public class ToolCircle extends Tool +{ + public ToolCircle(Draw host) + { + super(host, Material.DIAMOND_SWORD); + } + + public void customDraw(Block end) + { + Location mid = UtilAlg.getMidpoint(_start.getLocation().add(0.5, 0.5, 0.5), end.getLocation().add(0.5, 0.5, 0.5)); + + double height = Math.max(_start.getY(), end.getY()) - mid.getY(); + + boolean planeIsZ = _start.getZ() == end.getZ(); + + double width = Math.max(_start.getX(), end.getX()) - mid.getX(); + if (!planeIsZ) + width = Math.max(_start.getZ(), end.getZ()) - mid.getZ(); + + for (double i=0 ; i 0.5) + { + loc.add(UtilAlg.getTrajectory(loc, end.getLocation().add(0.5, 0.5, 0.5)).multiply(0.5)); + + Block lineBlock = loc.getBlock(); + + if (_new.containsKey(lineBlock)) + continue; + + if (!Host.getCanvas().contains(lineBlock)) + continue; + + byte color = lineBlock.getData(); + if (_past.containsKey(lineBlock)) + color = _past.get(lineBlock); + + _new.put(lineBlock, color); + lineBlock.setData(Host.getColor()); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/ToolSquare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/ToolSquare.java new file mode 100644 index 000000000..4fd70021f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/draw/tools/ToolSquare.java @@ -0,0 +1,82 @@ +package nautilus.game.arcade.game.games.draw.tools; + +import nautilus.game.arcade.game.games.draw.Draw; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; + +public class ToolSquare extends Tool +{ + public ToolSquare(Draw host) + { + super(host, Material.GOLD_SWORD); + } + + public void customDraw(Block end) + { + Location upper = new Location(end.getWorld(), Math.max(_start.getX(), end.getX()), Math.max(_start.getY(), end.getY()), Math.max(_start.getZ(), end.getZ())); + upper.add(0.5, 0.5, 0.5); + + Location lower = new Location(end.getWorld(), Math.min(_start.getX(), end.getX()), Math.min(_start.getY(), end.getY()), Math.min(_start.getZ(), end.getZ())); + lower.add(0.5, 0.5, 0.5); + + Location cur = upper.clone(); + + //Decrease + while (cur.getX() > lower.getX()) + { + cur.setX(cur.getX() - 1); + color(cur); + } + + while (cur.getY() > lower.getY()) + { + cur.setY(cur.getY() - 1); + color(cur); + } + + while (cur.getZ() > lower.getZ()) + { + cur.setZ(cur.getZ() - 1); + color(cur); + } + + //Increase + while (cur.getX() < upper.getX()) + { + cur.setX(cur.getX() + 1); + color(cur); + } + + while (cur.getY() < upper.getY()) + { + cur.setY(cur.getY() + 1); + color(cur); + } + + while (cur.getZ() < upper.getZ()) + { + cur.setZ(cur.getZ() + 1); + color(cur); + } + } + + public void color(Location loc) + { + Block block = loc.getBlock(); + + if (_new.containsKey(block)) + return; + + if (!Host.getCanvas().contains(block)) + return; + + byte color = block.getData(); + if (_past.containsKey(block)) + color = _past.get(block); + + _new.put(block, color); + block.setData(Host.getColor()); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java index d6c5d0f6e..554b15bc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/Quiver.java @@ -25,6 +25,7 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -53,7 +54,8 @@ public class Quiver extends SoloGame { new KitLeaper(manager), new KitBrawler(manager), - new KitElementalist(manager), + new KitEnchanter(manager), + new KitSlamShot(manager) }, new String[] @@ -148,8 +150,20 @@ public class Quiver extends SoloGame Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); if (player == null) return; + int amount = 1; + + if (GetKit(player) instanceof KitSlamShot) + { + if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null)) + { + amount = 2; + + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 3f, 0.75f); + } + } + //New Arrow - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, amount, F.item("Super Arrow"))); player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f); //Score diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java similarity index 94% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java index 4877d1c94..ad55270bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitEnchanter.java @@ -16,9 +16,9 @@ import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.*; -public class KitElementalist extends Kit +public class KitEnchanter extends Kit { - public KitElementalist(ArcadeManager manager) + public KitEnchanter(ArcadeManager manager) { super(manager, "Enchanter", KitAvailability.Gem, 5000, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java index fd318451a..bb8663832 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitLeaper.java @@ -29,7 +29,7 @@ public class KitLeaper extends Kit new Perk[] { - new PerkDoubleJump("Double Jump", 0.9, 0.9, true) + new PerkSeismicSlam() }, EntityType.ZOMBIE, new ItemStack(Material.IRON_AXE)); @@ -39,7 +39,7 @@ public class KitLeaper extends Kit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); if (Manager.GetGame().GetState() == GameState.Live) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java new file mode 100644 index 000000000..c82dc0c55 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitSlamShot.java @@ -0,0 +1,68 @@ +package nautilus.game.arcade.game.games.quiver.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.*; + +public class KitSlamShot extends Kit +{ + public KitSlamShot(ArcadeManager manager) + { + super(manager, "Slam Shooter", KitAvailability.Achievement, + + new String[] + { + "Gets 2 arrows for killing slammed players!" + }, + + new Perk[] + { + new PerkSeismicSlamOITQ() + }, + EntityType.ZOMBIE, + new ItemStack(Material.IRON_SPADE)); + + this.setAchievementRequirements(new Achievement[] + { + Achievement.OITQ_PERFECTIONIST, + Achievement.OITQ_SHARPSHOOTER, + Achievement.OITQ_WHATS_A_BOW, + Achievement.OITQ_WINS, + }); + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + if (Manager.GetGame().GetState() == GameState.Live) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow"))); + + final Player fPlayer = player; + + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + UtilInv.Update(fPlayer); + } + }, 10); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index 989e03891..0da116918 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -1,7 +1,9 @@ package nautilus.game.arcade.game.games.sneakyassassins; import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.disguise.*; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.*; import mineplex.core.updater.event.*; import mineplex.minecraft.game.core.combat.event.*; @@ -54,7 +56,8 @@ public class SneakyAssassins extends SoloGame new Kit[]{ new KitEscapeArtist(manager, EntityType.VILLAGER), new KitAssassin(manager, EntityType.VILLAGER), - new KitRevealer(manager, EntityType.VILLAGER) + new KitRevealer(manager, EntityType.VILLAGER), + new KitBriber(manager, EntityType.VILLAGER), }, new String[] { @@ -286,7 +289,25 @@ public class SneakyAssassins extends SoloGame public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.getRightClicked() instanceof Villager) + { event.setCancelled(true); + + if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.EMERALD)) + { + if (!Recharge.Instance.use(event.getPlayer(), "Bribe Villager", 4000, true, true)) + return; + + _npcManager.setBribed(event.getRightClicked(), event.getPlayer()); + + UtilInv.remove(event.getPlayer(), Material.EMERALD, (byte)0, 1); + + UtilPlayer.message(event.getPlayer(), F.main("Game", "You used " + F.elem("Bribe Villager") + ".")); + + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.VILLAGER_YES, 1f, 1f); + + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, event.getRightClicked().getLocation().add(0, 1, 0), 0.3f, 0.5f, 0.3f, 0, 10); + } + } } @EventHandler(ignoreCancelled = true) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java new file mode 100644 index 000000000..79fa73015 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitBriber.java @@ -0,0 +1,46 @@ +package nautilus.game.arcade.game.games.sneakyassassins.kits; + +import mineplex.core.common.util.*; +import mineplex.core.itemstack.*; +import nautilus.game.arcade.*; +import nautilus.game.arcade.kit.*; +import nautilus.game.arcade.kit.perks.*; + +import org.bukkit.*; +import org.bukkit.entity.*; +import org.bukkit.inventory.*; + +public class KitBriber extends SneakyAssassinKit +{ + public KitBriber(ArcadeManager manager, EntityType disguiseType) + { + super(manager, "Briber", KitAvailability.Achievement, + new String[] + { + "Pay Villagers to attack other players!" + }, + new Perk[] + { + new PerkSmokebomb(Material.INK_SACK, 3, true), + //new PerkBriber(), + }, + new ItemStack(Material.EMERALD), + disguiseType); + } + + @Override + public void GiveItems(Player player) + { + super.GiveItems(player); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 4, + C.cYellow + C.Bold + "Right-Click Villager" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bribe Villager", + new String[] + { + ChatColor.RESET + "Pay a villager to help you.", + ChatColor.RESET + "It will attack the nearest", + ChatColor.RESET + "enemy for 15 seconds.", + + })); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java index 894dec4ea..1c54610d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java @@ -33,7 +33,7 @@ public class KitRevealer extends SneakyAssassinKit { super.GiveItems(player); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 3, + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 3, C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reveal Assassins", new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/BribedData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/BribedData.java new file mode 100644 index 000000000..24f29d447 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/BribedData.java @@ -0,0 +1,16 @@ +package nautilus.game.arcade.game.games.sneakyassassins.npc; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +public class BribedData +{ + public Player Player; + public Location LastLocation; + public long LastTime; + + public BribedData(Player player) + { + Player = player; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java index c3889854f..fd410a916 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java @@ -12,6 +12,7 @@ import org.bukkit.block.*; import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.entity.*; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.plugin.*; import java.util.*; @@ -21,7 +22,9 @@ public class NpcManager implements Listener private final SneakyAssassins _sneakyAssassins; private final Random _random; private EntityType _disguiseType = EntityType.VILLAGER; - + + private NautHashMap _bribed = new NautHashMap(); + public NpcManager(SneakyAssassins sneakyAssassins, Random random) { _sneakyAssassins = sneakyAssassins; @@ -66,7 +69,7 @@ public class NpcManager implements Listener return; if (getGame().GetState() == Game.GameState.Live || getGame().GetState() == Game.GameState.Prepare) - bustle(); + move(); } @EventHandler @@ -91,12 +94,20 @@ public class NpcManager implements Listener { event.setDroppedExp(0); event.getDrops().clear(); + + _bribed.remove(event.getEntity()); } - public void bustle() + public void move() { for (Entity npc : getNpcs()) { + if (_bribed.containsKey(npc)) + { + if (bribedLogic(npc)) + continue; + } + if (getRandom().nextInt(40) == 0) { List nearby = new ArrayList<>(); @@ -136,6 +147,68 @@ public class NpcManager implements Listener } } + private boolean bribedLogic(Entity npc) + { + if (!(npc instanceof LivingEntity)) + return false; + + BribedData data = _bribed.get(npc); + if (data == null) + return false; + + Player bestTarget = null; + double bestDist = 0; + + for (Player other : _sneakyAssassins.GetPlayers(true)) + { + if (data.Player.equals(other)) + continue; + + double dist = UtilMath.offset(npc, other); + + if (bestTarget == null || dist < bestDist) + { + bestTarget = other; + bestDist = dist; + } + } + + if (bestTarget == null) + return false; + + //Move + UtilEnt.CreatureMove(npc, bestTarget.getLocation().add(UtilAlg.getTrajectory(bestTarget, npc)), 0.8f); + + //Stuck + if (data.LastLocation == null) + data.LastLocation = npc.getLocation(); + + if (UtilMath.offset(npc.getLocation(), data.LastLocation) > 1.5) + { + data.LastLocation = npc.getLocation(); + data.LastTime = System.currentTimeMillis(); + } + else + { + if (UtilTime.elapsed(data.LastTime, 800)) + { + UtilAction.velocity(npc, 0.3, 0.3, 0.7, true); + } + } + + if (UtilMath.offset(npc, bestTarget) < 1.5) + { + //Damage Event + _sneakyAssassins.Manager.GetDamage().NewDamageEvent(bestTarget, (LivingEntity)npc, null, + DamageCause.CUSTOM, 2, true, false, false, + data.Player.getName(), data.Player.getName() + "'s Bribed Villager"); + + npc.getWorld().playSound(npc.getLocation(), Sound.VILLAGER_NO, 1f, 1f); + } + + return true; + } + public Random getRandom() { return _random; @@ -155,4 +228,9 @@ public class NpcManager implements Listener { _disguiseType = disguiseType; } + + public void setBribed(Entity ent, Player player) + { + _bribed.put(ent, new BribedData(player)); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java index 1bec59ce7..9f4a8fba3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/tug/kits/KitSmasher.java @@ -26,7 +26,6 @@ public class KitSmasher extends Kit new Perk[] { new PerkMammoth(), - new PerkSeismicSlamHG() }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java index acb1fb83d..0be43a2d6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLazer.java @@ -74,12 +74,6 @@ public class PerkLazer extends Perk if (!Kit.HasKit(player)) return; - if (!UtilEnt.isGrounded(player)) - { - UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while airborne.")); - return; - } - if (!Recharge.Instance.use(player, GetName(), _recharge, true, true)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java index 05f2d9a8b..04cd10a79 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java @@ -52,7 +52,7 @@ public class PerkRevealer extends Perk implements IThrown private static final FireworkEffect REVEALER_FIREWORK_EFFECT = FireworkEffect .builder() .flicker(false) - .withColor(Color.GREEN) + .withColor(Color.AQUA) .with(FireworkEffect.Type.BALL_LARGE) .trail(false) .build(); @@ -72,7 +72,7 @@ public class PerkRevealer extends Perk implements IThrown public PerkRevealer() { - super("Revealer", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Emerald to " + C.cGreen + "Throw Revealer"}); + super("Revealer", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Diamond to " + C.cGreen + "Throw Revealer"}); } @EventHandler @@ -84,7 +84,7 @@ public class PerkRevealer extends Perk implements IThrown if (event.getPlayer().getItemInHand() == null) return; - if (event.getPlayer().getItemInHand().getType() != Material.EMERALD) + if (event.getPlayer().getItemInHand().getType() != Material.DIAMOND) return; Player player = event.getPlayer(); @@ -94,10 +94,10 @@ public class PerkRevealer extends Perk implements IThrown event.setCancelled(true); - UtilInv.remove(player, Material.EMERALD, (byte) 0, 1); + UtilInv.remove(player, Material.DIAMOND, (byte) 0, 1); UtilInv.Update(player); - Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.EMERALD)); + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.DIAMOND)); UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false); Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamHG.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamHG.java index 60fede5f5..a0feac759 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamHG.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamHG.java @@ -29,12 +29,12 @@ public class PerkSeismicSlamHG extends Perk { super("Ground Pound", new String[] { - C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Ground Pound" + C.cYellow + "Right-Click" + C.cGray + " with " + "Sword/Axe" + " to " + C.cGreen + "Ground Pound" }); } @EventHandler - public void Leap(PlayerInteractEvent event) + public void skill(PlayerInteractEvent event) { if (event.isCancelled()) return; @@ -48,7 +48,7 @@ public class PerkSeismicSlamHG extends Perk if (event.getPlayer().getItemInHand() == null) return; - if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE") && !event.getPlayer().getItemInHand().getType().toString().contains("_SWORD")) + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD") && !event.getPlayer().getItemInHand().getType().toString().contains("_AXE")) return; Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamOITQ.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamOITQ.java new file mode 100644 index 000000000..b0a12668a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSeismicSlamOITQ.java @@ -0,0 +1,96 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.HashMap; + +import org.bukkit.Effect; +import org.bukkit.EntityEffect; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +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.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.kit.Perk; + +public class PerkSeismicSlamOITQ extends Perk +{ + public PerkSeismicSlamOITQ() + { + super("Ground Pound", new String[] + { + C.cYellow + "Right-Click" + C.cGray + " with " + "SPADE" + " to " + C.cGreen + "Ground Pound" + }); + } + + @EventHandler + public void skill(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 10000, true, true)) + return; + + //Action + double range = 8; + + HashMap targets = UtilEnt.getInRadius(player.getLocation(), range); + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + continue; + + cur.playEffect(EntityEffect.HURT); + + //Velocity + UtilAction.velocity(cur, + UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()), + 0.8 * targets.get(cur), true, 0, 0.8 + 1.0 * targets.get(cur), 1.8, true); + + //Condition + Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); + + //Inform + if (cur instanceof Player) + UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); + } + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KeenEyeStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KeenEyeStatTracker.java index 8fddec0cc..185fd078e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KeenEyeStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KeenEyeStatTracker.java @@ -22,6 +22,16 @@ public class KeenEyeStatTracker extends StatTracker super(game); } + @EventHandler + public void onGameStart(GameStateChangeEvent event) + { + if (event.GetState() != Game.GameState.Prepare) + return; + + for (Player player : event.GetGame().GetPlayers(true)) + _guessAll.add(player); + } + @EventHandler public void onDrawRoundEnd(DrawRoundEndEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillEntityStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillEntityStatTracker.java index 2a7ef6928..733651e44 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillEntityStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/KillEntityStatTracker.java @@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; public class KillEntityStatTracker extends StatTracker @@ -24,23 +25,19 @@ public class KillEntityStatTracker extends StatTracker } @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public void onEntityDeath(EntityDeathEvent event) + public void onKillingBlow(CustomDamageEvent event) { - if (event.getEntity().getType() != getEntityType()) + if (event.GetDamageeEntity().getType() != getEntityType()) return; - if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent)) + if (!event.GetDamageeEntity().isDead()) return; - - EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) event.getEntity(); - Player damager = null; - if (edbee.getDamager() instanceof Player) - damager = (Player) edbee.getDamager(); - else if (edbee.getDamager() instanceof Projectile && ((Projectile) edbee.getDamager()).getShooter() instanceof Player) - damager = (Player) ((Projectile) edbee.getDamager()).getShooter(); - - if (damager != null) - addStat(damager, getStatName(), 1, false, false); + + Player player = event.GetDamagerPlayer(true); + if (player == null) + return; + + addStat(player, getStatName(), 1, false, false); } public String getStatName() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/PureLuckStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/PureLuckStatTracker.java index 782154a6d..22c510826 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/PureLuckStatTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/PureLuckStatTracker.java @@ -20,7 +20,7 @@ public class PureLuckStatTracker extends StatTracker if (getGame().GetState() != Game.GameState.Live) return; - if (System.currentTimeMillis() - event.getDrawRound().Time < 5000) + if (System.currentTimeMillis() - event.getDrawRound().Time < 8000) addStat(event.getPlayer(), "PureLuck", 1, true, false); } }