mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-28 06:26:41 +00:00
Some updates
This commit is contained in:
@ -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"));
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
48
src/main/java/dev/plex/command/impl/AdminworldCMD.java
Normal file
48
src/main/java/dev/plex/command/impl/AdminworldCMD.java
Normal file
@ -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<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
47
src/main/java/dev/plex/command/impl/FlatlandsCMD.java
Normal file
47
src/main/java/dev/plex/command/impl/FlatlandsCMD.java
Normal file
@ -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<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
@ -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<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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<PlexCommand> commands = Lists.newArrayList();
|
||||
|
||||
public CommandHandler()
|
||||
{
|
||||
List<PlexCommand> 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()));
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ import dev.plex.util.PlexLog;
|
||||
|
||||
public class ListenerHandler
|
||||
{
|
||||
List<PlexListener> listeners = Lists.newArrayList();
|
||||
public ListenerHandler()
|
||||
{
|
||||
List<PlexListener> listeners = Lists.newArrayList();
|
||||
listeners.add(new ServerListener());
|
||||
listeners.add(new ChatListener());
|
||||
listeners.add(new PlayerListener());
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,5 +17,4 @@ public class FreezeListener extends PlexListener
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class PlexUtils
|
||||
{
|
||||
public static Map<String, ChatColor> CHAT_COLOR_NAMES;
|
||||
public static List<ChatColor> CHAT_COLOR_POOL;
|
||||
private static Random RANDOM;
|
||||
private static final Random RANDOM;
|
||||
|
||||
static
|
||||
{
|
||||
|
@ -57,4 +57,11 @@ playerSetOtherGameMode: <v> set your gamemode to <v>.
|
||||
consoleMustDefinePlayer: You must define a player since you are running this command from console.
|
||||
newAdminAdded: <b><v> - Adding <v> to the admin list
|
||||
adminRemoved: <c><v> - Removing <v> from the admin list
|
||||
adminSetRank: <b><v> - Setting <v>'s rank to <v>
|
||||
adminSetRank: <b><v> - Setting <v>'s rank to <v>
|
||||
teleportedToWorld: <b>You have been teleported to the <v>.
|
||||
higherRankThanYou: <b>This player is an admin and a higher rank than you.
|
||||
playerNotAdmin: <b>That player is not an admin.
|
||||
playerIsAdmin: <b>That player is already an admin.
|
||||
rankNotFound: <b>The rank you entered was not found.
|
||||
rankMustBeHigherThanAdmin: <b>The rank you entered must be higher than Admin.
|
||||
consoleOnly: <b>This command can only be executed by the console.
|
Reference in New Issue
Block a user