mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-01 07:36:42 +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
|
||||
|
Reference in New Issue
Block a user