mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-17 12:54:03 +00:00
Reformat
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package me.totalfreedom.plex.command;
|
||||
|
||||
import me.totalfreedom.plex.command.source.CommandSource;
|
||||
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.source.CommandSource;
|
||||
|
||||
public interface IPlexCommand
|
||||
{
|
||||
|
||||
void execute(CommandSource sender, String[] args);
|
||||
|
||||
List<String> onTabComplete(CommandSource sender, String[] args);
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,9 @@
|
||||
package me.totalfreedom.plex.command;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import me.totalfreedom.plex.Plex;
|
||||
import me.totalfreedom.plex.cache.PlayerCache;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
@@ -16,13 +19,12 @@ import me.totalfreedom.plex.util.PlexLog;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
public abstract class PlexCommand extends Command implements TabExecutor, IPlexCommand
|
||||
@@ -67,9 +69,14 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
|
||||
{
|
||||
if (!matches(label)) return false;
|
||||
if (!matches(label))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.sender == null)
|
||||
{
|
||||
this.sender = new CommandSource(sender);
|
||||
}
|
||||
PlexLog.log(this.sender.getSender().getName());
|
||||
if (commandSource == RequiredCommandSource.CONSOLE && sender instanceof Player)
|
||||
{
|
||||
@@ -83,7 +90,7 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
sender.sendMessage(tl("noPermissionConsole"));
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
Player player = (Player)sender;
|
||||
PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(player.getUniqueId());
|
||||
if (!plexPlayer.getRankFromString().isAtLeast(getLevel()))
|
||||
{
|
||||
@@ -109,20 +116,29 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String alias, String[] args)
|
||||
{
|
||||
if (!matches(alias)) return ImmutableList.of();
|
||||
if (!matches(alias))
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
if (this.sender == null)
|
||||
{
|
||||
this.sender = new CommandSource(sender);
|
||||
}
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
Player player = (Player) sender;
|
||||
Player player = (Player)sender;
|
||||
PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(player.getUniqueId());
|
||||
if (plexPlayer.getRankFromString().isAtLeast(getLevel()))
|
||||
{
|
||||
return onTabComplete(this.sender, args);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return onTabComplete(this.sender, args);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +160,8 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (params.aliases().split(",").length < 1)
|
||||
}
|
||||
else if (params.aliases().split(",").length < 1)
|
||||
{
|
||||
return getName().equalsIgnoreCase(label);
|
||||
}
|
||||
@@ -169,7 +186,9 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
protected void send(String s)
|
||||
{
|
||||
if (sender == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
send(s, sender);
|
||||
}
|
||||
|
||||
@@ -177,7 +196,9 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
{
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
{
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
||||
@@ -186,7 +207,9 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
Player player = getNonNullPlayer(name);
|
||||
PlexPlayer plexPlayer = PlayerCache.getPlexPlayer(player.getUniqueId());
|
||||
if (plexPlayer == null)
|
||||
{
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
return plexPlayer;
|
||||
}
|
||||
|
||||
@@ -194,7 +217,9 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
{
|
||||
PlexPlayer plexPlayer = PlayerCache.getPlexPlayer(uuid);
|
||||
if (plexPlayer == null)
|
||||
{
|
||||
throw new PlayerNotFoundException();
|
||||
}
|
||||
return plexPlayer;
|
||||
}
|
||||
|
||||
@@ -202,7 +227,9 @@ public abstract class PlexCommand extends Command implements TabExecutor, IPlexC
|
||||
{
|
||||
World world = Bukkit.getWorld(name);
|
||||
if (world == null)
|
||||
{
|
||||
throw new CommandFailException(tl("worldNotFound"));
|
||||
}
|
||||
return world;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,8 @@ import java.lang.annotation.RetentionPolicy;
|
||||
public @interface CommandParameters
|
||||
{
|
||||
String description() default "";
|
||||
|
||||
String usage() default "/<command>";
|
||||
|
||||
String aliases() default "";
|
||||
}
|
@@ -1,14 +1,14 @@
|
||||
package me.totalfreedom.plex.command.annotation;
|
||||
|
||||
import me.totalfreedom.plex.command.source.RequiredCommandSource;
|
||||
import me.totalfreedom.plex.rank.enums.Rank;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import me.totalfreedom.plex.command.source.RequiredCommandSource;
|
||||
import me.totalfreedom.plex.rank.enums.Rank;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandPermissions
|
||||
{
|
||||
Rank level() default Rank.IMPOSTOR;
|
||||
|
||||
RequiredCommandSource source() default RequiredCommandSource.ANY;
|
||||
}
|
@@ -1,3 +1,5 @@
|
||||
package me.totalfreedom.plex.command.exception;
|
||||
|
||||
public class CommandArgumentException extends RuntimeException {} // lolololol
|
||||
public class CommandArgumentException extends RuntimeException
|
||||
{
|
||||
} // lolololol
|
@@ -1,6 +1,9 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import me.totalfreedom.plex.cache.DataUtils;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
@@ -16,15 +19,12 @@ import me.totalfreedom.plex.util.PlexUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = RequiredCommandSource.CONSOLE)
|
||||
@CommandParameters(usage = "/<command> <add | remove | setrank | list> [player] [rank]", aliases = "adminconfig,adminmanage", description = "Manages all admins")
|
||||
public class AdminCMD extends PlexCommand
|
||||
{
|
||||
public AdminCMD() {
|
||||
public AdminCMD()
|
||||
{
|
||||
super("admin");
|
||||
}
|
||||
|
||||
@@ -133,11 +133,13 @@ public class AdminCMD extends PlexCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
return Arrays.asList("add", "remove", "setrank", "list");
|
||||
} else if (args.length == 2 && !args[0].equalsIgnoreCase("list"))
|
||||
}
|
||||
else if (args.length == 2 && !args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
return PlexUtils.getPlayerNameList();
|
||||
}
|
||||
|
@@ -1,6 +1,11 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import me.totalfreedom.plex.cache.PlayerCache;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
@@ -12,12 +17,16 @@ import me.totalfreedom.plex.command.source.RequiredCommandSource;
|
||||
import me.totalfreedom.plex.util.PlexUtils;
|
||||
import me.totalfreedom.plex.world.BlockMapChunkGenerator;
|
||||
import me.totalfreedom.plex.world.CustomWorld;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Strider;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandParameters(description = "Subliminal message.")
|
||||
@@ -36,9 +45,13 @@ public class FionnCMD extends PlexCommand
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
if (!sender.getPlayer().getUniqueId().equals(UUID.fromString("9aa3eda6-c271-440a-a578-a952ee9aee2f")))
|
||||
{
|
||||
throw new CommandFailException(tl("noPermission"));
|
||||
}
|
||||
if (args.length != 0)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
}
|
||||
String name = "fionn";
|
||||
LinkedHashMap<Material, Integer> map = new LinkedHashMap<>();
|
||||
map.put(Material.CRIMSON_NYLIUM, 1);
|
||||
@@ -47,11 +60,11 @@ public class FionnCMD extends PlexCommand
|
||||
ENABLED = true;
|
||||
fionnWorld.setTime(0);
|
||||
fionnWorld.getBlockAt(0, 5, 0).setType(Material.BARRIER);
|
||||
Strider fionn = (Strider) fionnWorld.spawnEntity(new Location(fionnWorld, 12, 6, 6, -180, -3), EntityType.STRIDER);
|
||||
Strider fionn = (Strider)fionnWorld.spawnEntity(new Location(fionnWorld, 12, 6, 6, -180, -3), EntityType.STRIDER);
|
||||
fionn.setCustomNameVisible(true);
|
||||
fionn.setCustomName(ChatColor.GREEN + "fionn");
|
||||
fionn.setAI(false);
|
||||
Enderman elmon = (Enderman) fionnWorld.spawnEntity(new Location(fionnWorld, 12, 6, 0, 0, 18), EntityType.ENDERMAN);
|
||||
Enderman elmon = (Enderman)fionnWorld.spawnEntity(new Location(fionnWorld, 12, 6, 0, 0, 18), EntityType.ENDERMAN);
|
||||
elmon.setCustomNameVisible(true);
|
||||
elmon.setCustomName(ChatColor.RED + "elmon");
|
||||
elmon.setInvulnerable(true);
|
||||
@@ -108,7 +121,9 @@ public class FionnCMD extends PlexCommand
|
||||
p.setInvisible(false);
|
||||
Location location = LOCATION_CACHE.get(p);
|
||||
if (location != null)
|
||||
{
|
||||
p.teleport(location);
|
||||
}
|
||||
PlayerCache.getPunishedPlayer(p.getUniqueId()).setFrozen(false);
|
||||
}
|
||||
LOCATION_CACHE.clear();
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.cache.PlayerCache;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
@@ -11,9 +12,6 @@ import me.totalfreedom.plex.player.PunishedPlayer;
|
||||
import me.totalfreedom.plex.rank.enums.Rank;
|
||||
import me.totalfreedom.plex.util.PlexUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandParameters(description = "Freeze/unfreeze a player on the server", usage = "/<command> <player>")
|
||||
@@ -29,7 +27,9 @@ public class FreezeCMD extends PlexCommand
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
PunishedPlayer punishedPlayer = PlayerCache.getPunishedPlayer(player.getUniqueId());
|
||||
punishedPlayer.setFrozen(!punishedPlayer.isFrozen());
|
||||
|
@@ -1,6 +1,10 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||
@@ -11,12 +15,6 @@ import me.totalfreedom.plex.util.PlexUtils;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandParameters(description = "Get the name history of a player", usage = "/<command> <player>", aliases = "nh")
|
||||
@@ -34,14 +32,16 @@ public class NameHistoryCMD extends PlexCommand
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
}
|
||||
String username = args[0];
|
||||
JSONArray array;
|
||||
try
|
||||
{
|
||||
JSONObject profile = (JSONObject) PlexUtils.simpleGET("https://api.mojang.com/users/profiles/minecraft/" + username);
|
||||
String uuid = (String) profile.get("id");
|
||||
array = (JSONArray) PlexUtils.simpleGET("https://api.mojang.com/user/profiles/" + uuid + "/names");
|
||||
JSONObject profile = (JSONObject)PlexUtils.simpleGET("https://api.mojang.com/users/profiles/minecraft/" + username);
|
||||
String uuid = (String)profile.get("id");
|
||||
array = (JSONArray)PlexUtils.simpleGET("https://api.mojang.com/user/profiles/" + uuid + "/names");
|
||||
}
|
||||
catch (ParseException | IOException ex)
|
||||
{
|
||||
@@ -56,14 +56,18 @@ public class NameHistoryCMD extends PlexCommand
|
||||
.append("\n");
|
||||
for (Object o : array)
|
||||
{
|
||||
JSONObject object = (JSONObject) o;
|
||||
JSONObject object = (JSONObject)o;
|
||||
Object changedToAt = object.get("changedToAt");
|
||||
if (changedToAt == null)
|
||||
{
|
||||
changedToAt = "O";
|
||||
}
|
||||
else
|
||||
{
|
||||
changedToAt = DATE_FORMAT.format(changedToAt);
|
||||
}
|
||||
result.append(tl("nameHistoryBody", object.get("name"), changedToAt))
|
||||
.append("\n");
|
||||
.append("\n");
|
||||
}
|
||||
send(result.toString());
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||
@@ -9,9 +10,6 @@ import me.totalfreedom.plex.rank.enums.Rank;
|
||||
import me.totalfreedom.plex.util.PlexUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandParameters(description = "Op everyone on the server", aliases = "opa")
|
||||
@@ -27,12 +25,15 @@ public class OpAllCMD extends PlexCommand
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.setOp(true);
|
||||
}
|
||||
PlexUtils.broadcast(tl("oppedAllPlayers", sender.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||
@@ -9,9 +10,6 @@ import me.totalfreedom.plex.command.source.CommandSource;
|
||||
import me.totalfreedom.plex.rank.enums.Rank;
|
||||
import me.totalfreedom.plex.util.PlexUtils;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandParameters(description = "Op a player on the server", usage = "/<command> <player>")
|
||||
@@ -27,7 +25,9 @@ public class OpCMD extends PlexCommand
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
}
|
||||
Player player = getNonNullPlayer(args[0]);
|
||||
player.setOp(true);
|
||||
PlexUtils.broadcast(tl("oppedPlayer", sender.getName(), player.getName()));
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||
@@ -7,14 +9,12 @@ import me.totalfreedom.plex.command.source.CommandSource;
|
||||
import me.totalfreedom.plex.command.source.RequiredCommandSource;
|
||||
import me.totalfreedom.plex.rank.enums.Rank;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "plexhelp", description = "Help with plex")
|
||||
public class PlexCMD extends PlexCommand
|
||||
{
|
||||
public PlexCMD() {
|
||||
public PlexCMD()
|
||||
{
|
||||
super("plex");
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ public class PlexCMD extends PlexCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
return Arrays.asList("Telesphoreo", "super", "Taahh");
|
||||
}
|
||||
}
|
||||
|
@@ -1,23 +1,22 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.source.CommandSource;
|
||||
import me.totalfreedom.plex.command.source.RequiredCommandSource;
|
||||
import me.totalfreedom.plex.rank.enums.Rank;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.ANY)
|
||||
@CommandParameters(aliases = "tst,tast", description = "HELLO")
|
||||
public class TestCMD extends PlexCommand
|
||||
{
|
||||
public TestCMD() {
|
||||
public TestCMD()
|
||||
{
|
||||
super("test");
|
||||
}
|
||||
|
||||
@@ -28,7 +27,8 @@ public class TestCMD extends PlexCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args) {
|
||||
public List<String> onTabComplete(CommandSource sender, String[] args)
|
||||
{
|
||||
if (args.length == 1)
|
||||
{
|
||||
return Arrays.asList("WHATTHEFAWK", "LUL");
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package me.totalfreedom.plex.command.impl;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.plex.command.PlexCommand;
|
||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||
@@ -11,17 +13,14 @@ import me.totalfreedom.plex.rank.enums.Rank;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static me.totalfreedom.plex.util.PlexUtils.tl;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = RequiredCommandSource.IN_GAME)
|
||||
@CommandParameters(description = "Teleport to a world.", usage = "/<command> <world>")
|
||||
public class WorldCMD extends PlexCommand
|
||||
{
|
||||
public WorldCMD() {
|
||||
public WorldCMD()
|
||||
{
|
||||
super("world");
|
||||
}
|
||||
|
||||
@@ -29,7 +28,9 @@ public class WorldCMD extends PlexCommand
|
||||
public void execute(CommandSource sender, String[] args)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
throw new CommandArgumentException();
|
||||
}
|
||||
World world = getNonNullWorld(args[0]);
|
||||
sender.getPlayer().teleport(new Location(world, 0, world.getHighestBlockYAt(0, 0) + 1, 0, 0, 0));
|
||||
send(tl("playerWorldTeleport", world.getName()));
|
||||
@@ -40,9 +41,13 @@ public class WorldCMD extends PlexCommand
|
||||
{
|
||||
List<String> worlds = new ArrayList<>();
|
||||
for (World world : Bukkit.getWorlds())
|
||||
{
|
||||
worlds.add(world.getName());
|
||||
}
|
||||
if (args.length == 1)
|
||||
{
|
||||
return worlds;
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ public class CommandSource
|
||||
{
|
||||
this.sender = sender;
|
||||
this.player = sender instanceof Player ? Bukkit.getPlayer(sender.getName()) : null;
|
||||
this.plexPlayer = sender instanceof Player ? PlayerCache.getPlexPlayerMap().get(((Player) sender).getUniqueId()) : null;
|
||||
this.plexPlayer = sender instanceof Player ? PlayerCache.getPlexPlayerMap().get(((Player)sender).getUniqueId()) : null;
|
||||
}
|
||||
|
||||
public void send(String s)
|
||||
|
Reference in New Issue
Block a user