mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-01 13:14:43 +02:00
@ -9,6 +9,7 @@ import java.util.Set;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
@ -141,7 +142,7 @@ public abstract class ChunkManager {
|
||||
for (final ChunkLoc loc : chunks) {
|
||||
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
|
||||
final File file = new File(PS.get().IMP.getWorldContainer(), directory);
|
||||
PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
ConsolePlayer.getConsole().sendMessage("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
@ -283,7 +284,8 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static List<PlotPlayer> getPlayersInPlot(final Plot plot) {
|
||||
final ArrayList<PlotPlayer> players = new ArrayList<>();
|
||||
final ArrayList<PlotPlayer> players = new ArrayList<>();
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
PlotPlayer pp = entry.getValue();
|
||||
if (plot.equals(pp.getCurrentPlot())) {
|
||||
players.add(pp);
|
||||
@ -2013,7 +2015,7 @@ public class MainUtil {
|
||||
|
||||
public static boolean sendMessage(final PlotPlayer plr, final String msg, final boolean prefix) {
|
||||
if ((msg.length() > 0) && !msg.equals("")) {
|
||||
if (plr == null) {
|
||||
if (plr == null) {
|
||||
ConsolePlayer.getConsole().sendMessage((prefix ? C.PREFIX.s() : "") + msg);
|
||||
} else {
|
||||
plr.sendMessage((prefix ? C.PREFIX.s() : "") + C.color(msg));
|
||||
@ -2103,7 +2105,7 @@ public class MainUtil {
|
||||
if ((args != null) && (args.length > 0)) {
|
||||
msg = C.format(c, args);
|
||||
}
|
||||
if (plr == null) {
|
||||
if (plr == null) {
|
||||
ConsolePlayer.getConsole().sendMessage(msg);
|
||||
} else {
|
||||
sendMessage(plr, msg, c.usePrefix());
|
||||
@ -2126,7 +2128,7 @@ public class MainUtil {
|
||||
if ((args != null) && (args.length > 0)) {
|
||||
msg = C.format(c, args);
|
||||
}
|
||||
if (plr == null) {
|
||||
if (plr == null) {
|
||||
ConsolePlayer.getConsole().sendMessage(msg);
|
||||
} else {
|
||||
sendMessage(plr, msg, c.usePrefix());
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.BiMap;
|
||||
@ -13,6 +14,7 @@ import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
@ -25,11 +27,11 @@ public abstract class UUIDHandlerImplementation {
|
||||
private BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
public boolean CACHED = false;
|
||||
public UUIDWrapper uuidWrapper = null;
|
||||
public final HashMap<String, PlotPlayer> players;
|
||||
public final ConcurrentHashMap<String, PlotPlayer> players;
|
||||
|
||||
public UUIDHandlerImplementation(final UUIDWrapper wrapper) {
|
||||
uuidWrapper = wrapper;
|
||||
players = new HashMap<>();
|
||||
players = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,7 +98,7 @@ public abstract class UUIDHandlerImplementation {
|
||||
try {
|
||||
unknown.add(uuid);
|
||||
} catch (final Exception e) {
|
||||
PS.log("&c(minor) Invalid UUID mapping: " + uuid);
|
||||
ConsolePlayer.getConsole().sendMessage("&c(minor) Invalid UUID mapping: " + uuid);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
@ -178,11 +180,11 @@ public abstract class UUIDHandlerImplementation {
|
||||
if (uuid == null) {
|
||||
return null;
|
||||
}
|
||||
// check online
|
||||
final PlotPlayer player = getPlayer(uuid);
|
||||
if (player != null) {
|
||||
return player.getName();
|
||||
}
|
||||
// // check online
|
||||
// final PlotPlayer player = getPlayer(uuid);
|
||||
// if (player != null) {
|
||||
// return player.getName();
|
||||
// }
|
||||
// check cache
|
||||
final StringWrapper name = uuidMap.inverse().get(uuid);
|
||||
if (name != null) {
|
||||
@ -228,10 +230,9 @@ public abstract class UUIDHandlerImplementation {
|
||||
}
|
||||
|
||||
public PlotPlayer getPlayer(final UUID uuid) {
|
||||
for (final PlotPlayer player : players.values()) {
|
||||
if (player.getUUID().equals(uuid)) {
|
||||
return player;
|
||||
}
|
||||
String name = getName(uuid);
|
||||
if (name != null) {
|
||||
return getPlayer(name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user