From 9b6394c8c61f012b8f6179d7d6361c86b7de4f23 Mon Sep 17 00:00:00 2001 From: Seth <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Sun, 14 Jan 2018 14:53:05 -0700 Subject: [PATCH] Fixed pom, added tprandom, admins can now kick other admins (#21) * Fixed pom, added tprandom, admins can now kick other admins * went too fast * im mental --- pom.xml | 59 +++++++++---------- .../totalfreedommod/command/Command_kick.java | 6 -- .../command/Command_tprandom.java | 27 +++++++++ .../totalfreedommod/util/FUtil.java | 7 +++ 4 files changed, 62 insertions(+), 37 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java diff --git a/pom.xml b/pom.xml index 5e53cc9a..1eff2198 100644 --- a/pom.xml +++ b/pom.xml @@ -54,10 +54,6 @@ spigot-repo https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - sk89q-repo http://maven.sk89q.com/repo/ @@ -86,22 +82,24 @@ org.projectlombok lombok - 1.16.18 + 1.16.20 provided org.spigotmc spigot-api - 1.12-pre5-SNAPSHOT - provided + 1.12.2 + system + ${project.basedir}/lib/spigot-1.12.2.jar com.github.Pravian Aero 2.1-SNAPSHOT - provided + system + ${project.basedir}/lib/aero-2.1-SNAPSHOT.jar @@ -117,53 +115,52 @@ 2.13.1 provided - + com.sk89q worldguard 6.2 - provided + system + ${project.basedir}/lib/worldguard-6.2.jar com.github.TotalFreedom.TF-WorldEdit worldedit-bukkit 6.1.0-TF - provided - - - - com.github.TotalFreedom.TF-WorldEdit - worldedit-core - 6.1.0-TF - provided + system + ${project.basedir}/lib/TF-WorldEdit.jar net.coreprotect CoreProtect 2.14.2 - provided + system + ${project.basedir}/lib/CoreProtect_2.14.2.jar - + me.libraryaddict LibsDisguise 9.4.0-SNAPSHOT provided - + - minecraft.server - Spigot - 1.12 - provided + org.spigot + spigot + 1.12.2 + system + ${project.basedir}/lib/spigot-1.12.2.jar - + net.dv8tion JDA 3.4.0_317-withDependencies + system + ${project.basedir}/lib/JDA-3.4.0_317-withDependencies.jar @@ -191,7 +188,7 @@ 1.7 - + maven-antrun-plugin @@ -301,7 +298,7 @@ - + org.apache.maven.plugins @@ -311,9 +308,9 @@ target/generated-sources - + - + org.apache.maven.plugins maven-shade-plugin 1.4 @@ -355,4 +352,4 @@ - + \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java index 6f2bf21c..0b8b08aa 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_kick.java @@ -28,12 +28,6 @@ public class Command_kick extends FreedomCommand return true; } - if (isAdmin(player)) - { - msg("Admins can not be kicked", ChatColor.RED); - return true; - } - String reason = null; if (args.length > 1) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java new file mode 100644 index 00000000..29a1cb0a --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tprandom.java @@ -0,0 +1,27 @@ +package me.totalfreedom.totalfreedommod.command; + +import me.totalfreedom.totalfreedommod.rank.Rank; +import me.totalfreedom.totalfreedommod.util.FUtil; +import org.bukkit.Location; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; + +@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME) +@CommandParameters(description = "Go to a random place in the current world you are in", usage = "/", aliases = "tpr") +public class Command_tprandom extends FreedomCommand +{ + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + int x = FUtil.random(-10000, 10000); + int z = FUtil.random(-10000, 10000); + int y = playerSender.getWorld().getHighestBlockYAt(x, z); + Location location = new Location(playerSender.getLocation().getWorld(), x, y, z); + playerSender.teleport(location); + msg("Poof!", ChatColor.GREEN); + return true; + } +} \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java index 424f986e..ef0b2a3d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java @@ -420,4 +420,11 @@ public class FUtil String packageName = Bukkit.getServer().getClass().getPackage().getName(); return packageName.substring(packageName.lastIndexOf('.') + 1); } + + public static int random(int min, int max) + { + int range = max - min + 1; + int value = (int) (Math.random() * range) + min; + return value; + } }