mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-23 01:27:37 +00:00
Actually add Player as a field to the commands
This commit is contained in:
parent
fe53f5c49f
commit
081a702c70
@ -28,10 +28,13 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.command.PluginIdentifiableCommand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class PlexCommand extends Command
|
public abstract class PlexCommand extends Command implements PluginIdentifiableCommand
|
||||||
{
|
{
|
||||||
protected static Plex plugin = Plex.get();
|
protected static Plex plugin = Plex.get();
|
||||||
|
|
||||||
@ -61,7 +64,7 @@ public abstract class PlexCommand extends Command
|
|||||||
getMap().register("plex", this);
|
getMap().register("plex", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Component execute(CommandSender sender, String[] args);
|
protected abstract Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, @NotNull String[] args);
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -113,7 +116,7 @@ public abstract class PlexCommand extends Command
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Component component = this.execute(sender, args);
|
Component component = this.execute(sender, isConsole(sender) ? null : (Player)sender, args);
|
||||||
if (component != null)
|
if (component != null)
|
||||||
{
|
{
|
||||||
send(sender, component);
|
send(sender, component);
|
||||||
@ -237,6 +240,12 @@ public abstract class PlexCommand extends Command
|
|||||||
return player.getUniqueId();
|
return player.getUniqueId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Plugin getPlugin()
|
||||||
|
{
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean isConsole(CommandSender sender)
|
protected boolean isConsole(CommandSender sender)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@ import net.kyori.adventure.text.Component;
|
|||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = RequiredCommandSource.ANY)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = RequiredCommandSource.ANY)
|
||||||
@ -30,7 +31,7 @@ public class AdminCMD extends PlexCommand
|
|||||||
//TODO: Better return messages
|
//TODO: Better return messages
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -16,13 +16,13 @@ import org.bukkit.entity.Player;
|
|||||||
public class AdminworldCMD extends PlexCommand
|
public class AdminworldCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
// TODO: Add adminworld settings
|
// TODO: Add adminworld settings
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
Location loc = new Location(Bukkit.getWorld("adminworld"), 0, 50, 0);
|
Location loc = new Location(Bukkit.getWorld("adminworld"), 0, 50, 0);
|
||||||
((Player)sender).teleportAsync(loc);
|
playerSender.teleportAsync(loc);
|
||||||
return tl("teleportedToWorld", "adminworld");
|
return tl("teleportedToWorld", "adminworld");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -22,20 +22,19 @@ public class AdventureCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
Player player = (Player)sender;
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
if (isConsole(sender))
|
if (isConsole(sender))
|
||||||
{
|
{
|
||||||
throw new CommandFailException("You must define a player when using the console!");
|
throw new CommandFailException("You must define a player when using the console!");
|
||||||
}
|
}
|
||||||
player.setGameMode(GameMode.ADVENTURE);
|
playerSender.setGameMode(GameMode.ADVENTURE);
|
||||||
return tl("gameModeSetTo", "adventure");
|
return tl("gameModeSetTo", "adventure");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkRank(player, Rank.ADMIN, "plex.gamemode.adventure.others"))
|
if (checkRank(playerSender, Rank.ADMIN, "plex.gamemode.adventure.others"))
|
||||||
{
|
{
|
||||||
if (args[0].equals("-a"))
|
if (args[0].equals("-a"))
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class BanCMD extends PlexCommand
|
public class BanCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -21,20 +21,19 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class CreativeCMD extends PlexCommand
|
public class CreativeCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
Player player = (Player)sender;
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
if (isConsole(sender))
|
if (isConsole(sender))
|
||||||
{
|
{
|
||||||
throw new CommandFailException("You must define a player when using the console!");
|
throw new CommandFailException("You must define a player when using the console!");
|
||||||
}
|
}
|
||||||
player.setGameMode(GameMode.CREATIVE);
|
playerSender.setGameMode(GameMode.CREATIVE);
|
||||||
return tl("gameModeSetTo", "creative");
|
return tl("gameModeSetTo", "creative");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkRank(player, Rank.ADMIN, "plex.gamemode.creative.others"))
|
if (checkRank(playerSender, Rank.ADMIN, "plex.gamemode.creative.others"))
|
||||||
{
|
{
|
||||||
if (args[0].equals("-a"))
|
if (args[0].equals("-a"))
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class DeopAllCMD extends PlexCommand
|
public class DeopAllCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class DeopCMD extends PlexCommand
|
public class DeopCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -17,12 +17,12 @@ public class FlatlandsCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
Location loc = new Location(Bukkit.getWorld("flatlands"), 0, 50, 0);
|
Location loc = new Location(Bukkit.getWorld("flatlands"), 0, 50, 0);
|
||||||
((Player)sender).teleportAsync(loc);
|
playerSender.teleportAsync(loc);
|
||||||
return tl("teleportedToWorld", "flatlands");
|
return tl("teleportedToWorld", "flatlands");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class FreezeCMD extends PlexCommand
|
public class FreezeCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -12,23 +12,25 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandParameters(name = "list", description = "Show a list of all online players", usage = "/<command> <player>")
|
@CommandParameters(name = "list", description = "Show a list of all online players")
|
||||||
@CommandPermissions(level = Rank.OP, permission = "plex.list")
|
@CommandPermissions(level = Rank.OP, permission = "plex.list")
|
||||||
public class ListCMD extends PlexCommand
|
public class ListCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected Component execute(CommandSender sender, String[] args)
|
protected Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
List<Player> players = Lists.newArrayList(Bukkit.getOnlinePlayers());
|
List<Player> players = Lists.newArrayList(Bukkit.getOnlinePlayers());
|
||||||
Component component = Component.text("There " + (players.size() > 1 ? "are" : "is") + " currently").color(NamedTextColor.GRAY)
|
Component component = Component.text("There " + (players.size() == 1 ? "is" : "are") + " currently").color(NamedTextColor.GRAY)
|
||||||
.append(Component.space())
|
.append(Component.space())
|
||||||
.append(Component.text(players.size()).color(NamedTextColor.YELLOW))
|
.append(Component.text(players.size()).color(NamedTextColor.YELLOW))
|
||||||
.append(Component.space())
|
.append(Component.space())
|
||||||
.append(Component.text(players.size() > 1 ? "players " : "player " + "online out of").color(NamedTextColor.GRAY))
|
.append(Component.text(players.size() == 1 ? "player" : "players").color(NamedTextColor.GRAY))
|
||||||
|
.append(Component.space())
|
||||||
|
.append(Component.text("online out of").color(NamedTextColor.GRAY))
|
||||||
.append(Component.space())
|
.append(Component.space())
|
||||||
.append(Component.text(Bukkit.getMaxPlayers()).color(NamedTextColor.YELLOW))
|
.append(Component.text(Bukkit.getMaxPlayers()).color(NamedTextColor.YELLOW))
|
||||||
.append(Component.newline())
|
.append(Component.space())
|
||||||
.append(Component.text("players").color(NamedTextColor.GRAY))
|
.append(Component.text(Bukkit.getMaxPlayers() == 1 ? "player." : "players.").color(NamedTextColor.GRAY))
|
||||||
.append(Component.newline());
|
.append(Component.newline());
|
||||||
for (int i = 0; i < players.size(); i++)
|
for (int i = 0; i < players.size(); i++)
|
||||||
{
|
{
|
||||||
|
21
src/main/java/dev/plex/command/impl/LocalSpawnCMD.java
Normal file
21
src/main/java/dev/plex/command/impl/LocalSpawnCMD.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package dev.plex.command.impl;
|
||||||
|
|
||||||
|
import dev.plex.command.PlexCommand;
|
||||||
|
import dev.plex.command.annotation.CommandParameters;
|
||||||
|
import dev.plex.command.annotation.CommandPermissions;
|
||||||
|
import dev.plex.rank.enums.Rank;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandParameters(name = "localspawn", description = "Teleport to the spawnpoint of the world you are in")
|
||||||
|
@CommandPermissions(level = Rank.OP, permission = "plex.spawnpoint")
|
||||||
|
public class LocalSpawnCMD extends PlexCommand
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
|
{
|
||||||
|
playerSender.teleportAsync(playerSender.getWorld().getSpawnLocation());
|
||||||
|
return tl("teleportedToWorldSpawn");
|
||||||
|
}
|
||||||
|
}
|
@ -17,13 +17,13 @@ public class MasterbuilderworldCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
// TODO: Add adminworld settings
|
// TODO: Add adminworld settings
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
Location loc = new Location(Bukkit.getWorld("masterbuilderworld"), 0, 50, 0);
|
Location loc = new Location(Bukkit.getWorld("masterbuilderworld"), 0, 50, 0);
|
||||||
((Player)sender).teleportAsync(loc);
|
playerSender.teleportAsync(loc);
|
||||||
return tl("teleportedToWorld", "Master Builder World");
|
return tl("teleportedToWorld", "Master Builder World");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -21,6 +21,7 @@ import net.kyori.adventure.text.format.TextDecoration;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@CommandParameters(name = "namehistory", description = "Get the name history of a player", usage = "/<command> <player>", aliases = "nh")
|
@CommandParameters(name = "namehistory", description = "Get the name history of a player", usage = "/<command> <player>", aliases = "nh")
|
||||||
@ -30,7 +31,7 @@ public class NameHistoryCMD extends PlexCommand
|
|||||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' HH:mm:ss");
|
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("MM/dd/yyyy 'at' HH:mm:ss");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
@ -38,7 +39,6 @@ public class NameHistoryCMD extends PlexCommand
|
|||||||
}
|
}
|
||||||
String username = args[0];
|
String username = args[0];
|
||||||
|
|
||||||
|
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayerIfCached(username);
|
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayerIfCached(username);
|
||||||
if (offlinePlayer != null)
|
if (offlinePlayer != null)
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class OpAllCMD extends PlexCommand
|
public class OpAllCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
for (Player player : Bukkit.getOnlinePlayers())
|
for (Player player : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class OpCMD extends PlexCommand
|
public class OpCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, permission = "plex.plex", source = RequiredCommandSource.ANY)
|
@CommandPermissions(level = Rank.OP, permission = "plex.plex", source = RequiredCommandSource.ANY)
|
||||||
@ -20,7 +21,7 @@ public class PlexCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PunishmentsCMD extends PlexCommand
|
public class PunishmentsCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
new PunishmentMenu().openInv(((Player)sender), 0);
|
new PunishmentMenu().openInv(((Player)sender), 0);
|
||||||
return null;
|
return null;
|
||||||
|
@ -16,8 +16,8 @@ import org.bukkit.entity.Player;
|
|||||||
public class RankCMD extends PlexCommand
|
public class RankCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
return tl("yourRank", getPlexPlayer((Player)sender).getRank());
|
return tl("yourRank", getPlexPlayer(playerSender).getLoginMSG());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,20 +21,19 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class SpectatorCMD extends PlexCommand
|
public class SpectatorCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
Player player = (Player)sender;
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
if (isConsole(sender))
|
if (isConsole(sender))
|
||||||
{
|
{
|
||||||
throw new CommandFailException("You must define a player when using the console!");
|
throw new CommandFailException("You must define a player when using the console!");
|
||||||
}
|
}
|
||||||
player.setGameMode(GameMode.SPECTATOR);
|
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||||
return tl("gameModeSetTo", "spectator");
|
return tl("gameModeSetTo", "spectator");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkRank(player, Rank.ADMIN, "plex.gamemode.spectator.others"))
|
if (checkRank(playerSender, Rank.ADMIN, "plex.gamemode.spectator.others"))
|
||||||
{
|
{
|
||||||
if (args[0].equals("-a"))
|
if (args[0].equals("-a"))
|
||||||
{
|
{
|
||||||
|
@ -21,20 +21,19 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class SurvivalCMD extends PlexCommand
|
public class SurvivalCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
Player player = (Player)sender;
|
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
if (isConsole(sender))
|
if (isConsole(sender))
|
||||||
{
|
{
|
||||||
throw new CommandFailException("You must define a player when using the console!");
|
throw new CommandFailException("You must define a player when using the console!");
|
||||||
}
|
}
|
||||||
player.setGameMode(GameMode.SURVIVAL);
|
playerSender.setGameMode(GameMode.SURVIVAL);
|
||||||
return tl("gameModeSetTo", "survival");
|
return tl("gameModeSetTo", "survival");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkRank(player, Rank.ADMIN, "plex.gamemode.survival.others"))
|
if (checkRank(playerSender, Rank.ADMIN, "plex.gamemode.survival.others"))
|
||||||
{
|
{
|
||||||
if (args[0].equals("-a"))
|
if (args[0].equals("-a"))
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@CommandParameters(name = "unban", usage = "/<command> <player>", description = "Unbans a player, offline or online")
|
@CommandParameters(name = "unban", usage = "/<command> <player>", description = "Unbans a player, offline or online")
|
||||||
@ -23,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class UnbanCMD extends PlexCommand
|
public class UnbanCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -21,16 +21,15 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
@CommandParameters(name = "world", description = "Teleport to a world.", usage = "/<command> <world>")
|
@CommandParameters(name = "world", description = "Teleport to a world.", usage = "/<command> <world>")
|
||||||
public class WorldCMD extends PlexCommand
|
public class WorldCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component execute(CommandSender sender, String[] args)
|
public Component execute(CommandSender sender, Player playerSender, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
throw new CommandArgumentException();
|
throw new CommandArgumentException();
|
||||||
}
|
}
|
||||||
World world = getNonNullWorld(args[0]);
|
World world = getNonNullWorld(args[0]);
|
||||||
((Player)sender).teleportAsync(new Location(world, 0, world.getHighestBlockYAt(0, 0) + 1, 0, 0, 0));
|
playerSender.teleportAsync(new Location(world, 0, world.getHighestBlockYAt(0, 0) + 1, 0, 0, 0));
|
||||||
return tl("playerWorldTeleport", world.getName());
|
return tl("playerWorldTeleport", world.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,5 +42,4 @@ public class WorldCMD extends PlexCommand
|
|||||||
}
|
}
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class CommandHandler extends PlexBase
|
|||||||
commands.add(new FlatlandsCMD());
|
commands.add(new FlatlandsCMD());
|
||||||
commands.add(new FreezeCMD());
|
commands.add(new FreezeCMD());
|
||||||
commands.add(new ListCMD());
|
commands.add(new ListCMD());
|
||||||
|
commands.add(new LocalSpawnCMD());
|
||||||
commands.add(new MasterbuilderworldCMD());
|
commands.add(new MasterbuilderworldCMD());
|
||||||
commands.add(new NameHistoryCMD());
|
commands.add(new NameHistoryCMD());
|
||||||
commands.add(new PlexCMD());
|
commands.add(new PlexCMD());
|
||||||
|
@ -71,3 +71,4 @@ yourRank: "<b>Your rank is: <v>"
|
|||||||
banningPlayer: "<e><v> - Banning <v>"
|
banningPlayer: "<e><v> - Banning <v>"
|
||||||
unbanningPlayer: "<b><v> - Unbanning <v>"
|
unbanningPlayer: "<b><v> - Unbanning <v>"
|
||||||
playerNotBanned: "<e>That player is not banned!"
|
playerNotBanned: "<e>That player is not banned!"
|
||||||
|
teleportedToWorldSpawn: "<b>Teleporting to the local spawn"
|
Loading…
Reference in New Issue
Block a user