From 1dedde41a896c8dd659c45cba837e06d8b9799b3 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Thu, 21 Jul 2016 05:09:31 -0400 Subject: [PATCH] Banners and beginning javadocs --- Plugins/Mineplex.EnjinTranslator/plugin.yml | 4 + .../src/mineplex/enjinTranslator/Enjin.java | 9 +- .../game/clans/clans/ClansManager.java | 62 +++++++-- .../clans/amplifiers/AmplifierManager.java | 6 + .../clans/clans/banners/BannerManager.java | 117 +++++++++++++++++ .../clans/banners/BannerPacketManager.java | 101 +++++++++++++++ .../clans/clans/banners/BannerPattern.java | 61 +++++++++ .../clans/clans/banners/BannerRepository.java | 101 +++++++++++++++ .../game/clans/clans/banners/ClanBanner.java | 83 ++++++++++++ .../clans/banners/command/BannerCommand.java | 72 +++++++++++ .../clans/clans/banners/gui/BannerGUI.java | 97 ++++++++++++++ .../gui/creation/BaseColorSelectionGUI.java | 75 +++++++++++ .../creation/PatternColorSelectionGUI.java | 77 +++++++++++ .../gui/creation/PatternTypeSelectionGUI.java | 84 ++++++++++++ .../gui/nonedit/NonEditOverviewGUI.java | 58 +++++++++ .../banners/gui/overview/OverviewGUI.java | 121 ++++++++++++++++++ .../clans/clans/nether/NetherManager.java | 88 +++++++------ .../game/clans/clans/nether/NetherPortal.java | 55 ++++++-- .../clans/nether/command/CloseCommand.java | 5 +- .../clans/nether/command/CreateCommand.java | 3 + .../clans/nether/command/DeleteCommand.java | 3 + .../nether/command/ForceTeleportCommand.java | 63 +++++++++ .../clans/nether/command/ListCommand.java | 3 + .../clans/nether/command/PortalCommand.java | 3 + .../clans/nether/command/SpawnCommand.java | 3 + .../clans/nether/command/WandCommand.java | 3 + .../clans/clans/nether/data/ClaimData.java | 23 ++++ .../miniboss/NetherMinibossManager.java | 2 +- .../miniboss/bosses/ArcherMiniboss.java | 3 + .../nether/miniboss/bosses/GhastMiniboss.java | 3 + .../miniboss/bosses/PigmanMiniboss.java | 3 + .../miniboss/bosses/WarriorMiniboss.java | 3 + 32 files changed, 1332 insertions(+), 62 deletions(-) create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/amplifiers/AmplifierManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPacketManager.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPattern.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/ClanBanner.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/command/BannerCommand.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/BannerGUI.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/BaseColorSelectionGUI.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternColorSelectionGUI.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternTypeSelectionGUI.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/nonedit/NonEditOverviewGUI.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/overview/OverviewGUI.java create mode 100644 Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ForceTeleportCommand.java diff --git a/Plugins/Mineplex.EnjinTranslator/plugin.yml b/Plugins/Mineplex.EnjinTranslator/plugin.yml index ef3eac20a..e3996d524 100644 --- a/Plugins/Mineplex.EnjinTranslator/plugin.yml +++ b/Plugins/Mineplex.EnjinTranslator/plugin.yml @@ -6,6 +6,10 @@ commands: description: Translates enjin commands to mineplex. usage: Don't use it, you get kicked. aliases: + enjin_clans: + description: Translates enjin commands to mineplex. + usage: Don't use it, you get kicked. + aliases: pull: description: Translates enjin commands to mineplex. usage: Don't use it, you get kicked. diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 3c569acb1..d1887f960 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -55,6 +55,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); + plugin.getCommand("enjin_clans").setExecutor(this); } @EventHandler @@ -81,7 +82,13 @@ public class Enjin extends MiniPlugin implements CommandExecutor { if (sender instanceof Player) ((Player)sender).kickPlayer("Like bananas? I don't. Here take these and go have fun."); - + + if (label.equalsIgnoreCase("enjin_clans")) + { + String clansServer = args[0]; + Long minutes = Long.parseLong(args[1]); + } + if (label.equalsIgnoreCase("enjin_mineplex")) { final String name = args[1]; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java index 8f53fec8d..bc5f5bfb9 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansManager.java @@ -1,7 +1,14 @@ package mineplex.game.clans.clans; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.TimeZone; +import java.util.UUID; + import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; @@ -10,7 +17,13 @@ import mineplex.core.chat.Chat; import mineplex.core.common.Pair; import mineplex.core.common.Rank; import mineplex.core.common.events.PlayerMessageEvent; -import mineplex.core.common.util.*; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.creature.Creature; import mineplex.core.creature.event.CreatureSpawnCustomEvent; import mineplex.core.disguise.DisguiseManager; @@ -40,7 +53,15 @@ import mineplex.game.clans.Clans; import mineplex.game.clans.clans.ClanTips.TipType; import mineplex.game.clans.clans.ClansUtility.ClanRelation; import mineplex.game.clans.clans.ban.ClansBanManager; -import mineplex.game.clans.clans.commands.*; +import mineplex.game.clans.clans.banners.BannerManager; +import mineplex.game.clans.clans.commands.ClanManagementCommand; +import mineplex.game.clans.clans.commands.ClansAllyChatCommand; +import mineplex.game.clans.clans.commands.ClansChatCommand; +import mineplex.game.clans.clans.commands.ClansCommand; +import mineplex.game.clans.clans.commands.KillCommand; +import mineplex.game.clans.clans.commands.MapCommand; +import mineplex.game.clans.clans.commands.RegionsCommand; +import mineplex.game.clans.clans.commands.SpeedCommand; import mineplex.game.clans.clans.data.PlayerClan; import mineplex.game.clans.clans.event.ClansPlayerDeathEvent; import mineplex.game.clans.clans.gui.ClanShop; @@ -82,8 +103,8 @@ import mineplex.minecraft.game.classcombat.Class.ClientClass; import mineplex.minecraft.game.classcombat.Class.IPvpClass; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; -import mineplex.minecraft.game.classcombat.Skill.Mage.events.FissureModifyBlockEvent; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.classcombat.Skill.Mage.events.FissureModifyBlockEvent; import mineplex.minecraft.game.classcombat.item.ItemFactory; import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; import mineplex.minecraft.game.classcombat.shop.ClassShopManager; @@ -96,7 +117,7 @@ import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.mechanics.Weapon; import mineplex.serverdata.commands.ServerCommandManager; -import net.md_5.bungee.api.ChatColor; + import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -113,13 +134,18 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; -import java.util.*; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; public class ClansManager extends MiniClientPluginimplements IRelation { @@ -166,6 +192,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati private mineplex.game.clans.legacytutorial.TutorialManager _legacyTutorial; private ClassManager _classManager; + private BannerManager _bannerManager; public ClassManager getClassManager() { @@ -208,6 +235,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati private ClansBanManager _clansBans; + private PacketHandler _packetHandler; + public ClanTips ClanTips; // Spawn area @@ -221,6 +250,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati _clansBans = clansBans; _punish = punish; + _packetHandler = packetHandler; + _incognitoManager = incognitoManager; _serverName = serverName; _clientManager = clientManager; @@ -423,6 +454,7 @@ public class ClansManager extends MiniClientPluginimplements IRelati _siegeManager = new SiegeManager(this); _netherManager = new NetherManager(this); + _bannerManager = new BannerManager(plugin); } @Override @@ -450,6 +482,8 @@ public class ClansManager extends MiniClientPluginimplements IRelati for (ClanTerritoryToken territoryToken : clanToken.Territories) _claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken)); + + _bannerManager.loadBanner(clan); } public DisguiseManager getDisguiseManager() @@ -492,6 +526,16 @@ public class ClansManager extends MiniClientPluginimplements IRelati return _explosion; } + public PacketHandler getPacketHandler() + { + return _packetHandler; + } + + public BannerManager getBannerManager() + { + return _bannerManager; + } + public int getInviteExpire() { return _inviteExpire; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/amplifiers/AmplifierManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/amplifiers/AmplifierManager.java new file mode 100644 index 000000000..14aaf0505 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/amplifiers/AmplifierManager.java @@ -0,0 +1,6 @@ +package mineplex.game.clans.clans.amplifiers; + +public class AmplifierManager +{ + +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java new file mode 100644 index 000000000..6726e6102 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerManager.java @@ -0,0 +1,117 @@ +package mineplex.game.clans.clans.banners; + +import java.util.HashMap; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTime.TimeUnit; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.banners.command.BannerCommand; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.block.Banner; +import org.bukkit.block.Block; +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.BlockPlaceEvent; +import org.bukkit.inventory.meta.BannerMeta; +import org.bukkit.plugin.java.JavaPlugin; + +public class BannerManager extends MiniPlugin +{ + private static final long BANNER_PLACE_DURATION = UtilTime.convert(30, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); + public final HashMap LoadedBanners = new HashMap<>(); + private final HashMap _placedBanners = new HashMap<>(); + private BannerRepository _repo; + + public BannerManager(JavaPlugin plugin) + { + super("Clan Banners", plugin); + _repo = new BannerRepository(plugin, this); + + new BannerPacketManager(); + addCommand(new BannerCommand(this)); + } + + public int getBannerUnlockLevel(Player player) + { + int level = 0; + if (ClansManager.getInstance().getDonationManager().Get(player).OwnsUnknownPackage("UseClanBanner")) + { + level = 1; + } + if (ClansManager.getInstance().getDonationManager().Get(player).OwnsUnknownPackage("MakeClanBanner")) + { + level = 2; + } + if (ClansManager.getInstance().getClientManager().hasRank(player, Rank.ADMIN)) + { + level = 2; + } + return level; + } + + public void loadBanner(ClanInfo clan) + { + _repo.loadBanner(LoadedBanners, clan); + } + + public void saveBanner(ClanBanner banner) + { + _repo.saveBanner(banner); + } + + public void placeBanner(Player placing, ClanBanner banner) + { + Block block = placing.getLocation().getBlock(); + BlockPlaceEvent event = new BlockPlaceEvent(block, block.getState(), block, placing.getItemInHand(), placing, false); + Bukkit.getPluginManager().callEvent(event); + if (!event.isCancelled()) + { + ClansManager.getInstance().getBlockRestore().restore(block); + if (block.getType() == Material.AIR && UtilBlock.fullSolid(block.getRelative(BlockFace.DOWN))) + { + block.setType(Material.STANDING_BANNER); + Banner state = (Banner) block.getState(); + state.setBaseColor(banner.getBaseColor()); + state.setPatterns(((BannerMeta)banner.getBanner().getItemMeta()).getPatterns()); + state.update(); + _placedBanners.put(block, System.currentTimeMillis()); + } + } + } + + @EventHandler + public void onBreak(BlockBreakEvent event) + { + if (_placedBanners.containsKey(event.getBlock())) + { + _placedBanners.remove(event.getBlock()); + event.setCancelled(true); + event.getBlock().setType(Material.AIR); + } + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.FAST) + { + for (Block reset : _placedBanners.keySet()) + { + if (UtilTime.elapsed(_placedBanners.get(reset), BANNER_PLACE_DURATION)) + { + reset.setType(Material.AIR); + } + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPacketManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPacketManager.java new file mode 100644 index 000000000..9c7c76007 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPacketManager.java @@ -0,0 +1,101 @@ +package mineplex.game.clans.clans.banners; + +import java.lang.reflect.Field; +import java.util.HashMap; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.packethandler.IPacketHandler; +import mineplex.core.packethandler.PacketInfo; +import mineplex.game.clans.clans.ClansManager; +import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; + +public class BannerPacketManager implements Listener +{ + private Field _itemField; + private static BannerPacketManager Instance; + private final HashMap _wearing = new HashMap<>(); + + public BannerPacketManager() + { + try + { + _itemField = PacketPlayOutSetSlot.class.getDeclaredField("c"); + _itemField.setAccessible(true); + + Bukkit.getPluginManager().registerEvents(this, ClansManager.getInstance().getPlugin()); + } + catch (Exception e) + { + e.printStackTrace(); + } + + Instance = this; + } + + public static BannerPacketManager getInstance() + { + return Instance; + } + + public void toggleBanner(Player player, ItemStack banner) + { + if (_wearing.containsKey(player)) + { + IPacketHandler bannerHandler = _wearing.remove(player); + ClansManager.getInstance().getPacketHandler().removePacketHandler(bannerHandler); + for (Player refresh : Bukkit.getOnlinePlayers()) + { + ItemStack helmet = new ItemStack(Material.AIR); + if (player.getInventory().getHelmet() != null) + { + helmet = player.getInventory().getHelmet(); + } + UtilPlayer.sendPacket(refresh, new PacketPlayOutEntityEquipment(player.getEntityId(), 4, CraftItemStack.asNMSCopy(helmet))); + } + } + else + { + IPacketHandler bannerHandler = new IPacketHandler() + { + @Override + public void handle(PacketInfo packetInfo) + { + if (packetInfo.getPacket() instanceof PacketPlayOutEntityEquipment) + { + PacketPlayOutEntityEquipment equip = (PacketPlayOutEntityEquipment) packetInfo.getPacket(); + + if (equip.a == player.getEntityId() && equip.b == 4) + { + equip.c = CraftItemStack.asNMSCopy(banner); + } + } + } + }; + _wearing.put(player, bannerHandler); + ClansManager.getInstance().getPacketHandler().addPacketHandler(bannerHandler, PacketPlayOutEntityEquipment.class); + for (Player refresh : Bukkit.getOnlinePlayers()) + { + UtilPlayer.sendPacket(refresh, new PacketPlayOutEntityEquipment(player.getEntityId(), 4, CraftItemStack.asNMSCopy(banner))); + } + } + } + + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + if (_wearing.containsKey(event.getPlayer())) + { + ClansManager.getInstance().getPacketHandler().removePacketHandler(_wearing.remove(event.getPlayer())); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPattern.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPattern.java new file mode 100644 index 000000000..a3ea8ad8a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerPattern.java @@ -0,0 +1,61 @@ +package mineplex.game.clans.clans.banners; + +import org.bukkit.DyeColor; +import org.bukkit.block.banner.Pattern; +import org.bukkit.block.banner.PatternType; + +public class BannerPattern +{ + private int _layer; + private DyeColor _color; + private PatternType _type; + + public BannerPattern(int layer, DyeColor color, PatternType type) + { + _layer = layer; + _color = color; + _type = type; + } + + public BannerPattern(int layer) + { + _layer = layer; + _color = null; + _type = null; + } + + public int getLayer() + { + return _layer; + } + + public Pattern getBukkitPattern() + { + if (_color == null || _type == null) + { + return null; + } + + return new Pattern(_color, _type); + } + + public String getDatabaseForm() + { + if (_color == null || _type == null) + { + return "Blank"; + } + + return _color.toString() + "," + _type.toString(); + } + + public void setColor(DyeColor color) + { + _color = color; + } + + public void setPatternType(PatternType type) + { + _type = type; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java new file mode 100644 index 000000000..ae972f6b2 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/BannerRepository.java @@ -0,0 +1,101 @@ +package mineplex.game.clans.clans.banners; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import mineplex.core.database.MinecraftRepository; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.serverdata.database.DBPool; +import mineplex.serverdata.database.column.ColumnInt; +import mineplex.serverdata.database.column.ColumnVarChar; + +import org.bukkit.DyeColor; +import org.bukkit.block.banner.PatternType; +import org.bukkit.plugin.java.JavaPlugin; + +public class BannerRepository extends MinecraftRepository +{ + private static final String CREATE = "CREATE TABLE IF NOT EXISTS clanBanners (clanId INT NOT NULL," + + "baseColor VARCHAR(15)," + + "patterns VARCHAR(300)," + + "PRIMARY KEY (clanId));"; + + private static final String GET_BANNER_BY_CLAN = "SELECT * FROM clanBanners WHERE clanId=? LIMIT 1;"; + private static final String INSERT_BANNER = "INSERT INTO clanBanners (clanId, baseColor, patterns) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE baseColor=VALUES(baseColor), patterns=VALUES(patterns);"; + + private BannerManager _bannerManager; + + public BannerRepository(JavaPlugin plugin, BannerManager bannerManager) + { + super(plugin, DBPool.getAccount()); + _bannerManager = bannerManager; + } + + public void loadBanner(final HashMap map, ClanInfo clan) + { + _bannerManager.runAsync(() -> + { + executeQuery(GET_BANNER_BY_CLAN, resultSet -> + { + while(resultSet.next()) + { + DyeColor baseColor = DyeColor.valueOf(resultSet.getString("baseColor")); + List patternStrs = Arrays.asList(resultSet.getString("patterns").split("/")); + LinkedList patterns = new LinkedList<>(); + int layer = 1; + for (String patternStr : patternStrs) + { + if (patternStr.equalsIgnoreCase("Blank")) + { + patterns.add(new BannerPattern(layer)); + } + else + { + try + { + DyeColor patternColor = DyeColor.valueOf(patternStr.split(",")[0]); + PatternType patternType = PatternType.valueOf(patternStr.split(",")[1]); + patterns.add(new BannerPattern(layer, patternColor, patternType)); + } + catch (Exception e) + { + e.printStackTrace(); + patterns.add(new BannerPattern(layer)); + } + } + layer++; + } + map.put(clan.getName(), new ClanBanner(_bannerManager, clan, baseColor, patterns)); + } + }, new ColumnInt("clanId", clan.getId())); + }); + } + + public void saveBanner(ClanBanner banner) + { + _bannerManager.runAsync(() -> + { + String patternStr = ""; + for (BannerPattern pattern : banner.getPatterns()) + { + if (!patternStr.equalsIgnoreCase("")) + { + patternStr = patternStr + "/"; + } + patternStr = patternStr + pattern.getDatabaseForm(); + } + executeUpdate(INSERT_BANNER, new ColumnInt("clanId", banner.getClan().getId()), new ColumnVarChar("baseColor", 15, banner.getBaseColor().toString()), new ColumnVarChar("patterns", 300, patternStr)); + }); + } + + @Override + protected void initialize() + { + executeUpdate(CREATE); + } + + @Override + protected void update() {} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/ClanBanner.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/ClanBanner.java new file mode 100644 index 000000000..e5531df42 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/ClanBanner.java @@ -0,0 +1,83 @@ +package mineplex.game.clans.clans.banners; + +import java.util.LinkedList; +import java.util.List; + +import mineplex.core.common.util.C; +import mineplex.game.clans.clans.ClanInfo; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.block.banner.Pattern; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; + +import com.google.common.collect.Lists; + +public class ClanBanner +{ + private BannerManager _manager; + private ClanInfo _clan; + private DyeColor _baseColor; + private LinkedList _patterns; + + public ClanBanner(BannerManager manager, ClanInfo clan, DyeColor baseColor, LinkedList patterns) + { + _manager = manager; + _clan = clan; + _baseColor = baseColor; + _patterns = patterns; + } + + public ClanInfo getClan() + { + return _clan; + } + + public DyeColor getBaseColor() + { + return _baseColor; + } + + public LinkedList getPatterns() + { + return _patterns; + } + + public ItemStack getBanner() + { + ItemStack banner = new ItemStack(Material.BANNER); + BannerMeta im = (BannerMeta) banner.getItemMeta(); + + im.setDisplayName(C.cGray + _clan.getName() + "'s Banner"); + im.setBaseColor(_baseColor); + List patterns = Lists.newArrayList(); + for (BannerPattern bp : _patterns) + { + if (bp.getBukkitPattern() != null) + { + patterns.add(bp.getBukkitPattern()); + } + } + im.setPatterns(patterns); + banner.setItemMeta(im); + + return banner; + } + + public void setBaseColor(DyeColor color) + { + _baseColor = color; + } + + public void save() + { + _manager.saveBanner(this); + } + + public void place(Player player) + { + _manager.placeBanner(player, this); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/command/BannerCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/command/BannerCommand.java new file mode 100644 index 000000000..66cb36aa2 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/command/BannerCommand.java @@ -0,0 +1,72 @@ +package mineplex.game.clans.clans.banners.command; + +import java.util.LinkedList; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClanInfo; +import mineplex.game.clans.clans.ClanRole; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.banners.BannerManager; +import mineplex.game.clans.clans.banners.BannerPattern; +import mineplex.game.clans.clans.banners.ClanBanner; +import mineplex.game.clans.clans.banners.gui.nonedit.NonEditOverviewGUI; +import mineplex.game.clans.clans.banners.gui.overview.OverviewGUI; + +import org.bukkit.DyeColor; +import org.bukkit.entity.Player; + +public class BannerCommand extends CommandBase +{ + public BannerCommand(BannerManager plugin) + { + super(plugin, Rank.ALL, "banner"); + } + + @Override + public void Execute(Player caller, String[] args) + { + if (ClansManager.getInstance().getClan(caller) == null) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You are not in a Clan!")); + return; + } + ClanInfo clan = ClansManager.getInstance().getClan(caller); + if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER || Plugin.getBannerUnlockLevel(caller) < 2) + { + if (Plugin.getBannerUnlockLevel(caller) < 1) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "You have not purchased the ability to use Clan banners! Buy it at http://www.mineplex.com/shop!")); + return; + } + if (!Plugin.LoadedBanners.containsKey(clan.getName())) + { + UtilPlayer.message(caller, F.main(Plugin.getName(), "Your Clan does not have a set banner!")); + return; + } + new NonEditOverviewGUI(caller, Plugin.LoadedBanners.get(clan.getName())); + } + else + { + if (!Plugin.LoadedBanners.containsKey(clan.getName())) + { + LinkedList patterns = new LinkedList<>(); + for (int i = 0; i < 12; i++) + { + patterns.add(new BannerPattern(i + 1)); + } + ClanBanner banner = new ClanBanner(Plugin, clan, DyeColor.WHITE, patterns); + Plugin.LoadedBanners.put(clan.getName(), banner); + banner.save(); + new OverviewGUI(caller, banner); + } + else + { + ClanBanner banner = Plugin.LoadedBanners.get(clan.getName()); + new OverviewGUI(caller, banner); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/BannerGUI.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/BannerGUI.java new file mode 100644 index 000000000..2b274547a --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/BannerGUI.java @@ -0,0 +1,97 @@ +package mineplex.game.clans.clans.banners.gui; + +import java.util.HashMap; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.game.clans.clans.ClansManager; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public abstract class BannerGUI implements Listener +{ + private Player _viewer; + private Inventory _inventory; + private final HashMap _items = new HashMap<>(); + + public BannerGUI(Player viewer, String pageName, int slots) + { + _viewer = viewer; + _inventory = Bukkit.createInventory(viewer, slots, pageName); + Bukkit.getPluginManager().registerEvents(this, ClansManager.getInstance().getPlugin()); + } + + public Player getViewer() + { + return _viewer; + } + + public HashMap getItems() + { + return _items; + } + + public abstract void propagate(); + + public abstract void onClick(Integer slot, ClickType type); + + public void open() + { + _viewer.openInventory(_inventory); + } + + public void refresh() + { + for (Integer slot : _items.keySet()) + { + _inventory.setItem(slot, _items.get(slot)); + } + for (Integer slot = 0; slot < _inventory.getSize(); slot++) + { + if (!_items.containsKey(slot)) + { + _inventory.setItem(slot, new ItemBuilder(Material.STAINED_GLASS_PANE).setTitle(C.cGray).setData((short)7).build()); + } + } + _viewer.updateInventory(); + } + + @EventHandler + public void handleClick(InventoryClickEvent event) + { + if (event.getClickedInventory() == null || !event.getClickedInventory().equals(_inventory)) + { + return; + } + if (!_viewer.getName().equals(event.getWhoClicked().getName())) + { + return; + } + event.setCancelled(true); + Integer slot = event.getSlot(); + if (!_items.containsKey(slot)) + { + return; + } + onClick(slot, event.getClick()); + } + + @EventHandler + public void onClose(InventoryCloseEvent event) + { + if (event.getPlayer().getUniqueId().equals(_viewer.getUniqueId())) + { + HandlerList.unregisterAll(this); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/BaseColorSelectionGUI.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/BaseColorSelectionGUI.java new file mode 100644 index 000000000..daf486024 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/BaseColorSelectionGUI.java @@ -0,0 +1,75 @@ +package mineplex.game.clans.clans.banners.gui.creation; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.banners.ClanBanner; +import mineplex.game.clans.clans.banners.gui.BannerGUI; +import mineplex.game.clans.clans.banners.gui.overview.OverviewGUI; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +public class BaseColorSelectionGUI extends BannerGUI +{ + private ClanBanner _banner; + + public BaseColorSelectionGUI(Player viewer, ClanBanner banner) + { + super(viewer, "Background Color", 27); + _banner = banner; + + propagate(); + open(); + } + + @Override + public void propagate() + { + Integer slot = 1; + for (short data = 0; data <= 15; data++) + { + getItems().put(slot, new ItemBuilder(Material.INK_SACK).setData(data).setTitle(C.cGray).build()); + if ((slot + 1) == 8) + { + slot = 10; + } + else if ((slot + 1) == 17) + { + slot = 21; + } + else if ((slot + 1) == 22) + { + slot = 23; + } + else + { + slot++; + } + } + refresh(); + } + + @SuppressWarnings("deprecation") + @Override + public void onClick(Integer slot, ClickType type) + { + if (getItems().get(slot).getType() == Material.INK_SACK) + { + DyeColor color = DyeColor.getByDyeData(getItems().get(slot).getData().getData()); + _banner.setBaseColor(color); + _banner.save(); + + ClansManager.getInstance().runSyncLater(() -> + { + getViewer().closeInventory(); + }, 1L); + ClansManager.getInstance().runSyncLater(() -> + { + new OverviewGUI(getViewer(), _banner); + }, 2L); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternColorSelectionGUI.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternColorSelectionGUI.java new file mode 100644 index 000000000..73f823fd4 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternColorSelectionGUI.java @@ -0,0 +1,77 @@ +package mineplex.game.clans.clans.banners.gui.creation; + +import mineplex.core.common.util.C; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.banners.BannerPattern; +import mineplex.game.clans.clans.banners.ClanBanner; +import mineplex.game.clans.clans.banners.gui.BannerGUI; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; + +public class PatternColorSelectionGUI extends BannerGUI +{ + private ClanBanner _banner; + private int _bannerPos; + + public PatternColorSelectionGUI(Player viewer, ClanBanner banner, int bannerPosition) + { + super(viewer, "Pattern Color", 27); + _banner = banner; + _bannerPos = bannerPosition; + + propagate(); + open(); + } + + @Override + public void propagate() + { + Integer slot = 1; + for (short data = 0; data <= 15; data++) + { + getItems().put(slot, new ItemBuilder(Material.INK_SACK).setData(data).setTitle(C.cGray).build()); + if ((slot + 1) == 8) + { + slot = 10; + } + else if ((slot + 1) == 17) + { + slot = 21; + } + else if ((slot + 1) == 22) + { + slot = 23; + } + else + { + slot++; + } + } + refresh(); + } + + @SuppressWarnings("deprecation") + @Override + public void onClick(Integer slot, ClickType type) + { + if (getItems().get(slot).getType() == Material.INK_SACK) + { + DyeColor color = DyeColor.getByDyeData(getItems().get(slot).getData().getData()); + BannerPattern pattern = _banner.getPatterns().get(_bannerPos); + pattern.setColor(color); + + ClansManager.getInstance().runSyncLater(() -> + { + getViewer().closeInventory(); + }, 1L); + ClansManager.getInstance().runSyncLater(() -> + { + new PatternTypeSelectionGUI(getViewer(), _banner, _bannerPos, color); + }, 2L); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternTypeSelectionGUI.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternTypeSelectionGUI.java new file mode 100644 index 000000000..11a88dc31 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/creation/PatternTypeSelectionGUI.java @@ -0,0 +1,84 @@ +package mineplex.game.clans.clans.banners.gui.creation; + +import java.util.LinkedList; + +import mineplex.core.common.util.C; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.banners.BannerPattern; +import mineplex.game.clans.clans.banners.ClanBanner; +import mineplex.game.clans.clans.banners.gui.BannerGUI; +import mineplex.game.clans.clans.banners.gui.overview.OverviewGUI; + +import org.bukkit.DyeColor; +import org.bukkit.Material; +import org.bukkit.block.banner.Pattern; +import org.bukkit.block.banner.PatternType; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; + +public class PatternTypeSelectionGUI extends BannerGUI +{ + private ClanBanner _banner; + private int _bannerPos; + private DyeColor _color; + + public PatternTypeSelectionGUI(Player viewer, ClanBanner banner, int bannerPosition, DyeColor patternColor) + { + super(viewer, "Pattern Color", 45); + _banner = banner; + _bannerPos = bannerPosition; + _color = patternColor; + + propagate(); + open(); + } + + @Override + public void propagate() + { + for (int i = 0; i < PatternType.values().length; i++) + { + ItemStack item = new ItemStack(Material.BANNER); + BannerMeta im = (BannerMeta) item.getItemMeta(); + im.setBaseColor(_banner.getBaseColor()); + LinkedList patterns = new LinkedList<>(); + for (int patternId = 0; patternId < _bannerPos; patternId++) + { + BannerPattern show = _banner.getPatterns().get(patternId); + if (show.getBukkitPattern() != null) + { + patterns.add(show.getBukkitPattern()); + } + } + patterns.add(new Pattern(_color, PatternType.values()[i])); + im.setPatterns(patterns); + im.setDisplayName(C.cGray); + item.setItemMeta(im); + getItems().put(i, item); + } + refresh(); + } + + @Override + public void onClick(Integer slot, ClickType ctype) + { + if (getItems().get(slot).getType() == Material.BANNER) + { + PatternType type = ((BannerMeta)getItems().get(slot).getItemMeta()).getPatterns().get(Math.min(_bannerPos, ((BannerMeta)getItems().get(slot).getItemMeta()).getPatterns().size() - 1)).getPattern(); + BannerPattern pattern = _banner.getPatterns().get(_bannerPos); + pattern.setPatternType(type); + _banner.save(); + + ClansManager.getInstance().runSyncLater(() -> + { + getViewer().closeInventory(); + }, 1L); + ClansManager.getInstance().runSyncLater(() -> + { + new OverviewGUI(getViewer(), _banner); + }, 2L); + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/nonedit/NonEditOverviewGUI.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/nonedit/NonEditOverviewGUI.java new file mode 100644 index 000000000..d7a233e14 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/nonedit/NonEditOverviewGUI.java @@ -0,0 +1,58 @@ +package mineplex.game.clans.clans.banners.gui.nonedit; + +import java.util.Arrays; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.banners.BannerPacketManager; +import mineplex.game.clans.clans.banners.ClanBanner; +import mineplex.game.clans.clans.banners.gui.BannerGUI; + +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +public class NonEditOverviewGUI extends BannerGUI +{ + private ClanBanner _banner; + + public NonEditOverviewGUI(Player viewer, ClanBanner banner) + { + super(viewer, "Clan Banner", 9); + _banner = banner; + + propagate(); + open(); + } + + @Override + public void propagate() + { + ItemStack banner = _banner.getBanner().clone(); + ItemMeta im = banner.getItemMeta(); + im.setDisplayName(C.cGreen + "Clan Banner"); + im.setLore(Arrays.asList(new String[] {F.elem("Left Click") + " to toggle wearing your banner", F.elem("Right Click") + " to place down your banner"})); + banner.setItemMeta(im); + getItems().put(4, banner); + refresh(); + } + + @Override + public void onClick(Integer slot, ClickType type) + { + if (slot == 4) + { + if (type == ClickType.LEFT) + { + BannerPacketManager.getInstance().toggleBanner(getViewer(), _banner.getBanner()); + UtilPlayer.message(getViewer(), F.main("Clan Banners", "You have toggled your banner!")); + } + else if (type == ClickType.RIGHT) + { + _banner.place(getViewer()); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/overview/OverviewGUI.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/overview/OverviewGUI.java new file mode 100644 index 000000000..59553930d --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/banners/gui/overview/OverviewGUI.java @@ -0,0 +1,121 @@ +package mineplex.game.clans.clans.banners.gui.overview; + +import java.util.Arrays; + +import mineplex.core.common.util.C; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.banners.BannerPattern; +import mineplex.game.clans.clans.banners.ClanBanner; +import mineplex.game.clans.clans.banners.gui.BannerGUI; +import mineplex.game.clans.clans.banners.gui.creation.BaseColorSelectionGUI; +import mineplex.game.clans.clans.banners.gui.creation.PatternColorSelectionGUI; +import mineplex.game.clans.clans.banners.gui.nonedit.NonEditOverviewGUI; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.BannerMeta; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.material.MaterialData; + +public class OverviewGUI extends BannerGUI +{ + private static final int MAX_BANNER_LAYERS = 12; + private static final int PATTERN_DISPLAY_START_SLOT = 27; + private final ClanBanner _banner; + + public OverviewGUI(Player viewer, ClanBanner banner) + { + super(viewer, "Clan Banner", 45); + _banner = banner; + + propagate(); + open(); + } + + @Override + @SuppressWarnings("deprecation") + public void propagate() + { + getItems().put(4, _banner.getBanner()); + ItemStack color = new MaterialData(Material.INK_SACK, _banner.getBaseColor().getDyeData()).toItemStack(1); + ItemMeta colorMeta = color.getItemMeta(); + colorMeta.setDisplayName(C.cGray); + color.setItemMeta(colorMeta); + getItems().put(22, color); + Integer slot = PATTERN_DISPLAY_START_SLOT; + for (int i = 0; i < MAX_BANNER_LAYERS; i++) + { + ItemStack item = new ItemStack(Material.INK_SACK, 1, (short)8); + if (i < _banner.getPatterns().size()) + { + BannerPattern pattern = _banner.getPatterns().get(i); + if (pattern.getBukkitPattern() != null) + { + ItemStack representation = new ItemStack(Material.BANNER); + BannerMeta im = (BannerMeta) representation.getItemMeta(); + im.setBaseColor(_banner.getBaseColor()); + im.setDisplayName(C.cGray); + im.setPatterns(Arrays.asList(pattern.getBukkitPattern())); + representation.setItemMeta(im); + item = representation; + } + } + getItems().put(slot, item); + slot++; + } + refresh(); + } + + @Override + public void onClick(Integer slot, ClickType type) + { + if (slot == 4) + { + ClansManager.getInstance().runSyncLater(() -> + { + getViewer().closeInventory(); + }, 1L); + ClansManager.getInstance().runSyncLater(() -> + { + new NonEditOverviewGUI(getViewer(), _banner); + }, 2L); + } + if (slot == 22) + { + ClansManager.getInstance().runSyncLater(() -> + { + getViewer().closeInventory(); + }, 1L); + ClansManager.getInstance().runSyncLater(() -> + { + new BaseColorSelectionGUI(getViewer(), _banner); + }, 2L); + } + if (slot >= PATTERN_DISPLAY_START_SLOT) + { + if (type == ClickType.RIGHT) + { + _banner.getPatterns().get(slot - PATTERN_DISPLAY_START_SLOT).setColor(null); + ClansManager.getInstance().runSyncLater(() -> + { + getItems().clear(); + propagate(); + refresh(); + }, 1L); + } + else + { + ClansManager.getInstance().runSyncLater(() -> + { + getViewer().closeInventory(); + }, 1L); + ClansManager.getInstance().runSyncLater(() -> + { + new PatternColorSelectionGUI(getViewer(), _banner, slot - PATTERN_DISPLAY_START_SLOT); + }, 2L); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java index 427b61e35..dc79d705a 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherManager.java @@ -10,7 +10,6 @@ import mineplex.core.common.Rank; import mineplex.core.common.generator.VoidGenerator; import mineplex.core.common.util.C; import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -23,6 +22,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; +import mineplex.game.clans.clans.nether.command.ForceTeleportCommand; import mineplex.game.clans.clans.nether.command.PortalCommand; import mineplex.game.clans.clans.nether.data.ClaimData; import mineplex.game.clans.clans.nether.miniboss.NetherMinibossManager; @@ -49,6 +49,7 @@ import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityPortalEvent; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPortalEvent; @@ -59,8 +60,7 @@ import com.google.common.collect.Lists; public class NetherManager extends MiniPlugin { - private static final long PORTAL_OPEN_DURATION = UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); - private static final long NETHER_ALLOWED_DURATION = UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); + private static final long PORTAL_OPEN_DURATION = UtilTime.convert(10, TimeUnit.MINUTES, TimeUnit.MILLISECONDS); private static final String CLAIM_WAND_NAME = C.cRedB + "Portal Claim Wand"; private static final String[] CLAIM_WAND_LORE = new String[] {C.cYellow + "Left Click to select the Portal's first corner", C.cYellow + "Right Click to select the Portal's second corner"}; private static final ItemStack CLAIM_WAND = new ItemBuilder(Material.WOOD_AXE).setTitle(CLAIM_WAND_NAME).setLore(CLAIM_WAND_LORE).build(); @@ -76,7 +76,7 @@ public class NetherManager extends MiniPlugin public NetherManager(ClansManager manager) { - super("Nether Manager", manager.getPlugin()); + super("Nether", manager.getPlugin()); _portalCfg = new File(UtilServer.getServer().getWorlds().get(0).getWorldFolder().getPath() + File.separator + ".." + File.separator + "portals.yml"); @@ -96,6 +96,7 @@ public class NetherManager extends MiniPlugin begin(); _miniboss = new NetherMinibossManager(this); addCommand(new PortalCommand(this)); + addCommand(new ForceTeleportCommand(this)); } private void begin() @@ -124,17 +125,12 @@ public class NetherManager extends MiniPlugin _portalConfig.set("PortalCount", 0); _portalConfig.save(_portalCfg); } - if (!_portalConfig.isConfigurationSection("Portals")); - { - _portalConfig.createSection("Portals"); - _portalConfig.save(_portalCfg); - } log("Loading " + _portalConfig.getInt("PortalCount") + " Nether Portals!"); - for (String portalSectionPath : _portalConfig.getConfigurationSection("Portals").getValues(false).keySet()) + ConfigurationSection portalSection = _portalConfig.getConfigurationSection("Portals"); + for (String portalSectionPath : portalSection.getKeys(false)) { - log("Loading Portal"); - ConfigurationSection portal = _portalConfig.getConfigurationSection("Portals." + portalSectionPath); + ConfigurationSection portal = portalSection.getConfigurationSection(portalSectionPath); Location firstCorner = UtilWorld.strToLoc(portal.getString("CornerOne")); Location secondCorner = UtilWorld.strToLoc(portal.getString("CornerTwo")); boolean returnPortal = portal.getBoolean("ReturnPortal"); @@ -194,18 +190,28 @@ public class NetherManager extends MiniPlugin public void spawnPortal(long duration) { - if (Portals.isEmpty()) + if (Portals.isEmpty() || _returnPortals.isEmpty()) { return; } - NetherPortal portal = Portals.get(UtilMath.r(Portals.size())); - portal.open(); + List available = Lists.newArrayList(); + available.addAll(Portals); + for (NetherPortal remove : _returnPortals) + { + available.remove(remove); + } + if (available.isEmpty()) + { + return; + } + NetherPortal portal = available.get(UtilMath.r(available.size())); + portal.open(duration); + for (NetherPortal returnPortal : _returnPortals) + { + returnPortal.open(-1); + } UtilTextMiddle.display(F.clansNether("Nether Portal"), "Has opened at " + F.elem(UtilWorld.locToStrClean(portal.getLocation()))); Bukkit.broadcastMessage(F.main(getName(), "A " + F.clansNether("Nether Portal") + " has opened at " + F.elem(UtilWorld.locToStrClean(portal.getLocation())) + " for " + F.elem(UtilTime.MakeStr(duration)) + "!")); - runSyncLater(() -> - { - portal.close(); - }, (duration / 1000) * 20); } public void spawnPortal() @@ -224,6 +230,10 @@ public class NetherManager extends MiniPlugin ClaimData data = Claiming.remove(creator); NetherPortal portal = new NetherPortal(data.getFirstCorner().getLocation(), data.getSecondCorner().getLocation(), returnPortal); Portals.add(portal); + if (returnPortal) + { + _returnPortals.add(portal); + } try { @@ -284,7 +294,6 @@ public class NetherManager extends MiniPlugin { Block block = event.getBlock(); Player player = event.getPlayer(); - ItemStack item = player.getItemInHand(); if (player.getGameMode() == GameMode.CREATIVE) { @@ -296,12 +305,8 @@ public class NetherManager extends MiniPlugin return; } - if (!item.getType().equals(Material.GOLD_PICKAXE)) - { - UtilPlayer.message(player, F.main("Clans", "You can only break blocks in the Nether with a " + F.elem("Golden Pickaxe") + ".")); - event.setCancelled(true); - return; - } + event.setCancelled(true); + UtilPlayer.message(player, F.main(getName(), "You cannot build in " + F.clansNether("The Nether") + "!")); } @EventHandler @@ -309,7 +314,6 @@ public class NetherManager extends MiniPlugin { Block block = event.getBlock(); Player player = event.getPlayer(); - ItemStack item = player.getItemInHand(); if (player.getGameMode() == GameMode.CREATIVE) { @@ -321,12 +325,8 @@ public class NetherManager extends MiniPlugin return; } - if (!UtilItem.isFromNether(item)) - { - UtilPlayer.message(player, F.main("Clans", "You can only place blocks here that come from " + F.clansNether("The Nether") + ".")); - event.setCancelled(true); - return; - } + event.setCancelled(true); + UtilPlayer.message(player, F.main(getName(), "You cannot build in " + F.clansNether("The Nether") + "!")); } @EventHandler(priority = EventPriority.HIGHEST) @@ -361,7 +361,7 @@ public class NetherManager extends MiniPlugin netherKeys.addAll(InNether.keySet()); for (Player player : netherKeys) { - if (UtilTime.elapsed(InNether.get(player), NETHER_ALLOWED_DURATION)) + if (System.currentTimeMillis() >= InNether.get(player)) { InNether.remove(player); if (isInNether(player)) @@ -374,12 +374,12 @@ public class NetherManager extends MiniPlugin } UtilServer.getPlayersCollection() - .stream() - .filter(player -> isInNether(player)) - .forEach(player -> { - player.setCompassTarget(new Location(_netherWorld, -200.d + UtilMath.r(400), player.getLocation().getY(), -200.d + UtilMath.r(400))); - ClansManager.getInstance().getItemMapManager().removeMap(player); - }); + .stream() + .filter(player -> isInNether(player)) + .forEach(player -> + { + ClansManager.getInstance().getItemMapManager().removeMap(player); + }); } } @@ -395,6 +395,14 @@ public class NetherManager extends MiniPlugin Claiming.remove(event.getPlayer()); } + @EventHandler(priority = EventPriority.LOWEST) + public void onQuit(PlayerDeathEvent event) + { + InNether.remove(event.getEntity()); + OverworldOrigins.remove(event.getEntity()); + Claiming.remove(event.getEntity()); + } + @EventHandler public void onTpHome(ClansCommandExecutedEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherPortal.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherPortal.java index 8db21cebf..fa6e8c14b 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherPortal.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/NetherPortal.java @@ -4,6 +4,8 @@ import java.util.List; 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.game.clans.clans.ClanTips.TipType; import mineplex.game.clans.clans.ClansManager; @@ -11,7 +13,6 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.block.BlockState; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -35,6 +36,9 @@ public class NetherPortal implements Listener private boolean _returnPortal; private byte _portalFacing; + public boolean Open = false; + public long Expire = -1; + public NetherPortal(Location firstCorner, Location secondCorner, boolean returnPortal) { int maxX = Math.max(firstCorner.getBlockX(), secondCorner.getBlockX()); @@ -111,23 +115,39 @@ public class NetherPortal implements Listener } @SuppressWarnings("deprecation") - public void open() + public void open(long duration) { - Bukkit.getPluginManager().registerEvents(this, ClansManager.getInstance().getPlugin()); - for (Block block : _frame) + if (Open) { - block.setType(Material.OBSIDIAN); + if (Expire != -1) + { + Expire = Expire + duration; + } } - for (Block block : _portal) + else { - block.setType(Material.PORTAL); - block.setData(_portalFacing); - Bukkit.broadcastMessage("Creating Portal Piece"); + if (!_returnPortal) + { + Expire = System.currentTimeMillis() + duration; + } + Open = true; + Bukkit.getPluginManager().registerEvents(this, ClansManager.getInstance().getPlugin()); + for (Block block : _frame) + { + block.setType(Material.OBSIDIAN); + } + for (Block block : _portal) + { + block.setType(Material.PORTAL); + block.setData(_portalFacing); + } } } public void close() { + Open = false; + Expire = -1; HandlerList.unregisterAll(this); for (Block block : _portal) { @@ -188,7 +208,9 @@ public class NetherPortal implements Listener } else { - ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), System.currentTimeMillis()); + ClansManager.getInstance().getNetherManager().InNether.put((Player)event.getEntity(), Expire); + Location from = event.getEntity().getLocation(); + ClansManager.getInstance().getNetherManager().OverworldOrigins.put((Player)event.getEntity(), from); event.getEntity().teleport(ClansManager.getInstance().getNetherManager().getNetherWorld().getSpawnLocation()); ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, (Player)event.getEntity()); } @@ -206,4 +228,17 @@ public class NetherPortal implements Listener event.setCancelled(true); } } + + @EventHandler + public void handleExpiration(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + { + return; + } + if (Open && Expire != -1 && System.currentTimeMillis() >= Expire) + { + close(); + } + } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CloseCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CloseCommand.java index cfc778e90..d6a456fad 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CloseCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CloseCommand.java @@ -8,6 +8,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.game.clans.clans.nether.NetherManager; +/** + * Command to close all nether portals + */ public class CloseCommand extends CommandBase { public CloseCommand(NetherManager plugin) @@ -18,7 +21,7 @@ public class CloseCommand extends CommandBase @Override public void Execute(Player caller, String[] args) { - UtilPlayer.message(caller, F.main(Plugin.getName(), "Closing all " + F.clansNether("Nether Portals" + "!"))); + UtilPlayer.message(caller, F.main(Plugin.getName(), "Closing all " + F.clansNether("Nether Portals") + "!")); Plugin.closePortals(); } } \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CreateCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CreateCommand.java index 0fe76df8b..c7395e4f3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CreateCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/CreateCommand.java @@ -8,6 +8,9 @@ import mineplex.game.clans.clans.nether.NetherManager; import org.bukkit.entity.Player; +/** + * Command to create a nether portal + */ public class CreateCommand extends CommandBase { public CreateCommand(NetherManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/DeleteCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/DeleteCommand.java index ebbc9dec8..2b6ac0f41 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/DeleteCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/DeleteCommand.java @@ -8,6 +8,9 @@ import mineplex.game.clans.clans.nether.NetherManager; import org.bukkit.entity.Player; +/** + * Command to delete a nether portal + */ public class DeleteCommand extends CommandBase { public DeleteCommand(NetherManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ForceTeleportCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ForceTeleportCommand.java new file mode 100644 index 000000000..5640d6526 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ForceTeleportCommand.java @@ -0,0 +1,63 @@ +package mineplex.game.clans.clans.nether.command; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.ClanTips.TipType; +import mineplex.game.clans.clans.ClansManager; +import mineplex.game.clans.clans.nether.NetherManager; +import mineplex.game.clans.spawn.Spawn; + +import org.bukkit.entity.Player; + +/** + * Command to artificially portal + */ +public class ForceTeleportCommand extends CommandBase +{ + public ForceTeleportCommand(NetherManager plugin) + { + super(plugin, Rank.ADMIN, "forcePortal"); + } + + @Override + public void Execute(Player caller, String[] args) + { + boolean natural = false; + + if (args.length > 0 && (args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("false"))) + { + natural = Boolean.parseBoolean(args[0]); + } + + if (Plugin.isInNether(caller)) + { + if (natural) + { + Plugin.InNether.remove(caller); + caller.teleport(Plugin.getReturnLocation(caller)); + Plugin.OverworldOrigins.remove(caller); + UtilPlayer.message(caller, F.main(ClansManager.getInstance().getNetherManager().getName(), "You have escaped " + F.clansNether("The Nether") + "!")); + } + else + { + caller.teleport(Spawn.getNorthSpawn()); + } + } + else + { + if (natural) + { + Plugin.InNether.put(caller, System.currentTimeMillis()); + Plugin.OverworldOrigins.put(caller, caller.getLocation()); + caller.teleport(Plugin.getNetherWorld().getSpawnLocation()); + ClansManager.getInstance().ClanTips.displayTip(TipType.ENTER_NETHER, caller); + } + else + { + caller.teleport(Plugin.getNetherWorld().getSpawnLocation()); + } + } + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ListCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ListCommand.java index b9bc31495..d475cf342 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ListCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/ListCommand.java @@ -6,6 +6,9 @@ import mineplex.game.clans.clans.nether.NetherManager; import org.bukkit.entity.Player; +/** + * Command to list all nether portals + */ public class ListCommand extends CommandBase { public ListCommand(NetherManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/PortalCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/PortalCommand.java index b0c0f1551..f39d5276f 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/PortalCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/PortalCommand.java @@ -8,6 +8,9 @@ import mineplex.game.clans.clans.nether.NetherManager; import org.bukkit.entity.Player; +/** + * Base portal command + */ public class PortalCommand extends MultiCommandBase { public PortalCommand(NetherManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/SpawnCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/SpawnCommand.java index 9ab0efd52..2763dff60 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/SpawnCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/SpawnCommand.java @@ -8,6 +8,9 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.game.clans.clans.nether.NetherManager; +/** + * Command to open a nether portal + */ public class SpawnCommand extends CommandBase { public SpawnCommand(NetherManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/WandCommand.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/WandCommand.java index 2e1bced57..ef57df1db 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/WandCommand.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/command/WandCommand.java @@ -6,6 +6,9 @@ import mineplex.game.clans.clans.nether.NetherManager; import org.bukkit.entity.Player; +/** + * Command to give yourself a portal creation wand + */ public class WandCommand extends CommandBase { public WandCommand(NetherManager plugin) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/data/ClaimData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/data/ClaimData.java index 2549921c9..96570e1be 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/data/ClaimData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/data/ClaimData.java @@ -2,20 +2,35 @@ package mineplex.game.clans.clans.nether.data; import org.bukkit.block.Block; +/** + * Data class to hold specified player portal corners + */ public class ClaimData { private Block _first, _second; + /** + * Fetches the first selected corner + * @return The first selected corner + */ public Block getFirstCorner() { return _first; } + /** + * Fetches the second selected corner + * @return The second selected corner + */ public Block getSecondCorner() { return _second; } + /** + * Fetches the total count of selected corners + * @return The number of selected corners + */ public int getTotalSelected() { int total = 2; @@ -31,11 +46,19 @@ public class ClaimData return total; } + /** + * Sets the first selected corner + * @param block The block to set the corner to + */ public void setFirstCorner(Block block) { _first = block; } + /** + * Sets the first selected corner + * @param block The block to set the corner to + */ public void setSecondCorner(Block block) { _second = block; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java index e52e58967..d486c3188 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/NetherMinibossManager.java @@ -19,7 +19,7 @@ import com.google.common.collect.Lists; public class NetherMinibossManager implements Listener { - private static final long TIME_BETWEEN_MINIBOSS_TARGET_PLAYER = 5000; + private static final long TIME_BETWEEN_MINIBOSS_TARGET_PLAYER = 10000; private NetherManager _manager; private boolean _allowSpawn = false; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java index 73b6841db..d41f3f8e1 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/ArcherMiniboss.java @@ -27,6 +27,9 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +/** + * Class for running an individual Archer miniboss + */ public class ArcherMiniboss extends NetherMiniBoss { private static final int BARBED_LEVEL = 1; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java index 15c642384..800106b0d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/GhastMiniboss.java @@ -14,6 +14,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.inventory.ItemStack; +/** + * Class for running an individual Ghast miniboss + */ public class GhastMiniboss extends NetherMiniBoss { private static final long MAIN_FIREBALL_COOLDOWN = 5000; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/PigmanMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/PigmanMiniboss.java index 2cc84b4aa..1e15f0758 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/PigmanMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/PigmanMiniboss.java @@ -11,6 +11,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.PigZombie; import org.bukkit.event.EventHandler; +/** + * Class for running an individual Pigman miniboss + */ public class PigmanMiniboss extends NetherMiniBoss { private static final double IRON_SKIN_CHANCE = .33; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java index 8d8a8fc17..2e275f6e4 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/nether/miniboss/bosses/WarriorMiniboss.java @@ -26,6 +26,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +/** + * Class for running an individual Warrior miniboss + */ public class WarriorMiniboss extends NetherMiniBoss { public WarriorMiniboss(String displayName, Double maxHealth, Location spawn, EntityType type)