mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-09-06 00:58:26 +02:00
Merge branch 'master' of https://github.com/IntellectualSites/PlotSquared into 3.4.5
# 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:
commit
b2fdcad317
@ -7,7 +7,6 @@ repositories {
|
||||
dependencies {
|
||||
compile project(':Core')
|
||||
compile 'org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT'
|
||||
compile 'org.mcstats.bukkit:metrics:R7'
|
||||
compile 'net.milkbowl.vault:VaultAPI:1.6'
|
||||
}
|
||||
|
||||
@ -29,7 +28,6 @@ jar.enabled = false
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include(dependency(':Core'))
|
||||
include(dependency('org.mcstats.bukkit:metrics:R7'))
|
||||
}
|
||||
relocate('org.mcstats', 'com.plotsquared.stats')
|
||||
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||
|
@ -80,8 +80,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||
PS.debug("&aFast mode UUID caching enabled!");
|
||||
File playerDataFolder = new File(container, world + File.separator + "playerdata");
|
||||
@ -124,7 +124,6 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
PS.debug("Failed to cache: " + all.size() + " uuids - slowly processing all files");
|
||||
}
|
||||
}
|
||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||
HashSet<String> worlds = Sets.newHashSet(world, "world");
|
||||
HashSet<UUID> uuids = new HashSet<>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
@ -168,20 +167,23 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
} else {
|
||||
NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit");
|
||||
String name = (String) bukkit.get("lastKnownName");
|
||||
long last = (long) bukkit.get("lastPlayed");
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
||||
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
|
||||
} else {
|
||||
long most = (long) compound.get("UUIDMost");
|
||||
long least = (long) compound.get("UUIDLeast");
|
||||
uuid = new UUID(most, least);
|
||||
StringWrapper wrap = new StringWrapper(name);
|
||||
if (!toAdd.containsKey(wrap)) {
|
||||
long last = (long) bukkit.get("lastPlayed");
|
||||
if (Settings.UUID.OFFLINE) {
|
||||
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
||||
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
|
||||
} else {
|
||||
long most = (long) compound.get("UUIDMost");
|
||||
long least = (long) compound.get("UUIDLeast");
|
||||
uuid = new UUID(most, least);
|
||||
}
|
||||
}
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
toAdd.put(wrap, uuid);
|
||||
}
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||
@ -199,10 +201,12 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
if (last != 0) {
|
||||
String name = op.getName();
|
||||
StringWrapper wrap = new StringWrapper(name);
|
||||
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op);
|
||||
toAdd.put(wrap, uuid);
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
if (!toAdd.containsKey(wrap)) {
|
||||
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op);
|
||||
toAdd.put(wrap, uuid);
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -51,9 +51,7 @@ processResources {
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include(dependency(':Core'))
|
||||
//include(dependency('org.mcstats.sponge:metrics:R8-SNAPSHOT'))
|
||||
}
|
||||
//relocate 'org.mcstats', 'com.plotsquared.stats'
|
||||
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||
destinationDir = file '../target'
|
||||
}
|
||||
|
@ -51,6 +51,13 @@ import com.plotsquared.sponge.util.block.SpongeLocalQueue;
|
||||
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
||||
import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.api.Game;
|
||||
import org.spongepowered.api.Server;
|
||||
@ -67,14 +74,6 @@ import org.spongepowered.api.world.gen.GenerationPopulator;
|
||||
import org.spongepowered.api.world.gen.WorldGenerator;
|
||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Plugin(id = "plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.",
|
||||
url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
|
||||
public class SpongeMain implements IPlotMain {
|
||||
|
@ -34,7 +34,7 @@ public class SpongeAugmentedGenerator implements GenerationPopulator {
|
||||
populators.add(generator);
|
||||
return generator;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void populate(World world, MutableBlockVolume terrain, ImmutableBiomeArea biome) {
|
||||
Vector3i min = terrain.getBlockMin();
|
||||
|
@ -35,7 +35,6 @@ import org.spongepowered.api.event.cause.NamedCause;
|
||||
import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||
import org.spongepowered.api.text.translation.Translation;
|
||||
import org.spongepowered.api.world.BlockChangeFlag;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.biome.BiomeType;
|
||||
import org.spongepowered.api.world.biome.BiomeTypes;
|
||||
@ -431,7 +430,7 @@ public class SpongeUtil extends WorldUtil {
|
||||
@Override
|
||||
public void setSign(String worldName, int x, int y, int z, String[] lines) {
|
||||
World world = SpongeUtil.getWorld(worldName);
|
||||
world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState(), BlockChangeFlag.NONE, CAUSE);
|
||||
world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState(), CAUSE);
|
||||
Optional<TileEntity> block = world.getTileEntity(x, y, z);
|
||||
if (!block.isPresent()) {
|
||||
return;
|
||||
|
@ -52,7 +52,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
||||
modified = true;
|
||||
this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data),SpongeUtil.CAUSE);
|
||||
this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data), SpongeUtil.CAUSE);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user