diff --git a/Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch b/Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch new file mode 100644 index 000000000..e6e990d00 --- /dev/null +++ b/Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch @@ -0,0 +1,37 @@ +From 896df3218cf190a29901619e762b5399517dbfbd Mon Sep 17 00:00:00 2001 +From: libraryaddict +Date: Wed, 11 Nov 2015 11:43:17 +1300 +Subject: [PATCH] Fix schedulers + + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 1d29ae7..55e2afd 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -705,6 +705,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + } + + public void B() { ++ SpigotTimings.schedulerTimer.startTiming(); // Spigot ++ // CraftBukkit start ++ this.server.getScheduler().mainThreadHeartbeat(this.ticks); ++ SpigotTimings.schedulerTimer.stopTiming(); // Spigot ++ + this.methodProfiler.a("jobs"); + Queue queue = this.j; + +@@ -718,11 +723,6 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + + this.methodProfiler.c("levels"); + +- SpigotTimings.schedulerTimer.startTiming(); // Spigot +- // CraftBukkit start +- this.server.getScheduler().mainThreadHeartbeat(this.ticks); +- SpigotTimings.schedulerTimer.stopTiming(); // Spigot +- + // Run tasks that are waiting on processing + SpigotTimings.processQueueTimer.startTiming(); // Spigot + while (!processQueue.isEmpty()) { +-- +1.9.5.msysgit.0 + diff --git a/Plugins/.idea/compiler.xml b/Plugins/.idea/compiler.xml index 56d0c48ed..37717d4dc 100644 --- a/Plugins/.idea/compiler.xml +++ b/Plugins/.idea/compiler.xml @@ -6,8 +6,6 @@ - - @@ -26,7 +24,7 @@ - + diff --git a/Plugins/Libraries/craftbukkit.jar b/Plugins/Libraries/craftbukkit.jar index 74bb320e1..c06344ecb 100644 Binary files a/Plugins/Libraries/craftbukkit.jar and b/Plugins/Libraries/craftbukkit.jar differ diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java index c1cba124c..ede793bef 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -55,12 +55,12 @@ public class MotdManager implements Listener, Runnable //String motdLine = "§f§l◄ §c§lMaintenance§f§l ►"; //String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►"; - String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; - //String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►"; +// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f"; + String motdLine = " §f§l◄ §b§lNew Game§f§l ▬ §3§lChampions CTF§f§l ►"; //String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); - updateMainMotd(" §4§l§m §f§l§m §8§l§m[ §r §4§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §4§l§m §r", motdLine); + updateMainMotd(" §f§l§m §8§l§m[ §r §6§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §r", motdLine); System.out.println("Updated Bungee MOTD"); } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java index 51c4bf21a..08448c2c3 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/RadarData.java @@ -35,4 +35,4 @@ public class RadarData { return _bearing; } -} \ No newline at end of file +} diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index e0f96dc9f..8587871ee 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -78,10 +78,13 @@ public class UtilEnt public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable) { - leashed.setPullWhileLeashed(pull); - leashed.setShouldBreakLeash(breakable); - leashed.setLeashHolder(holder); + + if (!(((CraftLivingEntity)leashed).getHandle() instanceof EntityInsentient)) + return; + + ((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setPullWhileLeashed(pull); + ((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setShouldBreakLeash(breakable); } public static void addLookAtPlayerAI(Entity entity, float dist) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java index 3c8047fd9..9444efb9b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilRadar.java @@ -84,6 +84,8 @@ public class UtilRadar text += C.cPurple + C.Bold + "] Radar"; + UtilTextTop.display(text, player); + if(bossBar) { UtilTextTop.display(text, player); @@ -109,4 +111,4 @@ public class UtilRadar } } } -} \ No newline at end of file +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java index 73138c191..df327ad09 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/CustomTagFix.java @@ -22,6 +22,7 @@ import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject; import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; +import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction; import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; @@ -55,15 +56,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook private NautHashMap _exemptTimeMap = new NautHashMap(); private NautHashMap> _doubleStrike = new NautHashMap>(); - private PacketHandler _packetHandler; public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler) { super("Custom Tag Fix", plugin); - _packetHandler = packetHandler; - - packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class, + packetHandler.addPacketHandler(this, true, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class, PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, PacketPlayInUseEntity.class); @@ -353,10 +351,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook { PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity(); newPacket.a = entry.getKey(); - newPacket.action = usePacket.action; - newPacket.c = usePacket.c; + newPacket.action = usePacket.action == EnumEntityUseAction.ATTACK ? EnumEntityUseAction.ATTACK + : EnumEntityUseAction.INTERACT; - if (_packetHandler.handlePacket(owner, newPacket)) { ((CraftPlayer) owner).getHandle().playerConnection.a(newPacket); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java b/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java index 23901a1b8..227cba9bb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/PacketsInteractionFix.java @@ -5,11 +5,15 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import net.minecraft.server.v1_8_R3.EntityPlayer; +import net.minecraft.server.v1_8_R3.MathHelper; +import net.minecraft.server.v1_8_R3.MovingObjectPosition; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction; -import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_8_R3.Vec3D; +import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; @@ -18,9 +22,6 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerAnimationEvent; -import org.bukkit.event.player.PlayerAnimationType; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -33,8 +34,6 @@ import mineplex.core.updater.event.UpdateEvent; public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler { private HashMap> _armorStands = new HashMap>(); - private HashSet _leftClicked = new HashSet(); - private int _lastTick; public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler) { @@ -44,42 +43,9 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler PacketPlayInUseEntity.class); } - private void checkLeftClicks() - { - if (MinecraftServer.currentTick == _lastTick) - { - return; - } - - _lastTick = MinecraftServer.currentTick; - _leftClicked.clear(); - } - - @EventHandler - public void onArmAnimation(PlayerAnimationEvent event) - { - if (event.getAnimationType() != PlayerAnimationType.ARM_SWING) - { - return; - } - - checkLeftClicks(); - - Player player = event.getPlayer(); - - if (_leftClicked.remove(player)) - { - return; - } - - CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.LEFT_CLICK_AIR, - ((CraftPlayer) player).getHandle().inventory.getItemInHand()); - } - @EventHandler public void onQuit(PlayerQuitEvent event) { - _leftClicked.remove(event.getPlayer().getName()); _armorStands.remove(event.getPlayer().getName()); } @@ -91,8 +57,6 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler return; } - checkLeftClicks(); - Iterator itel = _armorStands.keySet().iterator(); while (itel.hasNext()) @@ -110,19 +74,6 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler } } - @EventHandler - public void onPlayerInteract(PlayerInteractEvent event) - { - if (!event.getAction().name().contains("LEFT")) - { - return; - } - - checkLeftClicks(); - - _leftClicked.add(event.getPlayer()); - } - @Override public void handle(PacketInfo packetInfo) { @@ -166,12 +117,38 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler { PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket(); - if (!list.contains(packet.a)) + if (packet.action == EnumEntityUseAction.ATTACK) { + EntityPlayer nmsPlayer = ((CraftPlayer) packetInfo.getPlayer()).getHandle(); + + float f1 = nmsPlayer.pitch; + float f2 = nmsPlayer.yaw; + double d0 = nmsPlayer.locX; + double d1 = nmsPlayer.locY + nmsPlayer.getHeadHeight(); + double d2 = nmsPlayer.locZ; + Vec3D vec3d = new Vec3D(d0, d1, d2); + + float f3 = MathHelper.cos(-f2 * 0.01745329F - 3.141593F); + float f4 = MathHelper.sin(-f2 * 0.01745329F - 3.141593F); + float f5 = -MathHelper.cos(-f1 * 0.01745329F); + float f6 = MathHelper.sin(-f1 * 0.01745329F); + float f7 = f4 * f5; + float f8 = f3 * f5; + nmsPlayer.playerInteractManager.getGameMode(); + double d3 = nmsPlayer.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5 : 4.5; + Vec3D vec3d1 = vec3d.add(f7 * d3, f6 * d3, f8 * d3); + MovingObjectPosition movingobjectposition = nmsPlayer.world.rayTrace(vec3d, vec3d1, false); + + if (movingobjectposition != null && movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) + { + CraftEventFactory.callPlayerInteractEvent(nmsPlayer, Action.LEFT_CLICK_AIR, + nmsPlayer.inventory.getItemInHand()); + } + return; } - if (packet.action == EnumEntityUseAction.ATTACK) + if (!list.contains(packet.a)) { return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 825b62026..5953c98fa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -277,8 +277,8 @@ public enum Achievement //Champions CHAMPIONS_WINS("Champion", 600, - new String[]{"Champions Domination.Wins", "Champions TDM.Wins"}, - new String[]{"Win 80 games of Dominate or TDM"}, + new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions Capture the Flag.Wins"}, + new String[]{"Win 80 games of Dominate, TDM, or CTF"}, new int[]{80}, AchievementCategory.CHAMPIONS), @@ -295,28 +295,40 @@ public enum Achievement AchievementCategory.CHAMPIONS), CHAMPIONS_ASSASSINATION("Assassination", 1000, - new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination"}, + new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions Capture the Flag.Assassination"}, new String[]{"Kill 40 players with Backstab without", "taking any damage from them"}, new int[]{40}, AchievementCategory.CHAMPIONS), CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200, - new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution"}, + new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions Capture the Flag.MassElectrocution"}, new String[]{"Hit 4 enemies with a Lightning Orb"}, new int[]{1}, AchievementCategory.CHAMPIONS), CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200, - new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot"}, + new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot", "Champions Capture the Flag.TheLongestShot"}, new String[]{"Kill someone using Longshot who", "is over 64 Blocks away from you"}, new int[]{1}, AchievementCategory.CHAMPIONS), CHAMPIONS_EARTHQUAKE("Earthquake", 1200, - new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake"}, + new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions Capture the Flag.Earthquake"}, new String[]{"Launch 5 enemies using Seismic Slam"}, new int[]{1}, AchievementCategory.CHAMPIONS), + + CHAMPIONS_CAPTURES("Sticky Fingers", 2500, + new String[]{"Champions Capture the Flag.Captures"}, + new String[]{"Capture the Enemy Flag 20 times"}, + new int[]{20}, + AchievementCategory.CHAMPIONS), + + CHAMPIONS_CLUTCH("Clutch", 600, + new String[]{"Champions Capture the Flag.Clutch"}, + new String[]{"Kill the Enemy Flag Carrier in Sudden Death"}, + new int[]{1}, + AchievementCategory.CHAMPIONS), //Paintball SUPER_PAINTBALL_WINS("Paintball King", 600, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 6ce3d8025..8eb4305a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -78,8 +78,8 @@ public enum AchievementCategory new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"), - CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, - new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, + CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions Capture the Flag"}, + new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") }, Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"), MASTER_BUILDERS("Master Builders", null, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java index fda3caaef..a9417c831 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blockrestore/BlockRestoreData.java @@ -1,5 +1,9 @@ package mineplex.core.blockrestore; +import java.util.HashMap; + +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -18,6 +22,8 @@ public class BlockRestoreData protected long _meltDelay = 0; protected long _meltLast = 0; + + protected HashMap _pad = new HashMap(); public BlockRestoreData(Block block, int toID, byte toData, int fromID, byte fromData, long expireDelay, long meltDelay) { @@ -136,6 +142,11 @@ public class BlockRestoreData { if (_toID == 78 && _toData == (byte)7) _block.setTypeIdAndData(80, (byte)0, true); + else if (_toID == 8 || _toID == 9 || _toID == 79) + { + handleLilypad(false); + _block.setTypeIdAndData(_toID, _toData, true); + } else _block.setTypeIdAndData(_toID, _toData, true); } @@ -143,6 +154,7 @@ public class BlockRestoreData public void restore() { _block.setTypeIdAndData(_fromID, _fromData, true); + handleLilypad(true); } public void setFromId(int i) @@ -154,4 +166,24 @@ public class BlockRestoreData { _fromData = i; } + + private void handleLilypad(boolean restore) + { + if (restore) + { + for (Location l : _pad.keySet()) + { + l.getBlock().setType(Material.WATER_LILY); + l.getBlock().setData(_pad.get(l)); + } + } + else + { + if (_block.getRelative(BlockFace.UP, 1).getType() == Material.WATER_LILY) + { + _pad.put(_block.getRelative(BlockFace.UP, 1).getLocation(), _block.getRelative(BlockFace.UP, 1).getData()); + _block.getRelative(BlockFace.UP, 1).setType(Material.AIR); + } + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index 7847b0408..8954b07c0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -134,9 +134,10 @@ public class Chat extends MiniPlugin public void preventMe(PlayerCommandPreprocessEvent event) { if (event.getMessage().toLowerCase().startsWith("/me ") - || event.getMessage().toLowerCase().startsWith("/bukkit")) + || event.getMessage().toLowerCase().startsWith("/bukkit") + || event.getMessage().toLowerCase().startsWith("/minecraft")) { - event.getPlayer().sendMessage(F.main(getName(), "No, you!")); + event.getPlayer().sendMessage(F.main(getName(), "Nope, not allowed!")); event.setCancelled(true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java index d1371487f..faf8929e2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java @@ -112,7 +112,7 @@ public class MobCommand extends MultiCommandBase HashSet entSet = new HashSet(); for (int i = 0 ; i < count ; i++) { - entSet.add(Plugin.SpawnEntity(caller.getTargetBlock((Set) null, 0).getLocation().add(0.5, 1, 0.5), type)); + entSet.add(Plugin.SpawnEntity(caller.getTargetBlock((Set) null, 150).getLocation().add(0.5, 1, 0.5), type)); } //Search Vars diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java index c39b95697..2b1c52204 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/GameDisplay.java @@ -67,6 +67,8 @@ public enum GameDisplay MonsterLeague("Monster League", Material.MINECART, (byte)0, GameCategory.ARCADE, 56), Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), + + ChampionsCTF("Champions CTF", "Champions", Material.REDSTONE_BLOCK, (byte)0, GameCategory.CHAMPIONS, 55), Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java index 1329e1045..97257bd98 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/GlobalPacketManager.java @@ -11,9 +11,19 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.giveaway.GiveawayManager; import mineplex.core.globalpacket.command.GlobalPacketCommand; +import mineplex.core.globalpacket.listeners.GlobalGiveCoins; +import mineplex.core.globalpacket.listeners.GlobalGiveGems; +import mineplex.core.globalpacket.listeners.GlobalGiveItem; +import mineplex.core.globalpacket.listeners.GlobalRawr; import mineplex.core.globalpacket.redis.GlobalPacketHandler; import mineplex.core.globalpacket.redis.GlobalPacketMessage; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.pet.PetManager; +import mineplex.core.reward.RewardManager; +import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; import mineplex.serverdata.commands.ServerCommandManager; @@ -21,15 +31,32 @@ public class GlobalPacketManager extends MiniPlugin { private CoreClientManager _clientManager; private ServerStatusManager _statusManager; + private InventoryManager _inventoryManager; + private DonationManager _donationManager; + private RewardManager _rewardManager; - public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager) + public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager) { super("Global Packet Manager", plugin); _clientManager = clientManager; _statusManager = statusManager; + _inventoryManager = inventoryManager; + _donationManager = donationManager; + + _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, + 100, 250, + 500, 1000, + 1500, 2500, + 6000, 12000, + false, false); ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager)); + + getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin()); + getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin()); + getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin()); + getPluginManager().registerEvents(new GlobalRawr(), getPlugin()); } public void callGlobalCommand(Player caller, String[] args) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java index d30163fe7..994262900 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/command/GlobalPacketCommand.java @@ -12,7 +12,7 @@ public class GlobalPacketCommand extends CommandBase { public GlobalPacketCommand(GlobalPacketManager plugin) { - super(plugin, Rank.ADMIN, "globalpacket"); + super(plugin, Rank.JNR_DEV, "global", "globalpacket"); } @Override @@ -20,8 +20,8 @@ public class GlobalPacketCommand extends CommandBase { if (args == null || args.length < 1) { - UtilPlayer.message(caller, F.main("Global", "Please call the globalpacket command with at least 1 argument")); - UtilPlayer.message(caller, F.main("Global", "For help please see /globalpacket google doc")); + UtilPlayer.message(caller, F.main("Global", "Please call the global command with at least 1 argument")); + UtilPlayer.message(caller, F.main("Global", "For help please see /global google doc")); return; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java new file mode 100644 index 000000000..f264b2457 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveCoins.java @@ -0,0 +1,82 @@ +package mineplex.core.globalpacket.listeners; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.donation.DonationManager; +import mineplex.core.globalpacket.event.GlobalPacketEvent; + +/** + * Created by William (WilliamTiger). + * 17/11/15 + */ +public class GlobalGiveCoins implements Listener +{ + + private DonationManager _donationManager; + private CoreClientManager _clientManager; + + public GlobalGiveCoins(DonationManager donationManager, CoreClientManager coreClientManager) + { + _donationManager = donationManager; + _clientManager = coreClientManager; + } + + @EventHandler + public void giveCoins(final GlobalPacketEvent e) + { + if (!e.getCallerRank().has(Rank.ADMIN)) + return; + + if (e.getParts() == null || e.getParts().length < 1) + return; + + if (!e.getParts()[0].equalsIgnoreCase("givecoins")) + return; + + if (e.getParts().length != 2) + { + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "/global givecoins ")); + + return; + } + + int amount = 1; + try + { + amount = Integer.parseInt(e.getParts()[1]); + } + catch (Exception ex) + { + // No number + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(amount + "") + "] is not a valid amount.")); + + return; + } + + final int fAmount = amount; + for (final Player p : UtilServer.getPlayers()) + { + _donationManager.RewardCoins(new Callback() + { + @Override + public void run(Boolean data) + { + UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Coins") + ".")); + UtilTextMiddle.display(C.cYellow + fAmount + " Coins", C.cGold + "received from " + e.getCallerName() + "!", p); + } + }, "Global Coins", p.getName(), _clientManager.getAccountId(p), amount); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java new file mode 100644 index 000000000..f7763b839 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveGems.java @@ -0,0 +1,79 @@ +package mineplex.core.globalpacket.listeners; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.donation.DonationManager; +import mineplex.core.globalpacket.event.GlobalPacketEvent; + +/** + * Created by William (WilliamTiger). + * 17/11/15 + */ +public class GlobalGiveGems implements Listener +{ + + private DonationManager _donationManager; + + public GlobalGiveGems(DonationManager donationManager) + { + _donationManager = donationManager; + } + + @EventHandler + public void giveGems(final GlobalPacketEvent e) + { + if (!e.getCallerRank().has(Rank.ADMIN)) + return; + + if (e.getParts() == null || e.getParts().length < 1) + return; + + if (!e.getParts()[0].equalsIgnoreCase("givegems")) + return; + + if (e.getParts().length != 2) + { + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "/global givegems ")); + + return; + } + + int amount = 1; + try + { + amount = Integer.parseInt(e.getParts()[1]); + } + catch (Exception ex) + { + // No number + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(amount + "") + "] is not a valid amount.")); + + return; + } + + final int fAmount = amount; + for (final Player p : UtilServer.getPlayers()) + { + _donationManager.RewardGems(new Callback() + { + @Override + public void run(Boolean data) + { + UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Gems") + ".")); + UtilTextMiddle.display(C.cYellow + fAmount + " Gems", C.cGold + "received from " + e.getCallerName() + "!", p); + } + }, "Global Gems", p.getName(), p.getUniqueId(), amount); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java new file mode 100644 index 000000000..1420cac3e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java @@ -0,0 +1,156 @@ +package mineplex.core.globalpacket.listeners; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.globalpacket.event.GlobalPacketEvent; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardManager; +import mineplex.core.reward.RewardType; + +/** + * Created by William (WilliamTiger). + * 17/11/15 + */ +public class GlobalGiveItem implements Listener +{ + + private InventoryManager _inventoryManager; + private RewardManager _rewardManager; + + public GlobalGiveItem(InventoryManager inventoryManager, RewardManager rewardManager) + { + _inventoryManager = inventoryManager; + _rewardManager = rewardManager; + } + + public enum GlobalItem + { + OLD_CHEST("Old Chest"), + ANCIENT_CHEST("Ancient Chest"), + MYTHICAL_CHEST("Mythical Chest"), + + GAME_LOOT("Game Loot"); + + private String _invName; + + GlobalItem(String invName) + { + _invName = invName; + } + + public String getInvName() + { + return _invName; + } + } + + @EventHandler + public void giveItem(final GlobalPacketEvent e) + { + if (!e.getCallerRank().has(Rank.ADMIN)) + return; + + if (e.getParts() == null || e.getParts().length < 1) + return; + + if (!e.getParts()[0].equalsIgnoreCase("giveitem")) + return; + + if (e.getParts().length != 3) + { + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "/global giveitem ")); + + return; + } + + GlobalItem item = null; + + try + { + item = GlobalItem.valueOf(e.getParts()[1]); + } + catch (Exception ex) + { + // Wrong item + + if (e.getCaller() != null) + { + UtilPlayer.message(e.getCaller(), F.main("Global", "That GlobalItem type can't be found. Types:")); + + String list = ""; + for (GlobalItem i : GlobalItem.values()) + list += i.toString() + " "; + + UtilPlayer.message(e.getCaller(), C.cYellow + list); + } + + return; + } + + int amount = 1; // Default, shouldn't happen anyway. + + try + { + amount = Integer.parseInt(e.getParts()[2]); + } + catch (Exception ex) + { + // Not a number + + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(e.getParts()[2]) + "] is not a valid number.")); + + return; + } + + if (item.toString().contains("CHEST")) + { + for (final Player p : UtilServer.getPlayers()) + { + final int fAmount = amount; + final GlobalItem fItem = item; + _inventoryManager.addItemToInventory(new Callback() + { + @Override + public void run(Boolean data) + { + UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " " + fItem.getInvName() + "(s)") + " from " + F.name(e.getCallerName()) + ".")); + UtilTextMiddle.display(C.cYellow + fAmount + " " + fItem.getInvName() + "(s)", C.cGold + "received from " + e.getCallerName() + "!", p); + } + }, p, item.getInvName(), amount); + } + + return; + } + else if (item.toString().equalsIgnoreCase("GAME_LOOT")) + { + for (final Player p : UtilServer.getPlayers()) + { + Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GameLoot, true); + reward.giveReward(RewardType.GameLoot, p, new Callback() + { + @Override + public void run(RewardData data) + { + UtilPlayer.message(p, F.main("Global", "You received " + F.elem("Game Loot") + " from " + F.name(e.getCallerName()) + ".")); + UtilPlayer.message(p, F.main("Global", "You won " + F.elem(data.getFriendlyName()) + "!")); + UtilTextMiddle.display(C.cYellow + data.getFriendlyName(), C.cGold + "received from " + e.getCallerName() + "!", p); + } + }); + } + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalRawr.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalRawr.java new file mode 100644 index 000000000..ffba8fb83 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalRawr.java @@ -0,0 +1,50 @@ +package mineplex.core.globalpacket.listeners; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.globalpacket.event.GlobalPacketEvent; + +/** + * Created by William (WilliamTiger). + * 18/11/15 + */ +public class GlobalRawr implements Listener +{ + + @EventHandler + public void globalRawr(GlobalPacketEvent e) + { + if (e.getParts() == null || e.getParts().length < 1) + return; + + if (!e.getParts()[0].equalsIgnoreCase("rawr")) + return; + + if (e.getParts().length < 2) + { + if (e.getCaller() != null) + UtilPlayer.message(e.getCaller(), F.main("Global", "/global rawr ")); + + return; + } + + String msg = ""; + for (int i = 1; i < e.getParts().length; i++) + { + msg += e.getParts()[i] + " "; + } + msg = msg.trim(); + + for (Player p : UtilServer.getPlayers()) + { + UtilTextMiddle.display("§6§lRAWR!", "§e" + msg, p); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java index 9df819f31..0936a669e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/message/MessageManager.java @@ -83,7 +83,7 @@ public class MessageManager extends MiniClientPlugin addCommand(new ResendAdminCommand(this)); addCommand(new AnnounceCommand(this)); - addCommand(new GlobalCommand(this)); + //addCommand(new GlobalCommand(this)); addCommand(new AdminCommand(this)); } @@ -219,16 +219,16 @@ public class MessageManager extends MiniClientPlugin Get(from).LastToTime = System.currentTimeMillis(); // Chiss or defek7 - if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify")) + if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify") || to.getName().equals("sampepere")) { UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development."); UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly."); } - if(to.getName().equals("ishh")) + /*if(to.getName().equals("ishh")) { UtilPlayer.message(from, C.cPurple + "Hi, my name is ishh. If I don't respond to your message, please be patient and try again later!"); - } + }*/ // Log // Logger().logChat("Private Message", from, to.getName(), message); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/GlobalCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/message/commands/GlobalCommand.java deleted file mode 100644 index 9c9f12e62..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/message/commands/GlobalCommand.java +++ /dev/null @@ -1,32 +0,0 @@ -package mineplex.core.message.commands; - -import mineplex.core.command.CommandBase; -import mineplex.core.common.Rank; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.message.MessageManager; -import mineplex.serverdata.commands.AnnouncementCommand; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -public class GlobalCommand extends CommandBase -{ - public GlobalCommand(MessageManager plugin) - { - super(plugin, Rank.ADMIN, "global"); - } - - @Override - public void Execute(Player caller, String[] args) - { - if (args == null || args.length == 0) - { - Plugin.Help(caller); - } - else - { - new AnnouncementCommand(false, F.combine(args, 0, null, false)).publish(); - } - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index 8faae8264..d34e42c11 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Sound; import org.bukkit.entity.Entity; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 1c64c938c..af01bf478 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -16,6 +16,7 @@ import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MovingObjectPosition; import net.minecraft.server.v1_8_R3.Vec3D; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Sound; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 2a9851180..d6a48c63d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.punish.Command.PunishCommand; import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishmentToken; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.serverdata.commands.ServerCommandManager; import org.bukkit.Bukkit; @@ -107,6 +109,33 @@ public class Punish extends MiniPlugin event.setCancelled(true); } } + + @EventHandler + public void banRefresh(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Player check : UtilServer.getPlayers()) + { + PunishClient client = GetClient(check.getName()); + if (client != null && client.IsBanned()) + { + Punishment punishment = client.GetPunishment(PunishmentSentence.Ban); + String time = UtilTime.convertString(punishment.GetRemaining(), 0, TimeUnit.FIT); + + if (punishment.GetHours() == -1) + time = "Permanent"; + + String reason = C.cRed + C.Bold + "You are banned for " + time + + "\n" + C.cWhite + punishment.GetReason() + + "\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals" + ; + + check.kickPlayer(reason); + } + } + } public void Help(Player caller) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java index cbc2c24ff..f51ee8b96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResPackManager.java @@ -32,7 +32,7 @@ public class ResPackManager implements CommandCallback { if (_packUnloadCheck.canSendUnload(player)) { - player.setResourcePack("http://www.chivebox.com/file/c/empty.zip"); + player.setResourcePack("http://file.mineplex.com/ResReset.zip"); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java new file mode 100644 index 000000000..47648f55b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RankRewardData.java @@ -0,0 +1,22 @@ +package mineplex.core.reward; + +import mineplex.core.common.Rank; + +import org.bukkit.inventory.ItemStack; + +public class RankRewardData extends RewardData +{ + private Rank _rank; + + public RankRewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, Rank rank) + { + super(friendlyName, displayItem, rarity); + _rank = rank; + } + + public Rank getWonRank() + { + return _rank; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index bd776c173..8c282a545 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -407,7 +407,7 @@ public class RewardManager } if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { - return new RankReward(_clientManager, _statusManager, 0, rarity); + return new RankReward(_clientManager, 0, rarity); } else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND)) { @@ -415,7 +415,7 @@ public class RewardManager } else { - return new RankReward(_clientManager, _statusManager, 0, rarity); + return new RankReward(_clientManager, 0, rarity); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java index 438124d54..89412121d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/GiveawayReward.java @@ -62,7 +62,7 @@ public class GiveawayReward extends Reward // Dang, I guess we failed! if (!_clientManager.hasRank(player, Rank.TITAN)) { - Reward reward = new RankReward(_clientManager, _serverStatusManager, 0, getRarity()); + Reward reward = new RankReward(_clientManager, 0, getRarity()); reward.giveReward(rewardType, player, rewardDataCallback); } else diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index db925baa2..234fb2215 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -2,31 +2,28 @@ package mineplex.core.reward.rewards; import java.util.Random; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.Rank; +import mineplex.core.reward.RankRewardData; +import mineplex.core.reward.Reward; +import mineplex.core.reward.RewardData; +import mineplex.core.reward.RewardRarity; +import mineplex.core.reward.RewardType; + import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.Rank; -import mineplex.core.reward.Reward; -import mineplex.core.reward.RewardData; -import mineplex.core.reward.RewardRarity; -import mineplex.core.reward.RewardType; -import mineplex.core.status.ServerStatusManager; -import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; - public class RankReward extends Reward { private Random _random; private CoreClientManager _clientManager; - private ServerStatusManager _statusManager; - public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity) + public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity) { super(rarity, weight); _clientManager = clientManager; - _statusManager = statusManager; _random = new Random(); } @@ -47,14 +44,8 @@ public class RankReward extends Reward _clientManager.Get(player).SetRank(rank, false); _clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true); - - if (rank == Rank.TITAN) - { - TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName()); - message.publish(); - } - return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity()); + return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank); } @Override @@ -68,7 +59,7 @@ public class RankReward extends Reward if (rank == null) return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); - return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity()); + return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index daafaea51..e4645cad3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -6,30 +6,25 @@ import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; -import org.bukkit.Bukkit; -import org.bukkit.Effect; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; -import org.bukkit.entity.Player; - -import net.minecraft.server.v1_8_R3.BlockPosition; -import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.hologram.HologramManager; +import mineplex.core.reward.RankRewardData; import mineplex.core.reward.Reward; import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardType; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage; import mineplex.core.treasure.animation.Animation; import mineplex.core.treasure.animation.BlockChangeAnimation; import mineplex.core.treasure.animation.ChestOpenAnimation; @@ -37,8 +32,17 @@ import mineplex.core.treasure.animation.ChestSpawnAnimation; import mineplex.core.treasure.animation.LootLegendaryAnimation; import mineplex.core.treasure.animation.LootMythicalAnimation; import mineplex.core.treasure.animation.LootRareAnimation; -import mineplex.core.treasure.animation.TreasureRemoveAnimation; import mineplex.core.treasure.animation.LootUncommonAnimation; +import mineplex.core.treasure.animation.TreasureRemoveAnimation; +import net.minecraft.server.v1_8_R3.BlockPosition; +import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; +import org.bukkit.entity.Player; /** * Created by Shaun on 8/27/2014. @@ -62,6 +66,7 @@ public class Treasure private Reward[] _rewards; private RewardType _rewardType; + private ConcurrentHashMap _rewardData = new ConcurrentHashMap(); private int _currentReward; private boolean _finished; @@ -70,15 +75,16 @@ public class Treasure private LinkedList _animations; private HologramManager _hologramManager; + private ServerStatusManager _statusManager; - public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager) + public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager, ServerStatusManager statusManager) { - this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager); + this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager, statusManager); _blockRestore = blockRestore; } - public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager) + public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager, ServerStatusManager statusManager) { _player = player; _random = seed; @@ -88,6 +94,7 @@ public class Treasure _centerBlock = centerBlock; _animations = new LinkedList(); _hologramManager = hologramManager; + _statusManager = statusManager; _currentChest = 0; _currentReward = 0; @@ -101,6 +108,19 @@ public class Treasure } _animations.add(new BlockChangeAnimation(this, _otherBlockInfo)); + + for (int i = 0; i < _rewards.length; i++) + { + Reward reward = _rewards[i]; + final int count = i; + reward.giveReward(_rewardType, player, new Callback() + { + @Override + public void run(RewardData data) { + _rewardData.put(count, data); + } + }); + } } public int getFinishedTickCount() @@ -203,14 +223,15 @@ public class Treasure final ChestData data = getChestData(block); if (data != null && !data.isOpened() && _currentReward < _rewards.length) { - final Reward reward = _rewards[_currentReward]; + //final Reward reward = _rewards[_currentReward]; + final RewardData rewardData = _rewardData.get(_currentReward); data.setOpened(true); _currentReward++; - reward.giveReward(_rewardType, _player, new Callback() - { - @Override - public void run(RewardData rewardData) - { + //reward.giveReward(_rewardType, _player, new Callback() + //{ + //@Override + //public void run(RewardData rewardData) + //{ if (swapList) { BlockInfo info = getBlockInfo(block); @@ -222,22 +243,30 @@ public class Treasure _animations.add(chestOpenTask); // Extra effects based off the rarity of the treasure - if (reward.getRarity() == RewardRarity.UNCOMMON) + if (rewardData.getRarity() == RewardRarity.UNCOMMON) { _animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock())); } - else if (reward.getRarity() == RewardRarity.RARE) + else if (rewardData.getRarity() == RewardRarity.RARE) { _animations.add(new LootRareAnimation(Treasure.this, data.getBlock().getLocation().add(0.5, 1.5, 0.5))); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName())); } - else if (reward.getRarity() == RewardRarity.LEGENDARY) + else if (rewardData.getRarity() == RewardRarity.LEGENDARY) { _animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName())); } - else if (reward.getRarity() == RewardRarity.MYTHICAL) + else if (rewardData.getRarity() == RewardRarity.MYTHICAL) { + if (rewardData instanceof RankRewardData) + { + if (((RankRewardData)rewardData).getWonRank() == Rank.TITAN) + { + TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(_player.getName(), _statusManager.getCurrentServerName()); + message.publish(); + } + } _animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName())); } @@ -248,8 +277,8 @@ public class Treasure _animations.add(animation); _finished = true; } - } - }); + //} + //}); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index d909bbe9b..c5f591843 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -2,6 +2,26 @@ package mineplex.core.treasure; import java.util.List; +import mineplex.core.account.CoreClientManager; +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.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramManager; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.reward.Reward; +import mineplex.core.status.ServerStatusManager; +import mineplex.core.treasure.event.TreasureFinishEvent; +import mineplex.core.treasure.event.TreasureStartEvent; +import mineplex.core.treasure.gui.TreasureShop; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -18,31 +38,13 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; -import mineplex.core.account.CoreClientManager; -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.UtilPlayer; -import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.donation.DonationManager; -import mineplex.core.gadget.event.GadgetBlockEvent; -import mineplex.core.hologram.Hologram; -import mineplex.core.hologram.HologramManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.reward.Reward; -import mineplex.core.treasure.event.TreasureFinishEvent; -import mineplex.core.treasure.event.TreasureStartEvent; -import mineplex.core.treasure.gui.TreasureShop; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; - public class TreasureLocation implements Listener { private TreasureManager _treasureManager; private InventoryManager _inventoryManager; private Hologram _hologram; private HologramManager _hologramManager; + private ServerStatusManager _statusManager; private Treasure _currentTreasure; private Block _chestBlock; private byte _chestBlockData; @@ -50,7 +52,7 @@ public class TreasureLocation implements Listener private TreasureShop _shop; private Location _resetLocation; - public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager) + public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, ServerStatusManager statusManager) { _treasureManager = treasureManager; _resetLocation = resetLocation; @@ -59,6 +61,7 @@ public class TreasureLocation implements Listener _chestBlockData = _chestBlock.getData(); _chestSpawns = chestSpawns; _hologramManager = hologramManager; + _statusManager = statusManager; _currentTreasure = null; _hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure"); setHoloChestVisible(true); @@ -107,7 +110,7 @@ public class TreasureLocation implements Listener Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName())); Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType()); - Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager); + Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); _currentTreasure = treasure; UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index c5e6aacac..c37885de1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -65,7 +65,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(-18, 72, -16); Block chestLoc8 = world.getBlockAt(-16, 72, -18); Location resetLocation = new Location(world, -23.5, 72, -23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); } { @@ -79,7 +79,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(18, 72, 16); Block chestLoc8 = world.getBlockAt(16, 72, 18); Location resetLocation = new Location(world, 23.5, 72, 23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); } { @@ -93,7 +93,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(18, 72, -16); Block chestLoc8 = world.getBlockAt(16, 72, -18); Location resetLocation = new Location(world, 23.5, 72, -23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); } { @@ -107,7 +107,7 @@ public class TreasureManager extends MiniPlugin Block chestLoc7 = world.getBlockAt(-18, 72, 16); Block chestLoc8 = world.getBlockAt(-16, 72, 18); Location resetLocation = new Location(world, -23.5, 72, 23.5); - _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager)); + _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager)); } for (TreasureLocation treasureLocation : _treasureLocations) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index d38e276db..05b6bb0e9 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -138,7 +138,7 @@ public class ClansManager extends MiniClientPlugin implements IRelat StatsManager statsManager = new StatsManager(plugin, _clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager); - ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager); + ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager, false); _classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop"); _warManager = new WarManager(plugin, this); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 8a46416d1..31364b88f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -149,7 +149,7 @@ public class Hub extends JavaPlugin implements IRelation return true; } }); - new GlobalPacketManager(this, clientManager, serverStatusManager); + new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager); //new Replay(this, packetHandler); AprilFoolsManager.Initialize(this, clientManager, disguiseManager); @@ -167,15 +167,15 @@ public class Hub extends JavaPlugin implements IRelation ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress); SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress); - ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress); + ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory, webServerAddress); ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager); - new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute")); - new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage")); - new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger")); - new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight")); - new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin")); + new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true); + new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true); + new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true); + new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true); + new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true); //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 2f8a774d4..2ac87ef75 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -226,7 +226,7 @@ public class StackerManager extends MiniPlugin implements IThrown UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); - _projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 0.5f); + _projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f); //Portal Delay Manager.SetPortalDelay(thrower); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java index 9260e2d78..55e32d4bf 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/TextManager.java @@ -60,9 +60,12 @@ public class TextManager extends MiniPlugin UtilBlockText.MakeText("TEAM DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER); UtilBlockText.MakeText("TEAM DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); + + UtilBlockText.MakeText("CAPTURE THE FLAG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER); + UtilBlockText.MakeText("CAPTURE THE FLAG", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); - UtilBlockText.MakeText("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER); - UtilBlockText.MakeText("CLANS", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); +// UtilBlockText.MakeText("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER); +// UtilBlockText.MakeText("CLANS", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER); //Arcade UtilBlockText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java index acea5910f..51cfec6cf 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java @@ -15,6 +15,7 @@ public enum GameType CastleSiege("Castle Siege"), ChampionsTDM("Champions TDM", "Champions"), ChampionsDominate("Champions Domination", "Champions"), + ChampionsCTF("Champions CTF", "Champions"), ChampionsMOBA("Champions MOBA", "Champions"), Christmas("Christmas Chaos"), DeathTag("Death Tag"), diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java index c983572ff..c2b817e81 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClassManager.java @@ -2,7 +2,18 @@ package mineplex.minecraft.game.classcombat.Class; import java.util.Collection; import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.common.Rank; +import mineplex.core.common.util.Callback; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository; import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTokenWrapper; @@ -10,14 +21,6 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildTok import mineplex.minecraft.game.classcombat.Skill.ISkill; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.item.ItemFactory; -import mineplex.core.MiniClientPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.account.event.ClientWebResponseEvent; -import mineplex.core.common.Rank; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.donation.DonationManager; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -34,12 +37,15 @@ public class ClassManager extends MiniClientPlugin implements IClas private SkillFactory _skillFactory; private ItemFactory _itemFactory; private ClassRepository _repository; + private GadgetManager _gadgetManager; private HashMap _classes; private HashMap _classSalesPackageIdMap; private Object _clientLock = new Object(); private boolean _enabled = true; + + private ConcurrentHashMap> _messageSuppressed; public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SkillFactory skillFactory, ItemFactory itemFactory, String webAddress) @@ -54,6 +60,26 @@ public class ClassManager extends MiniClientPlugin implements IClas _repository = new ClassRepository(webAddress); _classes = new HashMap(); _classSalesPackageIdMap = new HashMap(); + _messageSuppressed = new ConcurrentHashMap>(); + + PopulateClasses(); + } + + public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, + SkillFactory skillFactory, ItemFactory itemFactory, String webAddress) + { + super("Class Manager", plugin); + + _plugin = plugin; + _clientManager = clientManager; + _donationManager = donationManager; + _gadgetManager = gadgetManager; + _skillFactory = skillFactory; + _itemFactory = itemFactory; + _repository = new ClassRepository(webAddress); + _classes = new HashMap(); + _classSalesPackageIdMap = new HashMap(); + _messageSuppressed = new ConcurrentHashMap>(); PopulateClasses(); } @@ -300,6 +326,11 @@ public class ClassManager extends MiniClientPlugin implements IClas { return _repository; } + + public GadgetManager getGadgetManager() + { + return _gadgetManager; + } @EventHandler public void SkillDisplay(PlayerCommandPreprocessEvent event) @@ -344,4 +375,25 @@ public class ClassManager extends MiniClientPlugin implements IClas { _enabled = var; } + + public void hideNextEquipMessage(String name) + { + _messageSuppressed.put(name, new Callback() + { + public void run(String name) + { + _messageSuppressed.remove(name); + } + }); + } + + public void forceRemoveFromSuppressed(String name) + { + _messageSuppressed.remove(name); + } + + public Callback getMessageSuppressedCallback(String name) + { + return _messageSuppressed.get(name); + } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java index c04931c49..57c9f51a6 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/ClientClass.java @@ -563,13 +563,15 @@ public class ClientClass public void DisplaySkills(Player player) { - player.sendMessage("------------------------------------------"); - + String bar = "------------------------------------------"; + player.sendMessage(bar); for (SkillType type : _lastSkillMap.keySet()) { + if (_lastSkillMap.get(type).getKey() == null) + continue; player.sendMessage(C.cGreen + type + ": " + C.cWhite + _lastSkillMap.get(type).getKey().GetName() + " " + _lastSkillMap.get(type).getValue()); } - + player.sendMessage(bar); } //This is used to fix a dual class bug using Twitch broadcasting GUI (F6) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java index 4786b3433..ab1048153 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/IPvpClass.java @@ -1,6 +1,5 @@ package mineplex.minecraft.game.classcombat.Class; -import java.util.HashMap; import java.util.HashSet; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java index fea830b95..8be18e9d1 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Class/PvpClass.java @@ -1,10 +1,11 @@ package mineplex.minecraft.game.classcombat.Class; import java.util.HashSet; +import java.util.concurrent.ConcurrentHashMap; -import mineplex.core.common.util.F; +import mineplex.core.common.util.Callback; import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.types.GadgetType; import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Skill.ISkill; @@ -194,13 +195,17 @@ public class PvpClass implements IPvpClass !((LeatherArmorMeta)inv.getBoots().getItemMeta()).getColor().equals(_leatherColor)) continue; } + + if (_classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null) + continue; - Equip(cur); + Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null); + _classes.getMessageSuppressedCallback(cur.getName()).run(cur.getName()); } } } - public void Equip(Player player) + public void Equip(Player player, boolean inform) { ClientClass client = _classes.Get(player); @@ -208,12 +213,12 @@ public class PvpClass implements IPvpClass if (customBuild != null) { - client.EquipCustomBuild(customBuild, true, true); + client.EquipCustomBuild(customBuild, inform, true); } else { client.SetGameClass(this); - client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), true, true); + client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), inform, true); } //Ensure Sneak Removed diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java index f250c0839..dbad68ca0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Flash.java @@ -55,7 +55,7 @@ public class Flash extends SkillActive @Override public String GetRechargeString() { - return "Recharge: #10#-1 Seconds per Charge"; + return "Recharge: #8#-1 Seconds per Charge"; } @Override @@ -84,7 +84,7 @@ public class Flash extends SkillActive } @EventHandler - public void Recharge(UpdateEvent event) + public void recharge(UpdateEvent event) { for (Player cur : GetUsers()) { @@ -100,7 +100,7 @@ public class Flash extends SkillActive if (charges >= 1 + level) continue; - if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 10000 - (1000 * level), false, false)) + if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 8000 - (1000 * level), false, false)) continue; _flash.put(cur, charges + 1); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index 4093a58d0..2d687d6dc 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -107,6 +107,9 @@ public class Illusion extends SkillActive UtilEnt.Vegetate(skel); UtilEnt.silence(skel, true); + skel.setMaxHealth(7); + skel.setHealth(7); + ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false); UtilServer.getServer().getPluginManager().callEvent(disableEvent); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java index 518cb9969..a59cee5da 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Recall.java @@ -31,6 +31,7 @@ import org.bukkit.event.player.PlayerDropItemEvent; public class Recall extends Skill { private HashMap> _locMap = new HashMap>(); + private HashMap> _healthMap = new HashMap>(); public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) { @@ -52,7 +53,7 @@ public class Recall extends Skill } @EventHandler - public void Use(PlayerDropItemEvent event) + public void use(PlayerDropItemEvent event) { Player player = event.getPlayer(); @@ -79,14 +80,22 @@ public class Recall extends Skill if (locs == null) return; + LinkedList health = _healthMap.remove(player); + if (health == null) + return; + + //Heal + player.setHealth(health.getLast()); + //Effect player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); + //Teleport Location current = player.getLocation(); Location target = locs.getLast(); player.teleport(target); - + //Inform UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); @@ -102,21 +111,32 @@ public class Recall extends Skill } @EventHandler - public void StoreLocation(UpdateEvent event) + public void storeLocation(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; for (Player cur : GetUsers()) { + //Create if (!_locMap.containsKey(cur)) _locMap.put(cur, new LinkedList()); + if (!_healthMap.containsKey(cur)) + _healthMap.put(cur, new LinkedList()); + + //Store _locMap.get(cur).addFirst(cur.getLocation()); + _healthMap.get(cur).addFirst(cur.getHealth()); int level = getLevel(cur); + + //Cull if (_locMap.get(cur).size() > (2 + 2 * level) * 20) _locMap.get(cur).removeLast(); + + if (_healthMap.get(cur).size() > (2 + 2 * level) * 20) + _healthMap.get(cur).removeLast(); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java index 059dec01d..7f18fb654 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java @@ -52,7 +52,7 @@ public class SilencingArrow extends SkillActive SetDesc(new String[] { "Your next arrow will Silence", - "target for #1#3 seconds.", + "target for #2#2 seconds.", "", "Silence stops skills being used." }); @@ -129,7 +129,7 @@ public class SilencingArrow extends SkillActive if (level == 0) return; //Confuse - Factory.Condition().Factory().Silence(GetName(), damagee, damager, 3 + 3*level, true, true); + Factory.Condition().Factory().Silence(GetName(), damagee, damager, 2 + 2*level, true, true); //Effect damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java index 23ff9525c..6332794e1 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/BlockToss.java @@ -14,6 +14,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; @@ -104,15 +105,15 @@ public class BlockToss extends SkillCharge implements IThrown if (!Recharge.Instance.use(player, GetName(), 1000, false, false)) return; - //Door - if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71) + //Door and Banner + if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER) { UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); return; } // Ladder and beacon grabs - if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON) + if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON || grab.getType() == Material.WEB || grab.getType() == Material.STANDING_BANNER || grab.getType() == Material.WALL_BANNER) { UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); return; @@ -135,6 +136,12 @@ public class BlockToss extends SkillCharge implements IThrown } } } + + if (Factory.BlockRestore().Contains(grab)) + { + UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); + return; + } //Block to Item FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData()); @@ -266,6 +273,19 @@ public class BlockToss extends SkillCharge implements IThrown } + @EventHandler + public void blockSolidify(EntityChangeBlockEvent event) + { + if (_falling.containsKey(event.getEntity())) + { + event.setCancelled(true); + + createBlock((FallingBlock)event.getEntity(), event.getBlock()); + + _falling.remove(event.getEntity()); + } + } + @EventHandler public void CreateBlock(UpdateEvent event) { @@ -282,21 +302,27 @@ public class BlockToss extends SkillCharge implements IThrown continue; fallIter.remove(); - - Block block = fall.getLocation().getBlock(); - - if (block.getType() != fall.getMaterial()) - continue; - - block.setTypeIdAndData(0, (byte)0, false); - - //Block Replace - Factory.BlockRestore().Add(block, fall.getBlockId(), (byte)0, 10000); - //Effect - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + createBlock(fall, fall.getLocation().getBlock()); } } + + public void createBlock(FallingBlock fall, Block block) + { + if (!UtilBlock.airFoliage(block)) + return; + + int id = fall.getBlockId(); + + if (id == 12) id = Material.SANDSTONE.getId(); + if (id == 13) id = Material.STONE.getId(); + + //Block Replace + Factory.BlockRestore().Add(block, id, (byte)0, 10000); + + //Effect + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); + } @EventHandler public void ItemSpawn(ItemSpawnEvent event) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java index 4b210921e..8b8ead16e 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Colossus.java @@ -18,7 +18,7 @@ public class Colossus extends Skill SetDesc(new String[] { "You are so huge that you take", - "#15#20 % less knockback from attacks." + "35% less knockback from attacks." }); } @@ -36,7 +36,7 @@ public class Colossus extends Skill //Damage event.AddMod(damagee.getName(), GetName(), 0, false); - event.AddKnockback(GetName(), 0.85 - 0.20*level); + event.AddKnockback(GetName(), 0.35); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java index 252d4cd22..3e384a64c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java @@ -24,7 +24,7 @@ public class CripplingBlow extends Skill { "Your powerful axe attacks give", "targets Slow 2 for 1.5 second,", - "as well as no knockback." + "as well as 50% less knockback." }); } @@ -57,7 +57,7 @@ public class CripplingBlow extends Skill //Damage event.AddMod(damager.getName(), GetName(), 0, true); - event.SetKnockback(false); + event.AddKnockback(GetName(), 0.5); //Event UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java index b0afe2298..7421e96c6 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/DwarfToss.java @@ -58,7 +58,7 @@ public class DwarfToss extends SkillActive SetDesc(new String[] { "Hold Block to pick up target player.", - "Release Block to throw with #1.2#0.2 velocity.", + "Release Block to throw target player.", "", "Players you are holding cannot harm", "you, or be harmed by others.", @@ -209,8 +209,8 @@ public class DwarfToss extends SkillActive _time.put(player, System.currentTimeMillis()); //Inform - UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + ".")); - UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName()) + ".")); //Hide! if (target instanceof Player) @@ -303,9 +303,8 @@ public class DwarfToss extends SkillActive { LivingEntity target = _holding.remove(cur); _time.remove(cur); - int level = getLevel(cur); - UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName()) + ".")); //Show! if (target instanceof Player) @@ -316,7 +315,6 @@ public class DwarfToss extends SkillActive { final LivingEntity target = _holding.remove(cur); long time = _time.remove(cur); - int level = getLevel(cur); //Time Reduce double timeScale = 1; @@ -332,7 +330,7 @@ public class DwarfToss extends SkillActive //Throw cur.eject(); target.leaveVehicle(); - final double mult = (1.2 + (0.2 * level)) * timeScale; + final double mult = (1.8) * timeScale; //Delay Bukkit.getScheduler().scheduleSyncDelayedTask(Factory.getPlugin(), new Runnable() @@ -351,8 +349,8 @@ public class DwarfToss extends SkillActive }, 5); //Inform - UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + ".")); - UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName()) + ".")); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java index edcb302ae..2c1d7a8b3 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/FleshHook.java @@ -51,8 +51,8 @@ public class FleshHook extends SkillActiveCharge implements IThrown GetChargeString(), "", "If Flesh Hook hits a player, it", - "deals up to #2#2 damage, and rips them", - "towards you with #1.2#0.2 velocity.", + "deals up to #5#1 damage, and rips them", + "towards you with #1.2#0.3 velocity.", }); } @@ -142,14 +142,14 @@ public class FleshHook extends SkillActiveCharge implements IThrown //Pull UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), - 1.2 + (0.2 * level), false, 0, 0.8, 1.5, true); + 1.2 + (0.3 * level), false, 0, 0.7, 1.2, true); //Condition Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true); //Damage Event Factory.Damage().NewDamageEvent(target, player, null, - DamageCause.CUSTOM, velocity * (1 + (1*level)), false, true, false, + DamageCause.CUSTOM, 5 + level, false, true, false, player.getName(), GetName()); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java index 3c0147a82..2288671dc 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/SeismicSlam.java @@ -81,7 +81,7 @@ public class SeismicSlam extends SkillActive { "Jump up and slam back into the ground.", "Players within #5.5#0.5 Blocks take up to", - "#1#1 damage and are thrown into the air.", + "#1#1 damage and are smashed away from you.", }); } @@ -151,7 +151,7 @@ public class SeismicSlam extends SkillActive //Velocity UtilAction.velocity(cur, UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()), - 0.4 + 2 * targets.get(cur), true, 0, 0.2 + 1.2 * targets.get(cur), 1.6, true); + 0.6 + 2 * targets.get(cur), true, 0, 0.2 + 1.0 * targets.get(cur), 1.4, true); //Condition Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java index d521f4987..957f53cb0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java @@ -95,9 +95,6 @@ public class AxeThrow extends SkillActive implements IThrown //Store _thrown.put(item, player); - - //Inform - UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java index c6456547f..7eeb4d866 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HoldPosition.java @@ -67,8 +67,9 @@ public class HoldPosition extends SkillActive double duration = 3 + (1 * level); //Action - Factory.Condition().Factory().Slow(GetName(), player, player, duration, 3, false, true, false, true); - Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, true, true); + Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true); + Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, false, true); + Factory.Condition().Factory().Jump(GetName(), player, player, duration, 250, false, false, true); //Inform UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java index 2ae19bed9..5aa4ce028 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Riposte.java @@ -49,7 +49,7 @@ public class Riposte extends SkillActive "to riposte.", "", "If successful, you deal an additional", - "#0.5#0.5 bonus damage.", + "#0#0.5 bonus damage.", "", "You must block, parry, then riposte", "all within 1 second of each other." @@ -155,15 +155,13 @@ public class Riposte extends SkillActive _prepare.remove(damager); //Damage - event.AddMod(damager.getName(), GetName(), 0.5 + 0.5 * level, true); + event.AddMod(damager.getName(), GetName(), 0.5 * level, true); //Effect damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 1f, 1.2f); //UtilPlayer.health(damager, 1); //UtilParticle.PlayParticle(ParticleType.HEART, damager.getEyeLocation(), 0, 0.3f, 0, 0, 1); - - //Inform UtilPlayer.message(damager, F.main(GetClassType().name(), "You countered with " + F.skill(GetName(level)) + ".")); 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 dcd433766..bec32ab2e 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 @@ -46,10 +46,9 @@ public class ArcticArmor extends Skill "", "Create a freezing area around you", "in a #3#1 Block radius. Allies inside", - "this area receive Protection 1.", + "this area receive Protection 2.", "", - "You are permanently immune to the", - "Slowing effect of snow." + "You receive Protection 1." }); } @@ -154,6 +153,8 @@ public class ArcticArmor extends Skill HashMap blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level); for (Block block : blocks.keySet()) { + if (block.getType().toString().contains("BANNER") || block.getRelative(BlockFace.UP).getType().toString().contains("BANNER")) + continue; //Freeze if (!block.getRelative(BlockFace.UP).isLiquid()) if (block.getLocation().getY() <= cur.getLocation().getY()) @@ -177,7 +178,7 @@ public class ArcticArmor extends Skill //Protection for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur))) if (!Factory.Relation().canHurt(cur, other) || other.equals(cur)) - Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 0, false, true, true); + Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, cur.equals(other) ? 0 : 1, false, true, true); } } @@ -221,43 +222,6 @@ public class ArcticArmor extends Skill } } } - -// @EventHandler -// public void Slow(UpdateEvent event) -// { -// if (event.getType() != UpdateType.TICK) -// return; -// -// for (Player cur : UtilServer.getPlayers()) -// { -// if (cur.getLocation().getChunk() == null) -// continue; -// -// Block block = cur.getLocation().getBlock(); -// -// if (block.getTypeId() != 78) -// continue; -// -// if (block.getData() == 0) -// continue; -// -// if (getLevel(cur) > 0) -// continue; -// -// int level = 0; -// if (block.getData() == 2 || block.getData() == 3) -// level = 1; -// else if (block.getData() == 4 || block.getData() == 5) -// level = 2; -// else if (block.getData() == 6 || block.getData() == 7) -// level = 3; -// -// //Slow -// Factory.Condition().Factory().Custom("Thick Snow", cur, cur, -// ConditionType.SLOW, 1.9, level, false, -// Material.SNOW_BALL, (byte)0, true); -// } -// } @EventHandler public void Particle(UpdateEvent event) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java index 3c9133a0a..57bf77854 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Blizzard.java @@ -149,44 +149,60 @@ public class Blizzard extends SkillActive } //Target - HashSet ignore = new HashSet(); - ignore.add((byte) 0); - ignore.add((byte) 78); - ignore.add((byte) 80); +// HashSet ignore = new HashSet(); +// ignore.add((byte) 0); +// ignore.add((byte) 78); +// ignore.add((byte) 80); - Block target = cur.getTargetBlock(ignore, 7); +// Block target = cur.getTargetBlock(ignore, 7); - //Snow - if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5) - for (int i=0 ; i<1+level ; i++) - { - Projectile snow = cur.launchProjectile(Snowball.class); - - double mult = 0.25 + 0.15 * level; - double x = (0.2 - (UtilMath.r(40)/100d)) * mult; - double y = (UtilMath.r(20)/100d) * mult; - double z = (0.2 - (UtilMath.r(40)/100d)) * mult; - - - - snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2)); - _snowball.put(snow, cur); - } - - if (target == null || target.getType() == Material.AIR) - continue; - - if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7) - continue; - - HashMap blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1); - for (Block block : blocks.keySet()) + //Snowballs +// if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5) +// for (int i=0 ; i<1+level ; i++) +// { +// Projectile snow = cur.launchProjectile(Snowball.class); +// +// double mult = 0.25 + 0.15 * level; +// double x = (0.2 - (UtilMath.r(40)/100d)) * mult; +// double y = (UtilMath.r(20)/100d) * mult; +// double z = (0.2 - (UtilMath.r(40)/100d)) * mult; +// +// +// +// snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2)); +// _snowball.put(snow, cur); +// } +// +// if (target == null || target.getType() == Material.AIR) +// continue; +// +// if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7) +// continue; +// +// HashMap blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1); +// for (Block block : blocks.keySet()) +// { +// Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)(7*level), 2500, 250, 3); +// } + + //Snowballs + for (int i=0 ; i<1+level ; i++) { - Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)(7*level), 2500, 250, 3); + Projectile snow = cur.launchProjectile(Snowball.class); + + double mult = 0.25 + 0.15 * level; + double x = (0.2 - (UtilMath.r(40)/100d)) * mult; + double y = (UtilMath.r(20)/100d) * mult; + double z = (0.2 - (UtilMath.r(40)/100d)) * mult; + + + + snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2)); + _snowball.put(snow, cur); } //Effect - target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80); +// target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80); cur.getWorld().playSound(cur.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f); } } @@ -213,30 +229,33 @@ public class Blizzard extends SkillActive UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0))); } - @EventHandler - public void SnowballForm(ProjectileHitEvent event) - { - if (!(event.getEntity() instanceof Snowball)) - return; - - if (_snowball.remove(event.getEntity()) == null) - return; - - Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); - } +// @EventHandler +// public void SnowballForm(ProjectileHitEvent event) +// { +// if (!(event.getEntity() instanceof Snowball)) +// return; +// +// if (_snowball.remove(event.getEntity()) == null) +// return; +// +// Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); +// } @EventHandler public void clearInvalidSnowballedPlayers(UpdateEvent event) { - if (event.getType() != UpdateType.SEC) + if (event.getType() != UpdateType.FASTER) return; for (Iterator> snowBallIterator = _snowball.entrySet().iterator(); snowBallIterator.hasNext();) { Entry entry = snowBallIterator.next(); - if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 60 || !entry.getValue().isOnline()) + if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 25 || !entry.getValue().isOnline()) + { snowBallIterator.remove(); + entry.getKey().remove(); + } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java index cdfb985fe..6f4353598 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FissureData.java @@ -114,6 +114,10 @@ public class FissureData //Cannot raise if (block.getTypeId() == 46) return false; + if (block.getType().toString().contains("BANNER")) + return false; + if (block.getRelative(BlockFace.UP).getType().toString().contains("BANNER")) + return false; Block up = block.getRelative(0, _height + 1, 0); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java index 153c00eff..ae7a7331c 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/IcePrison.java @@ -48,7 +48,7 @@ public class IcePrison extends SkillActive implements IThrown { "Launch an icy orb. When it collides,", "it creates a hollow sphere of ice", - "thats lasts for #2#1 seconds.", + "thats lasts for #3#1.5 seconds.", }); } @@ -148,7 +148,7 @@ public class IcePrison extends SkillActive implements IThrown if (!UtilBlock.airFoliage(freeze)) return; - long time = 2500 + (1000 * level); + long time = 3500 + (1500 * level); int yDiff = freeze.getY() - mid.getY(); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java index a8bce9d3c..cad743670 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBonds.java @@ -282,7 +282,7 @@ public class LifeBonds extends Skill HashSet remove = new HashSet(); for (Item cur : _items) - if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 400 || cur.isDead() || !cur.isValid()) + if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid()) remove.add(cur); for (Item cur : remove) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java index 693f06299..dbf235d74 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LightningOrb.java @@ -11,12 +11,14 @@ import org.bukkit.event.*; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.common.util.F; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; @@ -24,6 +26,9 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.condition.Condition; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import org.bukkit.event.player.*; @@ -78,8 +83,8 @@ public class LightningOrb extends SkillActive implements IThrown "Launch a lightning orb. Upon a direct", "hit with player, or #5#-0.4 seconds, it will", "strike all enemies within #3#0.5 Blocks ", - "with lightning, giving them Slow 2", - "for 4 seconds." + "with lightning, dealing #4#1 damage and", + "giving Slow 2 for 4 seconds." }); } @@ -101,7 +106,7 @@ public class LightningOrb extends SkillActive implements IThrown //Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57)); item.setVelocity(player.getLocation().getDirection()); - Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, true, false, false, + Factory.Projectile().AddThrow(item, player, this, 5000 - (400 * level), true, true, false, false, Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f); //Inform @@ -147,12 +152,6 @@ public class LightningOrb extends SkillActive implements IThrown HashMap hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level); - //Lightning Condition - for (LivingEntity cur : hit.keySet()) - { - Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true); - } - List struck = new ArrayList<>(); //Lightning @@ -161,14 +160,16 @@ public class LightningOrb extends SkillActive implements IThrown if (cur.equals(player)) continue; - if (cur instanceof Player) - { - //Inform - UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); - } - + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + ".")); + //Lightning - cur.getWorld().strikeLightning(cur.getLocation()); + cur.getWorld().strikeLightningEffect(cur.getLocation()); + + //Damage Event + Factory.Damage().NewDamageEvent(cur, player, null, + DamageCause.LIGHTNING, 4 + level, false, true, false, + player.getName(), GetName()); struck.add(cur); } @@ -180,18 +181,19 @@ public class LightningOrb extends SkillActive implements IThrown continue; Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true); + Factory.Condition().Factory().Shock(GetName(), cur, player, 1, false, true); } Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck)); } - + @EventHandler public void CancelFire(BlockIgniteEvent event) { if (event.getCause() == IgniteCause.LIGHTNING) event.setCancelled(true); } - + @Override public void Reset(Player player) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java index 0dbd6161f..12b4b8294 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java @@ -167,7 +167,7 @@ public class Rupture extends SkillActiveCharge public void MoveRupture(Player cur) { - Block targetBlock = cur.getTargetBlock((HashSet)null, 0); + Block targetBlock = cur.getTargetBlock((HashSet)null, 150); if (targetBlock == null) return; //Aiming at sky diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java index 950ce0293..c4fcddb70 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java @@ -105,6 +105,26 @@ public class Void extends Skill _active.remove(cur); } } + + @EventHandler + public void inWater(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : GetUsers()) + { + if (!_active.contains(cur)) + continue; + + if (cur.getLocation().getBlock().getTypeId() == 8 || cur.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + _active.remove(cur); + Factory.Condition().EndCondition(cur, null, GetName()); + } + } + } @EventHandler public void Audio(UpdateEvent event) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java index 3df193e1f..5d0fbc73a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Barrage.java @@ -32,7 +32,7 @@ public class Barrage extends SkillChargeBow SkillType skillType, int cost, int maxLevel) { super(skills, name, classType, skillType, cost, maxLevel, - 0.012f, 0.006f, false, true); + 0.016f, 0.008f, false, true); SetDesc(new String[] { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java index 327bfa27a..e8c899905 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Disengage.java @@ -67,6 +67,12 @@ public class Disengage extends SkillActive return false; } + if (player.getLocation().getBlock().getType() == Material.WEB) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while trapped in a cobweb!")); + return false; + } + return true; } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java index 43178e1bc..2d08a12a9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java @@ -55,10 +55,13 @@ public class HealingShot extends SkillActive SetDesc(new String[] { - "Prepare a healing shot;", + "Prepare a Healing Shot;", + "", "Your next arrow will give its target", - "Regeneration 2 for #5#1 seconds,", - "and remove all negative effects." + "Regeneration 3 for #3#1 seconds,", + "and remove all negative effects.", + "", + "Gives Nausea to enemies for #5#1 seconds." }); } @@ -109,7 +112,7 @@ public class HealingShot extends SkillActive @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.NORMAL) - public void ArrowHit(EntityDamageEvent event) + public void arrowHit(EntityDamageEvent event) { if (event.getCause() != DamageCause.PROJECTILE) return; @@ -128,10 +131,10 @@ public class HealingShot extends SkillActive if (!_arrows.contains((Entity)projectile)) return; - if (!(event.getEntity() instanceof LivingEntity)) + if (!(event.getEntity() instanceof Player)) return; - LivingEntity damagee = (LivingEntity)event.getEntity(); + Player damagee = (Player)event.getEntity(); if (projectile.getShooter() == null) return; @@ -150,14 +153,21 @@ public class HealingShot extends SkillActive projectile.remove(); //Regen - Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + 2 * level, 1, false, true, true); - - //Remove Bad - damagee.setFireTicks(0); - damagee.removePotionEffect(PotionEffectType.SLOW); - damagee.removePotionEffect(PotionEffectType.POISON); - damagee.removePotionEffect(PotionEffectType.CONFUSION); - damagee.removePotionEffect(PotionEffectType.WEAKNESS); + if (Factory.Relation().canHurt(damager, damagee)) + { + Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + level, 2, false, false, false); + + //Remove Bad + damagee.setFireTicks(0); + damagee.removePotionEffect(PotionEffectType.SLOW); + damagee.removePotionEffect(PotionEffectType.POISON); + damagee.removePotionEffect(PotionEffectType.CONFUSION); + damagee.removePotionEffect(PotionEffectType.WEAKNESS); + } + else + { + Factory.Condition().Factory().Confuse(GetName(), damagee, damager, 5 + level, 2, false, false, false); + } //Effect damagee.getWorld().playSound(damagee.getLocation(), Sound.LEVEL_UP, 1f, 1.5f); @@ -181,7 +191,7 @@ public class HealingShot extends SkillActive } @EventHandler - public void Particle(UpdateEvent event) + public void particle(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; @@ -194,7 +204,7 @@ public class HealingShot extends SkillActive } @EventHandler - public void Clean(UpdateEvent event) + public void clean(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java index 91bb49867..c8a3503bb 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java @@ -1,178 +1,178 @@ -package mineplex.minecraft.game.classcombat.Skill.Ranger; - -import java.util.HashSet; -import java.util.Iterator; - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.minecraft.game.classcombat.Skill.SkillActive; -import mineplex.minecraft.game.classcombat.Skill.SkillFactory; - -public class IncendiaryShot extends SkillActive -{ - private HashSet _arrows = new HashSet(); - private HashSet _active = new HashSet(); - - public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, - int cost, int levels, - int energy, int energyMod, - long recharge, long rechargeMod, boolean rechargeInform, - Material[] itemArray, - Action[] actionArray) - { - super(skills, name, classType, skillType, - cost, levels, - energy, energyMod, - recharge, rechargeMod, rechargeInform, - itemArray, - actionArray); - - SetDesc(new String[] - { - "Prepare an incendiary shot;", - "Your next arrow will ignite", - "its target for #2#1 seconds." - }); - } - - @Override - public boolean CustomCheck(Player player, int level) - { - if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) - { - UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); - return false; - } - - return true; - } - - @Override - public void Skill(Player player, int level) - { - //Action - _active.add(player); - - //Inform - UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); - - //Effect - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); - } - - @EventHandler - public void ShootBow(EntityShootBowEvent event) - { - if (!(event.getEntity() instanceof Player)) - return; - - if (!(event.getProjectile() instanceof Arrow)) - return; - - Player player = (Player)event.getEntity(); - - if (!_active.remove(player)) - return; - - //Inform - UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + ".")); - - _arrows.add(event.getProjectile()); - event.getProjectile().setFireTicks(200); - } - - @EventHandler(priority = EventPriority.HIGH) - public void ArrowHit(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.PROJECTILE) - return; - - Projectile projectile = event.GetProjectile(); - if (projectile == null) return; - - if (!_arrows.contains((Entity)projectile)) - return; - - LivingEntity damagee = event.GetDamageeEntity(); - if (damagee == null) return; - - Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; - - //Level - int level = getLevel(damager); - if (level == 0) return; - - //Ignite - Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true); - - //Damage - event.AddMod(damager.getName(), GetName(), 0, true); - - //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f); - - //Remove - projectile.remove(); - } - - @EventHandler - public void Particle(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - for (Entity ent : _arrows) - { - UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1, - ViewDist.MAX, UtilServer.getPlayers()); - } - } - - @EventHandler - public void Clean(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) - { - Entity arrow = arrowIterator.next(); - - if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) - { - arrowIterator.remove(); - } - } - } - - @Override - public void Reset(Player player) - { - _active.remove(player); - } -} +//package mineplex.minecraft.game.classcombat.Skill.Ranger; +// +//import java.util.HashSet; +//import java.util.Iterator; +// +//import org.bukkit.Material; +//import org.bukkit.Sound; +//import org.bukkit.entity.Arrow; +//import org.bukkit.entity.Entity; +//import org.bukkit.entity.LivingEntity; +//import org.bukkit.entity.Player; +//import org.bukkit.entity.Projectile; +//import org.bukkit.event.EventHandler; +//import org.bukkit.event.EventPriority; +//import org.bukkit.event.block.Action; +//import org.bukkit.event.entity.EntityShootBowEvent; +//import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +// +//import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +//import mineplex.minecraft.game.core.damage.CustomDamageEvent; +//import mineplex.core.common.util.F; +//import mineplex.core.common.util.UtilParticle; +//import mineplex.core.common.util.UtilServer; +//import mineplex.core.updater.event.UpdateEvent; +//import mineplex.core.updater.UpdateType; +//import mineplex.core.common.util.UtilPlayer; +//import mineplex.core.common.util.UtilParticle.ParticleType; +//import mineplex.core.common.util.UtilParticle.ViewDist; +//import mineplex.minecraft.game.classcombat.Skill.SkillActive; +//import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +// +//public class IncendiaryShot extends SkillActive +//{ +// private HashSet _arrows = new HashSet(); +// private HashSet _active = new HashSet(); +// +// public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, +// int cost, int levels, +// int energy, int energyMod, +// long recharge, long rechargeMod, boolean rechargeInform, +// Material[] itemArray, +// Action[] actionArray) +// { +// super(skills, name, classType, skillType, +// cost, levels, +// energy, energyMod, +// recharge, rechargeMod, rechargeInform, +// itemArray, +// actionArray); +// +// SetDesc(new String[] +// { +// "Prepare an incendiary shot;", +// "Your next arrow will ignite", +// "its target for #2#1 seconds." +// }); +// } +// +// @Override +// public boolean CustomCheck(Player player, int level) +// { +// if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) +// { +// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); +// return false; +// } +// +// return true; +// } +// +// @Override +// public void Skill(Player player, int level) +// { +// //Action +// _active.add(player); +// +// //Inform +// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); +// +// //Effect +// player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); +// } +// +// @EventHandler +// public void ShootBow(EntityShootBowEvent event) +// { +// if (!(event.getEntity() instanceof Player)) +// return; +// +// if (!(event.getProjectile() instanceof Arrow)) +// return; +// +// Player player = (Player)event.getEntity(); +// +// if (!_active.remove(player)) +// return; +// +// //Inform +// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + ".")); +// +// _arrows.add(event.getProjectile()); +// event.getProjectile().setFireTicks(200); +// } +// +// @EventHandler(priority = EventPriority.HIGH) +// public void ArrowHit(CustomDamageEvent event) +// { +// if (event.IsCancelled()) +// return; +// +// if (event.GetCause() != DamageCause.PROJECTILE) +// return; +// +// Projectile projectile = event.GetProjectile(); +// if (projectile == null) return; +// +// if (!_arrows.contains((Entity)projectile)) +// return; +// +// LivingEntity damagee = event.GetDamageeEntity(); +// if (damagee == null) return; +// +// Player damager = event.GetDamagerPlayer(true); +// if (damager == null) return; +// +// //Level +// int level = getLevel(damager); +// if (level == 0) return; +// +// //Ignite +// Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true); +// +// //Damage +// event.AddMod(damager.getName(), GetName(), 0, true); +// +// //Effect +// damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f); +// +// //Remove +// projectile.remove(); +// } +// +// @EventHandler +// public void Particle(UpdateEvent event) +// { +// if (event.getType() != UpdateType.TICK) +// return; +// +// for (Entity ent : _arrows) +// { +// UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1, +// ViewDist.MAX, UtilServer.getPlayers()); +// } +// } +// +// @EventHandler +// public void Clean(UpdateEvent event) +// { +// if (event.getType() != UpdateType.SEC) +// return; +// +// for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) +// { +// Entity arrow = arrowIterator.next(); +// +// if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) +// { +// arrowIterator.remove(); +// } +// } +// } +// +// @Override +// public void Reset(Player player) +// { +// _active.remove(player); +// } +//} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java index 90f4d217d..ecd747510 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java @@ -9,12 +9,15 @@ import org.bukkit.Sound; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.ProjectileHitEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -31,6 +34,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class NapalmShot extends SkillActive { @@ -53,9 +57,13 @@ public class NapalmShot extends SkillActive SetDesc(new String[] { - "Prepare a napalm shot;", + "Prepare a Napalm Shot;", + "", "Your next arrow will burst into", - "#8#8 flames on impact." + "#8#8 flames on impact.", + "", + "If your arrow hit an enemy, it", + "will ignite them for #2#1 seconds." }); } @@ -85,7 +93,7 @@ public class NapalmShot extends SkillActive } @EventHandler - public void BowShoot(EntityShootBowEvent event) + public void bowShoot(EntityShootBowEvent event) { if (!(event.getEntity() instanceof Player)) return; @@ -105,8 +113,46 @@ public class NapalmShot extends SkillActive event.getProjectile().setFireTicks(120); } + @EventHandler(priority = EventPriority.HIGH) + public void arrowDamage(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) return; + + if (!_arrows.contains((Entity)projectile)) + return; + + LivingEntity damagee = event.GetDamageeEntity(); + if (damagee == null) return; + + Player damager = event.GetDamagerPlayer(true); + if (damager == null) return; + + //Level + int level = getLevel(damager); + if (level == 0) return; + + //Ignite + Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true); + + //Damage + event.AddMod(damager.getName(), GetName(), 0, true); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f); + + //Remove + projectile.remove(); + } + @EventHandler - public void ProjectileHit(ProjectileHitEvent event) + public void projectileHit(ProjectileHitEvent event) { Projectile proj = event.getEntity(); @@ -142,20 +188,20 @@ public class NapalmShot extends SkillActive } @EventHandler - public void Particle(UpdateEvent event) + public void particle(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; for (Entity ent : _arrows) { - UtilParticle.PlayParticle(ParticleType.LAVA, ent.getLocation(), 0, 0, 0, 0, 1, + UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1, ViewDist.MAX, UtilServer.getPlayers()); } } @EventHandler - public void Clean(UpdateEvent event) + public void clean(UpdateEvent event) { if (event.getType() != UpdateType.SEC) return; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java index c2895fc66..df55695ec 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Overcharge.java @@ -34,7 +34,7 @@ public class Overcharge extends SkillChargeBow SkillType skillType, int cost, int maxLevel) { super(skills, name, classType, skillType, cost, maxLevel, - 0.012f, 0.006f, false, true); + 0.016f, 0.008f, false, true); SetDesc(new String[] { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java index 6946be806..56c12b9d5 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Sharpshooter.java @@ -2,18 +2,21 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.WeakHashMap; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilPlayer; import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import org.bukkit.Sound; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -33,17 +36,16 @@ public class Sharpshooter extends Skill SetDesc(new String[] { - "Consecutive arrow hits deal an", - "additional #1#0.5 damage.", + "Hitting with arrows increases", + "arrow damage by 1 for 5 seconds.", "", - "Stacks up to #1#1 times", - "", - "Missing an arrow resets the bonus.", + "Stacks up to #0#2 times, and each", + "hit sets duration to 5 seconds." }); } @EventHandler - public void ShootBow(EntityShootBowEvent event) + public void shootBow(EntityShootBowEvent event) { if (!(event.getEntity() instanceof Player)) return; @@ -56,7 +58,7 @@ public class Sharpshooter extends Skill } @EventHandler(priority = EventPriority.HIGH) - public void Damage(CustomDamageEvent event) + public void damage(CustomDamageEvent event) { if (event.IsCancelled()) return; @@ -76,48 +78,69 @@ public class Sharpshooter extends Skill if (event.GetDamagerEntity(true) != null && event.GetDamagerEntity(true).equals(event.GetDamageeEntity())) return; + int bonus = 1; if (_hitCount.containsKey(player)) - { - //Damage - event.AddMod(player.getName(), GetName(), _hitCount.get(player) * (1 + 0.5 * level), true); + bonus = _hitCount.get(player); + + //Damage + event.AddMod(player.getName(), GetName(), bonus, true); + + //Increase + bonus = Math.min(bonus + 1, 2 * level); + + _hitCount.put(player, bonus); + + //Inform + UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " + + F.elem(bonus + " Consecutive Hits") + C.cGray + " (" + F.skill("+" + bonus + "Damage" ) + C.cGray + ")" ) ); - int limit = Math.min(1 + level, _hitCount.get(player) + 1); - - _hitCount.put(player, limit); - - //Inform - UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " + - F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " (" + F.skill("+"+ (1 + 0.5 * limit) + "Damage" ) + C.cGray + ")" ) ); - } - else - { - _hitCount.put(player, 1); - } + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.8f + (float)(bonus * 0.2)); projectile.remove(); } @EventHandler - public void Clean(UpdateEvent event) + public void resetViaTime(UpdateEvent event) { - if (event.getType() != UpdateType.FAST) + if (event.getType() != UpdateType.TICK) return; - - HashSet remove = new HashSet(); - - for (Entity cur : _arrows.keySet()) - if (cur.isDead() || !cur.isValid() || cur.isOnGround()) - remove.add(cur); - - for (Entity cur : remove) + + Iterator playerIter = _hitCount.keySet().iterator(); + + while (playerIter.hasNext()) { - Player player = _arrows.remove(cur); - - if (player != null) - if (_hitCount.remove(player) != null) - UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits"))); - } + Player player = playerIter.next(); + + if (Recharge.Instance.usable(player, GetName() + " Timer")) + { + playerIter.remove(); + UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("Damage Bonus Reset"))); + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.75f); + } + } } + +// @EventHandler +// public void resetViaMiss(UpdateEvent event) +// { +// if (event.getType() != UpdateType.FAST) +// return; +// +// HashSet remove = new HashSet(); +// +// for (Entity cur : _arrows.keySet()) +// if (cur.isDead() || !cur.isValid() || cur.isOnGround()) +// remove.add(cur); +// +// for (Entity cur : remove) +// { +// Player player = _arrows.remove(cur); +// +// if (player != null) +// if (_hitCount.remove(player) != null) +// UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits"))); +// } +// } @Override public void Reset(Player player) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java index 97ce042c5..fb174c112 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/VitalitySpores.java @@ -1,12 +1,16 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger; +import java.util.HashMap; + import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerMoveEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -18,24 +22,30 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory; public class VitalitySpores extends Skill { + private HashMap _lastMove = new HashMap(); + public VitalitySpores(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) { super(skills, name, classType, skillType, cost, levels); SetDesc(new String[] { - "After #5#-1 seconds of not taking damage,", - "forest spores surround you, restoring", - "1 health per second.", - "", - "This remains until you take damage." + "While standing still, forest spores", + "heal you for #0#0.5 health per 2 seconds." }); } @EventHandler - public void Update(UpdateEvent event) + public void playerMove(PlayerMoveEvent event) { - if (event.getType() != UpdateType.SEC) + if (UtilMath.offset(event.getFrom(), event.getTo()) > 0) + _lastMove.put(event.getPlayer(), System.currentTimeMillis()); + } + + @EventHandler + public void update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) return; for (Player cur : GetUsers()) @@ -43,13 +53,17 @@ public class VitalitySpores extends Skill int level = getLevel(cur); if (level == 0) continue; - if (UtilTime.elapsed(Factory.Combat().Get(cur).GetLastDamaged(), 5000 - 1000*level)) + if (!_lastMove.containsKey(cur)) + continue; + + if (UtilTime.elapsed(_lastMove.get(cur), 2000)) { - //Factory.Condition().Factory().Regen(GetName(), cur, cur, 3.9 + 2*level, 0, false, true, true); - UtilPlayer.health(cur, 1); + UtilPlayer.health(cur, 0.5 * level); UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation().add(UtilAlg.getBehind(cur.getLocation().getDirection().multiply(0.5))), 0, 0.2f, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers()); + + _lastMove.put(cur, System.currentTimeMillis()); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java index 60d50bb67..28842a73d 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeBow.java @@ -118,7 +118,7 @@ public abstract class SkillChargeBow extends SkillCharge implements Listener continue; //Delay - if (!UtilTime.elapsed(_chargeStart.get(cur), 1200)) + if (!UtilTime.elapsed(_chargeStart.get(cur), 1000)) continue; float charge = _charge.get(cur); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java index 1e24bc023..768154f44 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java @@ -201,21 +201,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow, 1, 4, 40, 0, - 20000, 0, true, + 20000, -2000, true, new Material[] {Material.BOW}, new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); AddSkill(new SmokeArrow(this, "Smoke Arrow", ClassType.Assassin, SkillType.Bow, 1, 4, 40, 0, - 20000, 0, true, + 20000, -2000, true, new Material[] {Material.BOW}, new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow, 1, 4, 40, 0, - 20000, 0, true, + 20000, -2000, true, new Material[] {Material.BOW}, new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); @@ -238,9 +238,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory //Sword AddSkill(new DwarfToss(this, "Dwarf Toss", ClassType.Brute, SkillType.Sword, - 1, 5, + 2, 1, 0, 0, - 20000, -2000, true, + 16000, 0, true, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -257,21 +257,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe, 1, 5, 0, 0, - 30000, -2000, true, + 24000, -2000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe, 1, 5, 0, 0, - 30000, -3000, true, + 24000, -2000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); AddSkill(new WhirlwindAxe(this, "Whirlwind Axe", ClassType.Brute, SkillType.Axe, 1, 5, 0, 0, - 30000, -3000, true, + 24000, -2000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -282,7 +282,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory //Passive B AddSkill(new CripplingBlow(this, "Crippling Blow", ClassType.Brute, SkillType.PassiveB, 2, 1)); - AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 1, 3)); + AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 2, 1)); AddSkill(new Overwhelm(this, "Overwhelm", ClassType.Brute, SkillType.PassiveB, 1, 3)); } @@ -331,7 +331,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new ShieldSmash(this, "Shield Smash", ClassType.Knight, SkillType.Axe, 1, 5, 0, 0, - 10000, -1000, true, + 15000, -1000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -400,7 +400,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new LightningOrb(this, "Lightning Orb", ClassType.Mage, SkillType.Axe, 1, 5, 60, -2, - 11000, -1000, true, + 13000, -1000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -408,7 +408,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe, 1, 5, 60, -3, - 11000, -1000, true, + 13000, -1000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -434,13 +434,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB, 1, 3, 16, -2, - 1200, -200, false, + 1200, -250, false, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); AddSkill(new MagmaBlade(this, "Magma Blade", ClassType.Mage, SkillType.PassiveB, 1, 3)); AddSkill(new NullBlade(this, "Null Blade", ClassType.Mage, SkillType.PassiveB, 1, 3)); - //AddSkill(new RootingAxe(this, "Rooting Axe", ClassType.Mage, SkillType.PassiveB, 5, 3)); } public void AddRanger() @@ -451,7 +450,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new Disengage(this, "Disengage", ClassType.Ranger, SkillType.Sword, 1, 4, 0, 0, - 18000, -2000, true, + 16000, -1000, true, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -480,12 +479,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory new Material[] {Material.BOW}, new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); - AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow, - 1, 4, - 0, 0, - 20000, -2000, true, - new Material[] {Material.BOW}, - new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); +// AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow, +// 1, 4, +// 0, 0, +// 20000, -2000, true, +// new Material[] {Material.BOW}, +// new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); AddSkill(new NapalmShot(this, "Napalm Shot", ClassType.Ranger, SkillType.Bow, 1, 4, @@ -523,9 +522,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory //Passive B AddSkill(new BarbedArrows(this, "Barbed Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3)); AddSkill(new HeavyArrows(this, "Heavy Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3)); - //AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3)); AddSkill(new Longshot(this, "Longshot", ClassType.Ranger, SkillType.PassiveB, 1, 3)); AddSkill(new Sharpshooter(this, "Sharpshooter", ClassType.Ranger, SkillType.PassiveB, 1, 3)); + //AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3)); //AddSkill(new Fletcher(this, "Fletcher", ClassType.Ranger, SkillType.PassiveB, 5, 3)); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java index f312e0968..c86940077 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java @@ -156,11 +156,11 @@ public abstract class ItemUsable extends Item implements IThrown //Throw long expire = -1; if (_throwExpire >= 0) - expire = System.currentTimeMillis() + _throwExpire; + expire = _throwExpire; org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType())); UtilAction.velocity(ent, player.getLocation().getDirection(), _throwPower, false, 0, 0.2, 10, false); - Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f); + Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f); ThrowCustom(event, ent); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java index b56f0d51b..0768e5b2d 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java @@ -69,13 +69,23 @@ public class ProximityExplosive extends ItemUsable @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { - + //Arm + _armed.put(data.GetThrown(), data.GetThrower()); + + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Idle(ProjectileUser data) { - + //Arm + _armed.put(data.GetThrown(), data.GetThrower()); + + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java index c76c35011..230168163 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java @@ -66,13 +66,23 @@ public class ProximityZapper extends ItemUsable @Override public void Collide(LivingEntity target, Block block, ProjectileUser data) { + //Arm + _armed.put(data.GetThrown(), data.GetThrower()); + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override public void Idle(ProjectileUser data) { + //Arm + _armed.put(data.GetThrown(), data.GetThrower()); + //Effect + data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java index 71be0e14a..5696309d3 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java @@ -28,6 +28,7 @@ public class ClassCombatShop extends ShopBase private IPvpClass _gameClass; private boolean _takeAwayStuff; private boolean _skillsOnly; + private boolean _hub; public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name) { @@ -36,12 +37,13 @@ public class ClassCombatShop extends ShopBase _skillsOnly = skillsOnly; } - public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass) + public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass, boolean hub) { super(plugin, clientManager, donationManager, name, CurrencyType.Gems); _gameClass = iPvpClass; _takeAwayStuff = true; _skillsOnly = skillsOnly; + _hub = hub; } protected void openShopForPlayer(Player player) @@ -65,15 +67,22 @@ public class ClassCombatShop extends ShopBase ShopPageBase page = null; - if (getPlugin().GetClassManager().Get(player).GetGameClass() == null) - { - // page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player); - UtilPlayer.message(player, F.main(getPlugin().getName(), ChatColor.RED + "You need to have an armor set on to modify class builds.")); - player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); - return false; - } - else - page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + if (!_hub) + { + if (getPlugin().GetClassManager().Get(player).GetGameClass() == null) + { + // page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player); + UtilPlayer.message(player, F.main(getPlugin().getName(), ChatColor.RED + "You need to have an armor set on to modify class builds.")); + player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f); + return false; + } + else + page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player); + } + else + { + page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _gameClass); + } getOpenedShop().add(player.getName()); openShopForPlayer(player); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java index b4cb1481f..920a138d2 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java @@ -60,6 +60,8 @@ public class ClassShopManager extends MiniPlugin Achievement.CHAMPIONS_MASS_ELECTROCUTION, Achievement.CHAMPIONS_THE_LONGEST_SHOT, Achievement.CHAMPIONS_WINS, + Achievement.CHAMPIONS_CAPTURES, + Achievement.CHAMPIONS_CLUTCH }); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java index ab003436a..d0240b44b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/page/CustomBuildPage.java @@ -1,9 +1,10 @@ package mineplex.minecraft.game.classcombat.shop.page; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; - +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.C; +import mineplex.core.donation.DonationManager; +import mineplex.core.shop.item.ShopItem; +import mineplex.core.shop.page.ShopPageBase; import mineplex.minecraft.game.classcombat.Class.ClientClass; import mineplex.minecraft.game.classcombat.Class.IPvpClass; import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent; @@ -14,11 +15,10 @@ import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.classcombat.shop.button.DeleteCustomBuildButton; import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildButton; import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton; -import mineplex.core.account.CoreClientManager; -import mineplex.core.common.util.C; -import mineplex.core.donation.DonationManager; -import mineplex.core.shop.item.ShopItem; -import mineplex.core.shop.page.ShopPageBase; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; public class CustomBuildPage extends ShopPageBase { @@ -31,6 +31,14 @@ public class CustomBuildPage extends ShopPageBase _flags = new ArrayList(); + private ArrayList _resupply = new ArrayList(); + + //Stats + private HashMap _stats = new HashMap(); + + //Captures + private static int _victoryCaps = 5; + private int _redScore = 0; + private int _blueScore = 0; + + //Times + private long _gameTime = 420000; + + //protected String[] _blockedItems = new String[] {"SWORD", "AXE", "BOW"}; + private boolean _suddenDeath = false; + + private HashMap> _hotbars = new HashMap>(); + private HashMap _helmets = new HashMap(); + + private boolean _redFlickerStage = false; + private boolean _blueFlickerStage = false; + + public CaptureTheFlag(ArcadeManager manager, GameType type, Kit[] kits) + { + super(manager, type, kits, + + new String[] + { + "Capture The Opponent's Flag", + "First team to " + _victoryCaps + " Captures", + "Or with the most Captures after 7 minutes wins" + + }); + + this.DeathOut = false; + this.PrepareFreeze = true; + this.HungerSet = 20; + this.WorldTimeSet = 2000; + + this.DeathSpectateSecs = 10; + } + + @Override + public void ParseData() + { + _redFlag = WorldData.GetDataLocs("RED").get(0); + _blueFlag = WorldData.GetDataLocs("BLUE").get(0); + + for (GameTeam team : GetTeamList()) + { + if (team.GetColor() == ChatColor.RED || team.GetColor() == ChatColor.BLUE || team.GetColor() == ChatColor.AQUA) + { + _flags.add(new Flag(this, team.GetColor() == ChatColor.RED ? _redFlag : _blueFlag, team)); + } + } + + for (Location loc : WorldData.GetDataLocs("YELLOW")) + { + _resupply.add(new Resupply(this, loc)); + } + + //Kit spawning + + if (this instanceof ChampionsCTF) + { + CreatureAllowOverride = true; + for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("LIGHT_BLUE").size() && i < WorldData.GetDataLocs("PINK").size(); i++) + { + Entity ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i)); + Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("PINK").get(i)); + + ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("LIGHT_BLUE").get(i)); + Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("LIGHT_BLUE").get(i)); + } + CreatureAllowOverride = false; + } + + //End kit spawning + } + + @EventHandler + public void customTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + for (GameTeam team : GetTeamList()) + if (team.GetColor() == ChatColor.AQUA) + team.SetColor(ChatColor.BLUE); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void blockLiquidFlow(BlockPhysicsEvent event) + { + Material matOfBlock = event.getBlock().getType(); + + if (matOfBlock == Material.STATIONARY_WATER || matOfBlock == Material.SAND || matOfBlock == Material.GRAVEL || matOfBlock == Material.STATIONARY_LAVA) + { + event.setCancelled(true); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onTNTExplode(EntityExplodeEvent event) + { + if (!IsLive()) + return; + + if (event.getEntityType() == EntityType.PRIMED_TNT) + { + event.setCancelled(true); + } + } + + @EventHandler + public void updates(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() == UpdateType.FASTEST) + { + for (Flag flag : _flags) + flag.update(); + + Iterator hotbarIter = _hotbars.keySet().iterator(); + while (hotbarIter.hasNext()) + { + Player player = hotbarIter.next(); + + if (!player.isOnline() || UtilPlayer.isSpectator(player) || !IsAlive(player)) + hotbarIter.remove(); + } + + Iterator helmetIter = _helmets.keySet().iterator(); + while (helmetIter.hasNext()) + { + Player player = helmetIter.next(); + + if (!player.isOnline() || UtilPlayer.isSpectator(player) || !IsAlive(player)) + helmetIter.remove(); + } + } + else if (event.getType() == UpdateType.TICK) + { + for (Flag flag : _flags) + { + if (flag.getCarrier() == null) + for (Player player : GetPlayers(true)) + if (UtilMath.offset2d(player.getLocation(), flag.getPlacedLocation()) < .5 && player.getLocation().getY() > flag.getPlacedLocation().getY() - 2 && player.getLocation().getY() < flag.getPlacedLocation().getY() + 3) + flag.pickup(player); + } + } + else if (event.getType() == UpdateType.FAST) + { + for (Resupply resupply : _resupply) + resupply.Update(); + + getFlag(true).handleBottomInfo(_redFlickerStage, ChatColor.RED); + getFlag(false).handleBottomInfo(_blueFlickerStage, ChatColor.AQUA); + } + else if (event.getType() == UpdateType.SEC) + for (Flag flag : _flags) + flag.handleRespawn(); + else + progressTime(); + } + + public void progressTime() + { + if (_suddenDeath) return; + + long remain = _gameTime - (System.currentTimeMillis() - GetStateTime()); + + if (remain <= 0) + { + if (_redScore > _blueScore) + endCheckScore(_redScore); + else if(_redScore < _blueScore) + endCheckScore(_blueScore); + else + { + _suddenDeath = true; + this.DeathOut = true; + UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!"); + return; + } + } + } + + public void addCapture(GameTeam team) + { + if (_suddenDeath) + { + if (team.GetColor() == ChatColor.RED) + { + _redScore = _redScore + 1; + endCheckScore(_redScore); + } + else + { + _blueScore = _blueScore + 1; + endCheckScore(_blueScore); + } + } + else + { + if (team.GetColor() == ChatColor.RED) + { + _redScore = Math.min(_victoryCaps, _redScore + 1); + } + else + { + _blueScore = Math.min(_victoryCaps, _blueScore + 1); + } + + endCheckScore(_victoryCaps); + } + } + + public void saveInventory(Player player) + { + List items = new ArrayList(); + for (int i = 0; i < 9; i++) + { + if (player.getInventory().getItem(i) != null) + items.add(i, player.getInventory().getItem(i)); + else + items.add(i, new ItemStack(Material.AIR)); + } + _hotbars.put(player, items); + + _helmets.put(player, player.getInventory().getHelmet()); + } + + public void resetInventory(Player player) + { + if (_hotbars.containsKey(player)) + { + List items = _hotbars.get(player); + for (int i = 0; i < items.size(); i++) + { + if (items.get(i).getType() != Material.AIR) + player.getInventory().setItem(i, items.get(i)); + else + player.getInventory().setItem(i, new ItemStack(Material.AIR)); + } + getArcadeManager().getClassManager().hideNextEquipMessage(player.getName()); + player.getInventory().setHelmet(_helmets.get(player)); + //getArcadeManager().getClassManager().toggleMessage(player.getName(), false); + player.updateInventory(); + player.removePotionEffect(PotionEffectType.SLOW); + _hotbars.remove(player); + _helmets.remove(player); + } + } + + public boolean isAtHome(ChatColor team) + { + for (Flag flag : _flags) + { + if (flag.getTeam().GetColor() == team) + return flag.isAtHome(); + } + return false; + } + + public Location getRedFlag() + { + return _redFlag; + } + + public Location getBlueFlag() + { + return _blueFlag; + } + + public boolean isInZone(Location location, boolean red) + { + if (red) + { + if (UtilMath.offset(location, _redFlag) < 4) + return true; + } + else + { + if (UtilMath.offset(location, _blueFlag) < 4) + return true; + } + + return false; + } + + public boolean isSuddenDeath() + { + return _suddenDeath; + } + + private boolean isEnemyCarrier(Player check, Player stat) + { + if (GetTeam(check).GetColor() == GetTeam(stat).GetColor()) return false; + + for (Flag f : _flags) + { + if (f.getCarrier() == null) continue; + if (f.getCarrier().getName().equalsIgnoreCase(check.getName())) return true; + } + + return false; + } + + private String getVisualResult(ChatColor base) + { + String newc = base.toString(); + + if (base == ChatColor.BLUE) + newc = C.cDBlue; + + if (base == ChatColor.RED) + newc = C.cDRed; + + return newc; + } + + private Flag getFlag(boolean red) + { + if (red) + { + for (Flag f : _flags) + if (f.getTeam().GetColor() == ChatColor.RED) + return f; + } + else + { + for (Flag f : _flags) + if (f.getTeam().GetColor() == ChatColor.BLUE) + return f; + } + return null; + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + scoreboardWrite(); + } + + private void scoreboardWrite() + { + if (!InProgress()) + return; + + //Wipe Last + Scoreboard.Reset(); + + //Scores + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cRedB + "Red Team"); + Scoreboard.Write(_redScore + " Captures"); + + String redMessage = "Flag Dropped"; + if (getFlag(true).isAtHome()) + { + redMessage = "Flag Safe"; + _redFlickerStage = false; + } + if (getFlag(true).getCarrier() != null) + redMessage = "Flag Taken"; + + if (_redFlickerStage) + { + Scoreboard.Write(C.cRed + redMessage); + _redFlickerStage = false; + } + else + { + Scoreboard.Write(redMessage); + _redFlickerStage = true; + } + //Flag in play stuff + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cAquaB + "Blue Team"); + Scoreboard.Write(_blueScore + " Captures"); + + String blueMessage = "Flag Dropped"; + if (getFlag(false).isAtHome()) + { + blueMessage = "Flag Safe"; + _blueFlickerStage = false; + } + if (getFlag(false).getCarrier() != null) + blueMessage = "Flag Taken"; + + if (_blueFlickerStage) + { + Scoreboard.Write(C.cAqua + blueMessage); + _blueFlickerStage = false; + } + else + { + Scoreboard.Write(blueMessage); + _blueFlickerStage = true; + } + //Flag in play stuff + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cYellowB + "Score to Win"); + Scoreboard.Write(_victoryCaps + " Captures"); + + Scoreboard.WriteBlank(); + if (_suddenDeath) + { + Scoreboard.Write(C.cYellowB + "Sudden Death"); + Scoreboard.Write("Next Cap Wins"); + Scoreboard.Write("No Respawns"); + } + else + { + Scoreboard.Write(C.cYellowB + "Time Left"); + Scoreboard.Write(UtilTime.MakeStr(Math.max(_gameTime - (System.currentTimeMillis() - GetStateTime()), 0)) + C.cWhite); + } + + Scoreboard.Draw(); + } + + public void endCheckScore(int needed) + { + if (!IsLive()) + return; + + GameTeam winner = null; + + if (_redScore >= needed) + winner = GetTeam(ChatColor.RED); + else if (_blueScore >= needed) + winner = GetTeam(ChatColor.BLUE); + + if (winner == null) + return; + + scoreboardWrite(); + + //Announce + AnnounceEnd(winner); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : team.GetPlayers(false)) + AddGems(player, 10, "Winning Team", false, false); + } + + for (Player player : team.GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false, false); + } + + if (EloRanking) + { + EloTeam teamWinner = new EloTeam(); + EloTeam teamLoser = new EloTeam(); + + for (GameTeam team : GetTeamList()) + { + if (WinnerTeam != null && team.equals(WinnerTeam)) + { + for (Player player : WinnerTeam.GetPlayers(false)) + { + EloPlayer eloPlayer = new EloPlayer(); + eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + + teamWinner.addPlayer(eloPlayer); + } + } + else + { + for (Player player : team.GetPlayers(false)) + { + EloPlayer eloPlayer = new EloPlayer(); + eloPlayer.UniqueId = player.getUniqueId().toString(); + eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName()); + + teamLoser.addPlayer(eloPlayer); + } + } + } + + for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers()) + { + Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + } + + for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers()) + { + Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating); + } + } + + //End + SetState(GameState.End); + } + + @Override + public double GetKillsGems(Player killer, Player killed, boolean assist) + { + if (assist) + return .5; + + if (_suddenDeath) + return 2; + + return 1; + } + + @Override + public String GetMode() + { + return "Capture the Flag"; + } + + @EventHandler + public void respawnRegen(PlayerGameRespawnEvent event) + { + Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false); + Manager.GetCondition().Factory().Protection("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false); + } + + public PlayerData getStats(Player player) + { + if (!_stats.containsKey(player.getName())) + _stats.put(player.getName(), new PlayerData(player.getName())); + + return _stats.get(player.getName()); + } + + @EventHandler + public void statsKillAssistDeath(CombatDeathEvent event) + { + Game game = Manager.GetGame(); + if (game == null) return; + + if (!(event.GetEvent().getEntity() instanceof Player)) + return; + + Player killed = (Player)event.GetEvent().getEntity(); + getStats(killed).Deaths++; + + if (event.GetLog().GetKiller() != null) + { + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (killer != null && !killer.equals(killed)) + getStats(killer).Kills++; + } + + for (CombatComponent log : event.GetLog().GetAttackers()) + { + if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller())) + continue; + + Player assist = UtilPlayer.searchExact(log.GetName()); + + //Assist + if (assist != null) + getStats(assist).Assists++; + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void statsKillAssistDeath(CustomDamageEvent event) + { + Player damager = event.GetDamagerPlayer(true); + if (damager != null) + { + getStats(damager).DamageDealt += event.GetDamage(); + } + + Player damagee = event.GetDamageePlayer(); + if (damagee != null) + { + getStats(damagee).DamageTaken += event.GetDamage(); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void usableInteract(PlayerInteractEvent event) + { + if (UtilBlock.usable(event.getClickedBlock())) + event.setCancelled(true); + } + + @EventHandler + public void selectKit(PlayerKitApplyEvent event) + { + if (this instanceof ChampionsCTF) + { + for (Flag flag : _flags) + if (!flag.isAtHome()) + if (flag.getCarrier() != null) + if (flag.getCarrier().getName().equals(event.getPlayer().getName())) + { + event.setCancelled(true); + event.setCancelMessage("You cannot change kits while holding a flag!"); + } + + if (_suddenDeath) + { + event.setCancelled(true); + event.setCancelMessage("You cannot change kits during Sudden Death!"); + } + } + } + + @EventHandler + public void dropFlag(PlayerDropItemEvent event) + { + for (Flag flag : _flags) + if ((flag.getRepresentation().getType() == event.getItemDrop().getItemStack().getType()) || (event.getItemDrop().getItemStack().getType() == Material.COMPASS)) + if (flag.getCarrier() != null) + if (flag.getCarrier().getName().equals(event.getPlayer().getName())) + { + event.setCancelled(false); + event.getItemDrop().remove(); + flag.drop(event.getPlayer()); + resetInventory(event.getPlayer()); + } + } + + @EventHandler + public void radarUpdate(UpdateEvent event) + { + if (!InProgress()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + ArrayList data = new ArrayList(); + + for (Flag f : _flags) + { + if (f.getCarrier() == null) + data.add(new RadarData(f.getPlacedLocation(), f.getTeam().GetColor() + "⚑")); + else + data.add(new RadarData(f.getCarrier().getLocation(), getVisualResult(f.getTeam().GetColor()) + "⚑")); + } + + data.add(new RadarData(_redFlag, C.cRed + "☗")); + data.add(new RadarData(_blueFlag, C.cBlue + "☗")); + + for (Player player : UtilServer.getPlayers()) + UtilRadar.displayRadar(player, data); + } + + @EventHandler + public void useCmd(PlayerCommandPreprocessEvent event) + { + if (!InProgress()) + return; + + if (event.getMessage().contains("/suddendeath")) + { + boolean authorized = Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV); + + if (Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing")) + if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR)) + authorized = true; + + if (Manager.GetGameHostManager().isPrivateServer()) + if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false)) + authorized = true; + + if (Manager.GetGameHostManager().isEventServer()) + if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR)) + authorized = true; + + if (authorized) + { + if (_redScore < _blueScore) + _redScore = _blueScore; + else + _blueScore = _redScore; + + _gameTime = (System.currentTimeMillis() - GetStateTime()) + 11; + for (Player pl : UtilServer.getPlayers()) + UtilPlayer.message(pl, C.cYellowB + event.getPlayer().getName() + " has equalized both teams and enabled Sudden Death!"); + } + else + UtilPlayer.message(event.getPlayer(), F.main("Game", "You do not have permission to use this game modifier!")); + + event.setCancelled(true); + } + } + + @EventHandler + public void powerupPickup(PlayerPickupItemEvent event) + { + if (!IsLive()) + return; + + for (Flag f : _flags) + if (f.getCarrier() == event.getPlayer()) + return; + + if (_suddenDeath) + return; + + for (Resupply resupply : _resupply) + resupply.Pickup(event.getPlayer(), event.getItem()); + } + + //Dont allow powerups to despawn + @EventHandler + public void itemDespawn(ItemDespawnEvent event) + { + event.setCancelled(true); + } + + @EventHandler + public void onDie(CombatDeathEvent event) + { + Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + if (event.GetLog().GetKiller() != null) + { + if (event.GetLog().GetKiller().IsPlayer()) + { + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (isEnemyCarrier(player, killer)) + { + CarrierCombatDeathEvent e = new CarrierCombatDeathEvent(player, killer); + Bukkit.getPluginManager().callEvent(e); + } + } + } + + for (Flag flag : _flags) + flag.drop(player); + + getArcadeManager().getClassManager().forceRemoveFromSuppressed(player.getName()); + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + for (Flag flag : _flags) + flag.drop(event.getPlayer()); + + getArcadeManager().getClassManager().forceRemoveFromSuppressed(event.getPlayer().getName()); + } + + @EventHandler + public void equalizeBrute(CustomDamageEvent event) + { + if (event.GetDamageePlayer() == null) + return; + + boolean carrier = false; + for (Flag flag : _flags) + if (flag.getCarrier() != null) + if (flag.getCarrier().getName().equals(event.GetDamageePlayer().getName())) + carrier = true; + + if (carrier) + { + if (event.GetDamageePlayer().getInventory().getChestplate() != null) + if (event.GetDamageePlayer().getInventory().getChestplate().getType() == Material.DIAMOND_CHESTPLATE) + event.SetBrute(); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index 1ff47bd80..c92af3e1f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -7,6 +7,9 @@ import java.util.HashMap; + + + import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -24,8 +27,12 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import mineplex.core.common.util.C; +import mineplex.core.common.util.RadarData; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilRadar; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextTop; import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloTeam; import mineplex.core.elo.GameResult; @@ -435,4 +442,22 @@ public class Domination extends TeamGame if (UtilBlock.usable(event.getClickedBlock())) event.setCancelled(true); } + + @EventHandler + public void radarUpdate(UpdateEvent event) + { + if (!InProgress()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + ArrayList data = new ArrayList(); + + for (CapturePoint point : _points) + data.add(new RadarData(point.getLocation(), point.getRadarTag())); + + for (Player player : UtilServer.getPlayers()) + UtilRadar.displayRadar(player, data); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/CarrierCombatDeathEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/CarrierCombatDeathEvent.java new file mode 100644 index 000000000..a4f6c1955 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/CarrierCombatDeathEvent.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.games.common.ctf_data; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class CarrierCombatDeathEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Player _killed; + private Player _killer; + + public CarrierCombatDeathEvent(Player killed, Player killer) + { + _killed = killed; + _killer = killer; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Player GetPlayer(boolean killer) + { + if (killer) + return _killer; + else + return _killed; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java new file mode 100644 index 000000000..08417f095 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/Flag.java @@ -0,0 +1,436 @@ +package nautilus.game.arcade.game.games.common.ctf_data; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.GameTeam; +import nautilus.game.arcade.game.games.common.CaptureTheFlag; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.DyeColor; +import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Banner; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.banner.Pattern; +import org.bukkit.block.banner.PatternType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class Flag +{ + private CaptureTheFlag _host; + + private Location _spawn; + private Location _particleLoc; + private Location _beacon; + + private Block _flagBlock; + + private Material _priorBlock; + private Byte _priorData; + + private GameTeam _team; + private ChatColor _enemy; + + private ItemStack _representation; + private DyeColor _dyeData; + private List _patterns; + + private Player _holding = null; + + private boolean _moved = false; + private boolean _dropped = false; + private long _dropTime = 0; + private int _respawnTimer; + + private Hologram _name, _time; + + private String _displayName; + + public Flag(CaptureTheFlag host, Location spawn, GameTeam team) + { + _host = host; + _spawn = spawn; + _beacon = _spawn.clone().add(0, -2, 0); + _team = team; + _displayName = team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'"); + _patterns = new ArrayList(); + + ItemStack i; + if (team.GetColor() == ChatColor.RED) + { + i = new ItemStack(Material.BANNER); + _dyeData = DyeColor.RED; + _enemy = ChatColor.BLUE; + _patterns.add(new Pattern(DyeColor.WHITE, PatternType.CROSS)); + } + else + { + i = new ItemStack(Material.BANNER); + _dyeData = DyeColor.BLUE; + _enemy = ChatColor.RED; + _patterns.add(new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE)); + } + + BannerMeta im = (BannerMeta) i.getItemMeta(); + im.setBaseColor(_dyeData); + im.setPatterns(_patterns); + im.setDisplayName(_displayName); + i.setItemMeta(im); + + _representation = i; + + _name = new Hologram(_host.getArcadeManager().getHologramManager(), spawn, team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'")); + _time = new Hologram(_host.getArcadeManager().getHologramManager(), spawn, ""); + + spawnFlag(spawn); + } + + public GameTeam getTeam() + { + return _team; + } + + public boolean isAtHome() + { + return !_moved; + } + + public Player getCarrier() + { + return _holding; + } + + public Location getPlacedLocation() + { + return _flagBlock.getLocation().clone().add(0.5, 0, 0.5); + } + + + public ItemStack getRepresentation() + { + return _representation; + } + + public String getDisplayName() + { + return _displayName; + } + + private void announceSteal(Player cap, boolean steal) + { + if (steal) + UtilTextMiddle.display("", _host.GetTeam(cap).GetColor() + cap.getName() + C.cWhite + " stole " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10); + else + UtilTextMiddle.display("", _host.GetTeam(cap).GetColor() + cap.getName() + C.cWhite + " picked up " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10); + } + + private void announceDrop(Player player) + { + UtilTextMiddle.display("", _enemy + player.getName() + C.cWhite + " dropped " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10); + } + + private void announceCapture(Player player) + { + UtilTextMiddle.display("", _host.GetTeam(player).GetColor() + player.getName() + C.cWhite + " scored for " + _host.GetTeam(player).GetColor() + _host.GetTeam(player).GetName(), 0, 60, 10); + } + + private void announceReturn() + { + UtilTextMiddle.display("", _team.GetColor() + _team.GetName() + " Flag " + C.cWhite + " has returned to base", 0, 60, 10); + } + + public void update() + { + if (!_moved || _dropped) + { + _flagBlock.setType(Material.STANDING_BANNER); + Banner banner = (Banner) _flagBlock.getState(); + banner.setBaseColor(_dyeData); + banner.setPatterns(_patterns); + banner.update(); + } + + if (_moved) + { + if (_dropped) + { + Integer r = Math.max(0, _respawnTimer); + _time.setText(remainColor(r) + r.toString()); + + if (_respawnTimer > -1) + return; + + deleteFlag(); + + _moved = false; + _dropped = false; + spawnFlag(_spawn); + + announceReturn(); + + UtilFirework.playFirework(_spawn.clone().add(0, 1, 0), FireworkEffect.builder().flicker(false).withColor(_team.GetColorBase()).with(Type.BURST).trail(true).build()); + return; + } + + if (_holding == null) + return; + + while (UtilMath.offset(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)) > .2) + { + if (_team.GetColor() == ChatColor.RED) + { + for (int i = 0 ; i < 2 ; i++) + UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, 0, 0, 0, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + } + else + { + for (int i = 0 ; i < 2 ; i++) + UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, -1, 1, 1, 1, 0, + ViewDist.MAX, UtilServer.getPlayers()); + } + + _particleLoc.add(UtilAlg.getTrajectory(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)).multiply(.2)); + } + + if (_host.GetTeam(_holding).GetColor() == ChatColor.RED) + _holding.setCompassTarget(_host.getRedFlag()); + else + _holding.setCompassTarget(_host.getBlueFlag()); + + if (!_holding.hasPotionEffect(PotionEffectType.SLOW)) + _holding.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1)); + + //_holding.getWorld().playSound(_holding.getLocation(), Sound.NOTE_STICKS, 2f, 1f); + score(_holding); + } + } + + public void handleRespawn() + { + if (_moved) + { + if (_dropped) + { + _respawnTimer = _respawnTimer - 1; + } + else + { + if (_respawnTimer < 15) + _respawnTimer = _respawnTimer + 1; + } + } + } + + public void handleBottomInfo(boolean flicker, ChatColor color) + { + if (_holding != null) + { + if (flicker) + UtilTextBottom.display(color + "Return the Flag to your Capture Zone!", _holding); + else + UtilTextBottom.display("Return the Flag to your Capture Zone!", _holding); + } + } + + private ChatColor remainColor(int remain) + { + if (remain >= 9) return ChatColor.GREEN; + if ((remain < 9) && (remain >= 6)) return ChatColor.YELLOW; + return ChatColor.RED; + } + + @SuppressWarnings("deprecation") + public void spawnFlag(Location loc) + { + while (!UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.DOWN))) + loc.add(0, -1, 0); + + while (!UtilBlock.airFoliage(loc.getBlock())) + loc.add(0, 1, 0); + + _flagBlock = loc.getBlock(); + _host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().Restore(_flagBlock); + + _priorBlock = loc.getBlock().getType(); + + _priorData = loc.getBlock().getData(); + + _flagBlock.setType(Material.STANDING_BANNER); + Banner banner = (Banner) _flagBlock.getState(); + banner.setBaseColor(_dyeData); + banner.setPatterns(_patterns); + banner.update(); + + if (!_moved) + { + _name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5)); + _name.start(); + _beacon.getBlock().setType(Material.BEACON); + _respawnTimer = 15; + } + else + { + _name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5)); + _name.start(); + Integer re = Math.max(0, _respawnTimer); + _time.setText(remainColor(re) + re.toString()); + _time.setLocation(loc.getBlock().getLocation().clone().add(0.5, 2.5, 0.5)); + _time.start(); + } + } + + @SuppressWarnings("deprecation") + private void deleteFlag() + { + _flagBlock.setType(_priorBlock); + _flagBlock.setData(_priorData); + _beacon.getBlock().setType(Material.WOOL); + _beacon.getBlock().setData(_dyeData.getWoolData()); + + _name.stop(); + _time.stop(); + } + + public boolean pickup(Player player) + { + if (_holding == null) + { + if (!UtilPlayer.isSpectator(player)) + { + if (_host.IsAlive(player)) + { + if (_host.GetTeam(player) != _team) + { + if (_dropped) + { + if (!UtilTime.elapsed(_dropTime, 3000)) + return false; + } + + deleteFlag(); + + _host.saveInventory(player); + + for (int i = 0; i < 9; i++) + player.getInventory().setItem(i, _representation); + + ItemStack compass = new ItemStack(Material.COMPASS); + ItemMeta im = compass.getItemMeta(); + im.setDisplayName(C.cDAqua + "Your Base"); + compass.setItemMeta(im); + player.getInventory().setItem(4, compass); + player.getInventory().setHelmet(_representation); + player.updateInventory(); + player.getInventory().setHeldItemSlot(4); + + for (PotionEffect effect : player.getActivePotionEffects()) + player.removePotionEffect(effect.getType()); + + player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1)); + + player.setPassenger(null); + + if (_moved) + announceSteal(player, false); + else + announceSteal(player, true); + + _particleLoc = player.getEyeLocation().clone().add(0.0, 0.5, 0.0); + _holding = player; + _dropped = false; + _dropTime = 0; + _moved = true; + + return true; + } + } + } + } + + return false; + } + + public void drop(Player player) + { + if (_moved) + { + if (_holding != null) + { + if (_holding.getUniqueId() == player.getUniqueId()) + { + spawnFlag(player.getLocation()); + announceDrop(player); + _holding = null; + _dropped = true; + _dropTime = System.currentTimeMillis(); + } + } + } + } + + public void score(Player player) + { + if (_moved) + { + if (_holding != null) + { + if (_holding.getUniqueId() == player.getUniqueId()) + { + if (_team.GetColor() == ChatColor.RED) + if (!_host.isInZone(player.getLocation(), false)) return; + + if (_team.GetColor() == ChatColor.BLUE) + if (!_host.isInZone(player.getLocation(), true)) return; + + if (!_host.isAtHome(_team.GetColor() == ChatColor.RED ? ChatColor.BLUE : ChatColor.RED)) + { + if (Recharge.Instance.use(player, "No Cap Message", 1000, false, false)) + UtilTextMiddle.display("", C.cRed + "Your flag must be at home to capture!", player); + + return; + } + + _host.resetInventory(player); + announceCapture(player); + _host.AddGems(player, 10, "Enemy Flag Captured", true, true); + PlayerCaptureFlagEvent event = new PlayerCaptureFlagEvent(player); + Bukkit.getPluginManager().callEvent(event); + _host.addCapture(_host.GetTeam(player)); + + _moved = false; + _dropped = false; + _dropTime = 0; + spawnFlag(_spawn); + _holding = null; + } + } + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/PlayerCaptureFlagEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/PlayerCaptureFlagEvent.java new file mode 100644 index 000000000..4b44a5cde --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/ctf_data/PlayerCaptureFlagEvent.java @@ -0,0 +1,31 @@ +package nautilus.game.arcade.game.games.common.ctf_data; + +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class PlayerCaptureFlagEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + private Player _player; + + public PlayerCaptureFlagEvent(Player player) + { + _player = player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + + public Player GetPlayer() + { + return _player; + } +} 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 ac022741b..6dd87d7f5 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 @@ -452,4 +452,25 @@ public class CapturePoint Host.AddGems(player, amount / 25d, "Control Point Score", true, true); Host.GetStats(player).CaptureScore += amount; } + + public Location getLocation() + { + return _loc.clone(); + } + + public String getRadarTag() + { + String out = ""; + + if (_owner != null) + { + if (_owner.GetColor() == ChatColor.BLUE) + out += ChatColor.AQUA; + else + out += _owner.GetColor(); + } + + + return out + _name.substring(0, Math.min(1, _name.length())); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Emerald.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Emerald.java index f19f9a80e..2e6af351a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Emerald.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Emerald.java @@ -68,12 +68,18 @@ public class Emerald public void Pickup(Player player, Item item) { + if (!Host.IsLive()) + return; + if (_ent == null) return; if (!_ent.equals(item)) return; + if (_ent.getTicksLived() <= 40) + return; + if (!Host.IsAlive(player)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Resupply.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Resupply.java index 719272cef..154278736 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Resupply.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/dominate_data/Resupply.java @@ -68,12 +68,18 @@ public class Resupply public void Pickup(Player player, Item item) { + if (!Host.IsLive()) + return; + if (_ent == null) return; if (!_ent.equals(item)) return; + if (_ent.getTicksLived() <= 40) + return; + if (!Host.IsAlive(player)) return; 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 05be6dd43..11253f420 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 @@ -200,7 +200,7 @@ public class DragonEscape extends SoloGame @EventHandler public void Invisibility(PlayerKitGiveEvent event) { - Manager.GetCondition().Factory().Invisible(GetName(), event.GetPlayer(), event.GetPlayer(), 40, 0, false, false, false); + Manager.GetCondition().Factory().Invisible(GetName(), event.getPlayer(), event.getPlayer(), 40, 0, false, false, false); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java index 487202f0c..dd31d4703 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/event/EventModule.java @@ -1247,7 +1247,7 @@ public class EventModule extends MiniPlugin for (int i = 0 ; i < count ; i++) { Manager.GetGame().CreatureAllowOverride = true; - entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet)null, 0).getLocation().add(0.5, 1, 0.5), type)); + entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet)null, 150).getLocation().add(0.5, 1, 0.5), type)); Manager.GetGame().CreatureAllowOverride = false; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index 736b72cea..738b83cdc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -280,7 +280,7 @@ public class MineStrike extends TeamGame "Sprinting heavily decreases accuracy", "Jumping massively decreases accuracy", "Crouching increases accuracy", - "Left-Click to roll Grenades", + "Left-Click to drop Grenades", "Right-Click to throw Grenades", "Burst Fire for greater accuracy", "Sniper Rifles are only accurate while scoped", @@ -339,45 +339,45 @@ public class MineStrike extends TeamGame @EventHandler public void giveStartEquipment(PlayerKitGiveEvent event) { - GameTeam team = GetTeam(event.GetPlayer()); + GameTeam team = GetTeam(event.getPlayer()); if (team == null) return; if (team.GetColor() == ChatColor.RED) { - if (IsAlive(event.GetPlayer())) + if (IsAlive(event.getPlayer())) { //Pistol Gun gun = new Gun(GunStats.GLOCK_18); - registerGun(gun, event.GetPlayer()); - gun.giveToPlayer(event.GetPlayer(), true); + registerGun(gun, event.getPlayer()); + gun.giveToPlayer(event.getPlayer(), true); //Knife - event.GetPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife")); + event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife")); //Armor - giveTeamArmor(event.GetPlayer(), Color.fromRGB(255, 0, 0)); + giveTeamArmor(event.getPlayer(), Color.fromRGB(255, 0, 0)); } } else if (team.GetColor() == ChatColor.AQUA) { - if (IsAlive(event.GetPlayer())) + if (IsAlive(event.getPlayer())) { //Pistol Gun gun = new Gun(GunStats.P2000); - registerGun(gun, event.GetPlayer()); - gun.giveToPlayer(event.GetPlayer(), true); + registerGun(gun, event.getPlayer()); + gun.giveToPlayer(event.getPlayer(), true); //Knife - event.GetPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife")); + event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife")); //Armor - giveTeamArmor(event.GetPlayer(), Color.fromRGB(0, 0, 255)); + giveTeamArmor(event.getPlayer(), Color.fromRGB(0, 0, 255)); } } //Enter Shop - _shopManager.enterShop(event.GetPlayer()); + _shopManager.enterShop(event.getPlayer()); } @EventHandler(priority = EventPriority.MONITOR) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java index b7e50caff..6094d8e70 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/PerkFishFlurry.java @@ -124,7 +124,7 @@ public class PerkFishFlurry extends SmashPerk implements IThrown //particles for (Block block : data.Blocks) - UtilParticle.PlayParticle(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 10, ViewDist.LONG, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.SPLASH, block.getLocation().add(0.5, 1, 0.5), 0.25f, 0, 0.25f, 0, 3, ViewDist.LONG, UtilServer.getPlayers()); //sound Block block = UtilAlg.Random(data.Blocks); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index a3012fb12..9494c868e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -580,7 +580,7 @@ public class TurfForts extends TeamGame @EventHandler(ignoreCancelled = true) public void onSpawn(PlayerKitGiveEvent event) { - Player player = event.GetPlayer(); + Player player = event.getPlayer(); if (this.playersThatNeedBlocks.contains(player.getUniqueId())) { this.playersThatNeedBlocks.remove(player.getUniqueId()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java index 22beccdde..8169f2c4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -1,6 +1,15 @@ package nautilus.game.arcade.kit; -import org.bukkit.Bukkit; +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerKitGiveEvent; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Entity; @@ -12,17 +21,6 @@ import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; -import mineplex.core.achievement.Achievement; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.PlayerKitGiveEvent; - public abstract class Kit implements Listener { public ArcadeManager Manager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java index 7e977ed2b..99a6f459e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkInkBlast.java @@ -75,7 +75,7 @@ public class PerkInkBlast extends SmashPerk implements IThrown UtilInv.Update(player); - for (int i=0 ; i<8 ; i++) + for (int i=0 ; i<7 ; i++) { org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte)0, 1, "Ink" + Math.random())); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java index 513f4182b..e5be1cdbc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameHostManager.java @@ -100,6 +100,7 @@ public class GameHostManager implements Listener //Hero Games heroGames.add(GameType.ChampionsDominate); heroGames.add(GameType.ChampionsTDM); + heroGames.add(GameType.ChampionsCTF); heroGames.add(GameType.HideSeek); heroGames.add(GameType.Draw); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index f06f1d2dd..2a3c5b75d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -7,6 +7,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTabTitle; import mineplex.core.donation.Donor; import mineplex.core.recharge.Recharge; @@ -15,6 +16,7 @@ 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.PlayerKitApplyEvent; import nautilus.game.arcade.events.PlayerStateChangeEvent; import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; @@ -29,7 +31,6 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -316,58 +317,65 @@ public class GamePlayerManager implements Listener public void KitClick(final Player player, final Kit kit, final Entity entity) { - kit.DisplayDesc(player); - - if (Manager.GetGame() == null) - return; - - if (!Manager.GetGame().HasKit(kit)) - return; - - Donor donor = Manager.GetDonation().Get(player.getName()); - - if (kit.GetAvailability() == KitAvailability.Free || //Free - - Manager.hasKitsUnlocked(player) || //YouTube - - (kit.GetAvailability() == KitAvailability.Achievement && //Achievement - Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) || - - donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green - - Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF - - donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) - - Manager.GetServerConfig().Tournament) //Tournament + PlayerKitApplyEvent kitEvent = new PlayerKitApplyEvent(Manager.GetGame(), kit, player); + UtilServer.getServer().getPluginManager().callEvent(kitEvent); + if (!kitEvent.isCancelled()) { - Manager.GetGame().SetKit(player, kit, true); - } - else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost()) - { - Manager.GetShop().openPageForPlayer(player, new ConfirmationPage( - Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable() + kit.DisplayDesc(player); + + if (Manager.GetGame() == null) + return; + + if (!Manager.GetGame().HasKit(kit)) + return; + + Donor donor = Manager.GetDonation().Get(player.getName()); + + if (kit.GetAvailability() == KitAvailability.Free || //Free + + Manager.hasKitsUnlocked(player) || //YouTube + + (kit.GetAvailability() == KitAvailability.Achievement && //Achievement + Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) || + + donor.OwnsUnknownPackage(Manager.GetGame().GetType().GetKitGameName() + " " + kit.GetName()) || //Green + + Manager.GetClients().Get(player).GetRank().has(Rank.MAPDEV) || //STAFF + + donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) + + Manager.GetServerConfig().Tournament) //Tournament { - public void run() - { - if (player.isOnline()) - { - Manager.GetGame().SetKit(player, kit, true); - UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); - } - } - }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player)); - } - else if (kit.GetAvailability() == KitAvailability.Achievement) - { - UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + ".")); + Manager.GetGame().SetKit(player, kit, true); + } + else if (kit.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.Gems) >= kit.GetCost()) + { + Manager.GetShop().openPageForPlayer(player, new ConfirmationPage( + Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new Runnable() + { + public void run() + { + if (player.isOnline()) + { + Manager.GetGame().SetKit(player, kit, true); + UtilPlayer.sendPacket(player, new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity) entity).getHandle().getDataWatcher(), true)); + } + } + }, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(), kit), CurrencyType.Gems, player)); + } + else if (kit.GetAvailability() == KitAvailability.Achievement) + { + UtilPlayer.message(player, F.main("Kit", "You have not unlocked all " + F.elem(C.cPurple + Manager.GetGame().GetName() + " Achievements") + ".")); + } + else + { + player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); + + UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + ".")); + } } else - { - player.playSound(player.getLocation(), Sound.NOTE_BASS, 2f, 0.5f); - - UtilPlayer.message(player, F.main("Kit", "You do not have enough " + F.elem(C.cGreen + "Gems") + ".")); - } + UtilPlayer.message(player, F.main("Game", kitEvent.getCancelMessage())); } @EventHandler(priority = EventPriority.HIGHEST) @@ -415,4 +423,4 @@ public class GamePlayerManager implements Listener player.teleport(target); } } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/CapturesStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/CapturesStatTracker.java new file mode 100644 index 000000000..febf08d35 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/CapturesStatTracker.java @@ -0,0 +1,29 @@ +package nautilus.game.arcade.stats; + +import nautilus.game.arcade.game.games.common.CaptureTheFlag; +import nautilus.game.arcade.game.games.common.ctf_data.PlayerCaptureFlagEvent; + +import org.bukkit.event.EventHandler; + +public class CapturesStatTracker extends StatTracker +{ + private final String _stat; + + public CapturesStatTracker(CaptureTheFlag game, String stat) + { + super(game); + _stat = stat; + } + + @EventHandler + public void onCapture(PlayerCaptureFlagEvent event) + { + addStat(event.GetPlayer(), getStat(), 1, false, false); + } + + public String getStat() + { + return _stat; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ClutchStatTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ClutchStatTracker.java new file mode 100644 index 000000000..744e7afce --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/stats/ClutchStatTracker.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.stats; + +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.games.common.CaptureTheFlag; +import nautilus.game.arcade.game.games.common.ctf_data.CarrierCombatDeathEvent; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class ClutchStatTracker extends StatTracker +{ + private final String _stat; + + public ClutchStatTracker(CaptureTheFlag game, String stat) + { + super(game); + _stat = stat; + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCombatDeath(CarrierCombatDeathEvent event) + { + if (getGame().GetState() != Game.GameState.Live) + return; + + if (!getGame().isSuddenDeath()) + return; + + addStat(event.GetPlayer(true), getStat(), 1, false, false); + } + + public String getStat() + { + return _stat; + } + +}