Sueta

Fredashay's Torches

2023-11-11

This plugin spams your caves with torches.

·Plugin
  1. 2023-11-11latestUpdated for 1.20Nov 11, 2023
    Updated for Minecraft 1.20.
    1 download
  2. 3.0Recompiled for 1.16Dec 19, 2020
    Recompiled for 1.16
    45 downloads
  3. 2017-09-30general improvementsSep 30, 2017
    This plugin spams your caves with torches. To install this plugin, copy the plugin JAR file to your server's plugins folder. To run it, type /TORCH ON [DISTANCE] or /TORCH OFF. Be warned, this plugin has a snarky attitude, lol I currently run a Rainbow server but I want greater functionality than the Rainbow API provides, so I've been learning Spigot. This is one of several silly plugins I've written to that end. Code (Text): package FredashaySpigotTorch; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; public class MyPlugin extends JavaPlugin implements Listener, CommandExecutor { private static PluginDescriptionFile pdfFile = null; private static boolean torchOn = false; private static int torchDistance = 10; private static Player torchPlayer = null; private static boolean torchMove = false; @Override public void onEnable() { pdfFile = getDescription(); getServer().getPluginManager().registerEvents(this,this); clock(2); } private void clock(int interval) { getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { onTick(); clock(interval); } }, interval); } @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (label.equalsIgnoreCase("torch")) { if (!(sender instanceof Player)) { sender.sendMessage("[" + pdfFile.getName() + "] This command can only be issued by a player in the game. "); return (false); } Player player = (Player) sender; if (player.isOp()) { if (args.length > 0) { if (args[0].equalsIgnoreCase("on")) { if (torchOn) { if (player.getName().equalsIgnoreCase(torchPlayer.getName())) { player.sendMessage("<Torch> Already on for a radius of " + torchDistance + ". "); } else { player.sendMessage("<Torch> In use by someone else. Try later, dude. "); } } else { torchPlayer = player; torchOn = true; torchMove = true; torchDistance = 10; if (args.length > 1) { if (isNumeric(args[1])) { torchDistance = (int) toInteger(args[1]); if (torchDistance < 1) { player.sendMessage("<Torch> No! "); torchOn = false; } else if (torchDistance > 50) { player.sendMessage("<Torch> You really wanna turn the whole friggin' world into torches?!?! "); torchOn = false; } } else { player.sendMessage("<Torch> Say what?"); } } if (torchOn) { player.sendMessage("<Torch> On for a radius of " + torchDistance + ". "); } } } else if (args[0].equalsIgnoreCase("off")) { if (torchOn) { player.sendMessage("<Torch> What? You don't like torches any more? "); torchOn = false; } else { player.sendMessage("<Torch> Whatever, dude. "); } torchMove = false; } else { player.sendMessage("<Torch> Huh? "); } } else { player.sendMessage("<Torch> Yo! "); } return (true); } return (false); } return (false); } @EventHandler private void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); if (player == torchPlayer) { if (player.isOp()) { torchMove = true; } else { torchMove = false; } } } private static boolean isNumeric(String str) { double d = 0; if (d == 0) { try { d = Double.parseDouble(str); } catch(NumberFormatException nfe) { return (false); } } return (true); } private long toInteger(String garbage) { long bigNumber = 0; int inputIx = 0; String sign = null; String inputChar = ""; int inputDigit = 0; garbage = garbage.trim(); bigNumber = 0; if ((garbage.length() > 0) && (garbage.length() <= 18)) { inputChar = garbage.substring(0,1); inputIx = 0; sign = "+"; if (inputChar.equals("-")) { sign = "-"; inputIx = 1; inputChar = garbage.substring(1,2); } while ((inputIx < garbage.length()) && ((inputChar.equals("0") (inputChar.equals("1")) (inputChar.equals("2")) (inputChar.equals("3")) (inputChar.equals("4")) (inputChar.equals("5")) (inputChar.equals("6")) (inputChar.equals("7")) (inputChar.equals("8")) || (inputChar.equals("9"))))) { inputDigit = 0; if (inputChar.equals("1")) inputDigit = 1; else if (inputChar.equals("2")) inputDigit = 2; else if (inputChar.equals("3")) inputDigit = 3; else if (inputChar.equals("4")) inputDigit = 4; else if (inputChar.equals("5")) inputDigit = 5; else if (inputChar.equals("6")) inputDigit = 6; else if (inputChar.equals("7")) inputDigit = 7; else if (inputChar.equals("8")) inputDigit = 8; else if (inputChar.equals("9")) inputDigit = 9; bigNumber = bigNumber * 10; bigNumber = bigNumber + inputDigit;
    76 downloads
  4. 2017-09-17Sep 17, 2017
    46 downloads

Similar projects

Plugin →