mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
|
||||||
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
HashBiMap<StringWrapper, UUID> toAdd = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
|
if (Settings.UUID.NATIVE_UUID_PROVIDER) {
|
||||||
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,6 +167,8 @@ 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");
|
||||||
|
StringWrapper wrap = new StringWrapper(name);
|
||||||
|
if (!toAdd.containsKey(wrap)) {
|
||||||
long last = (long) bukkit.get("lastPlayed");
|
long last = (long) bukkit.get("lastPlayed");
|
||||||
if (Settings.UUID.OFFLINE) {
|
if (Settings.UUID.OFFLINE) {
|
||||||
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
if (Settings.UUID.FORCE_LOWERCASE && !name.toLowerCase().equals(name)) {
|
||||||
@ -181,7 +182,8 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
ExpireManager.IMP.storeDate(uuid, last);
|
ExpireManager.IMP.storeDate(uuid, last);
|
||||||
}
|
}
|
||||||
toAdd.put(new StringWrapper(name), uuid);
|
toAdd.put(wrap, 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,6 +201,7 @@ 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);
|
||||||
|
if (!toAdd.containsKey(wrap)) {
|
||||||
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op);
|
UUID uuid = FileUUIDHandler.this.uuidWrapper.getUUID(op);
|
||||||
toAdd.put(wrap, uuid);
|
toAdd.put(wrap, uuid);
|
||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
@ -207,6 +210,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
add(toAdd);
|
add(toAdd);
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
|
@ -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>() {
|
||||||
|
@Override
|
||||||
|
public void run(Plot plot) {
|
||||||
if (plot.hasOwner() && plot.temp != -1) {
|
if (plot.hasOwner() && plot.temp != -1) {
|
||||||
if (UUIDHandler.getName(plot.owner) == null) {
|
if (UUIDHandler.getName(plot.owner) == null) {
|
||||||
UUIDHandler.implementation.unknown.add(plot.owner);
|
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");
|
||||||
@ -148,7 +149,7 @@ 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,12 +165,11 @@ 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,8 +59,10 @@ 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>() {
|
||||||
|
@Override
|
||||||
|
public void run(Plot plot) {
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
uuids.add(plot.owner);
|
uuids.add(plot.owner);
|
||||||
uuids.addAll(plot.getTrusted());
|
uuids.addAll(plot.getTrusted());
|
||||||
@ -68,6 +70,7 @@ public class UUIDHandler {
|
|||||||
uuids.addAll(plot.getDenied());
|
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 {
|
||||||
|
@ -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