This commit is contained in:
Telesphoreo 2022-03-25 15:42:21 -05:00
parent 7d1705c79f
commit ea418bb916
3 changed files with 49 additions and 32 deletions

View File

@ -18,6 +18,13 @@ repositories {
}
}
maven {
url = uri('https://nexus.hc.to/content/repositories/pub_releases/')
content {
includeGroup('net.milkbowl.vault')
}
}
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
maven {
@ -91,20 +98,20 @@ dependencies {
implementation('commons-io:commons-io:2.11.0')
implementation('org.apache.commons:commons-lang3:3.12.0')
implementation('commons-codec:commons-codec:1.15')
implementation('org.bstats:bstats-base:2.2.1')
implementation('org.bstats:bstats-bukkit:2.2.1')
implementation('org.bstats:bstats-base:3.0.0')
implementation('org.bstats:bstats-bukkit:3.0.0')
implementation('org.reflections:reflections:0.10.2')
implementation('org.javassist:javassist:3.28.0-GA')
implementation('org.jetbrains:annotations:22.0.0')
implementation('org.jetbrains:annotations:23.0.0')
implementation('com.mattmalec:Pterodactyl4J:2.BETA_92')
implementation("com.squareup.okhttp3:okhttp:3.11.0")
compileOnly('org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT')
implementation('com.squareup.okhttp3:okhttp:4.9.3')
compileOnly('org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT')
compileOnly('me.totalfreedom:BukkitTelnet:4.7')
compileOnly('me.totalfreedom:TF-LibsDisguises:10.0.27-SNAPSHOT')
compileOnly('com.sk89q.worldedit:worldedit-bukkit:7.3.0-SNAPSHOT')
compileOnly('net.essentialsx:EssentialsX:2.19.2')
compileOnly('net.dv8tion:JDA:4.3.0_277')
compileOnly('net.coreprotect:coreprotect:20.1')
compileOnly('net.coreprotect:coreprotect:20.4')
compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.6')
compileOnly('com.github.vexsoftware:votifier:v1.9')
compileOnly('net.goldtreeservers:worldguardextraflags:4.0.0')

View File

@ -1,4 +1,4 @@
project.pluginVersion=7.0.1
project.pluginVersion=7.1.0
project.buildAuthor=unknown
project.buildCodeName=Ember
org.gradle.cache=true

View File

@ -4,8 +4,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.punishments.Punishment;
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
@ -20,6 +21,7 @@ import org.bukkit.entity.Player;
@CommandParameters(description = "Place a cage around someone with certain blocks, or someone's player head.", usage = "/<command> <purge | <partialname> [head | block] [playername | blockname]")
public class Command_cage extends FreedomCommand
{
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
{
if (args.length == 0)
@ -60,42 +62,58 @@ public class Command_cage extends FreedomCommand
final String s = args[1];
switch (s)
{
case "head" -> {
case "head":
{
outerMaterial = Material.PLAYER_HEAD;
if (args.length >= 3)
{
if (!FUtil.isValidUsername(args[2]))
{
msg("That is an invalid player name!", ChatColor.RED);
return true;
}
skullName = args[2];
}
else
{
outerMaterial = Material.SKELETON_SKULL;
}
break;
}
case "block" -> {
if (args.length == 3)
case "block":
{
if (args.length >= 3)
{
String block = args[2].toUpperCase();
if (Material.matchMaterial(block) != null && Objects.requireNonNull(Material.getMaterial(block)).isBlock())
// Checks the validity of the Material and checks if it's a block.
// This is incredibly inefficient, as Spigot's isBlock() method in Material is an actual
// nightmare of switch-cases.
if (Material.matchMaterial(args[2]) != null && Material.matchMaterial(args[2]).isBlock())
{
outerMaterial = Material.matchMaterial(block);
outerMaterial = Material.matchMaterial(args[2]);
break;
}
msg("The block you specified is invalid.", ChatColor.RED);
else
{
msg("Invalid block!", ChatColor.RED);
return true;
}
}
else
{
msg("You must specify a block.", ChatColor.RED);
return false;
}
return true;
}
default:
{
return false;
}
}
}
if (outerMaterial == Material.PLAYER_HEAD)
{
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
}
else
{
FUtil.adminAction(sender.getName(), "Caging " + player.getName(), true);
}
Location location = player.getLocation().clone().add(0.0, 1.0, 0.0);
if (skullName != null)
@ -106,17 +124,9 @@ public class Command_cage extends FreedomCommand
{
fPlayer.getCageData().cage(location, outerMaterial, innerMaterial);
}
player.setGameMode(GameMode.SURVIVAL);
player.setGameMode(GameMode.ADVENTURE);
if (outerMaterial == Material.PLAYER_HEAD)
{
FUtil.adminAction(sender.getName(), "Caging " + player.getName() + " in " + skullName, true);
}
else
{
FUtil.adminAction(sender.getName(), "Caging " + player.getName(), true);
}
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.CAGE, null));
return true;
}