diff --git a/src/me/despawningbone/HLR/CHlistener.java b/src/me/despawningbone/HLR/CHlistener.java new file mode 100644 index 0000000..0237e45 --- /dev/null +++ b/src/me/despawningbone/HLR/CHlistener.java @@ -0,0 +1,156 @@ +package me.despawningbone.HLR; + +import java.io.*; +import java.util.List; + +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.Hopper; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.block.*; +import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + + +public class CHlistener implements Listener { + + private HLRmain plugin; + + public CHlistener(HLRmain instance) { + plugin = instance; + } + + @EventHandler + public void onBlockPlace(BlockPlaceEvent event){ + Player player = (Player) event.getPlayer(); + String world = event.getBlock().getWorld().getName(); + ItemMeta blockMeta = player.getItemInHand().getItemMeta(); + ItemStack block = player.getItemInHand(); + if(blockMeta.hasDisplayName() && block.getType() == Material.HOPPER) + { + if(blockMeta.getDisplayName().equals(HLRmain.CHname)){ + File DataFile = new File(plugin.getDataFolder() + File.separator + + "Data.yml"); + YamlConfiguration DFile = YamlConfiguration.loadConfiguration(DataFile);; + if(plugin.isEnabledIn(world)) + { + double x = event.getBlock().getX(); + double y = event.getBlock().getY(); + double z = event.getBlock().getZ(); + //player.sendMessage(String.valueOf(x)); //debug + //player.sendMessage(String.valueOf(y)); //debug + //player.sendMessage(String.valueOf(z)); //debug + String coord = x + "," + y + "," + z; + //player.sendMessage(coord); //debug + List coordlist = DFile.getStringList(world); + coordlist.add(coord); + DFile.set(world, coordlist); + try { + DFile.save(plugin.getDataFolder() + File.separator + + "Data.yml"); + } catch (IOException e) { + e.printStackTrace(); + } + player.sendMessage(ChatColor.YELLOW + "You placed a " + HLRmain.CHname + ChatColor.YELLOW + "!"); + } else { + player.sendMessage(HLRmain.CHname + ChatColor.RED + " is not enabled in this world!"); + event.setCancelled(true); + } + } + } + } + @EventHandler + public void onBlockBreak(BlockBreakEvent event){ + Player player = (Player) event.getPlayer(); + String world = event.getBlock().getWorld().getName(); + //player.sendMessage(world); + if(plugin.isEnabledIn(world)) + { + File DataFile = new File(plugin.getDataFolder() + File.separator + + "Data.yml"); + YamlConfiguration DFile = YamlConfiguration.loadConfiguration(DataFile); + double x = event.getBlock().getX(); + double y = event.getBlock().getY(); + double z = event.getBlock().getZ(); + //player.sendMessage(String.valueOf(x)); //debug + //player.sendMessage(String.valueOf(y)); //debug + //player.sendMessage(String.valueOf(z)); //debug + String coord = x + "," + y + "," + z; + //player.sendMessage(coord); //debug + if(DFile.getStringList(world).contains(coord)) + { + List coordlist = DFile.getStringList(world); + coordlist.remove(coord); + DFile.set(world, coordlist); + player.sendMessage(ChatColor.RED + "You destroyed a " + HLRmain.CHname + ChatColor.RED + "!"); + try { + DFile.save(plugin.getDataFolder() + File.separator + + "Data.yml"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + @EventHandler + public void onItemSpawn(ItemSpawnEvent event){ + ItemStack item = event.getEntity().getItemStack(); + //plugin.log.info(item.getType().toString()); //debug + World world = event.getEntity().getWorld(); + String worldname = world.getName(); + //plugin.log.info(worldname); //debug + if(ConfigHandler.itemList.contains(item) && plugin.isEnabledIn(worldname)){ + File DataFile = new File(plugin.getDataFolder() + File.separator + + "Data.yml"); + YamlConfiguration DFile = YamlConfiguration.loadConfiguration(DataFile); + List list = DFile.getStringList(worldname); + //plugin.log.info("this item is in the list."); //debug + for (int i = 0; i < list.size(); i++) { + double itemx = event.getEntity().getLocation().getX(); + double itemz = event.getEntity().getLocation().getZ(); + String coord = list.get(i); + //plugin.log.info(coord); //debug + String[] coords = coord.split(","); + double blockx = Double.parseDouble(coords[0]); + double blocky = Double.parseDouble(coords[1]); + double blockz = Double.parseDouble(coords[2]); + //plugin.log.info(String.valueOf(blockx)); //debug + //plugin.log.info(String.valueOf(blocky)); //debug + //plugin.log.info(String.valueOf(blockz)); //debug + //plugin.log.info(String.valueOf(itemx)); //debug + //plugin.log.info(String.valueOf(itemz)); //debug + double bchunkx = Math.floor(blockx / 16); + double bchunkz = Math.floor(blockz / 16); + double ichunkx = Math.floor(itemx / 16); + double ichunkz = Math.floor(itemz / 16); + Chunk blockChunk = world.getChunkAt((int) bchunkx,(int) bchunkz); + Chunk itemChunk = world.getChunkAt((int) ichunkx,(int) ichunkz); + //plugin.log.info(itemChunk.toString()); //debug + //plugin.log.info(blockChunk.toString()); //debug + //plugin.log.info(String.valueOf(itemChunk.equals(blockChunk))); //debug + if(itemChunk == blockChunk){ + //plugin.log.info("found hopper in chunk of item"); //debug + Location blockcoord = new Location(world , blockx, blocky, blockz); + //plugin.log.info(blockcoord.getBlock().getType().toString()); //debug + Block block = blockcoord.getBlock(); + Hopper hopper = (Hopper) block.getState(); + Inventory hopperInv = hopper.getInventory(); + if(hopperInv.firstEmpty() != -1){ + event.getEntity().remove(); + hopperInv.addItem(item); + break; + } + } + } + } + } +} \ No newline at end of file diff --git a/src/me/despawningbone/HLR/ConfigHandler.java b/src/me/despawningbone/HLR/ConfigHandler.java new file mode 100644 index 0000000..22e37fa --- /dev/null +++ b/src/me/despawningbone/HLR/ConfigHandler.java @@ -0,0 +1,186 @@ +package me.despawningbone.HLR; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; + +import me.despawningbone.HLR.HLRmain; +import net.md_5.bungee.api.ChatColor; + +import org.bukkit.Material; +import org.bukkit.command.CommandSender; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.inventory.ItemStack; + +public class ConfigHandler { + + private HLRmain plugin; + + private FileConfiguration config; + private File configFile; + double fee; + boolean useEco; + boolean useCrops; + boolean useMobDrops; + boolean usePerms; + static long time; + boolean cooldown; + List customitems; + String tempname; + List hopperlore; + int maxamount; + public static ArrayList itemList = new ArrayList(); + + public static Logger log = HLRmain.log; //debug + + /** + * Constuctor for ConfigHandler, Runs the createConfig() method. + */ + public ConfigHandler(HLRmain instance) { + plugin = instance; + config = plugin.getConfig(); + createConfig(); + getConfigValues(); + } + + /** + * Copys configuration from defaults and makes it into a file. + */ + public void createConfig() { + File configFile = new File(plugin.getDataFolder() + File.separator + + "config.yml"); + if (!configFile.exists()) { + // Tells console its creating a config.yml + HLRmain.log.info("Cannot find config.yml, Generating now...."); + plugin.saveDefaultConfig(); + HLRmain.log.info("Config generated !"); + } + } + public void createDataFile() { + File DataFile = new File(plugin.getDataFolder() + File.separator + + "Data.yml"); + if (!DataFile.exists()) { + // Tells console its creating a Data.yml + HLRmain.log.info("Cannot find Data.yml, Generating now...."); + HLRmain.log.info("Data file generated !"); + } + } + + + /** + * Reloads the configuration and sends the sender a message. + * + * @param sender CommandSender player/console + * @param message String to send on completion + */ + public void reloadConfig(CommandSender sender, String message) { + plugin.reloadConfig(); + config = plugin.getConfig(); + getConfigValues(); + initConfigValues(); + sender.sendMessage(message); + } + + /** + * Gets the config from the plugin. + * + * @return the Configuration + */ + public FileConfiguration getConfig() { + return config; + } + + /** + * Gets the actual file from the system. + * + * @return the Configuration File + */ + public File getConfigFile() { + return configFile; + } + + /** + * Gets all configuration values + */ + public void getConfigValues() { + HLRmain.enabledWorlds = config.getStringList("Enabled-in-worlds"); + useEco = config.getBoolean("Eco.Use"); + fee = config.getDouble("Eco.Conversion-fee"); + customitems = config.getStringList("ItemList.Custom-items"); + usePerms = config.getBoolean("Use-permissions"); + tempname = config.getString("Hopper-name"); + time = config.getLong("Cooldown.Seconds") * 20; + cooldown = config.getBoolean("Cooldown.Enable"); + hopperlore = config.getStringList("Hopper-lore"); + useMobDrops = config.getBoolean("ItemList.Mob-drops"); + useCrops = config.getBoolean("ItemList.Crops"); + maxamount = config.getInt("Max-amount"); + } + + public void initConfigValues() { + //log.info("setting up economy..."); //debug + //log.info(("useEco = " + String.valueOf(useEco))); //debug + //log.info(String.valueOf(fee)); + if (useEco) { + if (!plugin.setupEconomy()) { + log.severe("Disabling due to no Vault dependency found!"); + plugin.getServer().getPluginManager().disablePlugin(plugin); + return; + } + } + HLRmain.CHname = ChatColor.translateAlternateColorCodes('&', tempname); + //log.info(String.valueOf(time)); //debug + //log.info(HLRmain.CHname); //debug + //log.info(("useCrops = " + String.valueOf(useCrops))); //debug + //log.info(("useMobDrops = " + String.valueOf(useMobDrops))); //debug + if(!itemList.isEmpty()){ + itemList.clear(); + //log.info("itemList cleared"); //debug + } + if(useCrops){ + //crops + //log.info("adding crops to itemlist..."); //debug + itemList.add(new ItemStack(Material.PUMPKIN)); itemList.add(new ItemStack(Material.CACTUS)); itemList.add(new ItemStack(Material.WHEAT)); + itemList.add(new ItemStack(Material.CARROT_ITEM)); itemList.add(new ItemStack(Material.SUGAR_CANE)); itemList.add(new ItemStack(Material.MELON)); + itemList.add(new ItemStack(Material.SEEDS)); itemList.add(new ItemStack(Material.POTATO_ITEM)); itemList.add(new ItemStack(Material.POISONOUS_POTATO)); + itemList.add(new ItemStack(Material.RED_MUSHROOM)); itemList.add(new ItemStack(Material.BROWN_MUSHROOM)); itemList.add(new ItemStack(Material.NETHER_WARTS)); + + } + if(useMobDrops){ + //mob drops + //log.info("adding mobdrops to itemlist..."); //debug + itemList.add(new ItemStack(Material.FEATHER)); itemList.add(new ItemStack(Material.RAW_CHICKEN)); itemList.add(new ItemStack(Material.LEATHER)); itemList.add(new ItemStack(Material.SPIDER_EYE)); + itemList.add(new ItemStack(Material.ENDER_PEARL)); itemList.add(new ItemStack(Material.RAW_BEEF)); itemList.add(new ItemStack(Material.PORK)); itemList.add(new ItemStack(Material.SLIME_BALL)); + itemList.add(new ItemStack(Material.WOOL)); itemList.add(new ItemStack(Material.ARROW)); itemList.add(new ItemStack(Material.SULPHUR)); itemList.add(new ItemStack(Material.GOLD_NUGGET)); + itemList.add(new ItemStack(Material.IRON_INGOT)); itemList.add(new ItemStack(Material.MUTTON)); itemList.add(new ItemStack(Material.BONE)); itemList.add(new ItemStack(Material.INK_SACK)); + itemList.add(new ItemStack(Material.BLAZE_ROD)); itemList.add(new ItemStack(Material.ROTTEN_FLESH)); itemList.add(new ItemStack(Material.STRING)); + + } + if (!customitems.isEmpty()) { + for (int i=0;i < customitems.size();i++) + { + String itemname = customitems.get(i); + itemname.toUpperCase(); + Material material = Material.getMaterial(itemname); + itemList.add(new ItemStack(material)); + } + } /* else { + //log.info("custom item list is Empty"); // debug + } */ + if(!HLRmain.hopperlore.isEmpty()){ + HLRmain.hopperlore.clear(); + //log.info("itemList cleared"); + } + if (!hopperlore.isEmpty()) { + for (int i=0;i < hopperlore.size();i++) + { + //log.info(String.valueOf(hopperlore.size())); + String lore = hopperlore.get(i); + lore = ChatColor.translateAlternateColorCodes('&', lore); + //log.info(("hopperlore: " + String.valueOf(lore))); //debug + HLRmain.hopperlore.add(lore); + } + } + } +} diff --git a/src/me/despawningbone/HLR/HLRCommandMain.java b/src/me/despawningbone/HLR/HLRCommandMain.java new file mode 100644 index 0000000..ed94a6d --- /dev/null +++ b/src/me/despawningbone/HLR/HLRCommandMain.java @@ -0,0 +1,126 @@ +package me.despawningbone.HLR; + +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +public class HLRCommandMain implements CommandExecutor { + + private HLRmain plugin; + + //public static Logger log; //debug + + + public HLRCommandMain(HLRmain instance) { + plugin = instance; + } + + public static boolean confirm = false; + public static boolean start = false; + public static Player executor; + public ConfigHandler configHandler; + + static boolean canUseCommand = true; + static boolean paying = false; + static String playername; + static Player recipient; + + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + boolean convert = false; + configHandler = new ConfigHandler(plugin); + //String sstart = String.valueOf(start); //debug + //sender.sendMessage(sstart); //debug + if (sender instanceof Player) { + Player player = (Player) sender; + executor = player; + double fee = configHandler.fee; + boolean useEco = configHandler.useEco; + + double money = 0; + if (useEco){ + money = HLRmain.getMoney(player); + //player.sendMessage(String.valueOf(money)); //debug + //player.sendMessage(String.valueOf(fee)); //debug + } + if (configHandler.usePerms) { + canUseCommand = player.hasPermission("HLR.convert"); + } + if (!canUseCommand) + sender.sendMessage(ChatColor.RED + "You don't have permissions to do that."); + + if (canUseCommand && fee > 0 && useEco) { + paying = true; + if (money < fee) { + canUseCommand = false; + player.sendMessage(ChatColor.RED + "You don't have enough money to convert the hopper."); + } + + if(configHandler.usePerms){ + if(player.hasPermission("HLR.nofee")){ + //player.sendMessage("no need to pay"); //debug + paying = false; + } + } + } + + if (canUseCommand) { + ItemStack item = player.getItemInHand(); + ItemMeta meta = player.getItemInHand().getItemMeta(); + String CHname = HLRmain.CHname; + if(!configHandler.cooldown || !start) { + if(player.getItemInHand().getType().equals(Material.HOPPER)){ + if(player.getItemInHand().getAmount() <= configHandler.maxamount) { + if (meta.hasDisplayName() && meta.hasLore()){ + if(!meta.getDisplayName().equals(CHname) && !meta.getLore().equals(HLRmain.hopperlore)){ + convert = true; + } + } else if (meta.hasDisplayName()){ + if(!meta.getDisplayName().equals(CHname)){ + convert = true; + } + } else if (meta.hasLore()){ + if(!meta.getLore().equals(HLRmain.hopperlore)){ + convert = true; + } + } else { + convert = true; + } + if(convert) { + meta.setDisplayName(CHname); + meta.setLore(HLRmain.hopperlore); + item.setItemMeta(meta); + player.sendMessage(ChatColor.GREEN + "Successfully converted the hopper to a " + ChatColor.YELLOW + ChatColor.stripColor(HLRmain.CHname) + ChatColor.GREEN + "!"); + if(configHandler.cooldown) { + start = true; + Timer timer = new Timer(); + timer.main(args); + } + if (paying) { + HLRmain.econ.withdrawPlayer(player, fee); + paying = false; + player.sendMessage(ChatColor.BLUE + "This transaction cost you " + ChatColor.GOLD + "$" + ChatColor.GREEN + fee + ChatColor.BLUE + "."); + } + } else { + player.sendMessage(ChatColor.RED + "You have already converted the hopper."); + } + } else { + player.sendMessage(ChatColor.RED + "You cannot convert more than " + ChatColor.YELLOW + configHandler.maxamount + ChatColor.RED + " hoppers at once."); + } + } else { + player.sendMessage(ChatColor.RED + "You are not holding a hopper right now."); + } + } else { + player.sendMessage(ChatColor.RED + "This command is still cooling down."); + } + } + } else { + sender.sendMessage(ChatColor.RED + "This is a player only command."); + } + return true; + } +} diff --git a/src/me/despawningbone/HLR/HLRSubCommand.java b/src/me/despawningbone/HLR/HLRSubCommand.java new file mode 100644 index 0000000..cba2f6e --- /dev/null +++ b/src/me/despawningbone/HLR/HLRSubCommand.java @@ -0,0 +1,64 @@ +package me.despawningbone.HLR; + +import java.io.File; +import java.util.UUID; +import org.bukkit.configuration.file.YamlConfiguration; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerJoinEvent; + +public class HLRSubCommand implements CommandExecutor { + private HLRmain plugin; + + public HLRSubCommand(HLRmain instance) { + plugin = instance; + } + + public void onPlayerJoin(PlayerJoinEvent event) { + File DataFile = new File(plugin.getDataFolder() + File.separator + + "Data.yml"); + Player player = event.getPlayer(); + YamlConfiguration DFile = YamlConfiguration.loadConfiguration(DataFile); + UUID uuid = player.getUniqueId(); + String suuid = uuid.toString(); + if(!DFile.isSet(suuid)){ + DFile.createSection(suuid); + DFile.set(suuid, false); + } + } + public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + ConfigHandler configHandler = new ConfigHandler(plugin); + if (args.length <= 0){ + sender.sendMessage(ChatColor.RED + "Unknown argument. Please type /HLR help for the help menu."); + return true; + } else { + if (args[0].equalsIgnoreCase("help")) { + sender.sendMessage(ChatColor.GRAY + "-------" + ChatColor.DARK_AQUA + "HLR Help" + ChatColor.GRAY + "-------"); + sender.sendMessage(ChatColor.RED + "/converthopper" + ChatColor.GRAY + " - " + ChatColor.YELLOW + "The main command of this plugin."); + sender.sendMessage(ChatColor.YELLOW + "Converts a normal hopper into a " + ChatColor.GREEN + ChatColor.stripColor(HLRmain.CHname) + ChatColor.YELLOW + "."); + sender.sendMessage(ChatColor.GRAY + "Alias:" + ChatColor.YELLOW + " /chopper"); + sender.sendMessage(ChatColor.RED + "/HLR help" + ChatColor.GRAY + " - " + ChatColor.YELLOW + "Displays this page."); + if(sender.hasPermission("HLR.reload")) { + sender.sendMessage(ChatColor.RED + "/HLR reload" + ChatColor.GRAY + " - " + ChatColor.YELLOW + "Reloads the config."); + } + sender.sendMessage(ChatColor.RED + "/HLR about" + ChatColor.GRAY + " - " + ChatColor.YELLOW + "Displays the about page."); + } else if (args[0].equalsIgnoreCase("reload")) { + if (sender.hasPermission("HLR.reload")){ + configHandler.reloadConfig(sender, ChatColor.BLUE + "HLR has been reloaded."); + } else { + sender.sendMessage(ChatColor.RED + "You do not have the permission to use this command."); + } + } else if (args[0].equalsIgnoreCase("about")) { + sender.sendMessage(ChatColor.DARK_GRAY + "HLR" + ChatColor.GRAY + " Version: " + ChatColor.GREEN + "1.0.0"); + sender.sendMessage(ChatColor.GOLD + "Made by " + ChatColor.DARK_BLUE + "despawningbone"); + } else { + sender.sendMessage(ChatColor.RED + "Unknown argument. Please type /HLR help for the help menu."); + } + } + return true; + } +} \ No newline at end of file diff --git a/src/me/despawningbone/HLR/HLRmain.java b/src/me/despawningbone/HLR/HLRmain.java new file mode 100644 index 0000000..68554b3 --- /dev/null +++ b/src/me/despawningbone/HLR/HLRmain.java @@ -0,0 +1,82 @@ +package me.despawningbone.HLR; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.logging.Logger; + +import net.milkbowl.vault.economy.Economy; +import me.despawningbone.HLR.CHlistener; + +import org.bukkit.entity.Player; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; + +public class HLRmain extends JavaPlugin { + + public static Economy econ = null; + public static HLRmain plugin; + public static Logger log; + public CHlistener listener = new CHlistener(this); + public HLRCommandMain HLRCM = new HLRCommandMain(this); + public HLRSubCommand HLRSC = new HLRSubCommand(this); + + public static String CHname; + public static List hopperlore = new ArrayList(); + //public static String CHname = ChatColor.GREEN + "Crop " + ChatColor.WHITE + "Hopper"; + public static List enabledWorlds; + public ConfigHandler configHandler; + + // tools that can be damaged + /*public ArrayList tools = new ArrayList(Arrays.asList( + 256, 257, 258, 259, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 283, 284, 285, 286, 290, 291, 292, 293, 294, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 346, 359)); */ + String[] commandAliases = {"chopper"}; + + @Override + public void onDisable() { + log.info(String.format("Disabled HLR Version %s", getDescription().getVersion())); + } + + @Override + public void onEnable() { + log = getLogger(); + configHandler = new ConfigHandler(this); + configHandler.createDataFile(); + configHandler.initConfigValues(); + PluginManager pm = getServer().getPluginManager(); + pm.registerEvents(listener, this); + //log.info("getting commands..."); //debug + getCommand("converthopper").setExecutor(HLRCM); + getCommand("converthopper").setAliases(Arrays.asList(commandAliases)); + getCommand("hlr").setExecutor(HLRSC); + + // Print that the plugin has been enabled! + log.info(String.format("HLR Version: %s by despawningbone has been enabled!", getDescription().getVersion())); + } + + public boolean isEnabledIn(String world) + { + return enabledWorlds.contains(world); + } + + public boolean setupEconomy() { + if (getServer().getPluginManager().getPlugin("Vault") == null) { + return false; + } + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); + if (rsp == null) { + return false; + } + econ = rsp.getProvider(); + return econ != null; + } + public static double getMoney(Player p) { + double m = econ.getBalance(p); + return m; + } +} diff --git a/src/me/despawningbone/HLR/Timer.java b/src/me/despawningbone/HLR/Timer.java new file mode 100644 index 0000000..fb8a4a8 --- /dev/null +++ b/src/me/despawningbone/HLR/Timer.java @@ -0,0 +1,19 @@ +package me.despawningbone.HLR; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; + +public class Timer { + public static int taskid; + public void main(String args[]) { + taskid = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("HLR"), new Runnable() { + @Override + public void run() { + HLRCommandMain.start = false; + Player player = HLRCommandMain.executor; + player.sendMessage(ChatColor.YELLOW + "You can now use /converthopper again."); + } + }, ConfigHandler.time); + } +} \ No newline at end of file