mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Curse be gone (#47)
Co-authored-by: Ryan <Wild1145@users.noreply.github.com> Co-authored-by: Nathan Curran <30569566+Focusvity@users.noreply.github.com>
This commit is contained in:
parent
64a4e70c41
commit
d5238150d0
@ -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();
|
||||
|
@ -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 = "/<command> <player>")
|
||||
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<String> 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();
|
||||
}
|
||||
}
|
@ -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<Player, Player> cursedPlayers = new HashMap<Player, Player>();
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user