From bd84257c162badccf46873c68147bbf36c934849 Mon Sep 17 00:00:00 2001
From: Nathan Curran <30569566+Focusvity@users.noreply.github.com>
Date: Wed, 11 Dec 2019 12:13:47 +1100
Subject: [PATCH] Added Paper Check (#163)
---
TotalFreedomMod.iml | 59 +++++++++++++++++++
.../totalfreedommod/command/Command_cuck.java | 13 ++--
.../command/Command_scare.java | 17 ++++--
.../command/Command_wiperegions.java | 2 +-
.../totalfreedommod/util/FUtil.java | 13 ++++
5 files changed, 91 insertions(+), 13 deletions(-)
diff --git a/TotalFreedomMod.iml b/TotalFreedomMod.iml
index b4253238..881b7013 100644
--- a/TotalFreedomMod.iml
+++ b/TotalFreedomMod.iml
@@ -100,5 +100,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java
index c99cb867..9692e2f6 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cuck.java
@@ -11,12 +11,17 @@ import org.bukkit.ChatColor;
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
@CommandParameters(description = "Cuck someone", usage = "/ ")
-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;
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java
index 40b3f17e..f35c4d1a 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_scare.java
@@ -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 = "/ ")
-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);
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java
index bf6be296..56502205 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_wiperegions.java
@@ -71,4 +71,4 @@ public class Command_wiperegions extends FreedomCommand
return Collections.emptyList();
}
-}
+}
\ 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 de7a9677..d79f5b80 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/util/FUtil.java
@@ -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;
+ }
+ }
}