Added Paper Check (#163)

This commit is contained in:
Nathan Curran
2019-12-11 12:13:47 +11:00
committed by super
parent d78d28cc7a
commit bd84257c16
5 changed files with 91 additions and 13 deletions

View File

@ -11,12 +11,17 @@ import org.bukkit.ChatColor;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Cuck someone", usage = "/<command> <player>")
public class Command_cuck extends FreedomCommand
public class Command_cuck extends FreedomCommand
{
/* This command will not work on Paper because there was a patch to remove it. This will work on Spigot and Bukkit. */
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (FUtil.isPaper())
{
msg("This command won't work on Paper!", ChatColor.RED);
return true;
}
if (args.length == 0)
{
@ -32,12 +37,8 @@ public class Command_cuck extends FreedomCommand
}
player.remove();
msg("Cucked " + player.getName());
player.sendTitle(ChatColor.DARK_RED + "HAHA CUCKED", ChatColor.RED + "relog if u want to be uncucked loser", 20, 200, 60);
return true;
}

View File

@ -4,21 +4,25 @@ import java.util.Collections;
import java.util.List;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.ChatColor;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Surprise someone.", usage = "/<command> <player>")
public class Command_scare extends FreedomCommand
public class Command_scare extends FreedomCommand
{
/* This command will not work on Paper because there was a patch to remove it. This will work on Spigot and Bukkit. */
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (!FUtil.isPaper())
{
msg("This command won't work on Paper!", ChatColor.RED);
return true;
}
if (args.length == 0)
{
@ -36,7 +40,8 @@ public class Command_scare extends FreedomCommand
msg("Scared " + player.getName());
player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4);
for (int i = 0; i < 10; ++i) {
for (int i = 0; i < 10; ++i)
{
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_SCREAM, 1, 0);
}

View File

@ -71,4 +71,4 @@ public class Command_wiperegions extends FreedomCommand
return Collections.emptyList();
}
}
}

View File

@ -460,4 +460,17 @@ public class FUtil
int value = (int)(Math.random() * range) + min;
return value;
}
public static boolean isPaper()
{
try
{
Class.forName("com.destroystokyo.paper.PaperConfig");
return true;
}
catch (ClassNotFoundException ex)
{
return false;
}
}
}