mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01: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 {
|
dependencies {
|
||||||
compile project(':Core')
|
compile project(':Core')
|
||||||
compile 'org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT'
|
compile 'org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT'
|
||||||
compile 'org.mcstats.bukkit:metrics:R7'
|
|
||||||
compile 'net.milkbowl.vault:VaultAPI:1.6'
|
compile 'net.milkbowl.vault:VaultAPI:1.6'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +28,6 @@ jar.enabled = false
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
include(dependency(':Core'))
|
include(dependency(':Core'))
|
||||||
include(dependency('org.mcstats.bukkit:metrics:R7'))
|
|
||||||
}
|
}
|
||||||
relocate('org.mcstats', 'com.plotsquared.stats')
|
relocate('org.mcstats', 'com.plotsquared.stats')
|
||||||
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||||
|
@ -80,8 +80,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
|
||||||
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
HashSet<UUID> all = UUIDHandler.getAllUUIDS();
|
||||||
PS.debug("&aFast mode UUID caching enabled!");
|
PS.debug("&aFast mode UUID caching enabled!");
|
||||||
File playerDataFolder = new File(container, world + File.separator + "playerdata");
|
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");
|
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<String> worlds = Sets.newHashSet(world, "world");
|
||||||
HashSet<UUID> uuids = new HashSet<>();
|
HashSet<UUID> uuids = new HashSet<>();
|
||||||
HashSet<String> names = new HashSet<>();
|
HashSet<String> names = new HashSet<>();
|
||||||
@ -168,20 +167,23 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
} else {
|
} else {
|
||||||
NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit");
|
NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit");
|
||||||
String name = (String) bukkit.get("lastKnownName");
|
String name = (String) bukkit.get("lastKnownName");
|
||||||
long last = (long) bukkit.get("lastPlayed");
|
StringWrapper wrap = new StringWrapper(name);
|
||||||
if (Settings.UUID.OFFLINE) {
|
if (!toAdd.containsKey(wrap)) {
|
||||||
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
long last = (long) bukkit.get("lastPlayed");
|
||||||
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
|
if (Settings.UUID.OFFLINE) {
|
||||||
} else {
|
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
||||||
long most = (long) compound.get("UUIDMost");
|
uuid = FileUUIDHandler.this.uuidWrapper.getUUID(name);
|
||||||
long least = (long) compound.get("UUIDLeast");
|
} else {
|
||||||
uuid = new UUID(most, least);
|
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) {
|
} catch (Exception ignored) {
|
||||||
PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
PS.debug(C.PREFIX + "&6Invalid PlayerData: " + uuid.toString() + ".dat");
|
||||||
@ -199,10 +201,12 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
if (last != 0) {
|
if (last != 0) {
|
||||||
String name = op.getName();
|
String name = op.getName();
|
||||||
StringWrapper wrap = new StringWrapper(name);
|
StringWrapper wrap = new StringWrapper(name);
|
||||||
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op);
|
if (!toAdd.containsKey(wrap)) {
|
||||||
toAdd.put(wrap, uuid);
|
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op);
|
||||||
if (ExpireManager.IMP != null) {
|
toAdd.put(wrap, uuid);
|
||||||
ExpireManager.IMP.storeDate(uuid, last);
|
if (ExpireManager.IMP != null) {
|
||||||
|
ExpireManager.IMP.storeDate(uuid, last);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,13 +369,16 @@ public class PS {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
|
UUIDHandler.add(new StringWrapper("*"), DBFunc.everyone);
|
||||||
for (Plot plot : getPlots()) {
|
foreachPlotRaw(new RunnableVal<Plot>() {
|
||||||
if (plot.hasOwner() && plot.temp != -1) {
|
@Override
|
||||||
if (UUIDHandler.getName(plot.owner) == null) {
|
public void run(Plot plot) {
|
||||||
UUIDHandler.implementation.unknown.add(plot.owner);
|
if (plot.hasOwner() && plot.temp != -1) {
|
||||||
|
if (UUIDHandler.getName(plot.owner) == null) {
|
||||||
|
UUIDHandler.implementation.unknown.add(plot.owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
startExpiryTasks();
|
startExpiryTasks();
|
||||||
startPlotMeConversion();
|
startPlotMeConversion();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public final class Flags {
|
|||||||
public static final IntervalFlag FEED = new IntervalFlag("feed");
|
public static final IntervalFlag FEED = new IntervalFlag("feed");
|
||||||
public static final IntervalFlag HEAL = new IntervalFlag("heal");
|
public static final IntervalFlag HEAL = new IntervalFlag("heal");
|
||||||
public static final GameModeFlag GAMEMODE = new GameModeFlag("gamemode");
|
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 StringFlag DONE = (StringFlag) new StringFlag("done").reserve();
|
||||||
public static final BooleanFlag REDSTONE = new BooleanFlag("redstone");
|
public static final BooleanFlag REDSTONE = new BooleanFlag("redstone");
|
||||||
public static final BooleanFlag FLY = new BooleanFlag("fly");
|
public static final BooleanFlag FLY = new BooleanFlag("fly");
|
||||||
@ -147,8 +148,8 @@ public final class Flags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Flag<?> getFlag(String flag) {
|
public static Flag<?> getFlag(String flag) {
|
||||||
return flags.get(flag);
|
return flags.get(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerFlag(final Flag<?> flag) {
|
public static void registerFlag(final Flag<?> flag) {
|
||||||
final Flag<?> duplicate = flags.put(flag.getName(), flag);
|
final Flag<?> duplicate = flags.put(flag.getName(), flag);
|
||||||
@ -164,11 +165,10 @@ public final class Flags {
|
|||||||
});
|
});
|
||||||
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
|
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
|
||||||
@Override public void run(Plot value) {
|
@Override public void run(Plot value) {
|
||||||
Object remove = null;
|
|
||||||
if (value.getFlags().containsKey(duplicate)) {
|
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() {
|
public static HashSet<UUID> getAllUUIDS() {
|
||||||
HashSet<UUID> uuids = new HashSet<>();
|
final HashSet<UUID> uuids = new HashSet<>();
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
PS.get().foreachPlotRaw(new RunnableVal<Plot>() {
|
||||||
if (plot.hasOwner()) {
|
@Override
|
||||||
uuids.add(plot.owner);
|
public void run(Plot plot) {
|
||||||
uuids.addAll(plot.getTrusted());
|
if (plot.hasOwner()) {
|
||||||
uuids.addAll(plot.getMembers());
|
uuids.add(plot.owner);
|
||||||
uuids.addAll(plot.getDenied());
|
uuids.addAll(plot.getTrusted());
|
||||||
|
uuids.addAll(plot.getMembers());
|
||||||
|
uuids.addAll(plot.getDenied());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return uuids;
|
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);
|
Optional<Long> timeFlag = plot.getFlag(Flags.TIME);
|
||||||
if (timeFlag.isPresent()) {
|
if (timeFlag.isPresent()) {
|
||||||
try {
|
try {
|
||||||
@ -171,7 +182,7 @@ public class PlotListener {
|
|||||||
if (pw == null) {
|
if (pw == null) {
|
||||||
return true;
|
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 (player.getGameMode() != pw.GAMEMODE) {
|
||||||
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
|
||||||
player.setGameMode(pw.GAMEMODE);
|
player.setGameMode(pw.GAMEMODE);
|
||||||
|
@ -51,9 +51,7 @@ processResources {
|
|||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
include(dependency(':Core'))
|
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"
|
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||||
destinationDir = file '../target'
|
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.SpongeLowerOfflineUUIDWrapper;
|
||||||
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
|
||||||
import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
|
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.slf4j.Logger;
|
||||||
import org.spongepowered.api.Game;
|
import org.spongepowered.api.Game;
|
||||||
import org.spongepowered.api.Server;
|
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.WorldGenerator;
|
||||||
import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
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.",
|
@Plugin(id = "plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.",
|
||||||
url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
|
url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
|
||||||
public class SpongeMain implements IPlotMain {
|
public class SpongeMain implements IPlotMain {
|
||||||
|
@ -34,7 +34,7 @@ public class SpongeAugmentedGenerator implements GenerationPopulator {
|
|||||||
populators.add(generator);
|
populators.add(generator);
|
||||||
return generator;
|
return generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(World world, MutableBlockVolume terrain, ImmutableBiomeArea biome) {
|
public void populate(World world, MutableBlockVolume terrain, ImmutableBiomeArea biome) {
|
||||||
Vector3i min = terrain.getBlockMin();
|
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.Text;
|
||||||
import org.spongepowered.api.text.serializer.TextSerializers;
|
import org.spongepowered.api.text.serializer.TextSerializers;
|
||||||
import org.spongepowered.api.text.translation.Translation;
|
import org.spongepowered.api.text.translation.Translation;
|
||||||
import org.spongepowered.api.world.BlockChangeFlag;
|
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
import org.spongepowered.api.world.biome.BiomeType;
|
import org.spongepowered.api.world.biome.BiomeType;
|
||||||
import org.spongepowered.api.world.biome.BiomeTypes;
|
import org.spongepowered.api.world.biome.BiomeTypes;
|
||||||
@ -431,7 +430,7 @@ public class SpongeUtil extends WorldUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void setSign(String worldName, int x, int y, int z, String[] lines) {
|
public void setSign(String worldName, int x, int y, int z, String[] lines) {
|
||||||
World world = SpongeUtil.getWorld(worldName);
|
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);
|
Optional<TileEntity> block = world.getTileEntity(x, y, z);
|
||||||
if (!block.isPresent()) {
|
if (!block.isPresent()) {
|
||||||
return;
|
return;
|
||||||
|
@ -52,7 +52,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
|
|||||||
@Override
|
@Override
|
||||||
public boolean setBlock(int x, int y, int z, int id, int data) {
|
public boolean setBlock(int x, int y, int z, int id, int data) {
|
||||||
modified = true;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user