mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Optionals introduced, code cleaned, potential purge fix
This commit is contained in:
@ -73,12 +73,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -93,6 +87,13 @@ import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
public static BukkitMain THIS;
|
||||
@ -449,18 +450,15 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) {
|
||||
if (new LikePlotMeConverter().run(new ClassicPlotMeConnector())) {
|
||||
return;
|
||||
}
|
||||
if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
|
||||
return;
|
||||
}
|
||||
if (new LikePlotMeConverter("AthionPlots").run(new ClassicPlotMeConnector())) {
|
||||
if (new LikePlotMeConverter().run(new PlotMeConnector_017())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
return Bukkit.getPluginManager().getPlugin("PlotMe") != null || Bukkit.getPluginManager().getPlugin("AthionPlots") != null;
|
||||
return Bukkit.getPluginManager().getPlugin("PlotMe") != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,29 +113,22 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
try {
|
||||
byte[] bytes = resultSet.getBytes(column);
|
||||
if (bytes != null) {
|
||||
try {
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
long high = bb.getLong();
|
||||
long low = bb.getLong();
|
||||
owner = new UUID(high, low);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
owner = UUID.nameUUIDFromBytes(bytes);
|
||||
}
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
long high = bb.getLong();
|
||||
long low = bb.getLong();
|
||||
owner = new UUID(high, low);
|
||||
UUIDHandler.add(new StringWrapper(name), owner);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (owner == null) {
|
||||
if (name.isEmpty()) {
|
||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
missing++;
|
||||
continue;
|
||||
}
|
||||
owner = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
if (name.isEmpty()) {
|
||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
missing++;
|
||||
continue;
|
||||
}
|
||||
owner = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
} else {
|
||||
UUIDHandler.add(new StringWrapper(name), owner);
|
||||
@ -183,15 +176,10 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
try {
|
||||
byte[] bytes = resultSet.getBytes("playerid");
|
||||
if (bytes != null) {
|
||||
try {
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
long high = bb.getLong();
|
||||
long low = bb.getLong();
|
||||
denied = new UUID(high, low);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
denied = UUID.nameUUIDFromBytes(bytes);
|
||||
}
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
long mostSigBits = bb.getLong();
|
||||
long leastSigBits = bb.getLong();
|
||||
denied = new UUID(mostSigBits, leastSigBits);
|
||||
UUIDHandler.add(new StringWrapper(name), denied);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@ -227,15 +215,10 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||
try {
|
||||
byte[] bytes = resultSet.getBytes("playerid");
|
||||
if (bytes != null) {
|
||||
try {
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
long high = bb.getLong();
|
||||
long low = bb.getLong();
|
||||
helper = new UUID(high, low);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
helper = UUID.nameUUIDFromBytes(bytes);
|
||||
}
|
||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
||||
long mostSigBits = bb.getLong();
|
||||
long leastSigBits = bb.getLong();
|
||||
helper = new UUID(mostSigBits, leastSigBits);
|
||||
UUIDHandler.add(new StringWrapper(name), helper);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -24,6 +24,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -33,17 +34,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class LikePlotMeConverter {
|
||||
|
||||
private final String plugin;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param plugin Plugin Used to run the converter
|
||||
*/
|
||||
public LikePlotMeConverter(String plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public static String getWorld(String world) {
|
||||
for (World newWorld : Bukkit.getWorlds()) {
|
||||
if (newWorld.getName().equalsIgnoreCase(world)) {
|
||||
@ -58,11 +48,7 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
|
||||
public String getPlotMePath() {
|
||||
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator + this.plugin + File.separator;
|
||||
}
|
||||
|
||||
public String getAthionPlotsPath() {
|
||||
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator + this.plugin + File.separator;
|
||||
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator + "PlotMe" + File.separator;
|
||||
}
|
||||
|
||||
public FileConfiguration getPlotMeConfig(String dataFolder) {
|
||||
@ -131,31 +117,31 @@ public class LikePlotMeConverter {
|
||||
|
||||
PS.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
||||
|
||||
Connection connection = connector.getPlotMeConnection(this.plugin, plotConfig, dataFolder);
|
||||
Connection connection = connector.getPlotMeConnection("PlotMe", plotConfig, dataFolder);
|
||||
|
||||
if (!connector.isValidConnection(connection)) {
|
||||
sendMessage("Cannot connect to PlotMe DB. Conversion process will not continue");
|
||||
return false;
|
||||
}
|
||||
|
||||
sendMessage(this.plugin + " conversion has started. To disable this, please set 'plotme-convert.enabled' to false in the 'settings.yml'");
|
||||
sendMessage("PlotMe conversion has started. To disable this, please set 'plotme-convert.enabled' to false in the 'settings.yml'");
|
||||
|
||||
mergeWorldYml(this.plugin, plotConfig);
|
||||
mergeWorldYml("PlotMe", plotConfig);
|
||||
|
||||
sendMessage("Connecting to " + this.plugin + " DB");
|
||||
sendMessage("Connecting to PlotMe DB");
|
||||
|
||||
ArrayList<Plot> createdPlots = new ArrayList<>();
|
||||
|
||||
sendMessage("Collecting plot data");
|
||||
|
||||
String dbPrefix = this.plugin.toLowerCase();
|
||||
String dbPrefix = "PlotMe".toLowerCase();
|
||||
sendMessage(" - " + dbPrefix + "Plots");
|
||||
final Set<String> worlds = getPlotMeWorlds(plotConfig);
|
||||
|
||||
if (Settings.CONVERT_PLOTME) {
|
||||
sendMessage("Updating bukkit.yml");
|
||||
updateWorldYml(this.plugin, "bukkit.yml");
|
||||
updateWorldYml(this.plugin, "plugins/Multiverse-Core/worlds.yml");
|
||||
updateWorldYml("PlotMe", "bukkit.yml");
|
||||
updateWorldYml("PlotMe", "plugins/Multiverse-Core/worlds.yml");
|
||||
for (String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
||||
sendMessage("Copying config for: " + world);
|
||||
try {
|
||||
@ -188,24 +174,17 @@ public class LikePlotMeConverter {
|
||||
for (String world : plots.keySet()) {
|
||||
String actualWorldName = getWorld(world);
|
||||
String plotMeWorldName = world.toLowerCase();
|
||||
Integer pathwidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
||||
/*
|
||||
* TODO: dead code
|
||||
*
|
||||
if (pathwidth == null) {
|
||||
pathwidth = 7;
|
||||
}
|
||||
*/
|
||||
PS.get().config.set("worlds." + world + ".road.width", pathwidth);
|
||||
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
||||
PS.get().config.set("worlds." + world + ".road.width", pathWidth);
|
||||
|
||||
Integer pathheight = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
||||
if (pathheight == 0) {
|
||||
pathheight = 64;
|
||||
int pathHeight = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
||||
if (pathHeight == 0) {
|
||||
pathHeight = 64;
|
||||
}
|
||||
PS.get().config.set("worlds." + world + ".road.height", pathheight);
|
||||
PS.get().config.set("worlds." + world + ".wall.height", pathheight);
|
||||
PS.get().config.set("worlds." + world + ".plot.height", pathheight);
|
||||
Integer plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize"); //
|
||||
PS.get().config.set("worlds." + world + ".road.height", pathHeight);
|
||||
PS.get().config.set("worlds." + world + ".wall.height", pathHeight);
|
||||
PS.get().config.set("worlds." + world + ".plot.height", pathHeight);
|
||||
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
|
||||
if (plotSize == 0) {
|
||||
plotSize = 32;
|
||||
}
|
||||
@ -218,7 +197,7 @@ public class LikePlotMeConverter {
|
||||
PS.get().config.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
||||
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
||||
PS.get().config.set("worlds." + world + ".road.block", road);
|
||||
Integer height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
||||
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight"); //
|
||||
if (height == 0) {
|
||||
height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight"); //
|
||||
if (height == 0) {
|
||||
@ -364,7 +343,7 @@ public class LikePlotMeConverter {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
} catch (InterruptedException | SQLException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug("&/end/");
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
@ -131,8 +130,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
Plot plot = new Plot(PlotArea.createGeneric(world), id, owner);
|
||||
plots.put(key, plot);
|
||||
}
|
||||
for (Entry<Integer, Plot> entry : plots.entrySet()) {
|
||||
Plot plot = entry.getValue();
|
||||
for (Plot plot : plots.values()) {
|
||||
HashMap<PlotId, boolean[]> mergeMap = merges.get(plot.getArea().worldname);
|
||||
if (mergeMap != null) {
|
||||
if (mergeMap.containsKey(plot.getId())) {
|
||||
@ -180,8 +178,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
}
|
||||
HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
||||
|
||||
for (Entry<Integer, Plot> entry : plots.entrySet()) {
|
||||
Plot plot = entry.getValue();
|
||||
for (Plot plot : plots.values()) {
|
||||
HashMap<PlotId, Plot> map = processed.get(plot.getArea().worldname);
|
||||
if (map == null) {
|
||||
map = new HashMap<>();
|
||||
|
@ -15,16 +15,17 @@ import com.intellectualcrafters.plot.util.PlotChunk;
|
||||
import com.intellectualcrafters.plot.util.SetQueue;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.block.GenChunk;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
|
||||
|
||||
private final PlotChunk<Chunk> chunkSetter;
|
||||
@ -56,11 +57,11 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
random.state = c.getX() << 16 | c.getZ() & 0xFFFF;
|
||||
BukkitPlotGenerator.this.random.state = c.getX() << 16 | c.getZ() & 0xFFFF;
|
||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
||||
SetQueue.ChunkWrapper wrap = SetQueue.IMP.new ChunkWrapper(area.worldname, c.getX(), c.getZ());
|
||||
PlotChunk<?> chunk = SetQueue.IMP.queue.getChunk(wrap);
|
||||
if (plotGenerator.populateChunk(chunk, area, random)) {
|
||||
if (BukkitPlotGenerator.this.plotGenerator.populateChunk(chunk, area, BukkitPlotGenerator.this.random)) {
|
||||
chunk.addToQueue();
|
||||
}
|
||||
}
|
||||
@ -212,12 +213,9 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (world == null) {
|
||||
return populators;
|
||||
}
|
||||
ArrayList<BlockPopulator> toAdd = new ArrayList<BlockPopulator>();
|
||||
List<BlockPopulator> existing = world.getPopulators();
|
||||
for (BlockPopulator populator : populators) {
|
||||
for (BlockPopulator populator : this.populators) {
|
||||
if (!existing.contains(populator)) {
|
||||
toAdd.add(populator);
|
||||
}
|
||||
|
@ -28,16 +28,6 @@ import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlayerBlockEventType;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -52,6 +42,7 @@ import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
@ -119,6 +110,17 @@ import org.bukkit.projectiles.BlockProjectileSource;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Player Events involving plots.
|
||||
*
|
||||
@ -361,7 +363,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
BukkitPlayer pp = (BukkitPlayer) BukkitUtil.getPlayer(player);
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
if (plot == null) {
|
||||
return;
|
||||
@ -564,14 +566,13 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer plr = BukkitUtil.getPlayer(player);
|
||||
Location loc = plr.getLocation();
|
||||
PlotArea area = loc.getPlotArea();
|
||||
if (area == null || (!area.PLOT_CHAT && !plr.getAttribute("chat"))) {
|
||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
||||
Location location = plotPlayer.getLocation();
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null || (!area.PLOT_CHAT && !plotPlayer.getAttribute("chat"))) {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getPlot(loc);
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot == null) {
|
||||
return;
|
||||
}
|
||||
@ -606,7 +607,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void BlockDestroy(BlockBreakEvent event) {
|
||||
public void blockDestroy(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Location loc = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||
PlotArea area = loc.getPlotArea();
|
||||
@ -745,7 +746,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
Entity e = event.getEntity();
|
||||
if (!(e instanceof org.bukkit.entity.FallingBlock)) {
|
||||
if (!(e instanceof FallingBlock)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class BukkitChatManager extends ChatManager<FancyMessage> {
|
||||
|
||||
@Override
|
||||
public void send(PlotMessage m, PlotPlayer player) {
|
||||
if (ConsolePlayer.isConsole(player)) {
|
||||
if (player instanceof ConsolePlayer) {
|
||||
player.sendMessage(m.$(this).toOldMessageFormat());
|
||||
} else {
|
||||
m.$(this).send(((BukkitPlayer) player).player);
|
||||
|
@ -4,9 +4,12 @@ import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.plotsquared.bukkit.commands.DebugUUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.ProxiedCommandSender;
|
||||
import org.bukkit.command.RemoteConsoleCommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -22,41 +25,19 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender commandSender, org.bukkit.command.Command command, final String commandLabel, String[] args) {
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String commandLabel, String[] args) {
|
||||
if (commandSender instanceof Player) {
|
||||
return MainCommand.onCommand(BukkitUtil.getPlayer((Player) commandSender), args);
|
||||
}
|
||||
if (commandSender.getClass() == Bukkit.getConsoleSender().getClass()) {
|
||||
if (commandSender instanceof ConsoleCommandSender || commandSender instanceof ProxiedCommandSender
|
||||
|| commandSender instanceof RemoteConsoleCommandSender) {
|
||||
return MainCommand.onCommand(ConsolePlayer.getConsole(), args);
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
ConsolePlayer sender = new ConsolePlayer() {
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
commandSender.sendMessage(commandLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return commandSender.hasPermission(commandLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (commandSender.getName().equals("CONSOLE")) {
|
||||
return "*";
|
||||
}
|
||||
return commandSender.getName();
|
||||
}
|
||||
};
|
||||
sender.teleport(ConsolePlayer.getConsole().getLocationFull());
|
||||
boolean result = MainCommand.onCommand(sender, args);
|
||||
ConsolePlayer.getConsole().teleport(sender.getLocationFull());
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender commandSender, org.bukkit.command.Command command, String s, String[] args) {
|
||||
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] args) {
|
||||
if (!(commandSender instanceof Player)) {
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user