# Conflicts:
#	Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java
#	Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java
This commit is contained in:
MattBDev
2016-07-25 22:08:32 -04:00
11 changed files with 68 additions and 53 deletions

View File

@@ -369,13 +369,16 @@ public class PS {
@Override
public void run() {
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
for (Plot plot : getPlots()) {
if (plot.hasOwner() && plot.temp != -1) {
if (UUIDHandler.getName(plot.owner) == null) {
UUIDHandler.implementation.unknown.add(plot.owner);
foreachPlotRaw(new RunnableVal<Plot>() {
@Override
public void run(Plot plot) {
if (plot.hasOwner() && plot.temp != -1) {
if (UUIDHandler.getName(plot.owner) == null) {
UUIDHandler.implementation.unknown.add(plot.owner);
}
}
}
}
});
startExpiryTasks();
startPlotMeConversion();
}

View File

@@ -21,6 +21,7 @@ public final class Flags {
public static final IntervalFlag FEED = new IntervalFlag("feed");
public static final IntervalFlag HEAL = new IntervalFlag("heal");
public static final GameModeFlag GAMEMODE = new GameModeFlag("gamemode");
public static final GameModeFlag GUEST_GAMEMODE = new GameModeFlag("guest-gamemode");
public static final StringFlag DONE = (StringFlag) new StringFlag("done").reserve();
public static final BooleanFlag REDSTONE = new BooleanFlag("redstone");
public static final BooleanFlag FLY = new BooleanFlag("fly");
@@ -147,8 +148,8 @@ public final class Flags {
}
public static Flag<?> getFlag(String flag) {
return flags.get(flag);
}
return flags.get(flag);
}
public static void registerFlag(final Flag<?> flag) {
final Flag<?> duplicate = flags.put(flag.getName(), flag);
@@ -164,11 +165,10 @@ public final class Flags {
});
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
@Override public void run(Plot value) {
Object remove = null;
if (value.getFlags().containsKey(duplicate)) {
remove = value.getFlags().remove(duplicate);
Object remove = value.getFlags().remove(duplicate);
value.getFlags().put(flag,flag.parseValue("" + remove));
}
value.getFlags().put(flag,flag.parseValue("" + remove));
}
});
}

View File

@@ -59,15 +59,18 @@ public class UUIDHandler {
}
public static HashSet<UUID> getAllUUIDS() {
HashSet<UUID> uuids = new HashSet<>();
for (Plot plot : PS.get().getPlots()) {
if (plot.hasOwner()) {
uuids.add(plot.owner);
uuids.addAll(plot.getTrusted());
uuids.addAll(plot.getMembers());
uuids.addAll(plot.getDenied());
final HashSet<UUID> uuids = new HashSet<>();
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
@Override
public void run(Plot plot) {
if (plot.hasOwner()) {
uuids.add(plot.owner);
uuids.addAll(plot.getTrusted());
uuids.addAll(plot.getMembers());
uuids.addAll(plot.getDenied());
}
}
}
});
return uuids;
}

View File

@@ -94,6 +94,17 @@ public class PlotListener {
}
}
}
Optional<PlotGameMode> guestGamemodeFlag = plot.getFlag(Flags.GUEST_GAMEMODE);
if (gamemodeFlag.isPresent()) {
if (player.getGameMode() != gamemodeFlag.get() && !plot.isAdded(player.getUUID())) {
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
player.setGameMode(gamemodeFlag.get());
} else {
MainUtil.sendMessage(player,
StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.getId(), "{gamemode}", gamemodeFlag.get()));
}
}
}
Optional<Long> timeFlag = plot.getFlag(Flags.TIME);
if (timeFlag.isPresent()) {
try {
@@ -171,7 +182,7 @@ public class PlotListener {
if (pw == null) {
return true;
}
if (plot.getFlag(Flags.GAMEMODE).isPresent()) {
if (plot.getFlag(Flags.GAMEMODE).isPresent() || plot.getFlag(Flags.GUEST_GAMEMODE).isPresent()) {
if (player.getGameMode() != pw.GAMEMODE) {
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
player.setGameMode(pw.GAMEMODE);