From d5238150d0b830e616a60aafae2a59012da15f60 Mon Sep 17 00:00:00 2001 From: Video Date: Mon, 12 Apr 2021 22:13:47 -0600 Subject: [PATCH] Curse be gone (#47) Co-authored-by: Ryan Co-authored-by: Nathan Curran <30569566+Focusvity@users.noreply.github.com> --- .../totalfreedommod/TotalFreedomMod.java | 3 - .../command/Command_curse.java | 64 ------------------- .../totalfreedommod/fun/CurseListener.java | 52 --------------- 3 files changed, 119 deletions(-) delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java delete mode 100644 src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index d60be15a..fc4bf512 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -28,7 +28,6 @@ import me.totalfreedom.totalfreedommod.command.CommandLoader; import me.totalfreedom.totalfreedommod.config.MainConfig; import me.totalfreedom.totalfreedommod.discord.Discord; import me.totalfreedom.totalfreedommod.freeze.Freezer; -import me.totalfreedom.totalfreedommod.fun.CurseListener; import me.totalfreedom.totalfreedommod.fun.ItemFun; import me.totalfreedom.totalfreedommod.fun.Jumppads; import me.totalfreedom.totalfreedommod.fun.Landminer; @@ -116,7 +115,6 @@ public class TotalFreedomMod extends JavaPlugin public Monitors mo; public MovementValidator mv; public ServerPing sp; - public CurseListener cul; public ItemFun it; public Landminer lm; public MP44 mp; @@ -368,7 +366,6 @@ public class TotalFreedomMod extends JavaPlugin private void initFun() { // Fun - cul = new CurseListener(); it = new ItemFun(); lm = new Landminer(); mp = new MP44(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java deleted file mode 100644 index 4417cf35..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_curse.java +++ /dev/null @@ -1,64 +0,0 @@ -package me.totalfreedom.totalfreedommod.command; - -import java.util.Collections; -import java.util.List; -import me.totalfreedom.totalfreedommod.rank.Rank; -import me.totalfreedom.totalfreedommod.util.FUtil; -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME) -@CommandParameters(description = "Curse someone - sends a cursed texture pack to the specified player.", usage = "/ ") -public class Command_curse extends FreedomCommand -{ - - /* The only problem with this is someone can prevent themself from being cursed by declining to download the - resource pack. However, if they hit yes, then you can curse them whenever you want and they can't stop it unless - they go into their server settings. and set server resource packs to prompt or disabled */ - - @Override - public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) - { - - if (!FUtil.isExecutive(sender.getName())) - { - return noPerms(); - } - - if (args.length == 0) - { - return false; - } - - final Player player = getPlayer(args[0]); - - if (player == null) - { - msg(FreedomCommand.PLAYER_NOT_FOUND); - return true; - } - - if (plugin.cul.cursedPlayers.containsKey(player)) - { - msg("Already attempting to curse!", ChatColor.RED); - return true; - } - - player.setResourcePack("http://play.totalfreedom.me/cursed.zip"); - msg("Attempting to curse " + player.getName(), ChatColor.GREEN); - plugin.cul.cursedPlayers.put(player, playerSender); - return true; - } - - @Override - public List getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) - { - if (args.length == 1 && plugin.al.isAdmin(sender) && FUtil.isExecutive(sender.getName())) - { - return FUtil.getPlayerList(); - } - return Collections.emptyList(); - } -} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java deleted file mode 100644 index 6477ff5b..00000000 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/CurseListener.java +++ /dev/null @@ -1,52 +0,0 @@ -package me.totalfreedom.totalfreedommod.fun; - -import java.util.HashMap; -import me.totalfreedom.totalfreedommod.FreedomService; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerResourcePackStatusEvent; -import static org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; - -public class CurseListener extends FreedomService -{ - public HashMap cursedPlayers = new HashMap(); - - @Override - public void onStart() - { - } - - @Override - public void onStop() - { - } - - @EventHandler(priority = EventPriority.MONITOR) - public void onResourcePackStatus(PlayerResourcePackStatusEvent event) - { - Player player = event.getPlayer(); - PlayerResourcePackStatusEvent.Status cursed = event.getStatus(); - Player cursedBy = cursedPlayers.get(player); - if (cursed.equals(Status.ACCEPTED)) - { - cursedBy.sendMessage(ChatColor.GREEN + "Casting curse on " + player.getName() + "..."); - } - else if (cursed.equals(Status.DECLINED)) - { - cursedBy.sendMessage(ChatColor.RED + "Failed to start cast on " + player.getName() + "!"); - cursedPlayers.remove(player); - } - else if (cursed.equals(Status.SUCCESSFULLY_LOADED)) - { - cursedBy.sendMessage(ChatColor.GREEN + "Successfully cursed + " + player.getName() + "!"); - cursedPlayers.remove(player); - } - else if (cursed.equals(Status.FAILED_DOWNLOAD)) - { - cursedBy.sendMessage(ChatColor.RED + "Failed to cast curse on " + player.getName() + "!"); - cursedPlayers.remove(player); - } - } -} \ No newline at end of file