Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.AJ_HD.Koth;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Date;
- import java.util.Random;
- import java.util.TimeZone;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.block.Block;
- import org.bukkit.block.Chest;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.ConfigurationSection;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.enchantments.Enchantment;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.event.player.PlayerMoveEvent;
- import org.bukkit.event.player.PlayerQuitEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.Plugin;
- import org.bukkit.plugin.java.JavaPlugin;
- import com.sk89q.worldedit.bukkit.WorldEditPlugin;
- import com.sk89q.worldedit.bukkit.selections.Selection;
- /* 29: */
- /* 9: */
- /* 15: */
- /* 16: */
- /* 23: */
- /* 38: */
- /* 40: */
- /* 41: */
- /* 42: */public class Koth
- /* 43: */extends JavaPlugin
- /* 44: */implements Listener
- /* 45: */{
- /* 46: 47 */boolean claim = false;
- /* 47: 47 */boolean cl = false;
- /* 48: 47 */boolean st = false;
- /* 49: 47 */boolean hill = false;
- /* 50: 48 */boolean koth = false;
- /* 51: 49 */ArrayList<Player> inHill = new ArrayList<Player>();
- /* 52: 50 */ArrayList<Player> b = new ArrayList<Player>();
- /* 53: 51 */ArrayList<Player> control = new ArrayList<Player>();
- /* 54: 52 */ArrayList<ItemStack> item = new ArrayList<ItemStack>();
- /* 55: 53 */ArrayList<String> a = new ArrayList<String>();
- /* 56: 54 */ArrayList<String> k = new ArrayList<String>();
- /* 57: 56 */int controltime = 60;
- /* 58: 65 */int yMore = 0;
- /* 59: 65 */int yLess = 0;
- /* 60: 65 */int zLess = 0;
- /* 61: 65 */int zMore = 0;
- /* 62: 65 */int xLess = 0;
- /* 63: 65 */int xMore = 0;
- /* 64: */String lastControl;
- /* 65: */int time;
- /* 66: */int finish;
- /* 67: */String winner;
- /* 68: */int c;
- /* 69: */Koth ko;
- /* 70: */FileConfiguration cfg;
- /* 71: */String name;
- /* 72: */Chest chest;
- /* 73: */
- /* 74: */public void onEnable()
- /* 75: */{
- /* 76: 69 */this.ko = this;
- /* 77: 70 */Bukkit.getPluginManager().registerEvents(this, this);
- /* 78: 71 */getConfig().addDefault("AutoStartEnabled",
- Boolean.valueOf(false));
- /* 79: 72 */getConfig().addDefault("FirstStartTime", "10:00");
- /* 80: 73 */getConfig().addDefault("SecondStartTime", "22:00");
- /* 81: 74 */final ConfigurationSection section = getConfig()
- .getConfigurationSection("Koth");
- /* 82: 75 */Bukkit.getServer().getScheduler()
- .scheduleSyncRepeatingTask(this, new Runnable()
- /* 83: */{
- /* 84: */public void run()
- /* 85: */{
- /* 86: 79 */if (Koth.this.finish == 1)
- /* 87: */{
- /* 88: 80 */Block b = Bukkit.getWorld("world")
- .getBlockAt(
- Koth.this.ko.getConfig().getInt(
- "Koth." + Koth.this.name
- + ".chestX"),
- Koth.this.ko.getConfig().getInt(
- "Koth." + Koth.this.name
- + ".chestY"),
- Koth.this.ko.getConfig().getInt(
- "Koth." + Koth.this.name
- + ".chestZ"));
- /* 89: 81 */b.setType(Material.AIR);
- /* 90: 82 */Koth.this.name = "";
- /* 91: 83 */Koth.this.finish = 0;
- /* 92: */}
- /* 93: 85 */if (Koth.this.getConfig()
- .getConfigurationSection("Koth") == null) {
- /* 94: 86 */return;
- /* 95: */}
- /* 96: 88 */for (String key : section.getValues(false)
- .keySet()) {
- /* 97: 89 */Koth.this.k.add(key);
- /* 98: */}
- /* 99: 91 */if (Koth.this.ko.getConfig().getBoolean(
- "AutoStartEnable"))
- /* 100: */{
- /* 101: 92 */SimpleDateFormat dateFormat = new SimpleDateFormat(
- "HH:mm");
- /* 102: 93 */dateFormat.setTimeZone(TimeZone
- .getTimeZone("GMT"));
- /* 103: 94 */if ((dateFormat.format(new Date())
- .equals("10:00"))
- || (dateFormat.format(new Date())
- .equals("22:24")))
- /* 104: */{
- /* 105: 95 */Collections.shuffle(Koth.this.k);
- /* 106: 96 */Koth.this.name = ((String) Koth.this.k
- .get(0));
- /* 107: 97 */Bukkit
- .broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GREEN
- + " A koth is about to begin! The map coordinates will be released in a moment!");
- /* 108: 98 */Bukkit
- .getServer()
- .getScheduler()
- .scheduleSyncDelayedTask(Koth.this.ko,
- new Runnable()
- /* 109: */{
- /* 110: */public void run()
- /* 111: */{
- /* 112:102 */Bukkit
- .broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GREEN
- + " The koth has begun");
- /* 113:103 */Bukkit
- .broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GREEN
- + " The koth map is "
- + ChatColor.GRAY
- + Koth.this.name);
- /* 114:104 */Bukkit
- .broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GREEN
- + " The coordinates are "
- + ChatColor.YELLOW
- + "x"
- + Koth.this.ko
- .getConfig()
- .getString(
- new StringBuilder(
- "Koth.")
- .append(Koth.this.name)
- .append(".xMore")
- .toString())
- + " z"
- + Koth.this.ko
- .getConfig()
- .getString(
- new StringBuilder(
- "Koth.")
- .append(Koth.this.name)
- .append(".zMore")
- .toString()));
- /* 115:105 */Koth.this.koth = true;
- /* 116: */}
- /* 117:109 */
- }, 100L);
- /* 118:110 */Koth.this.c = Bukkit
- .getServer()
- .getScheduler()
- .scheduleSyncRepeatingTask(
- Koth.this.ko, new Runnable()
- /* 119: */{
- /* 120: */public void run()
- /* 121: */{
- /* 122:113 */Bukkit
- .broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GOLD
- + " The "
- + ChatColor.GRAY
- + Koth.this.name
- + ChatColor.GOLD
- + " coordinates are "
- + ChatColor.YELLOW
- + "x"
- + Koth.this.ko
- .getConfig()
- .getString(
- new StringBuilder(
- "Koth.")
- .append(Koth.this.name)
- .append(".xMore")
- .toString())
- + " z"
- + Koth.this.ko
- .getConfig()
- .getString(
- new StringBuilder(
- "Koth.")
- .append(Koth.this.name)
- .append(".zMore")
- .toString()));
- /* 123: */}
- /* 124:116 */
- }, 4800L, 7200L);
- /* 125: */}
- /* 126: */}
- /* 127: */}
- /* 128:122 */
- }, 0L, 1000L);
- /* 129:123 */getConfig().options().copyDefaults(true);
- /* 130:124 */saveConfig();
- /* 131: */}
- /* 132: */
- /* 133: */public void onDisable() {
- }
- /* 134: */
- /* 135: */public WorldEditPlugin getWE()
- /* 136: */{
- /* 137:133 */Plugin p = Bukkit.getServer().getPluginManager()
- .getPlugin("WorldEdit");
- /* 138:135 */if ((p instanceof WorldEditPlugin)) {
- /* 139:136 */return (WorldEditPlugin) p;
- /* 140: */}
- /* 141:138 */return null;
- /* 142: */}
- /* 143: */
- /* 144: */public boolean onCommand(CommandSender sender, Command command,
- String label, String[] args)
- /* 145: */{
- /* 146:145 */if ((sender instanceof Player))
- /* 147: */{
- /* 148:146 */Player player = (Player) sender;
- /* 149:147 */if (command.getName().equalsIgnoreCase("koth")) {
- player.sendMessage(ChatColor.GREEN + "If you need help do");
- player.sendMessage(ChatColor.GREEN + "/koth help");
- /* 150:148 */if (args.length == 1)
- /* 151: */{
- if (args[0].equalsIgnoreCase("help"))
- player.sendMessage(ChatColor.GOLD + "=-"
- + ChatColor.AQUA + "Koth" + ChatColor.GOLD
- + "-=");
- player.sendMessage(ChatColor.DARK_RED + "/koth start");
- player.sendMessage(ChatColor.DARK_RED + "/koth stop");
- player.sendMessage(ChatColor.DARK_RED + "/koth add"
- + ChatColor.RED
- + " Select with World Edit the Koth");
- player.sendMessage(ChatColor.DARK_RED + "/koth loot");
- player.sendMessage(ChatColor.DARK_RED
- + "/koth setchest"
- + ChatColor.RED
- + " Select the chest with World Edit it will be put in");
- player.sendMessage(ChatColor.YELLOW + "Made by AJ_HD <3");
- if (args[0].equalsIgnoreCase("start"))
- {
- if (player.isOp())
- /* 155: */{
- /* 156:151 */this.winner = "";
- /* 157:152 */Inventory i = Bukkit.createInventory(
- null, 27, "Koth Modes");
- /* 158:153 */ConfigurationSection section = getConfig()
- .getConfigurationSection("Koth");
- /* 159:154 */int iii = 0;
- /* 160:155 */for (String key : section.getValues(
- false).keySet())
- /* 161: */{
- /* 162:156 */ItemStack g1 = new ItemStack(
- Material.DIAMOND_SWORD);
- /* 163:157 */ItemMeta ii = g1.getItemMeta();
- /* 164:158 */ii.setDisplayName(key);
- /* 165:159 */g1.setItemMeta(ii);
- /* 166:160 */i.setItem(iii, g1);
- /* 167:161 */iii++;
- /* 168: */}
- /* 169:163 */player.openInventory(i);
- /* 170: */}
- /* 171: */}
- /* 172:166 */else if (args[0].equalsIgnoreCase("loot"))
- /* 173: */{
- /* 174:167 */Inventory in = Bukkit.createInventory(
- null, 27, "Koth Loot");
- /* 175: */
- /* 176:169 */ItemStack h = new ItemStack(
- Material.DIAMOND_HELMET);
- /* 177:170 */h.addEnchantment(
- Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- /* 178: */
- /* 179:172 */ItemStack c = new ItemStack(
- Material.DIAMOND_CHESTPLATE);
- c.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- ItemStack l = new ItemStack(
- Material.DIAMOND_LEGGINGS);
- l.addEnchantment(
- Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- ItemStack b = new ItemStack(
- Material.DIAMOND_BOOTS);b.addEnchantment(
- Enchantment.PROTECTION_ENVIRONMENTAL, 1);
- ItemStack s = new ItemStack(
- Material.DIAMOND_SWORD);
- s.addEnchantment(Enchantment.DAMAGE_ALL, 2);
- ItemStack e = new ItemStack(
- Material.ENDER_PEARL, 16);
- ItemStack g = new ItemStack(
- Material.GOLDEN_APPLE, 1, (short) 1);
- in.setItem(0, h);
- in.setItem(1, c);
- in.setItem(2, l);
- in.setItem(3, b);
- in.setItem(4, s);
- in.setItem(5, e);
- in.setItem(6, g);
- player.openInventory(in);
- /* 206: */}
- /* 207:199 */else if ((args[0].equalsIgnoreCase("stop")) &&
- /* 208:200 */(player.isOp()))
- /* 209: */{
- /* 210:201 */player.sendMessage(ChatColor.GOLD + "["
- + ChatColor.YELLOW + "HCFKoth" + ChatColor.GOLD
- + "]" + ChatColor.GOLD
- + " Koth has been stopped");
- /* 211:202 */this.koth = false;
- /* 212:203 */this.inHill.clear();
- /* 213:204 */this.control.clear();
- /* 214:205 */this.controltime = 6;
- /* 215:206 */getServer().getScheduler().cancelTask(
- this.c);
- /* 216:207 */this.st = false;
- /* 217: */
- /* 218:209 */this.k.clear();
- /* 219: */}
- /* 220: */}
- /* 221:212 */else if (args.length == 2) {
- /* 222:213 */if (args[0].equalsIgnoreCase("add"))
- /* 223: */{
- /* 224:214 */if (player.isOp())
- /* 225: */{
- /* 226:215 */Selection s = getWE().getSelection(
- player);
- /* 227:216 */if (s == null)
- /* 228: */{
- /* 229:217 */player.sendMessage(ChatColor.RED
- + "Make a selection first");
- /* 230:218 */return true;
- /* 231: */}
- /* 232:220 */player.sendMessage(ChatColor.GOLD
- + "[" + ChatColor.YELLOW + "HCFKoth"
- + ChatColor.GOLD + "]" + ChatColor.GOLD
- + " Koth added");
- /* 233:221 */String name = args[1];
- /* 234:222 */int xMore = s.getMinimumPoint()
- .getBlockX();
- /* 235:223 */int zMore = s.getMinimumPoint()
- .getBlockZ();
- /* 236:224 */int yMore = s.getMinimumPoint()
- .getBlockY();
- /* 237:225 */int xLess = s.getMaximumPoint()
- .getBlockX();
- /* 238:226 */int zLess = s.getMaximumPoint()
- .getBlockZ();
- /* 239:227 */int yLess = s.getMaximumPoint()
- .getBlockY();
- /* 240:228 */getConfig().set(
- "Koth." + name + ".xMore",
- Integer.valueOf(xMore));
- /* 241:229 */getConfig().set(
- "Koth." + name + ".xLess",
- Integer.valueOf(xLess));
- /* 242:230 */getConfig().set(
- "Koth." + name + ".zMore",
- Integer.valueOf(zMore));
- /* 243:231 */getConfig().set(
- "Koth." + name + ".zLess",
- Integer.valueOf(zLess));
- /* 244:232 */getConfig().set(
- "Koth." + name + ".yMore",
- Integer.valueOf(yMore));
- /* 245:233 */getConfig().set(
- "Koth." + name + ".yLess",
- Integer.valueOf(yLess));
- /* 246:234 */saveConfig();
- /* 247: */}
- /* 248: */}
- if ((args[0].equalsIgnoreCase("chest")) &&
- (player.isOp()))
- {
- Selection s = getWE().getSelection(player);
- if (s == null)
- {
- player.sendMessage(ChatColor.RED + "Make a selection first");
- return true;
- }
- player.sendMessage(ChatColor.GOLD + "[" + ChatColor.YELLOW + "HCFKoth" + ChatColor.GOLD + "]" + ChatColor.GOLD + " Koth chest added");
- String name = args[1];
- int x = s.getMinimumPoint().getBlockX();
- int z = s.getMinimumPoint().getBlockZ();
- int y = s.getMinimumPoint().getBlockY();
- getConfig().set("Koth." + name + ".xChest", Integer.valueOf(x));
- getConfig().set("Koth." + name + ".zChest", Integer.valueOf(z));
- getConfig().set("Koth." + name + ".yChest", Integer.valueOf(y));
- saveConfig();
- }
- }
- }
- }
- return false;
- /* 272: */}
- /* 273: */
- /* 274: */@EventHandler
- /* 275: */ public void q(PlayerMoveEvent event)
- /* 276: */ {
- /* 277:267 */ Player player = event.getPlayer();
- /* 278:268 */ Location loc = player.getLocation();
- /* 279:269 */ double x = loc.getBlockX();
- /* 280:270 */ double z = loc.getBlockZ();
- /* 281:271 */ if (this.koth) {
- /* 282:273 */ if ((x > getConfig().getDouble("Koth." + this.name + ".xMore")) && (x < getConfig().getDouble("Koth." + this.name + ".xLess")) && (z < getConfig().getDouble("Koth." + this.name + ".zLess")) && (z > getConfig().getDouble("Koth." + this.name + ".zMore")) && (loc.getBlockY() > getConfig().getDouble("Koth." + this.name + ".yMore")) && (loc.getBlockY() < getConfig().getDouble("Koth." + this.name + ".yLess")))
- /* 283: */ {
- /* 284:274 */ if (!this.inHill.contains(player))
- /* 285: */ {
- /* 286:275 */ this.inHill.add(player);
- /* 287:276 */ player.sendMessage(ChatColor.GOLD + "[" + ChatColor.YELLOW + "HCFKoth" + ChatColor.GOLD + "] " + ChatColor.GOLD + "Entering" + ChatColor.YELLOW + " cap zone");
- /* 288: */ }
- /* 289:278 */ if (this.control.isEmpty())
- /* 290: */ {
- /* 291: */ Player p;
- /* 293:280 */ if (this.inHill.size() == 1)
- /* 294: */ {
- p = player;
- }
- else
- {
- Collections.shuffle(this.inHill);
- p = (Player)this.inHill.get(0);
- }
- this.control.add(p);
- this.lastControl = p.getName();
- this.time = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
- {
- public void run()
- {
- if ((Koth.this.controltime % 30 == 0) && (Koth.this.controltime > 0))
- {
- int minutes = Koth.this.controltime % 3600 / 60;
- int seconds = Koth.this.controltime % 60;
- String t = String.format("%02d:%02d", new Object[] { Integer.valueOf(minutes), Integer.valueOf(seconds) });
- Bukkit.broadcastMessage(ChatColor.GOLD + "[" + ChatColor.YELLOW + "HCFKoth" + ChatColor.GOLD + "] " + ChatColor.GREEN + Koth.this.name + ChatColor.GOLD + " is being controlled by " + ChatColor.GREEN + p.getName() + ChatColor.GREEN + " (" + ChatColor.WHITE + t + ChatColor.WHITE + ")");
- }
- if (Koth.this.controltime == 0)
- {
- Bukkit.broadcastMessage(ChatColor.GOLD + "[" + ChatColor.YELLOW + "HCFKoth" + ChatColor.GOLD + "]" + ChatColor.YELLOW + " " + ChatColor.RED + p.getName() + ChatColor.YELLOW + " has won the Koth.");
- Koth.this.getServer().getScheduler().cancelTask(Koth.this.time);
- Koth.this.koth = false;
- Koth.this.inHill.clear();
- Koth.this.control.clear();
- Koth.this.controltime = 60;
- Koth.this.st = false;
- Koth.this.k.clear();
- Koth.this.winner = p.getName();
- Koth.this.getServer().getScheduler().cancelTask(Koth.this.c);
- Block b = Bukkit.getWorld(p.getWorld().getName()).getBlockAt(Koth.this.ko.getConfig().getInt("Koth." + Koth.this.name + ".xChest"), Koth.this.ko.getConfig().getInt("Koth." + Koth.this.name + ".yChest"), Koth.this.ko.getConfig().getInt("Koth." + Koth.this.name + ".zChest"));
- b.setType(Material.CHEST);
- Koth.this.chest = ((Chest)b.getState());
- Koth.this.winner = p.getName();
- if ((b.getState() instanceof Chest))
- {
- ArrayList<ItemStack> toAdd = new ArrayList<ItemStack>();
- int percentage = new Random().nextInt(100);
- int addUntilPercentage = 0;
- ItemStack g = new ItemStack(Material.GOLD_BLOCK, 32 );
- ItemStack d = new ItemStack(Material.DIAMOND_BLOCK, 32);
- addUntilPercentage += 30;
- if(addUntilPercentage >= percentage) {toAdd.add(g); toAdd.add(d);}
- else{
- ItemStack e = new ItemStack(Material.GOLDEN_APPLE, 2);
- ItemStack ds1 = new ItemStack(Material.DIAMOND_SWORD);
- ds1.addEnchantment(Enchantment.KNOCKBACK, 1);
- addUntilPercentage += 25;
- if(addUntilPercentage >= percentage) {toAdd.add(e); toAdd.add(ds1);}
- else{
- ItemStack w = new ItemStack(Material.ENDER_PEARL, 64);
- ItemStack p = new ItemStack(Material.SULPHUR, 64);
- addUntilPercentage += 15;
- if(addUntilPercentage >= percentage) {toAdd.add(w); toAdd.add(p);}
- else{
- ItemStack s = new ItemStack(Material.SLIME_BALL, 64);
- ItemStack dp1 = new ItemStack(Material.DIAMOND_PICKAXE);
- dp1.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3);
- dp1.addEnchantment(Enchantment.DIG_SPEED, 4);
- addUntilPercentage += 15;
- if(addUntilPercentage >= percentage) {toAdd.add(s); toAdd.add(dp1);}
- else{
- ItemStack b1 = new ItemStack(Material.BEACON, 1);
- ItemStack ds2 = new ItemStack(Material.DIAMOND_SWORD);
- ds2.addEnchantment(Enchantment.LOOT_BONUS_MOBS, 3);
- ds2.addEnchantment(Enchantment.DAMAGE_ALL, 1);
- addUntilPercentage += 15;
- if(addUntilPercentage >= percentage) {toAdd.add(b1); toAdd.add(ds2);}
- }
- }
- }
- int index = 0;
- for(ItemStack add : toAdd){
- Koth.this.chest.getInventory().setItem(index, add);
- index++;
- }
- }
- }
- }
- Koth.this.controltime -= 1;
- Koth.this.finish = 1;
- }
- }, 0L, 20L);
- }
- }
- else if (this.inHill.contains(player))
- {
- this.inHill.remove(player);
- if (this.control.contains(player))
- {
- getServer().getScheduler().cancelTask(this.time);
- this.controltime = 60;
- this.control.remove(player);
- }
- player.sendMessage(ChatColor.GOLD + "[" + ChatColor.YELLOW + "HCFKoth" + ChatColor.GOLD + "] " + ChatColor.GOLD + "Leaving" + ChatColor.YELLOW + " cap zone");
- }
- }
- }
- @EventHandler
- public void InventoryClick(InventoryClickEvent event) {
- if (event.getInventory().getName().equalsIgnoreCase("Koth Loot")) {
- event.setCancelled(true);
- } else if (event.getInventory().getName()
- .equalsIgnoreCase("Koth Modes")) {
- Player player = (Player) event.getWhoClicked();
- ItemStack clicked = event.getCurrentItem();
- if (clicked.getType() == Material.DIAMOND_SWORD) {
- ItemMeta i = clicked.getItemMeta();
- final String n = i.getDisplayName();
- event.setCancelled(true);
- Bukkit.broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GREEN
- + " A koth is about to begin! The map coordinates will be shown shortly!");
- Bukkit.getServer().getScheduler()
- .scheduleSyncDelayedTask(this, new Runnable() {
- public void run() {
- Koth.this.name = n;
- Bukkit
- .broadcastMessage(ChatColor.GOLD + "["
- + ChatColor.YELLOW + "HCFKoth"
- + ChatColor.GOLD + "]"
- + ChatColor.GREEN
- + " The koth has begun");
- Bukkit
- .broadcastMessage(ChatColor.GOLD + "["
- + ChatColor.YELLOW + "HCFKoth"
- + ChatColor.GOLD + "]"
- + ChatColor.GREEN
- + " The koth map is "
- + ChatColor.GRAY
- + Koth.this.name);
- Bukkit
- .broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GREEN
- + " The coordinates are "
- + ChatColor.YELLOW
- + "x"
- + Koth.this.ko
- .getConfig()
- .getString(
- new StringBuilder(
- "Koth.")
- .append(Koth.this.name)
- .append(".xMore")
- .toString())
- + " z"
- + Koth.this.ko
- .getConfig()
- .getString(
- new StringBuilder(
- "Koth.")
- .append(Koth.this.name)
- .append(".zMore")
- .toString()));
- Koth.this.koth = true;
- }
- }, 100L);
- this.c = Bukkit.getServer().getScheduler()
- .scheduleSyncRepeatingTask(this, new Runnable()
- {
- public void run() {
- Bukkit.broadcastMessage(ChatColor.GOLD
- + "["
- + ChatColor.YELLOW
- + "HCFKoth"
- + ChatColor.GOLD
- + "]"
- + ChatColor.GOLD
- + " The "
- + ChatColor.GRAY
- + Koth.this.name
- + ChatColor.GOLD
- + " coordinates are "
- + ChatColor.YELLOW
- + "x"
- + Koth.this.ko.getConfig().getString(
- new StringBuilder("Koth.")
- .append(Koth.this.name)
- .append(".xMore")
- .toString())
- + " z"
- + Koth.this.ko.getConfig().getString(
- new StringBuilder("Koth.")
- .append(Koth.this.name)
- .append(".zMore")
- .toString()));
- }
- }, 4800L, 7200L);
- player.closeInventory();
- }
- }
- }
- @EventHandler
- public void q(PlayerInteractEvent event)
- {
- if ((event.getAction() == Action.RIGHT_CLICK_BLOCK) &&
- (event.getClickedBlock().getType() == Material.CHEST))
- {
- Block b = event.getClickedBlock();
- if ((b.getLocation().getBlockX() == -543)
- && (b.getLocation().getBlockY() == 67)
- && (b.getLocation().getBlockZ() == 1840) &&
- (event.getPlayer().getName() != this.winner))
- {
- event.getPlayer().sendMessage(
- ChatColor.GRAY + "[" + ChatColor.AQUA + "KOTH"
- + ChatColor.GRAY + "]" + ChatColor.RED
- + " Only the Koth winner can open this chest");
- event.setCancelled(true);
- }
- }
- }
- @EventHandler
- public void p(PlayerQuitEvent event)
- {
- final Player player = event.getPlayer();
- if (this.koth) {
- Bukkit.getServer().getScheduler()
- .scheduleSyncDelayedTask(this, new Runnable() {
- public void run() {
- if (Koth.this.inHill.contains(player)) {
- Koth.this.inHill.remove(player);
- }
- if (Koth.this.control.contains(player)) {
- Koth.this.getServer().getScheduler()
- .cancelTask(Koth.this.time);
- Koth.this.control.remove(player);
- Koth.this.controltime = 60;
- }
- }
- }, 20L);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement