From 69178d596d8b21f877235f65b5c0a3eb06c3d510 Mon Sep 17 00:00:00 2001 From: cockatoo2x Date: Tue, 9 Sep 2014 16:07:21 -0500 Subject: [PATCH] Added Files Added the source files never before been released! --- .classpath | 8 + .project | 17 + .settings/org.eclipse.jdt.core.prefs | 11 + bin/config.yml | 0 .../plugins/pvptower/PvpTower.class | Bin 0 -> 19522 bytes plugin.yml | 35 ++ src/config.yml | 0 .../cockatoo2x/plugins/pvptower/PvpTower.java | 403 ++++++++++++++++++ 8 files changed, 474 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 bin/config.yml create mode 100644 bin/ua/at/cockatoo2x/plugins/pvptower/PvpTower.class create mode 100644 plugin.yml create mode 100644 src/config.yml create mode 100644 src/ua/at/cockatoo2x/plugins/pvptower/PvpTower.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..e24838c --- /dev/null +++ b/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..eb7a78e --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + PvpTower + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7341ab1 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/bin/config.yml b/bin/config.yml new file mode 100644 index 0000000..e69de29 diff --git a/bin/ua/at/cockatoo2x/plugins/pvptower/PvpTower.class b/bin/ua/at/cockatoo2x/plugins/pvptower/PvpTower.class new file mode 100644 index 0000000000000000000000000000000000000000..e285c1189f8ab2f7ffb25b67ffa517962f1aba61 GIT binary patch literal 19522 zcmeHPdwdkt^*?8JXLoipA<2e^5s-}v1_%j0ikPSnk^sSw#3TfRB3+UJ7B;(acas!t z6_tW7TB}yU+E)7zTd7v7foOfuDz>)TmbTWmw%S_zuvTlIDp-HtduL`dv)P!~&*%4F zQ8tsg=bn4+d7pFd^7MZmdX$JxRoeWdFwNe( zMpJ1cZX}t!Mpq)vbYf%NNLThmV_ViI24a={k-k{EQVb<}wpP}gKdYIvGrMBZcr<-B zlc#KU2d391x{Uxa*E4(kfuTm_ zCzZ`^bikRftMh0&&G6H4ZY1WQPGKr#Dg+Xfw<{y@$VP$d1UD{IW|b}=U_OCn`sqZb z8IEOhf$B7iPGXvnG&Tw;CF_O6z?g+)PJ-QXtac8$kXFy`2tquwb(%wSne>#A?(4M# zDuuX44A0Z4f+|f8H6}L7T}{KTq&D@Xqp`{u-bUjaE6verjZS7d`TUuwwc&Z;x@byB zpgY{%XN1#fKu z=yYrw?5#6WUCC%~Iw~}C?)xy;0k||8Gpd7h237m1is_`$n4C35r!(m+CO=kfiu6ER zC)&G~^tGjv*fj7iq8dLfcF}H*>9mAunS2`($(~4>>5MXyY0l~AJ6@SPuC`d~gbGqU zE%Vb-rej89yH3lg0gI&|{UnH;lw&bd-X%ic8g*JpO|Z>wQ$VIhGEH}BQZ99A(dk@j zHT9u35#JEq$aJb(5bz0j-It6AF;#8=`zwVEOla#h7}ri6ep3pUIACL+QgHCJdLKsh1qIYYZu|eoID5@@7z)hNcKN(&WQ64xm~y{4>f4XMbbSfl$G;Wm>xr3eNP zvYc$R%SdHB})d2>}?PofE>_C)9AEAr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)%X%T60_p;OLpcL&?x5PjKUJ#G=FWqj9jjC;XOiywn*9VF zvflaksVkMUl(R|IDsVMPHr2KB&`Ot0b?pjVAC*mYZ6B^G%ci>a9B#_Xrh34Gmbz@J z2d48vv#B0DY-53bSXiJX78dA=g#{X8VS(OQSfD)?mi#y_vItt#{N1>`CTQ_NH{Ou6 z_@NwNRE~Olet!EM<#wDHJOG4g z{Cz{<7T7PBAMfB$hm}PN?mA>Q@|Aov^3l-e#d8OhnuB!p9$qM(a0Otc9ehV5hE~#r zW>(XfFyi>?_n8F22A2VU9^CPWexG*~5JzsC$%3=6IFi~-`kMvf$YwJghAa?A8mpBL zDa-IrRRmqn54;eU9h|)XtwJz@dWoXaNCA)!-S(0;?1-GM=BR^j0_y4 zTm}B$jYE`YxtHF=_eLh-j@C3>8C!twoGju2c_`Cs%EPu(UaTxv8epd(RL0`yNdd-y zvO*qAU4=LztkX+((@oMkReF{#lGf>?H>pWlryucYuCz`KQR)O~odI4z0co8JT>|A;IkskqWB68Ek|XrT+0Z}j1E$f!zgNQXLPG$uEsyQ+~Iode%V$|F0=z9;};9 zp rsp = getServer().getServicesManager().getRegistration(Economy.class); + if (rsp == null) { + return false; + } + econ = rsp.getProvider(); + return econ != null; + } + + + //Commands + @SuppressWarnings("deprecation") + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ + Player player = (Player) sender; + if(commandLabel.equalsIgnoreCase("pvptcreatetower")){ + if(player.hasPermission("pvpt.setup.createtower")){ + if(args.length == 1){ + getConfig().createSection("towers." + args[0]); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Created the Tower: " + args[0]); + saveConfig(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] OOPS! Need one argument! Try: /pvptcreatetower "); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry but you need the permission: pvpt.setup.createtower to use this command!"); + } + }else if(commandLabel.equalsIgnoreCase("pvptsettowerspawn")){ + if(player.hasPermission("pvpt.setup.settowerspawn")){ + if(args.length == 1){ + if(getConfig().contains("towers." + args[0])){ + this.getConfig().set("towers." + args[0] + ".towerspawn" + ".X", player.getLocation().getBlockX()); + this.getConfig().set("towers." + args[0] + ".towerspawn" + ".Y", player.getLocation().getBlockY()); + this.getConfig().set("towers." + args[0] + ".towerspawn" + ".Z", player.getLocation().getBlockZ()); + this.getConfig().set("towers." + args[0] + ".towerspawn" + ".Yaw", player.getLocation().getYaw()); + this.getConfig().set("towers." + args[0] + ".towerspawn" + ".Pitch", player.getLocation().getPitch()); + this.getConfig().set("towers." + args[0] + ".towerspawn" + ".World", player.getLocation().getWorld().getName()); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Set Tower Spawn for Tower: " + args[0]); + saveConfig(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Cannot set spawn for a non-existant tower! Use /pvptcreatetower to create a tower!"); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] OOPS! Need one argument! Try: /pvptsettowerspawn "); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry but you need the permission: pvpt.setup.settowerspawn to use this command!"); + } + }else if(commandLabel.equalsIgnoreCase("pvptleave")){ + if(this.getConfig().contains("players." + player.getName() + ".towerIN")){ + int exitX = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".X"); + int exitY = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Y"); + int exitZ = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Z"); + int exitYaw = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Yaw"); + int exitPitch = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Pitch"); + World exitWorld = Bukkit.getWorld(this.getConfig().getString("players." + player.getName() + ".exitCoords" + ".World")); + Location playerExit = new Location(exitWorld, exitX, exitY, exitZ, exitYaw, exitPitch); + player.teleport(playerExit); + this.getConfig().set("players." + player.getName() + ".towerIN", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".X", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Y", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Z", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Yaw", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Pitch", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".World", null); + saveConfig(); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Successfully left the tower!"); + player.getInventory().clear(); + player.updateInventory(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] You can't leave an tower you are not in!"); + } + }else if(commandLabel.equalsIgnoreCase("pvptfood")){ + if(this.getConfig().contains("players." + player.getName() + ".towerIN")){ + player.setFoodLevel(20); + player.setHealth(20.0); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Food Healed!"); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] You are not allowed to use this command unless you are in a tower!"); + } + } + return false; + } + + //Registers Sign is a Sign + public boolean issign(Block block){ + if(block.getType()==Material.SIGN || block.getType()==Material.SIGN_POST || block.getType()==Material.WALL_SIGN){ + return true; + } + return false; + } + + //Check if player interacts with the sign + @SuppressWarnings("deprecation") + @EventHandler + public void onInteract(PlayerInteractEvent event){ + Player player = event.getPlayer(); + PlayerInventory pi = event.getPlayer().getInventory(); + if(event.getClickedBlock()==null){ + return; + } + if(issign(event.getClickedBlock())){ + Sign s =(Sign) event.getClickedBlock().getState(); + if(s.getLine(0).equalsIgnoreCase("newpvptjoin")){ + if(this.getConfig().contains("towers."+s.getLine(1))){ + if(player.hasPermission("pvpt.setup.newjoinsigns")){ + s.setLine(0, ChatColor.GOLD + "[PvP Tower]"); + s.update(); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] New Join Sign Created! Checking if useable..."); + saveConfig(); + if(getConfig().contains("towers." + s.getLine(1) + ".towerspawn")){ + s.setLine(3, ChatColor.GREEN + "JOIN NOW!"); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Sign Usable!"); + s.update(); + }else{ + s.setLine(3, ChatColor.RED + "Need Spawn!"); + player.sendMessage(ChatColor.RED + "[PvP Tower] Sign Not Usable!"); + s.update(); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry you don't have permission to make join signs: pvpt.setup.newjoinsigns"); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry that tower doesn't exist! Can't make Join Sign!"); + } + }else if(s.getLine(0).equals(ChatColor.GOLD + "[PvP Tower]")){ + if(s.getLine(3).equals(ChatColor.RED + "Need Spawn!")){ + if(this.getConfig().contains("towers." + s.getLine(1) + ".towerspawn")){ + s.setLine(3, ChatColor.GREEN + "JOIN NOW!"); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Sign Now Usable!"); + s.update(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sign not able to be updated!"); + } + }else if(s.getLine(3).equals(ChatColor.GREEN + "JOIN NOW!")){ + if(this.getConfig().contains("towers." + s.getLine(1) + ".towerspawn")){ + player.setGameMode(GameMode.SURVIVAL); + player.getInventory().clear(); + this.getConfig().set("players." + player.getName() + ".towerIN", s.getLine(1)); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".X", player.getLocation().getBlockX()); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Y", player.getLocation().getBlockY()); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Z", player.getLocation().getBlockZ()); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Yaw", player.getLocation().getYaw()); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Pitch", player.getLocation().getPitch()); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".World", player.getLocation().getWorld().getName()); + int joinX = this.getConfig().getInt("towers." + s.getLine(1) + ".towerspawn" + ".X"); + int joinY = this.getConfig().getInt("towers." + s.getLine(1) + ".towerspawn" + ".Y"); + int joinZ = this.getConfig().getInt("towers." + s.getLine(1) + ".towerspawn" + ".Z"); + int joinYaw = this.getConfig().getInt("towers." + s.getLine(1) + ".towerspawn" + ".Yaw"); + int joinPitch = this.getConfig().getInt("towers." + s.getLine(1) + ".towerspawn" + ".Pitch"); + World joinWorld = Bukkit.getWorld(this.getConfig().getString("towers." + s.getLine(1) + ".towerspawn" + ".World")); + Location towerSpawn = new Location(joinWorld, joinX, joinY, joinZ, joinYaw, joinPitch); + player.teleport(towerSpawn); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] You have joined the tower: " + s.getLine(1)); + saveConfig(); + if(player.hasPermission("pvpt.ingame.donor")){ + if(player.hasPermission("pvpt.ingame.donorplus")){ + if(player.hasPermission("pvpt.ingame.admin")){ + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Thanks for being a ADMIN! Please enjoy these items to use ingame!"); + pi.addItem(new ItemStack(Material.BOW, 1)); + pi.addItem(new ItemStack(Material.ARROW, 32)); + pi.addItem(new ItemStack(Material.IRON_SWORD, 1)); + Potion potion = new Potion(PotionType.FIRE_RESISTANCE); + pi.addItem(potion.toItemStack(3)); + player.updateInventory(); + }else{ + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Thanks for being a DONOR+! Please enjoy these items to use ingame!"); + pi.addItem(new ItemStack(Material.STONE_SWORD, 1)); + pi.addItem(new ItemStack(Material.BOW, 1)); + pi.addItem(new ItemStack(Material.ARROW, 32)); + Potion potion = new Potion(PotionType.FIRE_RESISTANCE); + pi.addItem(potion.toItemStack(2)); + player.updateInventory(); + } + }else{ + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Thanks for being a DONOR! Please enjoy these items to use ingame!"); + pi.addItem(new ItemStack(Material.WOOD_SWORD, 1)); + Potion potion = new Potion(PotionType.FIRE_RESISTANCE); + pi.addItem(potion.toItemStack(1)); + player.updateInventory(); + } + } + }else{ + s.setLine(3, ChatColor.RED + "Need Spawn!"); + s.update(); + } + }else if(s.getLine(2).equals(ChatColor.LIGHT_PURPLE + "CLICK HERE")){ + if(s.getLine(3).equals(ChatColor.LIGHT_PURPLE + "TO WIN!")){ + EconomyResponse r = econ.depositPlayer(player.getName(), 50.0); + if(r.transactionSuccess()){ + player.sendMessage(ChatColor.GREEN + "[PvP Tower] You just won $50 for compleating the PvP Tower!!!"); + Bukkit.broadcastMessage(ChatColor.AQUA + "[PvP Tower] " + player.getName() + " has just won the tower: " + s.getLine(1)); + int exitX = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".X"); + int exitY = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Y"); + int exitZ = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Z"); + int exitYaw = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Yaw"); + int exitPitch = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Pitch"); + World exitWorld = Bukkit.getWorld(this.getConfig().getString("players." + player.getName() + ".exitCoords" + ".World")); + Location playerExit = new Location(exitWorld, exitX, exitY, exitZ, exitYaw, exitPitch); + player.teleport(playerExit); + this.getConfig().set("players." + player.getName() + ".towerIN", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".X", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Y", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Z", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Yaw", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Pitch", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".World", null); + saveConfig(); + player.getInventory().clear(); + player.updateInventory(); + }else{ + Bukkit.broadcastMessage(ChatColor.GREEN + "[PvP Tower] " + player.getName() + " has just won the tower: " + s.getLine(1)); + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry an error ocurred and we were unable to award you your money!"); + int exitX = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".X"); + int exitY = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Y"); + int exitZ = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Z"); + int exitYaw = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Yaw"); + int exitPitch = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Pitch"); + World exitWorld = Bukkit.getWorld(this.getConfig().getString("players." + player.getName() + ".exitCoords" + ".World")); + Location playerExit = new Location(exitWorld, exitX, exitY, exitZ, exitYaw, exitPitch); + player.teleport(playerExit); + this.getConfig().set("players." + player.getName() + ".towerIN", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".X", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Y", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Z", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Yaw", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Pitch", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".World", null); + saveConfig(); + player.getInventory().clear(); + player.updateInventory(); + } + } + }else if(s.getLine(2).equals(ChatColor.DARK_PURPLE + "Click Me")){ + if(s.getLine(3).equals(ChatColor.DARK_PURPLE + "To Exit!")){ + int exitX = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".X"); + int exitY = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Y"); + int exitZ = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Z"); + int exitYaw = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Yaw"); + int exitPitch = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Pitch"); + World exitWorld = Bukkit.getWorld(this.getConfig().getString("players." + player.getName() + ".exitCoords" + ".World")); + Location playerExit = new Location(exitWorld, exitX, exitY, exitZ, exitYaw, exitPitch); + player.teleport(playerExit); + this.getConfig().set("players." + player.getName() + ".towerIN", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".X", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Y", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Z", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Yaw", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Pitch", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".World", null); + saveConfig(); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Successfully left the tower!"); + player.getInventory().clear(); + player.updateInventory(); + } + }else if(s.getLine(2).equals(ChatColor.AQUA + "Heal Your")){ + if(s.getLine(3).equals(ChatColor.AQUA + "Food Here!")){ + player.setFoodLevel(20); + player.setHealth(20.0); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] Food Healed!"); + } + } + }else if(s.getLine(0).equalsIgnoreCase("newpvptwin")){ + if(this.getConfig().contains("towers."+s.getLine(1))){ + if(this.getConfig().contains("towers." + s.getLine(1) + ".towerspawn")){ + if(player.hasPermission("pvpt.setup.newwinsigns")){ + s.setLine(0, ChatColor.GOLD + "[PvP Tower]"); + s.setLine(2, ChatColor.LIGHT_PURPLE + "CLICK HERE"); + s.setLine(3, ChatColor.LIGHT_PURPLE + "TO WIN!"); + player.sendMessage(ChatColor.GREEN + "[PvP Tower] New Victory Sign set for arena: " + s.getLine(1)); + s.update(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry you need this permission to make a victory sign: pvpt.setup.newwinsigns"); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Can't make the victory sign because the tower still needs a: Spawn Point!"); + } + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Can't make the victory sign because the tower doesn't exist at all!"); + } + }else if(s.getLine(0).equalsIgnoreCase("newpvptleave")){ + if(player.hasPermission("pvpt.setup.newleavesign")){ + s.setLine(0, ChatColor.GOLD + "[PvP Tower]"); + s.setLine(2, ChatColor.DARK_PURPLE + "Click Me"); + s.setLine(3, ChatColor.DARK_PURPLE + "To Exit!"); + s.update(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry you need this permission to make a PvPT Leave Sign: pvpt.setup.newleavesign"); + } + }else if(s.getLine(0).equalsIgnoreCase("newpvptfood")){ + if(player.hasPermission("pvpt.setup.food")){ + s.setLine(0, ChatColor.GOLD + "[PvP Tower]"); + s.setLine(2, ChatColor.AQUA + "Heal Your"); + s.setLine(3, ChatColor.AQUA + "Food Here!"); + s.update(); + }else{ + player.sendMessage(ChatColor.RED + "[PvP Tower] Sorry you need this permission to make a player food heal sign: pvpt.setup.newfoodhealsign"); + } + } + } + } + + //Death Checker + @EventHandler + public void onEntityDeath(EntityDeathEvent e){ + if (e.getEntity() instanceof Player){ + Player player = (Player)e.getEntity(); + String towerName = this.getConfig().getString("players." + player.getName() + ".towerIN"); + if(getConfig().contains("players." + player.getName() + ".towerIN")){ + player.setHealth(20.0); + int joinX = this.getConfig().getInt("towers." + towerName + ".towerspawn" + ".X"); + int joinY = this.getConfig().getInt("towers." + towerName + ".towerspawn" + ".Y"); + int joinZ = this.getConfig().getInt("towers." + towerName + ".towerspawn" + ".Z"); + int joinYaw = this.getConfig().getInt("towers." + towerName + ".towerspawn" + ".Yaw"); + int joinPitch = this.getConfig().getInt("towers." + towerName + ".towerspawn" + ".Pitch"); + World joinWorld = player.getWorld(); + Location towerSpawn = new Location(joinWorld, joinX, joinY, joinZ, joinYaw, joinPitch); + player.teleport(towerSpawn); + } + } + } + + //Server Disconnect + @SuppressWarnings("deprecation") + @EventHandler + public void onDisconnect(PlayerQuitEvent e){ + Player player = (Player) e.getPlayer(); + if(this.getConfig().contains("players." + player.getName() + ".towerIN")){ + int exitX = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".X"); + int exitY = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Y"); + int exitZ = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Z"); + int exitYaw = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Yaw"); + int exitPitch = this.getConfig().getInt("players." + player.getName() + ".exitCoords" + ".Pitch"); + World exitWorld = Bukkit.getWorld(this.getConfig().getString("players." + player.getName() + ".exitCoords" + ".World")); + Location playerExit = new Location(exitWorld, exitX, exitY, exitZ, exitYaw, exitPitch); + player.teleport(playerExit); + this.getConfig().set("players." + player.getName() + ".towerIN", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".X", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Y", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Z", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Yaw", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".Pitch", null); + this.getConfig().set("players." + player.getName() + ".exitCoords" + ".World", null); + saveConfig(); + player.getInventory().clear(); + player.updateInventory(); + } + } +} \ No newline at end of file