diff --git a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml index d49f02062..a90117bcf 100644 --- a/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml +++ b/Plugins/.idea/artifacts/Mineplex_Hub_jar.xml @@ -17,8 +17,8 @@ - + \ No newline at end of file diff --git a/Plugins/.idea/modules.xml b/Plugins/.idea/modules.xml index c3a2035a7..bf0ac4bae 100644 --- a/Plugins/.idea/modules.xml +++ b/Plugins/.idea/modules.xml @@ -14,6 +14,7 @@ + diff --git a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java index 67f811440..f1bcc4118 100644 --- a/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java +++ b/Plugins/Classpath.Dummy/src/net/minecraft/server/v1_7_R4/PacketPlayOutPlayerInfo.java @@ -6,6 +6,7 @@ package net.minecraft.server.v1_7_R4; import java.io.IOException; +import java.util.Calendar; import java.util.Iterator; import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard; @@ -16,6 +17,11 @@ import net.minecraft.util.com.mojang.authlib.properties.Property; import net.minecraft.util.com.mojang.authlib.properties.PropertyMap; public class PacketPlayOutPlayerInfo extends Packet { + + public static final String NOTCH_SKIN = "eyJ0aW1lc3RhbXAiOjE0Mjc4MjgyMzMwNDUsInByb2ZpbGVJZCI6IjA2OWE3OWY0NDRlOTQ3MjZhNWJlZmNhOTBlMzhhYWY1IiwicHJvZmlsZU5hbWUiOiJOb3RjaCIsImlzUHVibGljIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTExNmU2OWE4NDVlMjI3ZjdjYTFmZGRlOGMzNTdjOGM4MjFlYmQ0YmE2MTkzODJlYTRhMWY4N2Q0YWU5NCJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2Y2ODhlMGU2OTliM2Q5ZmU0NDhiNWJiNTBhM2EyODhmOWM1ODk3NjJiM2RhZTgzMDg4NDIxMjJkY2I4MSJ9fX0="; + public static final String NOTCH_SIGNATURE = "WrBmNqkpkjh6VJY26jOOMNS6oSOPi0MTm9WWc0t4EMUHchUbTd6/1sT2O2zz2s7xwmCeUxuIhvRREa+1bIPzIIbXJLjhxiBWMdTJbQhv6zBb1U2SZb7eb5cYrFTD6rvxy0rOarScxCBdeOXpr1coxrvN8a6VkgLhc/dGhFx0ZmORxELBLFiCNi+4WE//MI+KioAq84Gdf0ltT9ZLWdlHNFV2ynBgcx2MfNTA2lrpdKEUVOYD7xhPoOdHa5d1hzdDxbYPGDgM0FzYjzNUlBx8SLvHEpyBB7XyOsIGnfqrS0ltIDTq82wgLrEwDRncuQN18w6IiQbNK06MZBDyNnIp79mmUYvRj+Zl0dPBrZok2q2uQ08hZ87ufU3jhjY39kr+iEaPYMvfWaBxt3ALjopsZRCGSlEukMzITjeYxhfVKuQ0fhWKRfwWn/Jv2de2h+i+t7nulvN3MV3rJVrS6OXsx87p/vm9biU7Hs07T8VSGONfkxXmsgYEtY6m2egU5pmqFnsKM0MwwnZJ7Sxz2EjiPikoGzJzpv4ncj3rhelIKJKjDk9jSAz7nPzc8/UdOiTrfy4ezr3jFVAVatiKr+kS/HNXHWiCFdufhpG4DVCrSkwkFBJw030pJ6ICVhpuYq5yOswQB5QOp0JDWc2Rdth7SVmvxthSCL9G2ksfm+v7sKw="; + + public static final int ADD_PLAYER = 0; public static final int UPDATE_GAMEMODE = 1; public static final int UPDATE_LATENCY = 2; @@ -38,6 +44,7 @@ public class PacketPlayOutPlayerInfo extends Packet { packet.player = player.getProfile(); packet.ping = player.ping; packet.gamemode = player.playerInteractManager.getGameMode().getId(); + packet._tabName = getFormattedName(player); return packet; } @@ -87,6 +94,9 @@ public class PacketPlayOutPlayerInfo extends Packet { public void b(PacketDataSerializer packetdataserializer) throws IOException { if(packetdataserializer.version >= 20) { + + Calendar c = Calendar.getInstance(); + packetdataserializer.b(this.action); packetdataserializer.b(1); packetdataserializer.writeUUID(this.player.getId()); @@ -94,16 +104,41 @@ public class PacketPlayOutPlayerInfo extends Packet { case 0: packetdataserializer.a(this.player.getName()); PropertyMap properties = this.player.getProperties(); + + // April Fools + if (isAprilFools() && properties.size() == 0) + { + // add texture if no textures exist + properties.put("textures", new Property("textures", NOTCH_SKIN, NOTCH_SIGNATURE)); + + } + packetdataserializer.b(properties.size()); Iterator var3 = properties.values().iterator(); while(var3.hasNext()) { Property property = (Property)var3.next(); - packetdataserializer.a(property.getName()); - packetdataserializer.a(property.getValue()); - packetdataserializer.writeBoolean(property.hasSignature()); - if(property.hasSignature()) { - packetdataserializer.a(property.getSignature()); + + // April Fools + if (isAprilFools() && property.getName().equalsIgnoreCase("textures")) + { + System.out.println("Applying notch texture for : " + property.getName()); + System.out.println("Skin: " + property.getValue()); + System.out.println("Signature: " + property.getSignature()); + packetdataserializer.a(property.getName()); + packetdataserializer.a(NOTCH_SKIN); + packetdataserializer.writeBoolean(true); + packetdataserializer.a(NOTCH_SIGNATURE); + } + else + { + packetdataserializer.a(property.getName()); + packetdataserializer.a(property.getValue()); + + packetdataserializer.writeBoolean(property.hasSignature()); + if(property.hasSignature()) { + packetdataserializer.a(property.getSignature()); + } } } @@ -149,6 +184,8 @@ public class PacketPlayOutPlayerInfo extends Packet { { String name = player.getName(); + if (isAprilFools()) name = "Notch"; + CraftScoreboard scoreboard = player.getBukkitEntity().getScoreboard(); if (scoreboard != null) { @@ -159,4 +196,12 @@ public class PacketPlayOutPlayerInfo extends Packet { return name; } + + public static boolean isAprilFools() + { + Calendar c = Calendar.getInstance(); + +// return true; + return c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1; + } } diff --git a/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml b/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml index 81ce3df96..872b77ead 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml +++ b/Plugins/Mineplex.Bungee.Mineplexer/Mineplex.Bungee.Mineplexer.iml @@ -13,5 +13,6 @@ + \ No newline at end of file diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/GlobalMotd.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/GlobalMotd.java index 055416f96..f8de8c523 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/GlobalMotd.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/GlobalMotd.java @@ -11,10 +11,12 @@ import mineplex.serverdata.data.Data; */ public class GlobalMotd implements Data { - // The unique name representing this MOTD set private String _name; + private String _headline; + public String getHeadline() { return _headline; } + // List of lines describing the MOTD private List _motd; public List getMotd() { return _motd; } @@ -24,9 +26,10 @@ public class GlobalMotd implements Data * @param name * @param motd */ - public GlobalMotd(String name, List motd) + public GlobalMotd(String name, String headline, List motd) { _name = name; + _headline = headline; _motd = motd; } 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 d136dc354..358e1d3b2 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/motd/MotdManager.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; import mineplex.serverdata.Region; -import mineplex.serverdata.data.BungeeServer; import mineplex.serverdata.data.DataRepository; import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.servers.ServerManager; @@ -23,7 +22,7 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory private DataRepository _repository; - private String firstLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r"; + private String _firstLine = " §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r"; private List _motdLines; public MotdManager(Plugin plugin) @@ -35,6 +34,7 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory _repository = new RedisDataRepository(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), Region.ALL, GlobalMotd.class, "globalMotd"); + run(); } @EventHandler @@ -42,7 +42,7 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory { net.md_5.bungee.api.ServerPing serverPing = event.getResponse(); - String motd = firstLine; + String motd = _firstLine; if (_motdLines != null && _motdLines.size() > 0) { motd += "\n" + _motdLines.get(0); @@ -55,19 +55,31 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory public void run() { // Add in default MOTD listing to database + /* if (!_repository.elementExists("MainMotd")) { _repository.removeElement("MainMotd"); List lines = new ArrayList(); - lines.add(" §e§lSurvival Games §a§lBIG UPDATE!"); // TODO: Implement in-game command to update MOTD? - lines.add(" §d§lHero Sale §a§l33% Off"); - lines.add(" §e§lSurvival Games §a§lBIG UPDATE!"); + lines.add(" §a§lDouble Gems for 1.8 Players!"); + lines.add(" §e§lChampions Update §a§lBalance Patch"); + lines.add(" §6§lSpecial Egg Baskets!"); + lines.add(" §e§lBunny Morph §a§lLimited Time!"); + lines.add(" §d§lHero Sale §a§l33% Off"); + lines.add(" §a§lDouble Gems for 1.8 Players!"); - updateMainMotd(lines); + updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines); } + */ - _motdLines = _repository.getElement("MainMotd").getMotd(); // Update MOTD lines + GlobalMotd motd = _repository.getElement("MainMotd"); + + if (motd != null) + { + _motdLines = motd.getMotd(); + _firstLine = motd.getHeadline(); + } + InitialHandler.setCustomMotdFactory(this); } @@ -75,9 +87,9 @@ public class MotdManager implements Listener, Runnable, CustomMotdFactory * Update the main {@link GlobalMotd} determining the MOTD for Bungee instances. * @param motdLines - the lines to update the MOTD to. */ - public void updateMainMotd(List motdLines) + public void updateMainMotd(String headline, List motdLines) { - _repository.addElement(new GlobalMotd("MainMotd", motdLines)); + _repository.addElement(new GlobalMotd("MainMotd", headline, motdLines)); } public List getMotdLines() diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 32770cc1a..09ee3d266 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -14,14 +14,15 @@ public enum Rank SNR_MODERATOR("Sr.Mod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD), HELPER("Helper", ChatColor.DARK_AQUA), - MAPDEV("Mapper", ChatColor.BLUE), - MAPLEAD("MapKing", ChatColor.DARK_PURPLE), + MAPDEV("MapTeam", ChatColor.BLUE), + MAPLEAD("MapLead", ChatColor.DARK_PURPLE), EVENT("Event", ChatColor.WHITE), //Staff ^^ YOUTUBE("YouTube", ChatColor.RED), + TWITCH("Twitch", ChatColor.DARK_PURPLE), LEGEND("Legend", ChatColor.GREEN), HERO("Hero", ChatColor.LIGHT_PURPLE), ULTRA("Ultra", ChatColor.AQUA), 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 a502bd8e2..bf726be24 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 @@ -627,4 +627,9 @@ public class UtilEnt return null; } + + public static boolean inWater(LivingEntity ent) + { + return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9; + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java index d15e401f2..393922947 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilInv.java @@ -79,11 +79,16 @@ public class UtilInv for (ItemStack stack : getItems(player, checkArmor, checkCursor)) { if (required <= 0) + { return true; + } if (stack == null) continue; + if (stack.getType() != item) + continue; + if (stack.getAmount() <= 0) continue; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java index f0715f5c7..88aafb1af 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/CoreClientManager.java @@ -220,7 +220,13 @@ public class CoreClientManager extends MiniPlugin if (client.getAccountId() > 0) _accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId())); - + } + catch (Exception exception) + { + exception.printStackTrace(); + } + finally + { Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable() { public void run() @@ -230,14 +236,6 @@ public class CoreClientManager extends MiniPlugin } }); } - catch (Exception exception) - { - exception.printStackTrace(); - } - finally - { - runnable.run(); - } } }); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java index 7a7dbf3f9..7bf400dd2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/account/command/UpdateRank.java @@ -52,7 +52,7 @@ public class UpdateRank extends CommandBase final Rank rank = tempRank; - if ((rank == Rank.YOUTUBE && Plugin.Get(caller).GetRank().Has(Rank.OWNER)) || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) + if (rank == Rank.YOUTUBE || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR) { Plugin.getRepository().matchPlayerName(new Callback>() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java index 5101f26be..7d203191d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/AntiHack.java @@ -102,6 +102,8 @@ public class AntiHack extends MiniPlugin _movementDetectors.add(new Speed(this)); _combatDetectors.add(new Reach(this)); + + _enabled = false; } public static void Initialize(JavaPlugin plugin, Punish punish, Portal portal, PreferencesManager preferences, CoreClientManager clientManager) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java index 257a35387..9bf8b4a00 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antihack/types/Reach.java @@ -30,7 +30,7 @@ public class Reach extends MiniPlugin implements Detector public Reach (AntiHack host) { - super("Speed Detector", host.getPlugin()); + super("Reach Detector", host.getPlugin()); Host = host; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/aprilfools/AprilFoolsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/aprilfools/AprilFoolsManager.java new file mode 100644 index 000000000..6507b48d6 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/aprilfools/AprilFoolsManager.java @@ -0,0 +1,203 @@ +package mineplex.core.aprilfools; + +import java.util.Calendar; + +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.plugin.java.JavaPlugin; + +import mineplex.core.MiniPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseCow; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class AprilFoolsManager extends MiniPlugin +{ + public static AprilFoolsManager Instance; + + private boolean _enabled; + private DisguiseManager _disguiseManager; + private CoreClientManager _clientManager; + + protected AprilFoolsManager(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager) + { + super("April Fools", plugin); + + _disguiseManager = disguiseManager; + _clientManager = clientManager; + + Calendar c = Calendar.getInstance(); + _enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1); + } + + public static void Initialize(JavaPlugin plugin, CoreClientManager clientManager, DisguiseManager disguiseManager) + { + Instance = new AprilFoolsManager(plugin, clientManager, disguiseManager); + } + + @EventHandler + public void updateEnabled(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOW) + return; + + Calendar c = Calendar.getInstance(); + _enabled = (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1); + } + + @EventHandler(priority = EventPriority.LOW) + public void chatAdd(AsyncPlayerChatEvent event) + { + if (!_enabled) + return; + + String[] words = event.getMessage().split(" "); + + String out = ""; + for (String word : words) + { + //Prefix + if (Math.random() > 0.85) + { + out += "moo"; + + for (int i=0 ; i 0.85) + { + out += word + " "; + + out += "moo"; + + for (int i=0 ; i 0.99) + { + out += "moo"; + + for (int i=3 ; i 0.8) + { + if (_disguiseManager.getDisguise(player) instanceof DisguiseCow) + { + player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, (float)Math.random() + 0.5f, (float)Math.random() + 0.5f); + } + } + + continue; + } + + //Disguise + DisguiseCow disguise = new DisguiseCow(player); + disguise.setName(getName(player), _clientManager.Get(player).GetRank()); + disguise.setCustomNameVisible(true); + _disguiseManager.disguise(disguise); + } + } + + public boolean isActive() + { + return _enabled; + } + + public String getName(Player player) + { + //Name + int index = 0; + boolean hitVowel = false; + for (int i=0 ; i 16) + name = name.substring(0, 16); + + return name; + } + + public void setEnabled(boolean b) + { + Calendar c = Calendar.getInstance(); + _enabled = b && (c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index bc8b4b5ae..bdcf593de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -6,6 +6,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.Map.Entry; import net.minecraft.server.v1_7_R4.Block; @@ -17,6 +18,7 @@ import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent; import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_7_R4.PacketPlayOutBed; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus; import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunk; import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn; @@ -28,6 +30,7 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect; @@ -62,6 +65,7 @@ import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseInsentient; import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketVerifier; @@ -80,6 +84,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler private NautHashMap> _disguisePlayerMap = new NautHashMap>(); private HashSet _blockedNames = new HashSet(); private NautHashMap> _futureDisguises = new NautHashMap>(); + private NautHashMap> _lastRabbitHop = new NautHashMap>(); private boolean _handlingPacket = false; @@ -93,6 +98,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler private Field _bedD; private Field _xChunk; private Field _zChunk; + private Field _eStatusId; + private Field _eStatusState; private Chunk _bedChunk; private boolean _bedPackets; @@ -121,6 +128,10 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler _bedB.setAccessible(true); _bedD = PacketPlayOutBed.class.getDeclaredField("d"); _bedD.setAccessible(true); + _eStatusId = PacketPlayOutEntityStatus.class.getDeclaredField("a"); + _eStatusId.setAccessible(true); + _eStatusState = PacketPlayOutEntityStatus.class.getDeclaredField("b"); + _eStatusState.setAccessible(true); _bedChunk = new Chunk(null, 0, 0); Field cSection = Chunk.class.getDeclaredField("sections"); @@ -221,6 +232,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler disguise.setEntity(event.GetEntity()); _spawnPacketMap.put(event.GetEntity().getEntityId(), disguise); _entityDisguiseMap.remove(event.GetEntity().getUniqueId().toString()); + + if (disguise instanceof DisguiseRabbit) + { + _lastRabbitHop.put(disguise.GetEntityId(), new NautHashMap()); + } } } @@ -325,6 +341,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { _entityDisguiseMap.put(entity.getUniqueId().toString(), _spawnPacketMap.get(entity.getEntityId())); _spawnPacketMap.remove(entity.getEntityId()); + _lastRabbitHop.remove(entity.getEntityId()); } } } @@ -374,6 +391,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler _spawnPacketMap.put(disguise.GetEntityId(), disguise); _disguisePlayerMap.put(disguise, new HashSet()); + if (disguise instanceof DisguiseRabbit) + { + _lastRabbitHop.put(disguise.GetEntityId(), new NautHashMap()); + } + for (Player player : players) addViewerToDisguise(disguise, player, false); @@ -513,6 +535,63 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler final Player owner = packetInfo.getPlayer(); final PacketVerifier packetVerifier = packetInfo.getVerifier(); + if (UtilPlayer.is1_8(owner) + && (packet instanceof PacketPlayOutRelEntityMoveLook || packet instanceof PacketPlayOutRelEntityMove)) + { + int entityId = -1; + + if (packet instanceof PacketPlayOutRelEntityMoveLook) + { + entityId = ((PacketPlayOutRelEntityMoveLook) packet).a; + }/* + else if (packet instanceof PacketPlayOutEntityLook) + { + entityId = ((PacketPlayOutEntityLook) packet).a; + }*/ + else if (packet instanceof PacketPlayOutRelEntityMove) + { + PacketPlayOutRelEntityMove rPacket = (PacketPlayOutRelEntityMove) packet; + + if (rPacket.b != 0 || rPacket.c != 0 || rPacket.d != 0) + { + entityId = rPacket.a; + } + } + /*else if (packet instanceof PacketPlayOutEntityTeleport) + { + entityId = ((PacketPlayOutEntityTeleport) packet).a; + }*/ + + if (_lastRabbitHop.containsKey(entityId)) + { + NautHashMap rabbitHops = _lastRabbitHop.get(entityId); + + if (rabbitHops != null) + { + long last = rabbitHops.containsKey(owner.getEntityId()) ? System.currentTimeMillis() + - rabbitHops.get(owner.getEntityId()) : 1000; + + if (last > 500 || last < 100) + { + rabbitHops.put(owner.getEntityId(), System.currentTimeMillis()); + + PacketPlayOutEntityStatus entityStatus = new PacketPlayOutEntityStatus(); + try + { + _eStatusId.set(entityStatus, entityId); + _eStatusState.set(entityStatus, (byte) 1); + + handlePacket(entityStatus, packetVerifier); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + } + } + } + if (packet instanceof PacketPlayOutPlayerInfo) { if (_blockedNames.contains(((PacketPlayOutPlayerInfo) packet).username)) @@ -520,10 +599,23 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler packetInfo.setCancelled(true); } } - else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutNamedEntitySpawn) + else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutSpawnEntityLiving + || packet instanceof PacketPlayOutNamedEntitySpawn) { - int entityId = packet instanceof PacketPlayOutSpawnEntity ? ((PacketPlayOutSpawnEntity) packet).a - : ((PacketPlayOutNamedEntitySpawn) packet).a; + int entityId = -1; + + if (packet instanceof PacketPlayOutSpawnEntity) + { + entityId = ((PacketPlayOutSpawnEntity) packet).a; + } + else if (packet instanceof PacketPlayOutSpawnEntityLiving) + { + entityId = ((PacketPlayOutSpawnEntityLiving) packet).a; + } + else if (packet instanceof PacketPlayOutNamedEntitySpawn) + { + entityId = ((PacketPlayOutNamedEntitySpawn) packet).a; + } if (_futureDisguises.containsKey(entityId)) { @@ -737,6 +829,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler private void handleSpawnPackets(PacketInfo packetInfo, DisguiseBase disguise) { final Player player = packetInfo.getPlayer(); + + if (!UtilPlayer.is1_8(player) && disguise instanceof DisguiseRabbit) + { + return; + } + final PacketVerifier packetVerifier = packetInfo.getVerifier(); if (disguise instanceof DisguisePlayer) @@ -795,54 +893,12 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler { _disguisePlayerMap.get(disguise).remove(event.getPlayer()); } - } - /*public void reApplyDisguise(final DisguiseBase disguise, final Player player) - { - PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(disguise.GetEntityId()); - - if (disguise.GetEntity() == ((CraftPlayer) player).getHandle()) - return; - - EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); - - entityPlayer.playerConnection.sendPacket(destroyPacket); - - List tempArmor = new ArrayList(); - - if (disguise instanceof DisguiseInsentient && disguise.GetEntity() instanceof LivingEntity) + for (Integer disguise : _lastRabbitHop.keySet()) { - if (((DisguiseInsentient) disguise).armorVisible()) - { - for (Packet armorPacket : ((DisguiseInsentient) disguise).getArmorPackets()) - tempArmor.add(armorPacket); - } + _lastRabbitHop.get(disguise).remove(event.getPlayer().getEntityId()); } - - final List armorPackets = tempArmor; - - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - public void run() - { - EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); - entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket()); - - if (disguise instanceof DisguisePlayer && ((DisguisePlayer) disguise).getSleepingDirection() != null) - { - for (Packet packet : getBedPackets(player.getLocation(), (DisguisePlayer) disguise)) - { - entityPlayer.playerConnection.sendPacket(packet); - } - } - - for (Packet packet : armorPackets) - { - entityPlayer.playerConnection.sendPacket(packet); - } - } - }); - }*/ + } private void prepareChunk(Location loc) { @@ -1007,6 +1063,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler if (!_spawnPacketMap.containsKey(entity.getEntityId())) return; + _lastRabbitHop.remove(entity.getEntityId()); DisguiseBase disguise = _spawnPacketMap.remove(entity.getEntityId()); Collection players = (disguise.Global ? Bukkit.getOnlinePlayers() : _disguisePlayerMap.remove(disguise)); @@ -1054,4 +1111,34 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler entityPlayer.playerConnection.sendPacket(disguise.GetMetaDataPacket()); } } + + @EventHandler + public void cleanDisguises(UpdateEvent event) + { + if (event.getType() != UpdateType.SLOWER || _disguisePlayerMap.isEmpty()) + return; + + for (Iterator disguiseIterator = _disguisePlayerMap.keySet().iterator(); disguiseIterator.hasNext();) + { + DisguiseBase disguise = disguiseIterator.next(); + + if (!(disguise.GetEntity() instanceof EntityPlayer)) + continue; + + EntityPlayer disguisedPlayer = (EntityPlayer)disguise.GetEntity(); + + if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid) + disguiseIterator.remove(); + else + { + for (Iterator playerIterator = _disguisePlayerMap.get(disguise).iterator(); playerIterator.hasNext();) + { + Player player = playerIterator.next(); + + if (!player.isOnline() || !player.isValid()) + playerIterator.remove(); + } + } + } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index fa806d384..33126f3d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -1,5 +1,7 @@ package mineplex.core.disguise.disguises; +import java.util.UUID; + import org.bukkit.Location; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; @@ -31,7 +33,11 @@ public class DisguisePlayer extends DisguiseHuman public void setProfile(GameProfile profile) { - _profile = profile; + GameProfile newProfile = new GameProfile(UUID.randomUUID(), profile.getName()); + + newProfile.getProperties().putAll(profile.getProperties()); + + _profile = newProfile; } public BlockFace getSleepingDirection() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java new file mode 100644 index 000000000..cdde5fd6e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseRabbit.java @@ -0,0 +1,80 @@ +package mineplex.core.disguise.disguises; + +import net.minecraft.server.v1_7_R4.EnumEntitySize; +import net.minecraft.server.v1_7_R4.MathHelper; +import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; + +public class DisguiseRabbit extends DisguiseInsentient +{ + + public DisguiseRabbit(org.bukkit.entity.Entity entity) + { + super(entity); + + DataWatcher.a(4, Byte.valueOf((byte) 0)); + + DataWatcher.a(12, (byte) 0); + DataWatcher.a(15, Byte.valueOf((byte) 0)); + DataWatcher.a(18, Byte.valueOf((byte) 0)); + } + + @Override + public Packet GetSpawnPacket() + { + PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); + packet.a = Entity.getId(); + packet.b = (byte) 101; + packet.c = (int) EnumEntitySize.SIZE_2.a(Entity.locX); + packet.d = (int) MathHelper.floor(Entity.locY * 32.0D); + packet.e = (int) EnumEntitySize.SIZE_2.a(Entity.locZ); + packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); + packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); + + double var2 = 3.9D; + double var4 = 0; + double var6 = 0; + double var8 = 0; + + if (var4 < -var2) + { + var4 = -var2; + } + + if (var6 < -var2) + { + var6 = -var2; + } + + if (var8 < -var2) + { + var8 = -var2; + } + + if (var4 > var2) + { + var4 = var2; + } + + if (var6 > var2) + { + var6 = var2; + } + + if (var8 > var2) + { + var8 = var2; + } + + packet.f = (int) (var4 * 8000.0D); + packet.g = (int) (var6 * 8000.0D); + packet.h = (int) (var8 * 8000.0D); + + packet.l = DataWatcher; + packet.m = DataWatcher.b(); + + return packet; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java index c82e72530..b8b2bf46b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/donation/DonationManager.java @@ -251,22 +251,35 @@ public class DonationManager extends MiniDbClientPlugin if (event.getType() != UpdateType.SLOWER) return; - for (Player player : _coinQueue.keySet()) + for (final Player player : _coinQueue.keySet()) { - String caller = null; - int total = 0; + String tempCaller = null; + int tempTotal = 0; for (String curCaller : _coinQueue.get(player).keySet()) { - caller = curCaller; - total += _coinQueue.get(player).get(curCaller); + tempCaller = curCaller; + tempTotal += _coinQueue.get(player).get(curCaller); } + final int total = tempTotal; + final String caller = tempCaller; + if (caller == null) continue; - //Actually Add Gems - RewardCoins(null, caller, player.getName(), ClientManager.Get(player).getAccountId(), total, false); + if (player.isOnline() && player.isValid()) + RewardCoins(null, caller, player.getName(), ClientManager.Get(player).getAccountId(), total, false); + else + { + Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable() + { + public void run() + { + RewardCoins(null, caller, player.getName(), ClientManager.getCachedClientAccountId(player.getUniqueId()), total, false); + } + }); + } System.out.println("Queue Added [" + player + "] with Coins [" + total + "] for [" + caller + "]"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java index 359220020..a06f3e540 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/friend/data/FriendRepository.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.database.DBPool; import mineplex.core.database.RepositoryBase; import mineplex.core.database.ResultSetCallable; +import mineplex.core.database.column.ColumnInt; import mineplex.core.database.column.ColumnVarChar; import mineplex.core.friend.FriendStatusType; import mineplex.serverdata.Region; @@ -26,11 +27,8 @@ import mineplex.serverdata.servers.ServerManager; public class FriendRepository extends RepositoryBase { - private static String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS accountFriend (id INT NOT NULL AUTO_INCREMENT, uuidSource VARCHAR(100), uuidTarget VARCHAR(100), status VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuidSource, uuidTarget));"; - private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN "; - private static String ADD_FRIEND_RECORD = "INSERT INTO accountFriend (uuidSource, uuidTarget, status, created) SELECT fA.uuid AS uuidSource, tA.uuid AS uuidTarget, ?, now() FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;"; - private static String UPDATE_MUTUAL_RECORD = "UPDATE accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid SET aF.status = ? WHERE tA.name = ? AND fA.name = ?;"; - private static String DELETE_FRIEND_RECORD = "DELETE aF FROM accountFriend AS aF INNER JOIN accounts as fA ON aF.uuidSource = fA.uuid INNER JOIN accounts AS tA ON aF.uuidTarget = tA.uuid WHERE fA.name = ? AND tA.name = ?;"; + private static String ADD_FRIEND_RECORD = "INSERT INTO accountFriend (sourceId, targetId) VALUES(?, ?);"; + private static String DELETE_FRIEND_RECORD = "DELETE FROM accountFriend WHERE id = ?;"; // Repository holding active PlayerStatus data. private DataRepository _repository; @@ -54,29 +52,14 @@ public class FriendRepository extends RepositoryBase { } - public boolean addFriend(final Player caller, String name) + public boolean addFriend(int sourceAccountId, int targetAccountId) { - int rowsAffected = executeUpdate(ADD_FRIEND_RECORD, new ColumnVarChar("status", 100, "Sent"), new ColumnVarChar("name", 100, name), new ColumnVarChar("name", 100, caller.getName())); - - if (rowsAffected > 0) - return executeUpdate(ADD_FRIEND_RECORD, new ColumnVarChar("status", 100, "Pending"), new ColumnVarChar("name", 100, caller.getName()), new ColumnVarChar("uuid", 100, name)) > 0; - - return false; + return executeUpdate(ADD_FRIEND_RECORD, new ColumnInt("sourceId", sourceAccountId), new ColumnInt("targetId", targetAccountId)) > 0; } - public boolean updateFriend(String caller, String name, String status) - { - return executeUpdate(UPDATE_MUTUAL_RECORD, new ColumnVarChar("status", 100, status), new ColumnVarChar("uuid", 100, name), new ColumnVarChar("name", 100, caller)) > 0; - } - - public boolean removeFriend(String caller, String name) + public boolean removeFriendRecord(int recordId) { - int rowsAffected = executeUpdate(DELETE_FRIEND_RECORD, new ColumnVarChar("name", 100, name), new ColumnVarChar("name", 100, caller)); - - if (rowsAffected > 0) - return executeUpdate(DELETE_FRIEND_RECORD, new ColumnVarChar("name", 100, caller), new ColumnVarChar("uuid", 100, name)) > 0; - - return false; + return executeUpdate(DELETE_FRIEND_RECORD, new ColumnInt("id", recordId)) > 0; } public NautHashMap getFriendsForAll(Player...players) @@ -84,7 +67,7 @@ public class FriendRepository extends RepositoryBase final NautHashMap friends = new NautHashMap(); StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(RETRIEVE_MULTIPLE_FRIEND_RECORDS + "("); + //stringBuilder.append(RETRIEVE_MULTIPLE_FRIEND_RECORDS + "("); for (Player player : players) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index 8f3a1d912..775206ffd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -119,6 +119,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphBlaze(this)); //addGadget(new MorphGeno(this)); addGadget(new MorphWither(this)); + addGadget(new MorphBunny(this)); // Particles addGadget(new ParticleFoot(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java index 165f662ed..44eb1ca17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFleshHook.java @@ -46,7 +46,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown 1.6, false, 0, 0.2, 10, false); Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, - Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 2d); + Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f); //Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java index faff21e22..a2ee2c308 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java @@ -58,7 +58,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown 1, false, 0, 0.2, 10, false); Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, - null, 1f, 1f, null, null, 0, UpdateType.TICK, 2d); + null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java index 373abb30e..0d6d18762 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java @@ -115,7 +115,7 @@ public class MorphBat extends MorphGadget implements IThrown 0.01, true, -0.3, 0, 10, false); Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, - null, 1f, 1f, null, null, 0, UpdateType.TICK, 3d); + null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); //Inform UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Poop") + ".")); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java new file mode 100644 index 000000000..5026ebbd7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBunny.java @@ -0,0 +1,253 @@ +package mineplex.core.gadget.gadgets; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.ItemDespawnEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.CurrencyType; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +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.UtilPlayer; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseRabbit; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphBunny extends MorphGadget +{ + private HashSet _jumpCharge = new HashSet(); + private HashMap _eggs = new HashMap(); + + public MorphBunny(GadgetManager manager) + { + super(manager, "Easter Bunny Morph", new String[] + { + C.cWhite + "Happy Easter!", + " ", + C.cYellow + "Charge Crouch" + C.cGray + " to use " + C.cGreen + "Super Jump", + C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Hide Easter Egg", + " ", + C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" , + " ", + C.cPurple + "Special Limited Time Morph", + C.cPurple + "Purchase at www.mineplex.com/shop", + }, + -1, + Material.MONSTER_EGG, (byte)98); + } + + @Override + public void EnableCustom(final Player player) + { + this.ApplyArmor(player); + + DisguiseRabbit disguise = new DisguiseRabbit(player); + disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); + disguise.setCustomNameVisible(true); + Manager.getDisguiseManager().disguise(disguise); + + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1)); + player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999999, 1)); + } + + @Override + public void DisableCustom(Player player) + { + _jumpCharge.remove(player); + this.RemoveArmor(player); + Manager.getDisguiseManager().undisguise(player); + + player.removePotionEffect(PotionEffectType.SPEED); + player.removePotionEffect(PotionEffectType.JUMP); + + } + + @EventHandler + public void jumpTrigger(PlayerToggleSneakEvent event) + { + Player player = event.getPlayer(); + + if (!IsActive(player)) + return; + + //Start + if (!event.getPlayer().isSneaking()) + { + if (UtilEnt.isGrounded(event.getPlayer())) + _jumpCharge.add(event.getPlayer()); + } + //Jump + else if (_jumpCharge.remove(event.getPlayer())) + { + float power = player.getExp(); + player.setExp(0f); + + UtilAction.velocity(player, power * 4, 0.4, 4, true); + + player.getWorld().playSound(player.getLocation(), Sound.CAT_HIT, 0.75f, 2f); + } + } + + @EventHandler + public void jumpBoost(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + Iterator jumpIter = _jumpCharge.iterator(); + + while (jumpIter.hasNext()) + { + Player player = jumpIter.next(); + + if (!player.isValid() || !player.isOnline() || !player.isSneaking()) + { + jumpIter.remove(); + continue; + } + + player.setExp(Math.min(0.9999f, player.getExp() + 0.03f)); + + player.playSound(player.getLocation(), Sound.FIZZ, 0.25f + player.getExp() * 0.5f, 0.5f + player.getExp()); + } + } + + @EventHandler + public void eggHide(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!IsActive(player)) + return; + + if (!UtilEvent.isAction(event, ActionType.L)) + return; + + if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Coins) < 500) + { + UtilPlayer.message(player, F.main("Gadget", "You do not have enough Coins.")); + return; + } + + if (!Recharge.Instance.use(player, "Hide Egg", 30000, true, false)) + return; + + //Color + + + //Item + ItemStack eggStack = ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte)0, 1, "Hidden Egg" + System.currentTimeMillis()); + eggStack.setDurability((short) 98); + + Item egg = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), eggStack); + UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false); + + + Manager.getDonationManager().RewardCoinsLater(this.GetName() + " Egg Hide", player, -500); + + egg.setPickupDelay(40); + + _eggs.put(egg, player.getName()); + + //Announce + Bukkit.broadcastMessage(C.cYellow + C.Bold + player.getName() + + ChatColor.RESET + C.Bold + " hid an " + + C.cYellow + C.Bold + "Easter Egg" + + ChatColor.RESET + C.Bold + " worth " + + C.cYellow + C.Bold + "450 Coins"); + + for (Player other : UtilServer.getPlayers()) + other.playSound(other.getLocation(), Sound.CAT_HIT, 1.5f, 1.5f); + } + + @EventHandler + public void eggPickup(PlayerPickupItemEvent event) + { + if (_eggs.containsKey(event.getItem()) && !_eggs.get(event.getItem()).equals(event.getPlayer().getName())) + { + _eggs.remove(event.getItem()); + + event.setCancelled(true); + event.getItem().remove(); + + Manager.getDonationManager().RewardCoinsLater(GetName() + " Egg Pickup", event.getPlayer(), 450); + + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 0.75f); + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.5f, 1.25f); + + UtilFirework.playFirework(event.getItem().getLocation(), Type.BURST, Color.YELLOW, true, true); + + //Announce + Bukkit.broadcastMessage(C.cGold + C.Bold + event.getPlayer().getName() + + ChatColor.RESET + C.Bold + " found an " + + C.cGold + C.Bold + "Easter Egg" + + ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!"); + } + } + + @EventHandler + public void eggClean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Iterator eggIter = _eggs.keySet().iterator(); + + while (eggIter.hasNext()) + { + Item egg = eggIter.next(); + + if (!egg.isValid() || egg.getTicksLived() > 24000) + { + egg.remove(); + eggIter.remove(); + + //Announce + Bukkit.broadcastMessage( + ChatColor.RESET + C.Bold + "No one found an " + + C.cGold + C.Bold + "Easter Egg" + + ChatColor.RESET + C.Bold + "! " + _eggs.size() + " Eggs left!"); + } + else + { + UtilParticle.PlayParticle(ParticleType.SPELL, egg.getLocation().add(0, 0.1, 0), 0.1f, 0.1f, 0.1f, 0, 1); + } + } + } + + @EventHandler + public void eggDespawnCancel(ItemDespawnEvent event) + { + if (_eggs.containsKey(event.getEntity())) + event.setCancelled(true); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java index ccca1c2be..c2f0d04b1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java @@ -98,7 +98,7 @@ public class MorphVillager extends MorphGadget implements IThrown //Throw Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, - null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 2d); + null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f); Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java index ba0aa8b4e..f20373576 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java @@ -34,7 +34,7 @@ public class ParticleBlizzard extends ParticleGadget C.cWhite + "Your double jumps and arrows", C.cWhite + "are enchanted with snow powers.", " ", - C.cPurple + "Purchased at www.mineplex.com/shop", + C.cPurple + "No longer available", }, -1, Material.SNOW_BALL, (byte)0); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java index bf3b827b5..a3e3fb661 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileManager.java @@ -31,54 +31,46 @@ public class ProjectileManager extends MiniPlugin } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, double hitboxMult) + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - null, 1f, 1f, null, 0, null, null, hitboxMult, null)); + null, 1f, 1f, null, 0, null, null, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, double hitboxMult, DisguiseManager disguise) - { - _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, - expireTime, hitPlayer, hitBlock, idle, false, - null, 1f, 1f, null, 0, null, null, hitboxMult, disguise)); - } - - public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, - long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, double hitboxMult) + long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, pickup, - null, 1f, 1f, null, 0, null, null, hitboxMult, null)); + null, 1f, 1f, null, 0, null, null, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, - Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , double hitboxMult) + Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxMult, null)); + sound, soundVolume, soundPitch, effect, effectData, effectRate, null, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, - Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, double hitboxMult) + Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxMult, null)); + sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, hitboxGrow)); } public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, - Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, double hitboxMult) + Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult) { _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, expireTime, hitPlayer, hitBlock, idle, false, - sound, soundVolume, soundPitch, null, 0, effectRate, particle, hitboxMult, null)); + sound, soundVolume, soundPitch, null, 0, effectRate, particle, hitboxMult)); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 876a95580..251022932 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -3,6 +3,7 @@ package mineplex.core.projectile; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -48,14 +49,14 @@ public class ProjectileUser private int _effectData = 0; private UpdateType _effectRate = UpdateType.TICK; - private DisguiseManager _disguise; - + private double _hitboxGrow; + public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate, ParticleType particle, - double hitboxMult, DisguiseManager disguise) + double hitboxMult) { Throw = throwInput; @@ -77,7 +78,7 @@ public class ProjectileUser _effectData = effectData; _effectRate = effectRate; - _disguise = disguise; + _hitboxGrow = hitboxMult; } public void Effect(UpdateEvent event) @@ -104,90 +105,93 @@ public class ProjectileUser return true; } - double distanceToEntity = 0.0D; - LivingEntity victim = null; - - net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity)_thrown).getHandle(); - Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); - Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); - - MovingObjectPosition finalObjectPosition = nmsEntity.world.rayTrace(vec3d, vec3d1, false, true, false); - vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); - vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); + if (_hitPlayer) + { + double distanceToEntity = 0.0D; + LivingEntity victim = null; + + net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity)_thrown).getHandle(); + Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); + Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); + + MovingObjectPosition finalObjectPosition = nmsEntity.world.rayTrace(vec3d, vec3d1, false, true, false); + vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); + vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); - if (finalObjectPosition != null) - { - vec3d1 = Vec3D.a(finalObjectPosition.pos.a, finalObjectPosition.pos.b, finalObjectPosition.pos.c); - } - - for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().getEntities(((CraftEntity)_thrown).getHandle(), ((CraftEntity)_thrown).getHandle().boundingBox.a(((CraftEntity)_thrown).getHandle().motX, ((CraftEntity)_thrown).getHandle().motY, ((CraftEntity)_thrown).getHandle().motZ).grow(1.0D, 1.0D, 1.0D))) - { - if (entity instanceof net.minecraft.server.v1_7_R4.Entity) - { - Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity(); - - if (bukkitEntity instanceof LivingEntity) - { - LivingEntity ent = (LivingEntity)bukkitEntity; - - //Avoid Self - if (ent.equals(_thrower)) - continue; - - //Creative or Spec - if (ent instanceof Player) - if (((Player)ent).getGameMode() == GameMode.CREATIVE || UtilPlayer.isSpectator(ent)) + if (finalObjectPosition != null) + { + vec3d1 = Vec3D.a(finalObjectPosition.pos.a, finalObjectPosition.pos.b, finalObjectPosition.pos.c); + } + + for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().getEntities(((CraftEntity)_thrown).getHandle(), + ((CraftEntity)_thrown).getHandle().boundingBox.a( + ((CraftEntity)_thrown).getHandle().motX, + ((CraftEntity)_thrown).getHandle().motY, + ((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow))) + { + if (entity instanceof net.minecraft.server.v1_7_R4.Entity) + { + Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity(); + + if (bukkitEntity instanceof LivingEntity) + { + LivingEntity ent = (LivingEntity)bukkitEntity; + + //Avoid Self + if (ent.equals(_thrower)) continue; - - EntityType disguise = null; - if (_disguise != null && _disguise.getDisguise(ent) != null) - { - if (_disguise.getDisguise(ent) instanceof DisguiseSquid) - disguise = EntityType.SQUID; - } + + //Creative or Spec + if (ent instanceof Player) + if (((Player)ent).getGameMode() == GameMode.CREATIVE || UtilPlayer.isSpectator(ent)) + continue; - float f1 = (float)(nmsEntity.boundingBox.a() * .6); - AxisAlignedBB axisalignedbb1 = ((CraftEntity)ent).getHandle().boundingBox.grow(f1, f1, f1); - MovingObjectPosition entityCollisionPosition = axisalignedbb1.a(vec3d, vec3d1); - - if (entityCollisionPosition != null) - { - double d1 = vec3d.distanceSquared(entityCollisionPosition.pos); - if ((d1 < distanceToEntity) || (distanceToEntity == 0.0D)) + //float f1 = (float)(nmsEntity.boundingBox.a() * 0.6f); + AxisAlignedBB axisalignedbb1 = ((CraftEntity)ent).getHandle().boundingBox.grow(1F, 1F, 1F); + MovingObjectPosition entityCollisionPosition = axisalignedbb1.a(vec3d, vec3d1); + + if (entityCollisionPosition != null) { - victim = ent; - distanceToEntity = d1; + if (_thrower instanceof Player) + ((Player)_thrower).playSound(_thrower.getLocation(), Sound.ORB_PICKUP, 1f, 1.25f); + + double d1 = vec3d.distanceSquared(entityCollisionPosition.pos); + if ((d1 < distanceToEntity) || (distanceToEntity == 0.0D)) + { + victim = ent; + distanceToEntity = d1; + } } } - } - } - } - - if (victim != null) - { - finalObjectPosition = new MovingObjectPosition(((CraftLivingEntity)victim).getHandle()); + } + } - _callback.Collide(victim, null, this); - return true; - } - - if (finalObjectPosition != null) - { - if (_hitBlock) + if (victim != null) { - Block block = _thrown.getWorld().getBlockAt(finalObjectPosition.b, finalObjectPosition.c, finalObjectPosition.d); - if (!UtilBlock.airFoliage(block) && !block.isLiquid()) + finalObjectPosition = new MovingObjectPosition(((CraftLivingEntity)victim).getHandle()); + + _callback.Collide(victim, null, this); + return true; + } + + if (finalObjectPosition != null) + { + if (_hitBlock) { - nmsEntity.motX = ((float) (finalObjectPosition.pos.a - nmsEntity.locX)); - nmsEntity.motY = ((float) (finalObjectPosition.pos.b - nmsEntity.locY)); - nmsEntity.motZ = ((float) (finalObjectPosition.pos.c - nmsEntity.locZ)); - float f2 = MathHelper.sqrt(nmsEntity.motX * nmsEntity.motX + nmsEntity.motY * nmsEntity.motY + nmsEntity.motZ * nmsEntity.motZ); - nmsEntity.locX -= nmsEntity.motX / f2 * 0.0500000007450581D; - nmsEntity.locY -= nmsEntity.motY / f2 * 0.0500000007450581D; - nmsEntity.locZ -= nmsEntity.motZ / f2 * 0.0500000007450581D; - - _callback.Collide(null, block, this); - return true; + Block block = _thrown.getWorld().getBlockAt(finalObjectPosition.b, finalObjectPosition.c, finalObjectPosition.d); + if (!UtilBlock.airFoliage(block) && !block.isLiquid()) + { + nmsEntity.motX = ((float) (finalObjectPosition.pos.a - nmsEntity.locX)); + nmsEntity.motY = ((float) (finalObjectPosition.pos.b - nmsEntity.locY)); + nmsEntity.motZ = ((float) (finalObjectPosition.pos.c - nmsEntity.locZ)); + float f2 = MathHelper.sqrt(nmsEntity.motX * nmsEntity.motX + nmsEntity.motY * nmsEntity.motY + nmsEntity.motZ * nmsEntity.motZ); + nmsEntity.locX -= nmsEntity.motX / f2 * 0.0500000007450581D; + nmsEntity.locY -= nmsEntity.motY / f2 * 0.0500000007450581D; + nmsEntity.locZ -= nmsEntity.motZ / f2 * 0.0500000007450581D; + + _callback.Collide(null, block, this); + return true; + } } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java index 72bc8f823..a0023e137 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/CoinReward.java @@ -1,9 +1,5 @@ package mineplex.core.reward.rewards; -/** - * Created by shaun on 2014-09-08. - */ - import java.util.Random; import org.bukkit.entity.Player; @@ -16,9 +12,6 @@ import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardRarity; -/** - * Created by shaun on 2014-09-08. - */ public class CoinReward extends Reward { private DonationManager _donationManager; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java index cb2b186df..962ea019c 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/PvpShopButton.java @@ -69,7 +69,7 @@ public class PvpShopButton> imple UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your purchase.")); } } - }, "Clans", player.getName(), player.getUniqueId(), -cost); + }, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), -cost); } } else if (clickType == ClickType.RIGHT || clickType == ClickType.SHIFT_RIGHT) @@ -109,7 +109,7 @@ public class PvpShopButton> imple UtilPlayer.message(player, F.main(Page.getPlugin().getName(), "An error occurred processing your return.")); } } - }, "Clans", player.getName(), player.getUniqueId(), creditAmount); + }, "Clans", player.getName(), Page.getClientManager().Get(player).getAccountId(), creditAmount); } } } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java index c0d416d3b..5398daf50 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/shop/energy/EnergyShopButton.java @@ -50,7 +50,7 @@ public class EnergyShopButton implements IButton _clanInfo.adjustEnergy(energy); _page.refresh(); } - }, "Energy Purchase", player.getName(), player.getUniqueId(), -goldCost, true); + }, "Energy Purchase", player.getName(), _page.getClientManager().Get(player).getAccountId(), -goldCost, true); } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 97672e417..1ff7875a9 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -8,6 +8,7 @@ import mineplex.core.TablistFix; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.antihack.AntiHack; +import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; @@ -113,13 +114,13 @@ public class Hub extends JavaPlugin implements IRelation StatsManager statsManager = new StatsManager(this, clientManager); AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager); - + PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager); HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this)); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); - + new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager); new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName()); new MemoryFix(this); @@ -129,6 +130,8 @@ public class Hub extends JavaPlugin implements IRelation //new Replay(this, packetHandler); new PersonalServerManager(this, clientManager); + AprilFoolsManager.Initialize(this, clientManager, disguiseManager); + CombatManager combatManager = new CombatManager(this); ProjectileManager throwManager = new ProjectileManager(this); @@ -136,7 +139,7 @@ public class Hub extends JavaPlugin implements IRelation DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager); Fire fire = new Fire(this, conditionManager, damage); - Teleport teleport = new Teleport(this); + Teleport teleport = new Teleport(this); Energy energy = new Energy(this); energy.setEnabled(false); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 17c624188..ebff189d5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -1,6 +1,7 @@ package mineplex.hub; import java.util.ArrayList; +import java.util.Calendar; import java.util.HashMap; import org.bukkit.Bukkit; @@ -45,6 +46,7 @@ import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; +import mineplex.core.aprilfools.AprilFoolsManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -510,18 +512,22 @@ public class HubManager extends MiniClientPlugin public void PlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); + String playerName = player.getName(); + + // April Fools + if (AprilFoolsManager.Instance.isActive()) + playerName = AprilFoolsManager.Instance.getName(player); //Public Message if (_clientManager.Get(player).GetRank() != Rank.LEGEND) event.setJoinMessage(null); else { - event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!"); + event.setJoinMessage(C.cGreen + C.Bold + "Legend " + playerName + " has joined!"); UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true); player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f); } - - + //Teleport player.teleport(GetSpawn().add(0, 10, 0)); @@ -622,6 +628,11 @@ public class HubManager extends MiniClientPlugin } Player player = event.getPlayer(); + String playerName = player.getName(); + + // April Fools + if (AprilFoolsManager.Instance.isActive()) + playerName = AprilFoolsManager.Instance.getName(player); Rank rank = GetClients().Get(player).GetRank(); @@ -647,7 +658,7 @@ public class HubManager extends MiniClientPlugin event.getRecipients().clear(); event.setMessage(event.getMessage().substring(1, event.getMessage().length())); - event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s"); + event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + playerName + " " + C.cPurple + "%2$s"); for (String name : party.GetPlayers()) { @@ -664,7 +675,7 @@ public class HubManager extends MiniClientPlugin } return; - } + } else { for (Player other : UtilServer.getPlayers()) @@ -676,7 +687,7 @@ public class HubManager extends MiniClientPlugin } event.setMessage(event.getMessage()); - event.setFormat(levelStr + rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s"); + event.setFormat(levelStr + rankStr + C.cYellow + playerName + " " + C.cWhite + "%2$s"); } } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java index 0683060e9..425ce1a0f 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ForcefieldManager.java @@ -42,7 +42,7 @@ public class ForcefieldManager extends MiniPlugin for (Player player : UtilServer.getPlayers()) { - if (Manager.getPreferences().Get(player).HubForcefield) + if (Manager.getPreferences().Get(player).HubForcefield && Manager.GetClients().Get(player).GetRank().Has(Rank.ADMIN)) { for (Player other : UtilServer.getPlayers()) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 0259a4cd3..76a74e62a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -206,7 +206,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, 2.4d); + _projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 0.5f); //Portal Delay Manager.SetPortalDelay(thrower); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index c2782cbff..c02a3c6a0 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -209,6 +209,9 @@ public class WorldManager extends MiniPlugin if (!(ent instanceof Item)) continue; + if (((Item)ent).getItemStack().getType() == Material.MONSTER_EGG) + continue; + if (ent.getTicksLived() > 1200) ent.remove(); } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java index 835973fb1..8935eb777 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ListCommand.java @@ -34,6 +34,9 @@ public class ListCommand extends BaseCommand for (GameType gameType : GameType.values()) { + if (gameType == GameType.InProgress) + continue; + if (listMaps(player, gameType, colorSwitch)) colorSwitch = !colorSwitch; } @@ -41,16 +44,22 @@ public class ListCommand extends BaseCommand else if (args.length == 1) { GameType gameType = null; - try + if (args[0].equalsIgnoreCase("p")) { - gameType = GameType.valueOf(args[0]); + gameType = GameType.InProgress; } - catch (Exception e) + else { - getPlugin().sendValidGameTypes(player); + try + { + gameType = GameType.valueOf(args[0]); + } + catch (Exception e) + { + getPlugin().sendValidGameTypes(player); + } } - - + UtilPlayer.message(player, F.main("Parser", "Listing Maps for gametype " + F.elem(gameType.GetName()))); listMaps(player, gameType, false); } 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 c42d12107..ae8816f3a 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 @@ -26,6 +26,7 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.SlotToken; import mineplex.minecraft.game.classcombat.Skill.ISkill; import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Knight.AxeThrow; import mineplex.minecraft.game.classcombat.item.ItemFactory; public class ClientClass @@ -372,6 +373,14 @@ public class ClientClass { _client.GetPlayer().getInventory().setItem(defaultItem.getKey(), defaultItem.getValue()); } + + for (ISkill skill : _skillMap.values()) + { + if (skill instanceof AxeThrow) + { + ((AxeThrow)skill).Reset(_client.GetPlayer()); + } + } } public void ResetToDefaults(boolean equipItems, boolean equipDefaultArmor) @@ -555,4 +564,30 @@ public class ClientClass } } + + //This is used to fix a dual class bug using Twitch broadcasting GUI (F6) + public void validateClassSkills(Player player) + { + if (_gameClass == null || _skillMap == null) + return; + + for (SkillType type : SkillType.values()) + { + if (type == SkillType.GlobalPassive) + continue; + + if (!_skillMap.containsKey(type)) + continue; + + ISkill skill = _skillMap.get(type); + + if (skill.GetClassType() != _gameClass.GetType()) + { + skill.Reset(player); + RemoveSkill(skill); + + System.out.println("[" + player.getName() + " / " + _gameClass.GetType() + "] Removed Invalid " + skill.GetClassType() + " Skill (" + skill.GetName() + ")"); + } + } + } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java index 94dea13b0..62dc3852b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Assassin.java @@ -23,7 +23,7 @@ public class Assassin extends Skill SetDesc(new String[] { "Permanent Speed II.", - "Fall damage reduced by 1." + "Fall damage reduced by 1.5." }); } @@ -87,7 +87,7 @@ public class Assassin extends Skill int level = getLevel(player); if (level == 0) return; - event.AddMod(null, GetName(), -1, false); + event.AddMod(null, GetName(), -1.5, false); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java index 7a1d5f331..66b2682dd 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java @@ -70,11 +70,14 @@ public class Blink extends SkillActive return false; } - //Mastery + //Deblink if (_loc.containsKey(player) && _blinkTime.containsKey(player)) if (!UtilTime.elapsed(_blinkTime.get(player), 5000)) { - Deblink(player, level); + //Require 500ms after blink to deblink + if (UtilTime.elapsed(_blinkTime.get(player), 500)) + Deblink(player, level); + return false; } 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 9e3890b3c..58f2a0046 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 @@ -53,7 +53,7 @@ public class Flash extends SkillActive @Override public String GetRechargeString() { - return "Recharge: #11#-1 Seconds per Charge"; + return "Recharge: #10#-1 Seconds per Charge"; } @Override @@ -98,7 +98,7 @@ public class Flash extends SkillActive if (charges >= 1 + level) continue; - if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 11000 - (1000 * level), false, false)) + if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 10000 - (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 f640e6181..dc0d6aef1 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 @@ -34,6 +34,7 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilWorld; +import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -120,14 +121,10 @@ public class Illusion extends SkillActive for (Player other : UtilServer.getPlayers()) if (UtilMath.offset2d(skel, other) < 70) inRange.add(other); - - Player[] disguiseList = new Player[inRange.size()]; - for (int i=0 ; i locs = _locMap.remove(player); 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 2af2d2345..2a9b18a2f 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 @@ -50,7 +50,7 @@ public class SilencingArrow extends SkillActive SetDesc(new String[] { "Your next arrow will Silence", - "target for #3#3 seconds.", + "target for #1#3 seconds.", "", "Silence stops skills being used." }); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeArrow.java index 29135e56f..ad888f7d5 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeArrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeArrow.java @@ -50,7 +50,7 @@ public class SmokeArrow extends SkillActive SetDesc(new String[] { "Your next arrow will give Blindness", - "to target for #3#1 seconds." + "to target for #4#1 seconds." }); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java index c7ddc4924..96de20042 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SmokeBomb.java @@ -46,7 +46,7 @@ public class SmokeBomb extends Skill @Override public String GetRechargeString() { - return "Recharge: #90#-15 Seconds"; + return "Recharge: #60#-10 Seconds"; } @EventHandler @@ -75,7 +75,7 @@ public class SmokeBomb extends Skill return; } - if (!Recharge.Instance.use(player, GetName(), GetName(level), 90000 - (level * 15000), true, false)) + if (!Recharge.Instance.use(player, GetName(), GetName(level), 60000 - (level * 10000), true, false)) return; //Action 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 8375c2ae5..9bf9994fc 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 @@ -2,6 +2,7 @@ package mineplex.minecraft.game.classcombat.Skill.Brute; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import org.bukkit.Bukkit; import org.bukkit.Effect; @@ -25,6 +26,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilServer; @@ -55,9 +57,6 @@ public class BlockToss extends SkillCharge implements IThrown "dealing up to #6#1 damage.", "", GetChargeString(), - "", - "You can only pick up Stone, Dirt,", - "Cobblestone, Sand, Gravel or Snow." }); } @@ -98,24 +97,13 @@ public class BlockToss extends SkillCharge implements IThrown UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); return; } - + + Block grab = event.getClickedBlock(); + //Recharge if (!Recharge.Instance.use(player, GetName(), 1000, false, false)) return; - - Block grab = event.getClickedBlock(); - - int id = event.getClickedBlock().getTypeId(); - - if ( - id != 1 && - id != 2 && - id != 3 && - id != 12 && - id != 13 && - id != 80) - return; - + //Door if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71) { @@ -143,7 +131,6 @@ public class BlockToss extends SkillCharge implements IThrown //Block to Item FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), (byte)0); - Factory.BlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000); //Action player.eject(); @@ -211,7 +198,7 @@ public class BlockToss extends SkillCharge implements IThrown //Action UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true); Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, - null, 0, 0, null, 0, UpdateType.FASTEST, 2.5d); + null, 0, 0, null, 0, UpdateType.FASTEST, 1.2f); //Event UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute)); @@ -240,7 +227,7 @@ public class BlockToss extends SkillCharge implements IThrown //Damage Event Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.CUSTOM, data.GetThrown().getVelocity().length() * (2.5 + 0.5 * level), true, true, false, + DamageCause.CUSTOM, data.GetThrown().getVelocity().length() * (3 + 0.6 * level), true, true, false, UtilEnt.getName(data.GetThrower()), GetName()); //Block to Item @@ -278,34 +265,26 @@ public class BlockToss extends SkillCharge implements IThrown if (event.getType() != UpdateType.TICK) return; - HashSet fallen = new HashSet(); - - for (FallingBlock cur : _falling.keySet()) + Iterator fallIter = _falling.keySet().iterator(); + + while (fallIter.hasNext()) { - if (cur.isDead() || !cur.isValid()) - fallen.add(cur); - } - - for (FallingBlock cur : fallen) - { - _falling.remove(cur); - Block block = cur.getLocation().getBlock(); + FallingBlock fall = fallIter.next(); - int id = block.getTypeId(); - if ( - id != 1 && - id != 2 && - id != 3 && - id != 4 && - id != 12 && - id != 13 && - id != 80) + if (!fall.isDead() && fall.isValid()) 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, cur.getBlockId(), (byte)0, 10000); + Factory.BlockRestore().Add(block, fall.getBlockId(), (byte)0, 10000); //Effect block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java index f857bad86..1101d4d65 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Bloodlust.java @@ -8,6 +8,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import com.mysql.jdbc.Util; + import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.common.util.F; import mineplex.core.updater.event.UpdateEvent; @@ -32,9 +34,9 @@ public class Bloodlust extends Skill SetDesc(new String[] { - "When an enemy dies within #8#2 blocks,", - "you go into a Bloodlust, receiving", - "Speed 1 and Strength 1 for #4#2 seconds.", + "When you kill an enemy, you go into", + "a Bloodlust, receiving Speed 1 and", + "Strength 1 for #4#2 seconds.", "You also heal #0#1 health.", "", "Bloodlust can stack up to 3 times,", @@ -47,50 +49,53 @@ public class Bloodlust extends Skill { if (!(event.GetEvent().getEntity() instanceof Player)) return; + + if (event.GetLog().GetKiller() == null || !event.GetLog().GetKiller().IsPlayer()) + return; - for (Player cur : UtilServer.getPlayers()) - { - if (Expire(cur)) - continue; + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (player == null) + return; - if (!Factory.Relation().canHurt(cur, (Player)event.GetEvent().getEntity())) - continue; - - if (cur.equals(event.GetEvent().getEntity())) - continue; + if (!Factory.Relation().canHurt(player, (Player)event.GetEvent().getEntity())) + return; - //Level - int level = getLevel(cur); - if (level == 0) continue; + if (player.equals(event.GetEvent().getEntity())) + return; - //Offset - double distance = 4 + (4 * level); - if (UtilMath.offset(event.GetEvent().getEntity().getLocation(), cur.getLocation()) > distance) - continue; + //Level + int level = getLevel(player); + if (level == 0) + return; + + //Offset + double distance = 4 + (4 * level); + if (UtilMath.offset(event.GetEvent().getEntity().getLocation(), player.getLocation()) > distance) + return; - //Strength - int str = 0; - if (_str.containsKey(cur)) - str = _str.get(cur) + 1; - str = Math.min(str, 3); - _str.put(cur, str); + //Strength + int str = 0; + if (_str.containsKey(player)) + str = _str.get(player) + 1; + str = Math.min(str, 2); + _str.put(player, str); - //Time - double dur = 4 + (2 * level); - _time.put(cur, (System.currentTimeMillis() + (long)(dur*1000))); + //Time + double dur = 4 + (2 * level); + _time.put(player, (System.currentTimeMillis() + (long)(dur*1000))); - //Condition - Factory.Condition().Factory().Speed(GetName(), cur, event.GetEvent().getEntity(), dur, str, false, true, true); - Factory.Condition().Factory().Strength(GetName(), cur, event.GetEvent().getEntity(), dur, 0, false, true, true); + //Condition + Factory.Condition().Factory().Speed(GetName(), player, event.GetEvent().getEntity(), dur, str, false, true, true); + Factory.Condition().Factory().Strength(GetName(), player, event.GetEvent().getEntity(), dur, 0, false, true, true); - UtilPlayer.health(cur, level); - - //Inform - UtilPlayer.message(cur, F.main(GetClassType().name(), "You entered " + F.skill(GetName(level)) + " at " + F.elem("Level " + (str+1)) + ".")); + UtilPlayer.health(player, level); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You entered " + F.skill(GetName(level)) + " at " + F.elem("Level " + (str+1)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 0.6f); - //Effect - cur.getWorld().playSound(cur.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 2f, 0.6f); - } } @EventHandler @@ -120,13 +125,13 @@ public class Bloodlust extends Skill return false; } - + @EventHandler public void Particle(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - + for (Entity ent : _str.keySet()) { UtilParticle.PlayParticle(ParticleType.RED_DUST, ent.getLocation(), 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 e19886d4a..86074595b 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 @@ -17,8 +17,8 @@ public class Colossus extends Skill SetDesc(new String[] { - "You are so huge that you do not", - "take any knockback from attacks." + "You are so huge that you take", + "#25#25 % less knockback from attacks." }); } @@ -36,7 +36,7 @@ public class Colossus extends Skill //Damage event.AddMod(damagee.getName(), GetName(), 0, false); - event.SetKnockback(false); + event.AddKnockback(GetName(), 0.75 - 0.25*level); } @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 9d85fd230..252d4cd22 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 @@ -23,7 +23,7 @@ public class CripplingBlow extends Skill SetDesc(new String[] { "Your powerful axe attacks give", - "targets Slow 1 for 1.5 second,", + "targets Slow 2 for 1.5 second,", "as well as no knockback." }); } @@ -53,7 +53,7 @@ public class CripplingBlow extends Skill if (level == 0) return; //Stun - Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 0, false, true, false, true); + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 1, false, true, false, true); //Damage event.AddMod(damager.getName(), GetName(), 0, true); 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 b078c8a9b..e9236c01e 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 @@ -2,6 +2,7 @@ package mineplex.minecraft.game.classcombat.Skill.Brute; import java.util.HashSet; +import org.bukkit.Bukkit; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; @@ -298,28 +299,37 @@ public class DwarfToss extends SkillActive UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName(level)) + ".")); } - for (Player cur : throwSet) + for (final Player cur : throwSet) { - LivingEntity target = _holding.remove(cur); + final LivingEntity target = _holding.remove(cur); _time.remove(cur); int level = getLevel(cur); //Throw cur.eject(); target.leaveVehicle(); - double mult = 1.2 + (0.2 * level); + final double mult = 1.2 + (0.2 * level); - UtilAction.velocity(target, cur.getLocation().getDirection(), mult, false, 0, 0.2, 1.2, true); - - //Condition - Factory.Condition().Factory().Falling(GetName(), target, cur, 10, false, true); + //Delay + Bukkit.getScheduler().scheduleSyncDelayedTask(Factory.getPlugin(), new Runnable() + { + @Override + public void run() + { + UtilAction.velocity(target, cur.getLocation().getDirection(), mult, false, 0, 0.2, 1.2, true); + + //Condition + Factory.Condition().Factory().Falling(GetName(), target, cur, 10, false, true); + + //Effect + target.playEffect(EntityEffect.HURT); + } + + }, 4); //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)) + ".")); - - //Effect - target.playEffect(EntityEffect.HURT); } } 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 865b16460..ddcac29bf 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 @@ -108,7 +108,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown 1 + charge , false, 0, 0.2, 20, false); Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, - Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 1.5d); + Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 1.2f); //Inform UtilPlayer.message(cur, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java index dd16ffaca..50001ce48 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/Overwhelm.java @@ -23,7 +23,7 @@ public class Overwhelm extends Skill "than your target, you deal 0.25", "bonus damage", "", - "Maximum of #0#1 bonus damage." + "Maximum of #0.5#0.5 bonus damage." }); } @@ -52,7 +52,7 @@ public class Overwhelm extends Skill int level = getLevel(damager); if (level == 0) return; - diff = Math.min(diff, level); + diff = Math.min(diff, 0.5 + 0.5 * level); //Damage event.AddMod(damager.getName(), GetName(), diff, true); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/WhirlwindAxe.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/WhirlwindAxe.java index 8c93a2b43..ec172fd73 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/WhirlwindAxe.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/WhirlwindAxe.java @@ -42,9 +42,8 @@ public class WhirlwindAxe extends SkillActive SetDesc(new String[] { "Whirl your axes around rapidly dealing", - "#4#1 damage to nearby enemies, and", - "pulling enemies within #5#1 blocks", - "towards you.", + "up to #3#1 damage to enemies within", + "#4#1 blocks, pulling them towards you.", }); this.setAchievementSkill(true); @@ -66,17 +65,21 @@ public class WhirlwindAxe extends SkillActive public void Skill(final Player player, int level) { //Pull + Damage - HashMap targets = UtilEnt.getInRadius(player.getLocation(), 5d + 1 * level); + HashMap targets = UtilEnt.getInRadius(player.getLocation(), 4d + 1 * level); for (LivingEntity cur : targets.keySet()) { if (cur.equals(player)) continue; + if (cur instanceof Player) + if (!Factory.Relation().canHurt((Player)cur, player)) + continue; + //Damage Event if (UtilMath.offset(cur, player) < 4) { Factory.Damage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, 4 + level, false, true, false, + DamageCause.CUSTOM, 2 + (1 + level) * targets.get(cur), false, true, false, player.getName(), GetName()); } 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 daf1b4245..7101df6aa 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 @@ -27,6 +27,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.Skill.SkillActive; @@ -53,13 +54,13 @@ public class AxeThrow extends SkillActive implements IThrown SetDesc(new String[] { "Throw your axe with #0.7#0.1 velocity, ", - "dealing #6.5#0.5 damage.", + "dealing #5.5#0.5 damage.", "", "You pull your axe back to you when it", "collides with anything.", "", "Your axe is returned to you if you do", - "not pick it up within #20#-2 seconds." + "not pick it up within #15#-1 seconds." }); setAchievementSkill(true); @@ -90,7 +91,7 @@ public class AxeThrow extends SkillActive implements IThrown player.setItemInHand(null); //Projectile - Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d); + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 0.5f); //Store _thrown.put(item, player); @@ -111,7 +112,7 @@ public class AxeThrow extends SkillActive implements IThrown if (level <= 0) return; - double damage = 6.5 + 0.5 * level; + double damage = 5.5 + 0.5 * level; //Damage Event Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, @@ -186,7 +187,7 @@ public class AxeThrow extends SkillActive implements IThrown int level = getLevel(player); - if (item.getTicksLived() > 400 - level * 40) + if (item.getTicksLived() > 300 - level * 20) { _thrown.get(item).getInventory().addItem(item.getItemStack()); item.remove(); @@ -212,7 +213,7 @@ public class AxeThrow extends SkillActive implements IThrown } } } - + @Override public void Reset(Player player) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java index 24819aabb..5935feefe 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/DefensiveStance.java @@ -15,6 +15,7 @@ import org.bukkit.util.Vector; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilTime; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -85,6 +86,9 @@ public class DefensiveStance extends SkillActive if (event.GetCause() != DamageCause.ENTITY_ATTACK && event.GetCause() != DamageCause.PROJECTILE) return; + + if (UtilEnt.inWater(event.GetDamageeEntity())) + return; Player damagee = event.GetDamageePlayer(); if (damagee == null) return; @@ -112,7 +116,10 @@ public class DefensiveStance extends SkillActive } //Damage - event.SetCancelled(GetName() + " Defense"); + if (event.GetCause() == DamageCause.ENTITY_ATTACK) + event.AddMult(GetName(), GetName(), 0.1, false); + else + event.SetCancelled(GetName() + " Defense"); //Effect damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_METAL, 1f, 2f); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java index 75bae265b..32b148220 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java @@ -29,7 +29,7 @@ public class Deflection extends Skill { "Prepare to deflect incoming attacks.", "You gain 1 Charge every #5#-1 seconds.", - "You can store a maximum of #2#1 Charges.", + "You can store a maximum of #1#1 Charges.", "", "When you are attacked, the damage is", "reduced by the number of your Charges,", @@ -73,7 +73,7 @@ public class Deflection extends Skill if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false)) continue; - int max = 2 + (1 * level); + int max = 1 + (1 * level); int charge = 1; if (_charges.containsKey(cur)) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java index 6979bbcff..9e743cea2 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/HiltSmash.java @@ -17,6 +17,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.core.common.util.F; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -46,13 +47,19 @@ public class HiltSmash extends SkillActive { "Smash the hilt of your sword into", "your opponent, dealing #2#1 damage", - "and Slow 4 for #0.5#0.5 seconds." + "and Slow 3 for #0.5#0.5 seconds." }); } @Override public boolean CustomCheck(Player player, int level) { + if (UtilEnt.inWater(player)) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + if (_used.contains(player)) return false; @@ -111,6 +118,9 @@ public class HiltSmash extends SkillActive { if (event.isCancelled()) return; + + if (UtilEnt.inWater(event.getPlayer())) + return; Player player = event.getPlayer(); @@ -123,12 +133,15 @@ public class HiltSmash extends SkillActive Entity ent = event.getRightClicked(); + if (UtilPlayer.isSpectator(ent)) + return; + if (ent == null) return; if (!(ent instanceof LivingEntity)) return; - + if (UtilMath.offset(player, ent) > 4) { UtilPlayer.message(player, F.main(GetClassType().name(), "You missed " + F.skill(GetName()) + ".")); @@ -169,7 +182,7 @@ public class HiltSmash extends SkillActive return; //Condition - Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * level, 4, false, true, true, true); + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * level, 2, false, true, true, true); //Effect damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_WOOD, 1f, 1.2f); 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 83782befe..5616119ee 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 @@ -66,7 +66,7 @@ public class Blizzard extends SkillActive @Override public String GetEnergyString() { - return "Energy: #32#-2 per Second"; + return "Energy: #34#-2 per Second"; } @Override @@ -113,7 +113,7 @@ public class Blizzard extends SkillActive } //Energy - if (!Factory.Energy().Use(cur, GetName(), 1.6 - (0.1 * level), true, true)) + if (!Factory.Energy().Use(cur, GetName(), 1.7 - (0.1 * level), true, true)) { _active.remove(cur); continue; @@ -234,7 +234,7 @@ public class Blizzard extends SkillActive { Entry entry = snowBallIterator.next(); - if (!entry.getValue().isOnline()) + if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 60 || !entry.getValue().isOnline()) snowBallIterator.remove(); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java index 906ccf605..5a60452db 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/FreezingBlast.java @@ -70,7 +70,7 @@ public class FreezingBlast extends SkillActive implements IThrown Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); item.setVelocity(player.getLocation().getDirection()); Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, - Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 2d); + Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1f); //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/Mage/GlacialBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java index 1e1e22255..e08ad1c21 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/GlacialBlade.java @@ -7,8 +7,10 @@ import org.bukkit.block.Block; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.core.itemstack.ItemStackFactory; @@ -42,7 +44,7 @@ public class GlacialBlade extends SkillActive implements IThrown SetDesc(new String[] { "Swinging your sword releases a", - "shard of ice, dealing 4 damage", + "shard of ice, dealing 3.5 damage", "to anything it hits.", "", "Will not work if enemies are close." @@ -71,7 +73,7 @@ public class GlacialBlade extends SkillActive implements IThrown Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.2, 0), ItemStackFactory.Instance.CreateStack(370)); UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false); Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, - null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5d); + null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 0.4f); //Effect item.getWorld().playSound(item.getLocation(), Sound.ORB_PICKUP, 1f, 2f); @@ -91,7 +93,7 @@ public class GlacialBlade extends SkillActive implements IThrown //Damage Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, - DamageCause.CUSTOM, 4, false, true, false, + DamageCause.CUSTOM, 3.5, false, true, false, UtilEnt.getName(data.GetThrower()), GetName()); } 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 592c595f8..ad59e1ddc 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.5 seconds.", + "thats lasts for #1#1.5 seconds.", }); } @@ -70,11 +70,11 @@ public class IcePrison extends SkillActive implements IThrown //Action Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); item.setVelocity(player.getLocation().getDirection()); - Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 2000, true, false, false, - Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 2d); - + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, + Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5f); + //Inform - UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); //Effect item.getWorld().playSound(item.getLocation(), Sound.SILVERFISH_HIT, 2f, 1f); @@ -148,7 +148,7 @@ public class IcePrison extends SkillActive implements IThrown if (!UtilBlock.airFoliage(freeze)) return; - long time = 4000 + (1500 * level); + long time = 2500 + (1500 * level); int yDiff = freeze.getY() - mid.getY(); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java index 1fb9140b6..cced308da 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Inferno.java @@ -53,7 +53,7 @@ public class Inferno extends SkillActive @Override public String GetEnergyString() { - return "Energy: #30#-2 per Second"; + return "Energy: #34#-2 per Second"; } @Override @@ -100,7 +100,7 @@ public class Inferno extends SkillActive } //Energy - if (!Factory.Energy().Use(cur, GetName(), 1.5 - (0.1 * level), true, false)) + if (!Factory.Energy().Use(cur, GetName(), 1.7 - (0.1 * level), true, false)) { _active.remove(cur); continue; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBondsData.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBondsData.java index 62b15b37b..a2a54c0fa 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBondsData.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/LifeBondsData.java @@ -33,8 +33,7 @@ public class LifeBondsData return true; } - - _loc.add(UtilAlg.getTrajectory(_loc, _target.getLocation().add(0, 0.8, 0)).multiply(0.5)); + _loc.add(UtilAlg.getTrajectory(_loc, _target.getLocation().add(0, 0.8, 0)).multiply(0.9)); UtilParticle.PlayParticle(ParticleType.HEART, _loc, 0, 0, 0, 0, 1); return false; 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 c7119f0b1..5cd444e56 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 @@ -102,7 +102,7 @@ public class LightningOrb extends SkillActive implements IThrown 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, false, false, - Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 1.5d); + Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 1f); //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/Mage/StaticLazer.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java index 10e364d40..7c343e2d6 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java @@ -33,7 +33,7 @@ public class StaticLazer extends SkillChargeSword int cost, int maxLevel) { super(skills, name, classType, skillType, cost, maxLevel, - 0.012f, 0.008f, + 0.012f, 0.004f, 12000, -1000, true, true, false, true); @@ -45,11 +45,12 @@ public class StaticLazer extends SkillChargeSword GetChargeString(), "Taking damage cancels charge.", "", - "Deals up to #7#1 damage and travels", - "up to #20#10 blocks.", + "Deals #6#1 damage and travels up to", + "#20#10 blocks.", }); - _fireOnFull = true; + _fireOnFull = false; + _energyPerCharge = 1.2f; setAchievementSkill(true); } @@ -58,6 +59,12 @@ public class StaticLazer extends SkillChargeSword { return "Recharge: " + "#12#-1 Seconds"; } + + @Override + public String GetEnergyString() + { + return "Energy: " + "24 per Second"; + } @Override public void DoSkillCustom(Player player, float charge) @@ -105,7 +112,7 @@ public class StaticLazer extends SkillChargeSword //Damage Event Factory.Damage().NewDamageEvent(other, player, null, - DamageCause.CUSTOM, (2 + (5 + level) * hit.get(other)) * charge, true, true, false, + DamageCause.CUSTOM, 6 + level * charge, true, true, false, player.getName(), GetName()); } 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 149ae1336..950ce0293 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 @@ -33,7 +33,7 @@ public class Void extends Skill "Drop Axe/Sword to Toggle.", "", "While in void form, you receive", - "Slow 2, take no knockback and", + "Slow 3, take no knockback and", "use no energy to swing weapons.", "", "Reduces incoming damage by #1#1 , but", @@ -144,8 +144,8 @@ public class Void extends Skill continue; //Condition - Factory.Condition().Factory().Invisible(GetName(), cur, cur, 1.9, 0, false, true, true); - Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 1, false, true, false, true); + Factory.Condition().Factory().Invisible(GetName(), cur, cur, 1.9, 1, false, true, true); + Factory.Condition().Factory().Slow(GetName(), cur, cur, 1.9, 2, false, true, false, true); } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java index fb2a899f3..aff5b5bc0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Agility.java @@ -45,7 +45,7 @@ public class Agility extends SkillActive SetDesc(new String[] { "Sprint with great agility, gaining", - "Speed I for #3#1 seconds. You take", + "Speed 2 for #3#1 seconds. You take", "#45#5 % less damage and take no knockback.", "", "Agility ends if you Left-Click." @@ -68,7 +68,7 @@ public class Agility extends SkillActive public void Skill(Player player, int level) { //Action - Factory.Condition().Factory().Speed(GetName(), player, player, 3 + level, 0, false, true, true); + Factory.Condition().Factory().Speed(GetName(), player, player, 3 + level, 1, false, true, true); _active.add(player); //Inform 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 231db08bb..a5e872bcb 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 @@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -28,7 +29,8 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory; public class Disengage extends SkillActive { private HashMap _prepare = new HashMap(); - + private HashMap _fall = new HashMap(); + public Disengage(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels, int energy, int energyMod, @@ -118,8 +120,10 @@ public class Disengage extends SkillActive //Condition Factory.Condition().Factory().Slow(GetName(), damager, damagee, 2.5 + (0.5 * level), 3, false, true, true, true); - Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 2, false, false); + Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 1, false, false); + _fall.put(damagee, System.currentTimeMillis()); + //Effect damagee.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 0.5f, 1.6f); UtilParticle.PlayParticle(ParticleType.ANGRY_VILLAGER, damager.getEyeLocation(), 0, 0, 0, 0, 1); @@ -135,26 +139,53 @@ public class Disengage extends SkillActive { if (event.getType() != UpdateType.TICK) return; - + for (Player cur : GetUsers()) { - if (!_prepare.containsKey(cur)) - continue; - - if (System.currentTimeMillis() > _prepare.get(cur)) + if (_fall.containsKey(cur)) { - //Remove - _prepare.remove(cur); - - //Inform - UtilPlayer.message(cur, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + ".")); + if (UtilTime.elapsed(_fall.get(cur), 2000)) + { + if (UtilEnt.isGrounded(cur) || UtilTime.elapsed(_fall.get(cur), 20000)) + { + _fall.remove(cur); + } + } } + + if (_prepare.containsKey(cur)) + { + if (System.currentTimeMillis() > _prepare.get(cur)) + { + //Remove + _prepare.remove(cur); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + ".")); + } + } + } + } + + @EventHandler(priority = EventPriority.LOW) + public void fallCancel(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.FALL) + return; + + if (_fall.remove(event.GetDamageeEntity()) != null) + { + event.SetCancelled(GetName() + " Fall"); } } @Override public void Reset(Player player) { + _fall.remove(player); _prepare.remove(player); } } 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 c29eb1021..8a92aea48 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,7 +55,7 @@ public class HealingShot extends SkillActive { "Prepare a healing shot;", "Your next arrow will give its target", - "Regeneration 1 for #2#2 seconds,", + "Regeneration 2 for #3#2 seconds,", "and remove all negative effects." }); } @@ -148,7 +148,7 @@ public class HealingShot extends SkillActive projectile.remove(); //Regen - Factory.Condition().Factory().Regen(GetName(), damagee, damager, 2 + 2 * level, 0, false, true, true); + Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + 2 * level, 1, false, true, true); //Remove Bad damagee.setFireTicks(0); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java index 6f1a142cd..9848193ed 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HeavyArrows.java @@ -39,7 +39,7 @@ public class HeavyArrows extends Skill "as well as #1#1 additional damage.", "", "You also receive #10#10 % knockback", - "when firing arrows.", + "when firing arrows if not sneaking.", }); } @@ -59,11 +59,11 @@ public class HeavyArrows extends Skill if (level == 0) return; //Backboost - if (Recharge.Instance.use(player, GetName(), 500, false, false)) + if (!player.isSneaking() && Recharge.Instance.use(player, GetName(), 750, false, false)) { double vel = (event.getProjectile().getVelocity().length() * (0.1 + 0.1 * level)); UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel, - false, 0, 0.2, 0.6, true); + false, 0, 0.3, 0.6, true); } //Decrease Speed diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java index a3abf916e..102f8110e 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/Longshot.java @@ -25,7 +25,7 @@ public class Longshot extends Skill SetDesc(new String[] { "Arrows do an additional 1 damage", "for every #4#-0.5 Blocks they travelled,", - "however, their base damage is", "reduced by 3.", "", "Maximum of #5#5 additional damage." + "however, their base damage is", "reduced by 3.", "", "Maximum of #6#6 additional damage." }); } @@ -70,7 +70,7 @@ public class Longshot extends Skill double length = UtilMath.offset(loc, projectile.getLocation()); // Damage - double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3); + double damage = Math.min(6 + 6 * level, (length / (4 - 0.5 * level)) - 3); event.AddMod(damager.getName(), GetName(), damage, damage > 0); } 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 e4e71d223..88412d922 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 @@ -40,7 +40,7 @@ public class Overcharge extends SkillChargeBow "", GetChargeString(), "", - "Deals up to #0#1 bonus damage." + "Deals up to #1.5#1.5 bonus damage." }); } 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 5fa378428..6946be806 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 @@ -72,7 +72,10 @@ public class Sharpshooter extends Skill Player player = _arrows.remove(projectile); int level = getLevel(player); - + + if (event.GetDamagerEntity(true) != null && event.GetDamagerEntity(true).equals(event.GetDamageeEntity())) + return; + if (_hitCount.containsKey(player)) { //Damage 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 55abc63f9..fa39af241 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 @@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler; 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.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; @@ -40,12 +41,12 @@ public class VitalitySpores extends Skill int level = getLevel(cur); if (level == 0) continue; - if (UtilTime.elapsed(Factory.Combat().Get(cur).GetLastDamaged(), 12000 - 2000*level)) + if (UtilTime.elapsed(Factory.Combat().Get(cur).GetLastDamaged(), 5000 - 1000*level)) { //Factory.Condition().Factory().Regen(GetName(), cur, cur, 3.9 + 2*level, 0, false, true, true); UtilPlayer.health(cur, 1); - UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation(), 0, 0.2f, 0, 0, 1); + UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation().add(UtilAlg.getBehind(cur.getLocation().getDirection().multiply(0.5))), 0, 0.2f, 0, 0, 1); } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java index dd6753902..5a827d651 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsPounce.java @@ -33,7 +33,7 @@ public class WolfsPounce extends SkillChargeSword { super(skills, name, classType, skillType, cost, maxLevel, 0.012f, 0.008f, - 7000, -1000, true, true, + 8000, -1000, true, true, false, false); SetDesc(new String[] @@ -88,7 +88,7 @@ public class WolfsPounce extends SkillChargeSword if (!_live.containsKey(player)) continue; - if (!UtilTime.elapsed(_live.get(player), 2000)) + if (!UtilTime.elapsed(_live.get(player), 1000)) continue; _live.remove(player); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java index 2825c5f93..9925302f8 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java @@ -14,6 +14,8 @@ public class SkillCharge extends Skill protected float _rateBase; protected float _rateBoost; + protected float _energyPerCharge = 0; + public SkillCharge(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int maxLevel, float base, float boost) @@ -36,6 +38,24 @@ public class SkillCharge extends Skill _charge.put(player, 0f); float charge = _charge.get(player); + + if (charge >= 1) + { + //Display + DisplayProgress(player, GetName(level), charge); + return true; + } + + //Energy + if (_energyPerCharge > 0) + { + if (!Factory.Energy().Use(player, GetName(), _energyPerCharge, true, false)) + { + //Display + DisplayProgress(player, GetName(level), charge); + return true; + } + } //Increase Charge charge = Math.min(1f, charge + _rateBase + (_rateBoost * level)); 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 543e45572..ec45933d8 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 @@ -171,7 +171,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword, 1, 4, 50, -4, - 20000, -1000, true, + 17000, -1000, true, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -193,7 +193,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new Leap(this, "Leap", ClassType.Assassin, SkillType.Axe, 1, 4, 36, -3, - 9500, -1500, true, + 10500, -1500, 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, 2, 1)); + AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 1, 3)); AddSkill(new Overwhelm(this, "Overwhelm", ClassType.Brute, SkillType.PassiveB, 1, 3)); } @@ -338,7 +338,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new AxeThrow(this, "Roped Axe Throw", ClassType.Knight, SkillType.Axe, 1, 5, 0, 0, - 3000, -450, true, + 2200, -200, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); @@ -386,7 +386,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory AddSkill(new FireBlast(this, "Fire Blast", 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})); 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 c3ce1c928..d781731bd 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 @@ -160,7 +160,7 @@ public abstract class ItemUsable extends Item implements IThrown 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, 1d); + Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f); ThrowCustom(event, ent); } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java index ff33ab273..c92e63a57 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/CustomDamageEvent.java @@ -243,6 +243,15 @@ public class CustomDamageEvent extends Event implements Cancellable _damagerPlayer = (Player)ent; } + public void setDamagee(LivingEntity ent) + { + _damageeEntity = ent; + + _damageePlayer = null; + if (ent instanceof Player) + _damageePlayer = (Player)ent; + } + public void changeReason(String initial, String reason) { for (DamageChange change : _damageMod) @@ -307,4 +316,6 @@ public class CustomDamageEvent extends Event implements Cancellable { SetCancelled("No reason given because SOMEONE IS AN IDIOT"); } + + } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index 5cd36efd5..69a258f60 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -21,6 +21,7 @@ import net.minecraft.server.v1_7_R4.DamageSource; import net.minecraft.server.v1_7_R4.EntityHuman; import net.minecraft.server.v1_7_R4.EntityLiving; +import org.bukkit.Bukkit; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Location; @@ -99,9 +100,17 @@ public class DamageManager extends MiniPlugin //Pre-Event Modifications if (!DisableDamageChanges) WeaponDamage(event, damager); + + double damage = event.getDamage(); + + //Consistent Arrow Damage + if (projectile != null && projectile instanceof Arrow) + { + damage = projectile.getVelocity().length() * 3; + } //New Event - NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel); + NewDamageEvent(damagee, damager, projectile, event.getCause(), damage, true, false, false, null, null, preCancel); //System.out.println(UtilEnt.getName(damagee) + " by " + event.getCause() + " at " + UtilWorld.locToStr(damagee.getLocation())); diff --git a/Plugins/Mineplex.PlayerCache/Mineplex.PlayerCache.iml b/Plugins/Mineplex.PlayerCache/Mineplex.PlayerCache.iml new file mode 100644 index 000000000..54892e832 --- /dev/null +++ b/Plugins/Mineplex.PlayerCache/Mineplex.PlayerCache.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index bdcca216a..889dd4ef4 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -230,6 +230,9 @@ public class ServerMonitor for (MinecraftServer minecraftServer : _serverStatuses) { + if (minecraftServer.getGroup().equalsIgnoreCase("Testing")) + continue; + onlineServers.add(minecraftServer.getName()); if (minecraftServer.getTps() <= 17) @@ -369,7 +372,7 @@ public class ServerMonitor _deadServers.clear(); for (MinecraftServer deadServer : _repository.getDeadServers()) { - if (deadServer.getUptime() <= 10) + if (deadServer.getUptime() <= 10 || deadServer.getGroup().equalsIgnoreCase("Testing")) continue; if (_count == 0 || deadServers.contains(deadServer.getName())) @@ -427,6 +430,7 @@ public class ServerMonitor if (availableSlots < 1500) { serversToAdd = Math.max(1, (1500 - availableSlots) / serverGroup.getMaxPlayers()); + serversToAdd = Math.min(250 - totalServers, serversToAdd); serversToKill = 0; } else if (serversToKill > 0) @@ -439,6 +443,8 @@ public class ServerMonitor if (serversToRestart <= 5) serversToRestart = 0; } + + } else if (serverGroup.getName().equalsIgnoreCase("Halloween")) { diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 64b5fc2ec..e3ef2eba3 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -16,6 +16,7 @@ import mineplex.staffServer.salespackage.salespackages.AncientChest; import mineplex.staffServer.salespackage.salespackages.ApplyKits; import mineplex.staffServer.salespackage.salespackages.Coins; import mineplex.staffServer.salespackage.salespackages.DefaultRank; +import mineplex.staffServer.salespackage.salespackages.EasterBunny; import mineplex.staffServer.salespackage.salespackages.FrostLord; import mineplex.staffServer.salespackage.salespackages.GemHunter; import mineplex.staffServer.salespackage.salespackages.LifetimeHero; @@ -61,6 +62,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new AncientChest(this)); AddSalesPackage(new MythicalChest(this)); AddSalesPackage(new FrostLord(this)); + AddSalesPackage(new EasterBunny(this)); } private void AddSalesPackage(SalesPackageBase salesPackage) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/EasterBunny.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/EasterBunny.java new file mode 100644 index 000000000..6aacf8014 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/EasterBunny.java @@ -0,0 +1,20 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +import org.bukkit.entity.Player; + +public class EasterBunny extends SalesPackageBase +{ + public EasterBunny(SalesPackageManager manager) + { + super(manager, "Easter Bunny Morph"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Morph Easter Bunny Morph", "Give Easter Bunny Morph."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 761a2b7c9..69439f95f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -109,13 +109,14 @@ import nautilus.game.arcade.managers.GameSpectatorManager; import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; +import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.shop.ArcadeShop; public class ArcadeManager extends MiniPlugin implements IRelation { - // Modules + // Modules private BlockRestore _blockRestore; private Blood _blood; private Chat _chat; @@ -131,7 +132,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation private Fire _fire; private ProjectileManager _projectileManager; - private Portal _portal; + private Portal _portal; private ArcadeShop _arcadeShop; //Champions Modules @@ -264,7 +265,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation new MiscManager(this); _hologramManager = hologramManager; _idleManager = new IdleManager(this); - //new HalloweenManager(this); + new HolidayManager(this); // Game Addons new CompassAddon(plugin, this); @@ -602,8 +603,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation @EventHandler public void MessageJoin(PlayerJoinEvent event) { + String name = event.getPlayer().getName(); + if (_game != null && _game.AnnounceJoinQuit) - event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + event.getPlayer().getName())); + event.setJoinMessage(F.sys("Join", GetColor(event.getPlayer()) + name)); else event.setJoinMessage(null); @@ -612,8 +615,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation @EventHandler public void MessageQuit(PlayerQuitEvent event) { + String name = event.getPlayer().getName(); + if (_game == null || _game.AnnounceJoinQuit) - event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + event.getPlayer().getName())); + event.setQuitMessage(F.sys("Quit", GetColor(event.getPlayer()) + name)); else event.setQuitMessage(null); } @@ -757,6 +762,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setFireTicks(0); player.setFallDistance(0); + + player.eject(); + player.leaveVehicle(); player.setLevel(0); player.setExp(0f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java index 42cf880f7..4852415a5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitMamaPig.java @@ -1,20 +1,28 @@ package nautilus.game.arcade.game.games.baconbrawl.kits; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Pig; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.disguise.disguises.DisguisePig; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBaconBlast; import nautilus.game.arcade.kit.perks.PerkSpeed; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; public class KitMamaPig extends Kit { @@ -37,7 +45,7 @@ public class KitMamaPig extends Kit } @Override - public void GiveItems(Player player) + public void GiveItems(final Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); @@ -48,12 +56,39 @@ public class KitMamaPig extends Kit Manager.GetDisguise().disguise(disguise); Manager.GetGame().CreatureAllowOverride = true; - Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); + final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class); pig.setBaby(); pig.setAgeLock(true); pig.setCustomName(C.cYellow + player.getName()); - pig.setCustomNameVisible(true); + pig.setCustomNameVisible(false); + Manager.GetGame().CreatureAllowOverride = false; player.setPassenger(pig); + + Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[] { pig.getEntityId() })); + } + }, 2); + } + + @EventHandler(priority=EventPriority.LOWEST) + public void damageTransfer(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (!(event.GetDamageeEntity() instanceof Pig)) + return; + + Pig pig = (Pig)event.GetDamageeEntity(); + + if (pig.getVehicle() == null || !(pig.getVehicle() instanceof LivingEntity)) + return; + + event.setDamagee((LivingEntity)pig.getVehicle()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java index 627da5201..db9071a12 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitPig.java @@ -43,7 +43,7 @@ public class KitPig extends Kit //Disguise DisguisePig disguise = new DisguisePig(player); disguise.setName(C.cYellow + player.getName()); - disguise.setCustomNameVisible(true); + disguise.setCustomNameVisible(false); Manager.GetDisguise().disguise(disguise); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java index 934909313..3a63d31ff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java @@ -50,7 +50,7 @@ public class KitSheepPig extends Kit //Disguise DisguiseSheep disguise = new DisguiseSheep(player); disguise.setName(C.cYellow + player.getName()); - disguise.setCustomNameVisible(true); + disguise.setCustomNameVisible(false); disguise.setColor(DyeColor.PINK); Manager.GetDisguise().disguise(disguise); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index 59f2f34d4..a3b8b3edd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.champions; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; @@ -53,7 +55,7 @@ public class ChampionsDominate extends Domination "Diamond Weapons deal 7 damage", }; - + Manager.GetDamage().UseSimpleWeaponDamage = false; Manager.getCosmeticManager().setHideParticles(true); @@ -65,7 +67,7 @@ public class ChampionsDominate extends Domination EloStart = 1000; this.DisableKillCommand = false; - + registerStatTrackers( new KillReasonStatTracker(this, "Backstab", "Assassination", false), new ElectrocutionStatTracker(this), @@ -120,4 +122,16 @@ public class ChampionsDominate extends Domination if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST) player.closeInventory(); } + + @EventHandler + public void validateSkills(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC) + { + for (Player player : GetPlayers(true)) + { + Manager.getClassManager().Get(player).validateClassSkills(player); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index 9af73ce5c..490688277 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -8,6 +8,8 @@ import org.bukkit.event.inventory.InventoryType; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; @@ -54,7 +56,7 @@ public class ChampionsTDM extends TeamDeathmatch "Diamond Weapons deal 7 damage", }; - + this.Manager.GetDamage().UseSimpleWeaponDamage = false; Manager.getCosmeticManager().setHideParticles(true); @@ -63,7 +65,7 @@ public class ChampionsTDM extends TeamDeathmatch InventoryOpenChest = true; this.DisableKillCommand = false; - + registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new KillAllOpposingStatTracker(this), @@ -120,4 +122,16 @@ public class ChampionsTDM extends TeamDeathmatch if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST) player.closeInventory(); } + + @EventHandler + public void validateSkills(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC) + { + for (Player player : GetPlayers(true)) + { + Manager.getClassManager().Get(player).validateClassSkills(player); + } + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java index d4cfea278..cb1765619 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitAssassin.java @@ -49,6 +49,8 @@ public class KitAssassin extends Kit @Override public void Selected(Player player) { + Manager.Clear(player); + _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Assassin"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java index 5a2be1d98..4462eb7a0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitBrute.java @@ -48,6 +48,8 @@ public class KitBrute extends Kit @Override public void Selected(Player player) { + Manager.Clear(player); + _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Brute"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java index e38d71a46..97bf4610d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitKnight.java @@ -45,6 +45,8 @@ public class KitKnight extends Kit @Override public void Selected(Player player) { + Manager.Clear(player); + AddPlayer(player); Manager.openClassShop(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java index 175496916..48e5b1296 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitMage.java @@ -45,6 +45,8 @@ public class KitMage extends Kit @Override public void Selected(Player player) { + Manager.Clear(player); + _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Mage"); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java index 0db49711a..fd3789a38 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/kits/KitRanger.java @@ -45,6 +45,8 @@ public class KitRanger extends Kit @Override public void Selected(Player player) { + Manager.Clear(player); + _class.put(player, Manager.getClassManager().Get(player)); ClientClass clientClass = _class.get(player); IPvpClass pvpClass = Manager.getClassManager().GetClass("Ranger"); 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 ba8a84196..ac022741b 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 @@ -301,6 +301,8 @@ public class CapturePoint RewardCapture(player, 30); } } + + UtilTextMiddle.display(null, _owner.GetColor() + _owner.GetName() + " captured " + _name, 5, 40, 5); } } //Count Down diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index cd0eb796a..e35832f40 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -9,13 +9,10 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockPlaceEvent; -import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; -import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; 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 197948aa0..0116237ea 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 @@ -109,7 +109,6 @@ import nautilus.game.arcade.stats.KillFastStatTracker; import nautilus.game.arcade.stats.KillReasonStatTracker; import nautilus.game.arcade.stats.KillsWithConditionStatTracker; import nautilus.game.arcade.stats.MineStrikeLastAliveKillStatTracker; - import net.minecraft.server.v1_7_R4.EntityArrow; public class MineStrike extends TeamGame diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index c938d57d6..75982a00d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -42,7 +42,6 @@ import mineplex.core.common.util.UtilServer; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.visibility.VisibilityManager; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -110,7 +109,7 @@ public class Paintball extends TeamGame "Revive/heal with Water Bombs", "Last team alive wins!" }); - + this.StrictAntiHack = true; this.HungerSet = 20; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index a97517672..95a7aa264 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -189,7 +189,7 @@ public class Runner extends SoloGame implements IThrown byte data = block.getData(); MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR); FallingBlock ent = block.getWorld().spawnFallingBlock(block.getLocation(), id, data); - Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 1d); + Manager.GetProjectile().AddThrow(ent, null, this, -1, true, false, false, false, 0.3f); blockIterator.remove(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index c91841a5c..769d08b71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -32,7 +32,6 @@ import org.bukkit.event.player.PlayerItemHeldEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAlg; - import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; @@ -260,7 +259,7 @@ public class SheepGame extends TeamGame for (Player player : GetPlayers(true)) { if (!Recharge.Instance.usable(player, "Sheep Stack")) - return; + continue; for (Entity ent : player.getWorld().getEntities()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 7b7565bfc..fef37436a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -152,7 +152,7 @@ public class Stacker extends SoloGame implements IThrown UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); - Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d); + Manager.GetProjectile().AddThrow(throwee, thrower, this, -1, true, false, true, false, 1f); } @Override @@ -170,7 +170,7 @@ public class Stacker extends SoloGame implements IThrown //Hit Own Stack > Rethrow if (hit.equals(data.GetThrower())) { - Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, -1, true, false, true, false, 2.4d); + Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this, -1, true, false, true, false, 1f); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java index ae083966e..d1c49d258 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/SurvivalGames.java @@ -246,20 +246,6 @@ public class SurvivalGames extends SoloGame BlockBreakAllow.add(Material.WEB.getId()); // Web BlockPlaceAllow.add(Material.WEB.getId()); - BlockBreakAllow.add(Material.TRIPWIRE.getId()); // Tripwire - BlockPlaceAllow.add(Material.TRIPWIRE.getId()); - - BlockBreakAllow.add(Material.TRIPWIRE_HOOK.getId()); // Wire Hook - BlockPlaceAllow.add(Material.TRIPWIRE_HOOK.getId()); - - BlockBreakAllow.add(Material.REDSTONE_WIRE.getId()); // Redstone Dust - BlockPlaceAllow.add(Material.REDSTONE_WIRE.getId()); - - BlockBreakAllow.add(Material.WOOD_PLATE.getId()); // Wood Pressure Plate - BlockPlaceAllow.add(Material.WOOD_PLATE.getId()); - - BlockBreakAllow.add(Material.LEVER.getId()); // Lever - BlockPlaceAllow.add(Material.LEVER.getId()); BlockBreakAllow.add(Material.LEAVES.getId()); // Leaves BlockBreakAllow.add(Material.LEAVES_2.getId()); // Leaves @@ -1495,6 +1481,9 @@ public class SurvivalGames extends SoloGame @EventHandler public void borderBlockDamage(ProjectileHitEvent event) { + if (!IsLive()) + return; + if (!(event.getEntity() instanceof Fireball)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java index 1f824827b..a623eb102 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java @@ -73,14 +73,10 @@ public class SpellMenuPage extends ShopPageBase pastTeams = null; //Chosen Game diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 8fdc41db5..7a7c00480 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -11,6 +11,7 @@ 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 mineplex.core.common.util.UtilTextMiddle; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import mineplex.core.teleport.event.MineplexTeleportEvent; @@ -713,6 +714,7 @@ public class GameFlagManager implements Listener UtilAction.velocity(player, new Vector(0,0,0), 1, true, 0.4, 0, 1, true); UtilPlayer.message(player, C.cWhite + C.Bold + "You will respawn in " + time + " seconds..."); + UtilTextMiddle.display(null, "Respawning in " + time + " seconds...", 5, 40, 5, player); Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { @@ -727,7 +729,7 @@ public class GameFlagManager implements Listener { Manager.addSpectator(player, true); } - + player.setFireTicks(0); player.setVelocity(new Vector(0,0,0)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 27ded40e6..46c4b86b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -30,7 +30,7 @@ public class GameGemManager implements Listener { ArcadeManager Manager; - boolean DoubleGem = false; + boolean DoubleGem = true; public GameGemManager(ArcadeManager manager) { @@ -174,7 +174,7 @@ public class GameGemManager implements Listener } } - if (DoubleGem && game.GemDoubleEnabled) + if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) total += earned; Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total); @@ -245,7 +245,7 @@ public class GameGemManager implements Listener } //Double Gem - if (DoubleGem && game.GemDoubleEnabled) + if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) { UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HalloweenManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HalloweenManager.java deleted file mode 100644 index fd45a05a8..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HalloweenManager.java +++ /dev/null @@ -1,245 +0,0 @@ -package nautilus.game.arcade.managers; - -import java.util.HashSet; -import java.util.Iterator; - -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; - -import org.bukkit.Effect; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Item; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - -public class HalloweenManager implements Listener -{ - ArcadeManager Manager; - - public HashSet _active = new HashSet(); - - private HashSet _coins = new HashSet(); - - public long _lastSpawn = System.currentTimeMillis(); - - public HalloweenManager(ArcadeManager manager) - { - Manager = manager; - - Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); - } - - @EventHandler - public void reset(GameStateChangeEvent event) - { - _active.clear(); - - _lastSpawn = System.currentTimeMillis(); - } - - @EventHandler - public void pumpkinEffect(UpdateEvent event) - { - if (event.getType() == UpdateType.TICK) - return; - - Iterator pumpkinIterator = _active.iterator(); - - while (pumpkinIterator.hasNext()) - { - Block pumpkin = pumpkinIterator.next(); - - if (pumpkin.getType() != Material.PUMPKIN && pumpkin.getType() != Material.JACK_O_LANTERN) - { - pumpkinBreak(pumpkin); - pumpkinIterator.remove(); - continue; - } - - UtilParticle.PlayParticle(ParticleType.FLAME, pumpkin.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0.06f, 4); - if (Math.random() > 0.90) - { - if (pumpkin.getType() == Material.PUMPKIN) - { - pumpkin.setType(Material.JACK_O_LANTERN); - } - else - { - pumpkin.setType(Material.PUMPKIN); - } - } - } - } - - @EventHandler - public void spawnPumpkinUpdate(UpdateEvent event) - { - if (event.getType() != UpdateType.SEC) - return; - - if (Manager.GetGame() == null) - return; - - Game game = Manager.GetGame(); - - int requirement = (int)((double)Manager.GetPlayerFull() * 0.75d); - if (UtilServer.getPlayers().length < requirement) - return; - - if (game.GetState() != GameState.Live) - return; - - if (!UtilTime.elapsed(_lastSpawn, 120000)) - return; - - if (Math.random() > 0.01) - return; - - int toDrop = Math.max(1, game.GetPlayers(false).size()/6); - for (int i=0 ; i< toDrop ; i++) - { - double interval = 1 / (double)(toDrop); - - if (Math.random() >= (i * interval)) // Diminishing per growth - { - spawnPumpkin(getPumpkinBlock(game)); - } - } - - _lastSpawn = System.currentTimeMillis(); - } - - private void spawnPumpkin(Block block) - { - if (block == null) - { - System.out.println("Pumpkin: Could Not Find Suitable Block"); - return; - } - - block.setType(Material.PUMPKIN); - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.PUMPKIN); - _active.add(block); - - System.out.println("Spawned Pumpkin: " + UtilWorld.locToStrClean(block.getLocation())); - } - - private Block getPumpkinBlock(Game game) - { - Block block = null; - int attempts = 2000; - while (attempts > 0) - { - attempts--; - - int x = game.WorldData.MinX + UtilMath.r(Math.abs(game.WorldData.MaxX - game.WorldData.MinX)); - int z = game.WorldData.MinZ + UtilMath.r(Math.abs(game.WorldData.MaxZ - game.WorldData.MinZ)); - - block = UtilBlock.getHighest(game.WorldData.World, x, z, null); - - if (block.getLocation().getY() <= 2 || block.getLocation().getY() < game.WorldData.MinY || block.getLocation().getY() > game.WorldData.MaxY) - continue; - - if (block.getRelative(BlockFace.DOWN).isLiquid()) - continue; - - if (!UtilBlock.airFoliage(block) || !UtilBlock.airFoliage(block.getRelative(BlockFace.UP))) - continue; - - if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN))) - continue; - - return block; - } - - return null; - } - - @EventHandler - public void pumpkinDamage(BlockDamageEvent event) - { - if (_active.contains(event.getBlock())) - { - Manager.GetGame().AddStat(event.getPlayer(), "Pumpkins Smashed", 1, false, true); - pumpkinBreak(event.getBlock()); - } - } - - private void pumpkinBreak(Block block) - { - block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.PUMPKIN); - block.setType(Material.AIR); - - //Coins - for (int i=0 ; i < 4 + Math.random()*16 ; i++) - { - Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), new ItemStack(Material.getMaterial(175))); - - Vector vel = new Vector( - (Math.random() - 0.5) * 0.5, - 0.1 + Math.random() * 0.3, - (Math.random() - 0.5) * 0.5); - - coin.setVelocity(vel); - - coin.setPickupDelay(20); - - _coins.add(coin); - } - - //Effect - block.getWorld().playSound(block.getLocation(), Sound.ZOMBIE_REMEDY, 1f, 1f); - } - - @EventHandler - public void coinPickup(PlayerPickupItemEvent event) - { - if (_coins.contains(event.getItem())) - { - event.setCancelled(true); - event.getItem().remove(); - - Manager.GetDonation().RewardCoins(null, "Halloween Pumpkin", event.getPlayer().getName(), Manager.GetClients().Get(event.getPlayer()).getAccountId(), 4 * event.getItem().getItemStack().getAmount()); - - event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); - } - } - - @EventHandler - public void coinClean(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - Iterator coinIterator = _coins.iterator(); - - while (coinIterator.hasNext()) - { - Item coin = coinIterator.next(); - - if (!coin.isValid() || coin.getTicksLived() > 1200) - { - coin.remove(); - coinIterator.remove(); - } - } - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java new file mode 100644 index 000000000..f2bba323b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -0,0 +1,391 @@ +package nautilus.game.arcade.managers; + +import java.util.HashSet; +import java.util.Iterator; + +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import net.minecraft.server.v1_7_R4.PacketPlayOutBlockAction; +import net.minecraft.server.v1_7_R4.TileEntity; +import net.minecraft.server.v1_7_R4.TileEntityEnderChest; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; + +public class HolidayManager implements Listener +{ + public enum HolidayType + { + Christmas(Material.CHEST, "Present", Sound.LEVEL_UP), + Halloween(Material.PUMPKIN, "Pumpkin", Sound.ZOMBIE_REMEDY), + Easter(Material.CHEST, "Egg Basket", Sound.CAT_MEOW); + + private Material _blockType; + private String _blockName; + private Sound _blockBreakSound; + + HolidayType(Material blockType, String blockName, Sound blockBreakSound) + { + _blockType = blockType; + _blockName = blockName; + _blockBreakSound = blockBreakSound; + } + + public String getBlockName() + { + return _blockName; + } + + public Sound getBlockSound() + { + return _blockBreakSound; + } + + public Material getBlockType() + { + return _blockType; + } + } + + private HolidayType type = HolidayType.Easter; + + ArcadeManager Manager; + + public HashSet _active = new HashSet(); + + private HashSet _eggs = new HashSet(); + + private HashSet _coins = new HashSet(); + + public long _lastSpawn = System.currentTimeMillis(); + + public HolidayManager(ArcadeManager manager) + { + Manager = manager; + + Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); + } + + @EventHandler + public void reset(GameStateChangeEvent event) + { + _active.clear(); + + _lastSpawn = System.currentTimeMillis(); + } + + @EventHandler + public void blockEffect(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + return; + + Iterator blockIterator = _active.iterator(); + + while (blockIterator.hasNext()) + { + Block block = blockIterator.next(); + + //Break + if (block.getType() != Material.PUMPKIN && + block.getType() != Material.JACK_O_LANTERN && + block.getType() != Material.CHEST) + { + specialBlockBreak(block); + blockIterator.remove(); + continue; + } + + if (type == HolidayType.Halloween) + { + UtilParticle.PlayParticle(ParticleType.FLAME, block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0.06f, 4); + if (Math.random() > 0.90) + { + if (block.getType() == Material.PUMPKIN) + { + block.setType(Material.JACK_O_LANTERN); + } + else + { + block.setType(Material.PUMPKIN); + } + } + } + else if (type == HolidayType.Easter) + { + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, block.getLocation().add(0.5, 0.2, 0.5), 0.3f, 0.2f, 0.3f, 0, 1); + + if (Math.random() > 0.90) + { + Item egg = block.getWorld().dropItem(block.getLocation().add(0.5, 0.8, 0.5), + ItemStackFactory.Instance.CreateStack(Material.EGG, (byte)0, 1, System.currentTimeMillis() + "Egg")); + egg.setVelocity(new Vector((Math.random()-0.5)*0.3, Math.random()-0.4, (Math.random()-0.5)*0.3)); + + _eggs.add(egg); + + block.getWorld().playSound(block.getLocation(), Sound.CHICKEN_EGG_POP, 0.25f + (float)Math.random() * 0.75f, 0.75f + (float)Math.random() * 0.5f); + } + + if (Math.random() > 0.95) + { + sendChestPackets(block); + } + } + } + } + + @EventHandler + public void spawnSpecialBlockUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (Manager.GetGame() == null) + return; + + Game game = Manager.GetGame(); + + int requirement = (int)((double)Manager.GetPlayerFull() * 0.5d); + if (UtilServer.getPlayers().length < requirement) + return; + + if (game.GetState() != GameState.Live) + return; + + if (!UtilTime.elapsed(_lastSpawn, 90000)) + return; + + if (Math.random() > 0.01) + return; + + int toDrop = Math.max(1, game.GetPlayers(false).size()/6); + for (int i=0 ; i< toDrop ; i++) + { + double interval = 1 / (double)(toDrop); + + if (Math.random() >= (i * interval)) // Diminishing per growth + { + spawnSpecialBlock(findSpecialBlockLocation(game)); + } + } + + _lastSpawn = System.currentTimeMillis(); + } + + private void spawnSpecialBlock(Block block) + { + if (block == null) + { + System.out.println("Holiday Block: Could Not Find Suitable Block"); + return; + } + + block.setType(type.getBlockType()); + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType()); + + if (type.getBlockType() == Material.CHEST) + { + sendChestPackets(block); + } + + _active.add(block); + + System.out.println("Spawned Holiday Block: " + UtilWorld.locToStrClean(block.getLocation())); + } + + private void sendChestPackets(Block block) + { + PacketPlayOutBlockAction packet = new PacketPlayOutBlockAction(block.getX(), block.getY(), block.getZ(), + CraftMagicNumbers.getBlock(block), 1, 1); + + for (Player other : UtilServer.getPlayers()) + ((CraftPlayer) other).getHandle().playerConnection.sendPacket(packet); + } + + private Block findSpecialBlockLocation(Game game) + { + Block block = null; + int attempts = 2000; + while (attempts > 0) + { + attempts--; + + int x = game.WorldData.MinX + UtilMath.r(Math.abs(game.WorldData.MaxX - game.WorldData.MinX)); + int z = game.WorldData.MinZ + UtilMath.r(Math.abs(game.WorldData.MaxZ - game.WorldData.MinZ)); + + block = UtilBlock.getHighest(game.WorldData.World, x, z, null); + + if (block.getLocation().getY() <= 2 || block.getLocation().getY() < game.WorldData.MinY || block.getLocation().getY() > game.WorldData.MaxY) + continue; + + if (block.getRelative(BlockFace.DOWN).isLiquid()) + continue; + + if (!UtilBlock.airFoliage(block) || !UtilBlock.airFoliage(block.getRelative(BlockFace.UP))) + continue; + + if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN))) + continue; + + boolean nextToChest = false; + for (Block other : UtilBlock.getSurrounding(block, false)) + { + if (other.getType() == Material.CHEST) + nextToChest = true; + } + if (nextToChest) + continue; + + return block; + } + + return null; + } + + @EventHandler + public void specialBlockInteract(PlayerInteractEvent event) + { + if (UtilPlayer.isSpectator(event.getPlayer())) + return; + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (event.getClickedBlock() == null) + return; + + if (event.getClickedBlock().getType() != Material.CHEST) + return; + + if (!_active.contains(event.getClickedBlock())) + return; + + event.setCancelled(true); + + specialBlockBreak(event.getClickedBlock()); + } + + @EventHandler + public void specialBlockDamage(BlockDamageEvent event) + { + if (UtilPlayer.isSpectator(event.getPlayer())) + return; + + if (!_active.contains(event.getBlock())) + return; + + specialBlockBreak(event.getBlock()); + } + + private void specialBlockBreak(Block block) + { + block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType()); + block.setType(Material.AIR); + + //Coins + for (int i=0 ; i < 4 + Math.random()*16 ; i++) + { + Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), + ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin")); + + Vector vel = new Vector( + (Math.random() - 0.5) * 0.5, + 0.1 + Math.random() * 0.3, + (Math.random() - 0.5) * 0.5); + + coin.setVelocity(vel); + + coin.setPickupDelay(20); + + _coins.add(coin); + } + + //Effect + block.getWorld().playSound(block.getLocation(), type.getBlockSound(), 1f, 1f); + } + + @EventHandler + public void coinPickup(PlayerPickupItemEvent event) + { + if (UtilPlayer.isSpectator(event.getPlayer())) + return; + + if (_coins.contains(event.getItem())) + { + event.setCancelled(true); + event.getItem().remove(); + + Manager.GetDonation().RewardCoins(null, type + " Coins", event.getPlayer().getName(), Manager.GetClients().Get(event.getPlayer()).getAccountId(), 4 * event.getItem().getItemStack().getAmount()); + + event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f); + } + + else if (_eggs.contains(event.getItem())) + { + event.setCancelled(true); + } + } + + @EventHandler + public void itemClean(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Iterator coinIterator = _coins.iterator(); + + while (coinIterator.hasNext()) + { + Item coin = coinIterator.next(); + + if (!coin.isValid() || coin.getTicksLived() > 1200) + { + coin.remove(); + coinIterator.remove(); + } + } + + Iterator eggIterator = _eggs.iterator(); + + while (eggIterator.hasNext()) + { + Item egg = eggIterator.next(); + + if (!egg.isValid() || egg.getTicksLived() > 40) + { + egg.remove(); + eggIterator.remove(); + } + } + } +}