diff --git a/pom.xml b/pom.xml
index 3b07ec1..4eaf873 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,21 +27,27 @@
com.destroystokyo.paper
paper-api
- 1.16.4-R0.1-SNAPSHOT
+ 1.16.5-R0.1-SNAPSHOT
provided
+
+ io.papermc
+ paperlib
+ 1.0.6
+ compile
+
org.projectlombok
lombok
- 1.18.16
+ 1.18.20
compile
org.json
json
- 20201115
+ 20210307
compile
@@ -56,19 +62,19 @@
dev.morphia.morphia
morphia-core
- 2.1.3
+ 2.1.7
compile
redis.clients
jedis
- 3.4.1
+ 3.6.1
compile
org.mariadb.jdbc
mariadb-java-client
- 2.7.1
+ 2.7.3
compile
@@ -86,14 +92,14 @@
maven-compiler-plugin
3.8.1
-
- 11
+
+ 16
org.apache.maven.plugins
maven-shade-plugin
- 3.2.4
+ 3.3.0-SNAPSHOT
package
diff --git a/src/main/java/dev/plex/command/exception/ConsoleOnlyException.java b/src/main/java/dev/plex/command/exception/ConsoleOnlyException.java
new file mode 100644
index 0000000..0cf2a73
--- /dev/null
+++ b/src/main/java/dev/plex/command/exception/ConsoleOnlyException.java
@@ -0,0 +1,11 @@
+package dev.plex.command.exception;
+
+import static dev.plex.util.PlexUtils.tl;
+
+public class ConsoleOnlyException extends RuntimeException
+{
+ public ConsoleOnlyException()
+ {
+ super(tl("consoleOnly"));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/dev/plex/command/impl/AdminCMD.java b/src/main/java/dev/plex/command/impl/AdminCMD.java
index ddd95f9..95aa19a 100644
--- a/src/main/java/dev/plex/command/impl/AdminCMD.java
+++ b/src/main/java/dev/plex/command/impl/AdminCMD.java
@@ -3,6 +3,7 @@ package dev.plex.command.impl;
import com.google.common.collect.ImmutableList;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
+import dev.plex.command.exception.ConsoleOnlyException;
import dev.plex.command.exception.PlayerNotFoundException;
import dev.plex.command.source.CommandSource;
import dev.plex.command.source.RequiredCommandSource;
@@ -50,8 +51,7 @@ public class AdminCMD extends PlexCommand
if (!sender.isConsoleSender())
{
- sender.send("Console only");
- return;
+ throw new ConsoleOnlyException();
}
UUID targetUUID = PlexUtils.getFromName(args[1]);
@@ -64,7 +64,7 @@ public class AdminCMD extends PlexCommand
if (isAdmin(plexPlayer))
{
- sender.send("Player is an admin");
+ sender.send(tl("playerIsAdmin"));
return;
}
@@ -83,8 +83,7 @@ public class AdminCMD extends PlexCommand
if (!sender.isConsoleSender())
{
- sender.send("Console only");
- return;
+ throw new ConsoleOnlyException();
}
UUID targetUUID = PlexUtils.getFromName(args[1]);
@@ -97,7 +96,7 @@ public class AdminCMD extends PlexCommand
if (!isAdmin(plexPlayer))
{
- sender.send("Player is not an admin");
+ sender.send(tl("playerNotAdmin"));
return;
}
@@ -117,8 +116,7 @@ public class AdminCMD extends PlexCommand
if (!sender.isConsoleSender())
{
- sender.send("Console only");
- return;
+ throw new ConsoleOnlyException();
}
UUID targetUUID = PlexUtils.getFromName(args[1]);
@@ -130,7 +128,7 @@ public class AdminCMD extends PlexCommand
if (!rankExists(args[2]))
{
- sender.send("Rank not found");
+ sender.send(tl("rankNotFound"));
return;
}
@@ -138,7 +136,7 @@ public class AdminCMD extends PlexCommand
if (!rank.isAtLeast(Rank.ADMIN))
{
- sender.send("Must be admin+");
+ sender.send(tl("rankMustBeHigherThanAdmin"));
return;
}
@@ -146,7 +144,7 @@ public class AdminCMD extends PlexCommand
if (!isAdmin(plexPlayer))
{
- sender.send("Player is not an admin");
+ sender.send(tl("playerNotAdmin"));
return;
}
diff --git a/src/main/java/dev/plex/command/impl/AdminworldCMD.java b/src/main/java/dev/plex/command/impl/AdminworldCMD.java
new file mode 100644
index 0000000..a5888a0
--- /dev/null
+++ b/src/main/java/dev/plex/command/impl/AdminworldCMD.java
@@ -0,0 +1,48 @@
+package dev.plex.command.impl;
+
+import dev.plex.command.annotation.CommandParameters;
+import dev.plex.command.annotation.CommandPermissions;
+import dev.plex.command.exception.CommandFailException;
+import dev.plex.command.source.CommandSource;
+import dev.plex.command.source.RequiredCommandSource;
+import io.papermc.lib.PaperLib;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+import dev.plex.command.PlexCommand;
+import dev.plex.rank.enums.Rank;
+import dev.plex.util.PlexUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.IN_GAME)
+@CommandParameters(aliases = "aw", description = "Teleport to the adminworld")
+public class AdminworldCMD extends PlexCommand
+{
+ public AdminworldCMD()
+ {
+ super("adminworld");
+ }
+
+ @Override
+ public void execute(CommandSource sender, String[] args)
+ {
+ // TODO: Add adminworld settings
+ if (args.length == 0)
+ {
+ Location loc = new Location(Bukkit.getWorld("adminworld"), 0, 50, 0);
+ PaperLib.teleportAsync(sender.getPlayer(), loc);
+ send(tl("teleportedToWorld", "adminworld"));
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSource sender, String[] args)
+ {
+ return Collections.emptyList();
+ }
+}
diff --git a/src/main/java/dev/plex/command/impl/BanCMD.java b/src/main/java/dev/plex/command/impl/BanCMD.java
index 49698ae..7a4befe 100644
--- a/src/main/java/dev/plex/command/impl/BanCMD.java
+++ b/src/main/java/dev/plex/command/impl/BanCMD.java
@@ -57,7 +57,7 @@ public class BanCMD extends PlexCommand
PlexPlayer plexPlayer1 = sender.getPlexPlayer();
if (!plexPlayer1.getRankFromString().isAtLeast(plexPlayer.getRankFromString()))
{
- sender.send("This player is an admin and a higher rank than you.");
+ sender.send(tl("higherRankThanYou"));
return;
}
}
diff --git a/src/main/java/dev/plex/command/impl/FlatlandsCMD.java b/src/main/java/dev/plex/command/impl/FlatlandsCMD.java
new file mode 100644
index 0000000..ce23b87
--- /dev/null
+++ b/src/main/java/dev/plex/command/impl/FlatlandsCMD.java
@@ -0,0 +1,47 @@
+package dev.plex.command.impl;
+
+import dev.plex.command.annotation.CommandParameters;
+import dev.plex.command.annotation.CommandPermissions;
+import dev.plex.command.exception.CommandFailException;
+import dev.plex.command.source.CommandSource;
+import dev.plex.command.source.RequiredCommandSource;
+import io.papermc.lib.PaperLib;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+import dev.plex.command.PlexCommand;
+import dev.plex.rank.enums.Rank;
+import dev.plex.util.PlexUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.IN_GAME)
+@CommandParameters(description = "Teleport to the flatlands")
+public class FlatlandsCMD extends PlexCommand
+{
+ public FlatlandsCMD()
+ {
+ super("flatlands");
+ }
+
+ @Override
+ public void execute(CommandSource sender, String[] args)
+ {
+ if (args.length == 0)
+ {
+ Location loc = new Location(Bukkit.getWorld("flatlands"), 0, 50, 0);
+ PaperLib.teleportAsync(sender.getPlayer(), loc);
+ send(tl("teleportedToWorld", "flatlands"));
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSource sender, String[] args)
+ {
+ return Collections.emptyList();
+ }
+}
diff --git a/src/main/java/dev/plex/command/impl/MasterbuilderworldCMD.java b/src/main/java/dev/plex/command/impl/MasterbuilderworldCMD.java
new file mode 100644
index 0000000..4ddc724
--- /dev/null
+++ b/src/main/java/dev/plex/command/impl/MasterbuilderworldCMD.java
@@ -0,0 +1,48 @@
+package dev.plex.command.impl;
+
+import dev.plex.command.annotation.CommandParameters;
+import dev.plex.command.annotation.CommandPermissions;
+import dev.plex.command.exception.CommandFailException;
+import dev.plex.command.source.CommandSource;
+import dev.plex.command.source.RequiredCommandSource;
+import io.papermc.lib.PaperLib;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.collect.ImmutableList;
+import dev.plex.command.PlexCommand;
+import dev.plex.rank.enums.Rank;
+import dev.plex.util.PlexUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.entity.Player;
+
+@CommandPermissions(level = Rank.ADMIN, source = RequiredCommandSource.IN_GAME)
+@CommandParameters(aliases = "mbw", description = "Teleport to the Master Builder world")
+public class MasterbuilderworldCMD extends PlexCommand
+{
+ public MasterbuilderworldCMD()
+ {
+ super("masterbuilderworld");
+ }
+
+ @Override
+ public void execute(CommandSource sender, String[] args)
+ {
+ // TODO: Add adminworld settings
+ if (args.length == 0)
+ {
+ Location loc = new Location(Bukkit.getWorld("masterbuilderworld"), 0, 50, 0);
+ PaperLib.teleportAsync(sender.getPlayer(), loc);
+ send(tl("teleportedToWorld", "Master Builder world"));
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSource sender, String[] args)
+ {
+ return Collections.emptyList();
+ }
+}
diff --git a/src/main/java/dev/plex/command/impl/PlexCMD.java b/src/main/java/dev/plex/command/impl/PlexCMD.java
index da7a3b5..3d505b6 100644
--- a/src/main/java/dev/plex/command/impl/PlexCMD.java
+++ b/src/main/java/dev/plex/command/impl/PlexCMD.java
@@ -1,5 +1,6 @@
package dev.plex.command.impl;
+import dev.plex.Plex;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.CommandSource;
@@ -8,6 +9,7 @@ import java.util.Arrays;
import java.util.List;
import dev.plex.command.PlexCommand;
import dev.plex.rank.enums.Rank;
+import org.bukkit.ChatColor;
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
@CommandParameters(aliases = "plexhelp", description = "Help with plex")
@@ -21,7 +23,8 @@ public class PlexCMD extends PlexCommand
@Override
public void execute(CommandSource sender, String[] args)
{
- send("HI");
+ send(ChatColor.LIGHT_PURPLE + "Plex. The long awaited TotalFreedomMod rewrite starts here...");
+ send(ChatColor.LIGHT_PURPLE + "Plugin version: " + ChatColor.GOLD + "1.0");
}
@Override
diff --git a/src/main/java/dev/plex/handlers/CommandHandler.java b/src/main/java/dev/plex/handlers/CommandHandler.java
index fee5e3a..75bc118 100644
--- a/src/main/java/dev/plex/handlers/CommandHandler.java
+++ b/src/main/java/dev/plex/handlers/CommandHandler.java
@@ -2,11 +2,14 @@ package dev.plex.handlers;
import com.google.common.collect.Lists;
import dev.plex.command.impl.AdminCMD;
+import dev.plex.command.impl.AdminworldCMD;
import dev.plex.command.impl.AdventureCMD;
import dev.plex.command.impl.BanCMD;
import dev.plex.command.impl.CreativeCMD;
import dev.plex.command.impl.FionnCMD;
+import dev.plex.command.impl.FlatlandsCMD;
import dev.plex.command.impl.FreezeCMD;
+import dev.plex.command.impl.MasterbuilderworldCMD;
import dev.plex.command.impl.NameHistoryCMD;
import dev.plex.command.impl.OpAllCMD;
import dev.plex.command.impl.OpCMD;
@@ -22,10 +25,9 @@ import dev.plex.util.PlexLog;
public class CommandHandler
{
- private List commands = Lists.newArrayList();
-
public CommandHandler()
{
+ List commands = Lists.newArrayList();
commands.add(new TestCMD());
commands.add(new PlexCMD());
commands.add(new FionnCMD());
@@ -41,6 +43,9 @@ public class CommandHandler
commands.add(new SpectatorCMD());
commands.add(new BanCMD());
commands.add(new PunishmentsCMD());
+ commands.add(new FlatlandsCMD());
+ commands.add(new AdminworldCMD());
+ commands.add(new MasterbuilderworldCMD());
PlexLog.log(String.format("Registered %s commands!", commands.size()));
}
}
diff --git a/src/main/java/dev/plex/handlers/ListenerHandler.java b/src/main/java/dev/plex/handlers/ListenerHandler.java
index 4c9cb4a..4aa3888 100644
--- a/src/main/java/dev/plex/handlers/ListenerHandler.java
+++ b/src/main/java/dev/plex/handlers/ListenerHandler.java
@@ -14,9 +14,9 @@ import dev.plex.util.PlexLog;
public class ListenerHandler
{
- List listeners = Lists.newArrayList();
public ListenerHandler()
{
+ List listeners = Lists.newArrayList();
listeners.add(new ServerListener());
listeners.add(new ChatListener());
listeners.add(new PlayerListener());
diff --git a/src/main/java/dev/plex/listener/impl/AdminListener.java b/src/main/java/dev/plex/listener/impl/AdminListener.java
index 9ac8fed..e00f201 100644
--- a/src/main/java/dev/plex/listener/impl/AdminListener.java
+++ b/src/main/java/dev/plex/listener/impl/AdminListener.java
@@ -7,6 +7,7 @@ import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer;
import dev.plex.rank.enums.Rank;
import static dev.plex.util.PlexUtils.tl;
+import dev.plex.util.PlexUtils;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
@@ -18,7 +19,7 @@ public class AdminListener extends PlexListener
String userSender = event.getSender().getName();
PlexPlayer target = event.getPlexPlayer();
- Bukkit.broadcastMessage(tl("newAdminAdded", userSender, target.getName()));
+ PlexUtils.broadcast(tl("newAdminAdded", userSender, target.getName()));
}
@EventHandler
@@ -27,7 +28,7 @@ public class AdminListener extends PlexListener
String userSender = event.getSender().getName();
PlexPlayer target = event.getPlexPlayer();
- Bukkit.broadcastMessage(tl("adminRemoved", userSender, target.getName()));
+ PlexUtils.broadcast(tl("adminRemoved", userSender, target.getName()));
}
@EventHandler
@@ -37,6 +38,6 @@ public class AdminListener extends PlexListener
PlexPlayer target = event.getPlexPlayer();
Rank newRank = event.getRank();
- Bukkit.broadcastMessage(tl("adminSetRank", userSender, target.getName(), newRank.name().toUpperCase()));
+ PlexUtils.broadcast(tl("adminSetRank", userSender, target.getName(), newRank.name().toUpperCase()));
}
}
diff --git a/src/main/java/dev/plex/listener/impl/ChatListener.java b/src/main/java/dev/plex/listener/impl/ChatListener.java
index 3f7c58e..95e26f1 100644
--- a/src/main/java/dev/plex/listener/impl/ChatListener.java
+++ b/src/main/java/dev/plex/listener/impl/ChatListener.java
@@ -23,6 +23,9 @@ public class ChatListener extends PlexListener
{
event.setFormat(String.format("%s %s §7» %s", plexPlayer.getRankFromString().getPrefix(), ChatColor.RESET + plexPlayer.getName(), event.getMessage()));
}
+ else
+ {
+ event.setFormat(String.format("%s §7» %s", ChatColor.RESET + plexPlayer.getName(), event.getMessage()));
+ }
}
-
}
diff --git a/src/main/java/dev/plex/listener/impl/FreezeListener.java b/src/main/java/dev/plex/listener/impl/FreezeListener.java
index 656e07d..6681e6d 100644
--- a/src/main/java/dev/plex/listener/impl/FreezeListener.java
+++ b/src/main/java/dev/plex/listener/impl/FreezeListener.java
@@ -17,5 +17,4 @@ public class FreezeListener extends PlexListener
e.setCancelled(true);
}
}
-
}
\ No newline at end of file
diff --git a/src/main/java/dev/plex/listener/impl/LoginListener.java b/src/main/java/dev/plex/listener/impl/LoginListener.java
index 9ac83a7..8b8fbde 100644
--- a/src/main/java/dev/plex/listener/impl/LoginListener.java
+++ b/src/main/java/dev/plex/listener/impl/LoginListener.java
@@ -7,7 +7,6 @@ import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
public class LoginListener extends PlexListener
{
-
//TODO: Customizable MSGS
@EventHandler
@@ -16,7 +15,7 @@ public class LoginListener extends PlexListener
PlexLog.log(String.valueOf(plugin.getBanManager().isBanned(event.getUniqueId())));
if (plugin.getBanManager().isBanned(event.getUniqueId()))
{
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, "§cYou're currently banned from this server.\n§cPlease appeal at §6https://forums.telesphoreo.me");
+ event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_BANNED, "§cYou're currently banned from this server.\n§cPlease appeal at §6https://forum.telesphoreo.me");
}
}
diff --git a/src/main/java/dev/plex/util/PlexUtils.java b/src/main/java/dev/plex/util/PlexUtils.java
index e26b3c9..e21796f 100644
--- a/src/main/java/dev/plex/util/PlexUtils.java
+++ b/src/main/java/dev/plex/util/PlexUtils.java
@@ -29,7 +29,7 @@ public class PlexUtils
{
public static Map CHAT_COLOR_NAMES;
public static List CHAT_COLOR_POOL;
- private static Random RANDOM;
+ private static final Random RANDOM;
static
{
diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml
index 2748834..9eeb74d 100644
--- a/src/main/resources/messages.yml
+++ b/src/main/resources/messages.yml
@@ -57,4 +57,11 @@ playerSetOtherGameMode: set your gamemode to .
consoleMustDefinePlayer: You must define a player since you are running this command from console.
newAdminAdded: - Adding to the admin list
adminRemoved: - Removing from the admin list
-adminSetRank: - Setting 's rank to
\ No newline at end of file
+adminSetRank: - Setting 's rank to
+teleportedToWorld: You have been teleported to the .
+higherRankThanYou: This player is an admin and a higher rank than you.
+playerNotAdmin: That player is not an admin.
+playerIsAdmin: That player is already an admin.
+rankNotFound: The rank you entered was not found.
+rankMustBeHigherThanAdmin: The rank you entered must be higher than Admin.
+consoleOnly: This command can only be executed by the console.
\ No newline at end of file