mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-27 19:24:43 +02:00
Refactor + optimizations
This commit is contained in:
@ -2,13 +2,16 @@ package com.plotsquared.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -36,9 +39,9 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.bukkit.commands.BukkitCommand;
|
||||
import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
|
||||
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
||||
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
||||
@ -55,27 +58,28 @@ import com.plotsquared.bukkit.listeners.WorldEvents;
|
||||
import com.plotsquared.bukkit.listeners.worldedit.WEListener;
|
||||
import com.plotsquared.bukkit.listeners.worldedit.WESubscriber;
|
||||
import com.plotsquared.bukkit.titles.DefaultTitle;
|
||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.BukkitCommand;
|
||||
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitEventUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitInventoryUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetupUtils;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitTaskManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.Metrics;
|
||||
import com.plotsquared.bukkit.util.bukkit.SendChunk;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetBlockFast;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetBlockFast_1_8;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetBlockSlow;
|
||||
import com.plotsquared.bukkit.util.bukkit.SetGenCB;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.FileUUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.Metrics;
|
||||
import com.plotsquared.bukkit.util.SendChunk;
|
||||
import com.plotsquared.bukkit.util.SetBlockFast;
|
||||
import com.plotsquared.bukkit.util.SetBlockFast_1_8;
|
||||
import com.plotsquared.bukkit.util.SetBlockSlow;
|
||||
import com.plotsquared.bukkit.util.SetGenCB;
|
||||
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.FileUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
|
||||
@ -543,4 +547,21 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
// Already initialized in UUID handler
|
||||
return AbstractTitle.TITLE_CLASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotPlayer wrapPlayer(Object obj) {
|
||||
if (obj instanceof Player) {
|
||||
return BukkitUtil.getPlayer((Player) obj);
|
||||
}
|
||||
else if (obj instanceof OfflinePlayer) {
|
||||
return BukkitUtil.getPlayer((OfflinePlayer) obj);
|
||||
}
|
||||
else if (obj instanceof String) {
|
||||
return UUIDHandler.getPlayer((String) obj);
|
||||
}
|
||||
else if (obj instanceof UUID) {
|
||||
return UUIDHandler.getPlayer((UUID) obj);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
@ -1,6 +1,6 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import static com.plotsquared.bukkit.util.bukkit.chat.TextualComponent.rawText;
|
||||
import static com.plotsquared.bukkit.chat.TextualComponent.rawText;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.chat;
|
||||
package com.plotsquared.bukkit.chat;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
@ -23,8 +23,8 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
|
||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
|
||||
|
||||
public class AugmentedPopulator extends BlockPopulator {
|
||||
public final PlotWorld plotworld;
|
||||
|
@ -40,7 +40,6 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.plotsquared.bukkit.listeners.WorldEvents;
|
||||
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
|
||||
|
||||
public abstract class BukkitPlotGenerator extends ChunkGenerator {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.object;
|
||||
package com.plotsquared.bukkit.generator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
@ -36,7 +36,6 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
|
||||
|
||||
/**
|
||||
* The default generator is very messy, as we have decided to try externalize all calculations from within the loop. -
|
||||
|
@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
|
||||
|
||||
/**
|
||||
* @author Citymonstret
|
||||
|
@ -18,7 +18,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* Created 2015-07-13 for PlotSquaredGit
|
||||
|
@ -36,8 +36,8 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitPlayerFunctions;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitPlayerFunctions;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* @author Citymonstret
|
||||
|
@ -142,7 +142,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
|
||||
import com.plotsquared.bukkit.object.BukkitLazyBlock;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
/**
|
||||
* Player Events involving plots
|
||||
@ -445,6 +445,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
player.saveData();
|
||||
}
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(player.getLocation()));
|
||||
|
||||
final String username = pp.getName();
|
||||
final StringWrapper name = new StringWrapper(username);
|
||||
final UUID uuid = pp.getUUID();
|
||||
@ -485,6 +489,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
org.bukkit.Location to = event.getTo();
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -492,8 +502,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -547,6 +555,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -554,8 +568,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -722,13 +734,19 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onWorldChanged(final PlayerChangedWorldEvent event) {
|
||||
final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer());
|
||||
Player player = event.getPlayer();
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Delete last location
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
|
||||
|
||||
if (PS.get().worldEdit != null) {
|
||||
if (!Permissions.hasPermission(player, PERMISSION_WORLDEDIT_BYPASS)) {
|
||||
WEManager.bypass.remove(player.getName());
|
||||
if (!Permissions.hasPermission(pp, PERMISSION_WORLDEDIT_BYPASS)) {
|
||||
WEManager.bypass.remove(pp.getName());
|
||||
}
|
||||
else {
|
||||
WEManager.bypass.add(player.getName());
|
||||
WEManager.bypass.add(pp.getName());
|
||||
}
|
||||
}
|
||||
((BukkitPlayer) player).hasPerm = new HashSet<>();
|
||||
@ -1382,6 +1400,8 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onTeleport(final PlayerTeleportEvent event) {
|
||||
if (event.getTo() == null || event.getFrom() == null) {
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
|
||||
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
|
||||
return;
|
||||
}
|
||||
final org.bukkit.Location from = event.getFrom();
|
||||
@ -1389,6 +1409,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -1396,8 +1422,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -1451,6 +1475,12 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
|
||||
// Set last location
|
||||
pp.setMeta("location", BukkitUtil.getLocation(to));
|
||||
|
||||
String worldname = to.getWorld().getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
if (plotworld == null) {
|
||||
@ -1458,8 +1488,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
|
@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
||||
|
@ -13,7 +13,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
public class PlayerEvents_1_8_3 implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
@ -54,7 +54,7 @@ import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
public class TNTListener implements Listener {
|
||||
private double lastRadius;
|
||||
|
@ -19,7 +19,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.plotsquared.bukkit.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -13,7 +12,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
@ -23,19 +21,16 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
|
||||
public class BukkitPlayer implements PlotPlayer {
|
||||
public class BukkitPlayer extends PlotPlayer {
|
||||
|
||||
public final Player player;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
private int op = 0;
|
||||
private long last = 0;
|
||||
public HashSet<String> hasPerm = new HashSet<>();
|
||||
public HashSet<String> noPerm = new HashSet<>();
|
||||
|
||||
private HashMap<String, Object> meta;
|
||||
|
||||
/**
|
||||
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player), as it caches player objects.
|
||||
@ -54,7 +49,8 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return BukkitUtil.getLocation(this.player);
|
||||
Location loc = super.getLocation();
|
||||
return loc == null ? BukkitUtil.getLocation(this.player) : loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,20 +96,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
if (this.op != 0) {
|
||||
return this.op != 1;
|
||||
}
|
||||
final boolean result = this.player.isOp();
|
||||
if (!result) {
|
||||
this.op = 1;
|
||||
return false;
|
||||
}
|
||||
this.op = 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (this.name == null) {
|
||||
@ -138,34 +120,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
return BukkitUtil.getLocationFull(this.player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMeta(String key, Object value) {
|
||||
if (this.meta == null) {
|
||||
this.meta = new HashMap<String, Object>();
|
||||
}
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
this.meta.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String key) {
|
||||
key = "plotsquared_user_attributes." + key;
|
||||
@ -202,11 +156,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
player.saveData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequiredType getSuperCaller() {
|
||||
return RequiredType.PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWeather(PlotWeather weather) {
|
||||
switch (weather) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.commands;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -16,7 +16,6 @@ import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
import com.plotsquared.general.commands.Command;
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
@ -37,7 +37,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.BukkitMain;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
|
||||
public class BukkitHybridUtils extends HybridUtils {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -23,7 +23,6 @@ import org.bukkit.material.Step;
|
||||
import org.bukkit.material.Tree;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.bukkit.material.Wool;
|
||||
import org.spongepowered.api.world.extent.Extent;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.callConstructor;
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.callMethod;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
@ -18,7 +18,7 @@
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.uuid;
|
||||
package com.plotsquared.bukkit.uuid;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
@ -1,4 +1,4 @@
|
||||
package com.plotsquared.bukkit.util.bukkit.uuid;
|
||||
package com.plotsquared.bukkit.uuid;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
@ -11,6 +11,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -23,7 +24,6 @@ import org.spongepowered.api.block.BlockTypes;
|
||||
import org.spongepowered.api.data.manipulator.block.StoneData;
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.event.EventHandler;
|
||||
import org.spongepowered.api.event.Subscribe;
|
||||
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
|
||||
import org.spongepowered.api.event.state.PreInitializationEvent;
|
||||
@ -38,7 +38,6 @@ import org.spongepowered.api.text.translation.Translation;
|
||||
import org.spongepowered.api.world.DimensionTypes;
|
||||
import org.spongepowered.api.world.GeneratorTypes;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.inject.Inject;
|
||||
@ -49,21 +48,18 @@ import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Configuration;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.ConsoleColors;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.sponge.generator.SpongeBasicGen;
|
||||
@ -72,11 +68,13 @@ import com.plotsquared.sponge.generator.WorldModify;
|
||||
import com.plotsquared.sponge.listener.MainListener;
|
||||
import com.plotsquared.sponge.util.KillRoadMobs;
|
||||
import com.plotsquared.sponge.util.SpongeBlockManager;
|
||||
import com.plotsquared.sponge.util.SpongeChunkManager;
|
||||
import com.plotsquared.sponge.util.SpongeCommand;
|
||||
import com.plotsquared.sponge.util.SpongeEventUtil;
|
||||
import com.plotsquared.sponge.util.SpongeInventoryUtil;
|
||||
import com.plotsquared.sponge.util.SpongeMetrics;
|
||||
import com.plotsquared.sponge.util.SpongeTaskManager;
|
||||
import com.plotsquared.sponge.util.SpongeTitleManager;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
||||
@ -596,4 +594,21 @@ public class SpongeMain implements IPlotMain, PluginContainer {
|
||||
public AbstractTitle initTitleManager() {
|
||||
return new SpongeTitleManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotPlayer wrapPlayer(Object obj) {
|
||||
if (obj instanceof Player) {
|
||||
return SpongeUtil.getPlayer((Player) obj);
|
||||
}
|
||||
// else if (obj instanceof OfflinePlayer) {
|
||||
// return BukkitUtil.getPlayer((OfflinePlayer) obj);
|
||||
// }
|
||||
else if (obj instanceof String) {
|
||||
return UUIDHandler.getPlayer((String) obj);
|
||||
}
|
||||
else if (obj instanceof UUID) {
|
||||
return UUIDHandler.getPlayer((UUID) obj);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -4,10 +4,6 @@ import org.spongepowered.api.data.DataContainer;
|
||||
import org.spongepowered.api.world.WorldCreationSettings;
|
||||
import org.spongepowered.api.world.gen.WorldGenerator;
|
||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||
import org.spongepowered.common.world.gen.SpongeWorldGenerator;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
|
||||
public class WorldModify implements WorldGeneratorModifier {
|
||||
|
||||
|
@ -22,7 +22,6 @@ import org.spongepowered.api.block.BlockState;
|
||||
import org.spongepowered.api.entity.Entity;
|
||||
import org.spongepowered.api.entity.EntityTypes;
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.event.Cancellable;
|
||||
import org.spongepowered.api.event.Subscribe;
|
||||
import org.spongepowered.api.event.block.BlockMoveEvent;
|
||||
import org.spongepowered.api.event.block.BlockRedstoneUpdateEvent;
|
||||
@ -36,20 +35,16 @@ import org.spongepowered.api.event.entity.player.PlayerChangeWorldEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerInteractBlockEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerJoinEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerMessageEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerMoveEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerPlaceBlockEvent;
|
||||
import org.spongepowered.api.event.entity.player.PlayerQuitEvent;
|
||||
import org.spongepowered.api.event.message.CommandEvent;
|
||||
import org.spongepowered.api.event.network.PlayerConnectionEvent;
|
||||
import org.spongepowered.api.event.world.ChunkLoadEvent;
|
||||
import org.spongepowered.api.event.world.ChunkPreGenerateEvent;
|
||||
import org.spongepowered.api.event.world.ChunkPrePopulateEvent;
|
||||
import org.spongepowered.api.network.PlayerConnection;
|
||||
import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.text.Texts;
|
||||
import org.spongepowered.api.util.command.CommandSource;
|
||||
import org.spongepowered.api.util.event.callback.EventCallback;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.extent.Extent;
|
||||
|
||||
@ -80,7 +75,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.listener.PlotListener;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
|
||||
public class MainListener {
|
||||
@ -557,10 +552,14 @@ public class MainListener {
|
||||
org.spongepowered.api.world.Location to = event.getNewLocation();
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -569,8 +568,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -622,10 +619,14 @@ public class MainListener {
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -634,8 +635,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = event.getUser();
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -694,10 +693,14 @@ public class MainListener {
|
||||
org.spongepowered.api.world.Location to = event.getNewLocation();
|
||||
int x2;
|
||||
if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -706,8 +709,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -759,10 +760,14 @@ public class MainListener {
|
||||
}
|
||||
int z2;
|
||||
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Extent extent = to.getExtent();
|
||||
if (!(extent instanceof World)) {
|
||||
pp.deleteMeta("location");
|
||||
return;
|
||||
}
|
||||
pp.setMeta("location", SpongeUtil.getLocation(player));
|
||||
World world = (World) extent;
|
||||
String worldname = ((World) extent).getName();
|
||||
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
|
||||
@ -771,8 +776,6 @@ public class MainListener {
|
||||
}
|
||||
PlotManager plotManager = PS.get().getPlotManager(worldname);
|
||||
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
|
||||
Player player = (Player) entity;
|
||||
PlotPlayer pp = SpongeUtil.getPlayer(player);
|
||||
Plot lastPlot = (Plot) pp.getMeta("lastplot");
|
||||
if (id == null) {
|
||||
if (lastPlot == null) {
|
||||
@ -828,6 +831,9 @@ public class MainListener {
|
||||
public void onWorldChange(PlayerChangeWorldEvent event) {
|
||||
final PlotPlayer player = SpongeUtil.getPlayer(event.getUser());
|
||||
|
||||
player.deleteMeta("location");
|
||||
player.deleteMeta("lastplot");
|
||||
|
||||
// TODO worldedit mask
|
||||
|
||||
((BukkitPlayer) player).hasPerm = new HashSet<>();
|
||||
|
@ -1,20 +1,14 @@
|
||||
package com.plotsquared.sponge;
|
||||
package com.plotsquared.sponge.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.spongepowered.api.entity.player.Player;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameMode;
|
||||
import org.spongepowered.api.entity.player.gamemode.GameModes;
|
||||
import org.spongepowered.api.service.permission.PermissionService;
|
||||
import org.spongepowered.api.text.Texts;
|
||||
import org.spongepowered.api.text.chat.ChatTypes;
|
||||
import org.spongepowered.api.text.title.Title;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3d;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
@ -25,19 +19,17 @@ import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
|
||||
public class SpongePlayer implements PlotPlayer {
|
||||
public class SpongePlayer extends PlotPlayer {
|
||||
|
||||
public final Player player;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
private int op = 0;
|
||||
private long last = 0;
|
||||
private HashSet<String> hasPerm = new HashSet<>();
|
||||
private HashSet<String> noPerm = new HashSet<>();
|
||||
|
||||
private HashMap<String, Object> meta;
|
||||
|
||||
public SpongePlayer(Player player) {
|
||||
this.player = player;
|
||||
@ -60,7 +52,8 @@ public class SpongePlayer implements PlotPlayer {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return SpongeUtil.getLocation(player);
|
||||
Location loc = super.getLocation();
|
||||
return loc == null ? SpongeUtil.getLocation(this.player) : loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,20 +107,6 @@ public class SpongePlayer implements PlotPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
if (this.op != 0) {
|
||||
return this.op != 1;
|
||||
}
|
||||
final boolean result = this.player.hasPermission("*");
|
||||
if (!result) {
|
||||
this.op = 1;
|
||||
return false;
|
||||
}
|
||||
this.op = 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return player.isOnline();
|
||||
@ -159,34 +138,6 @@ public class SpongePlayer implements PlotPlayer {
|
||||
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMeta(String key, Object value) {
|
||||
if (this.meta == null) {
|
||||
this.meta = new HashMap<String, Object>();
|
||||
}
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMeta(String key) {
|
||||
if (this.meta != null) {
|
||||
this.meta.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String key) {
|
||||
key = "plotsquared_user_attributes." + key;
|
@ -12,7 +12,6 @@ import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.biome.BiomeType;
|
||||
import org.spongepowered.api.world.biome.BiomeTypes;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
|
@ -1,27 +1,22 @@
|
||||
package com.plotsquared.sponge;
|
||||
package com.plotsquared.sponge.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.spongepowered.api.data.DataContainer;
|
||||
import org.spongepowered.api.world.Chunk;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.storage.ChunkDataStream;
|
||||
import org.spongepowered.api.world.storage.WorldStorage;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
|
||||
import com.plotsquared.sponge.util.SpongeUtil;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
|
||||
public class SpongeChunkManager extends ChunkManager {
|
||||
|
@ -14,7 +14,6 @@ import org.spongepowered.api.util.command.CommandResult;
|
||||
import org.spongepowered.api.util.command.CommandSource;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
@ -20,7 +20,7 @@ import com.intellectualcrafters.plot.object.PlotItemStack;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeInventoryUtil extends InventoryUtil {
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package com.plotsquared.sponge;
|
||||
package com.plotsquared.sponge.util;
|
||||
|
||||
import org.spongepowered.api.text.title.Title;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeTitleManager extends AbstractTitle {
|
||||
|
@ -13,7 +13,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeUtil {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.SpongePlayer;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
|
||||
public class SpongeOnlineUUIDWrapper extends UUIDWrapper {
|
||||
|
||||
|
Reference in New Issue
Block a user