mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
commit
This commit is contained in:
@ -0,0 +1,126 @@
|
||||
package com.intellectualcrafters.plot.object;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
|
||||
|
||||
public class ConsolePlayer implements PlotPlayer {
|
||||
|
||||
private static ConsolePlayer instance;
|
||||
private Location loc;
|
||||
private final HashMap<String, Object> meta;
|
||||
|
||||
public static ConsolePlayer getConsole() {
|
||||
if (instance == null) {
|
||||
instance = new ConsolePlayer();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private ConsolePlayer() {
|
||||
String world;
|
||||
Set<String> plotworlds = PS.get().getPlotWorlds();
|
||||
if (plotworlds.size() > 0) {
|
||||
world = plotworlds.iterator().next();
|
||||
}
|
||||
else {
|
||||
world = "world";
|
||||
}
|
||||
this.loc = new Location(world, 0, 0, 0);
|
||||
this.meta = new HashMap<>();
|
||||
}
|
||||
|
||||
public static boolean isConsole(PlotPlayer plr) {
|
||||
return instance == plr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPreviousLogin() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocationFull() {
|
||||
return loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return DBFunc.everyone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String perm) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
PS.log(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport(Location loc) {
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnline() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "*";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompassTarget(Location loc) {}
|
||||
|
||||
@Override
|
||||
public void loadData() {}
|
||||
|
||||
@Override
|
||||
public void saveData() {}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String key) {}
|
||||
|
||||
@Override
|
||||
public boolean getAttribute(String key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String key) {}
|
||||
|
||||
@Override
|
||||
public void setMeta(String key, Object value) {
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getMeta(String key) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMeta(String key) {
|
||||
this.meta.remove(key);
|
||||
}
|
||||
|
||||
}
|
@ -606,6 +606,9 @@ public class Plot {
|
||||
return false;
|
||||
}
|
||||
final Plot other = (Plot) obj;
|
||||
if (this.hashCode() != other.hashCode()) {
|
||||
return false;
|
||||
}
|
||||
return ((this.id.x.equals(other.id.x)) && (this.id.y.equals(other.id.y)) && (this.world.equals(other.world)));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user