diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Area.java b/src/main/java/com/intellectualcrafters/plot/commands/Area.java
index 9cde7dcb2..76e57ce11 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Area.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Area.java
@@ -438,9 +438,14 @@ public class Area extends SubCommand {
C.NOT_VALID_PLOT_WORLD.send(plr, args[1]);
return false;
}
- RegionWrapper region = area.getRegion();
- Location center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0, region.minZ + (region.maxZ - region.minZ) / 2);
- center.setY(WorldUtil.IMP.getHighestBlock(area.worldname, center.getX(), center.getZ()));
+ Location center;
+ if (area.TYPE != 2) {
+ center = WorldUtil.IMP.getSpawn(area.worldname);
+ } else {
+ RegionWrapper region = area.getRegion();
+ center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0, region.minZ + (region.maxZ - region.minZ) / 2);
+ center.setY(WorldUtil.IMP.getHighestBlock(area.worldname, center.getX(), center.getZ()));
+ }
plr.teleport(center);
return true;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
index 7b666ca2c..6edd81a0d 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
@@ -20,6 +20,15 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.UUID;
+
+import org.apache.commons.lang.mutable.MutableInt;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -36,14 +45,6 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.mutable.MutableInt;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.UUID;
@CommandDeclaration(
command = "rate",
@@ -83,7 +84,7 @@ public class Rate extends SubCommand {
});
final UUID uuid = player.getUUID();
for (final Plot p : plots) {
- if ((!Settings.REQUIRE_DONE || p.getFlags().containsKey("done")) && p.isBasePlot() && (p.getRatings().isEmpty() || !p.getRatings()
+ if ((!Settings.REQUIRE_DONE || p.getFlags().containsKey("done")) && p.isBasePlot() && (p.hasRatings() || !p.getRatings()
.containsKey(uuid)) && !p.isAdded(uuid)) {
p.teleportPlayer(player);
MainUtil.sendMessage(player, C.RATE_THIS);
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
index 4e4d1ecef..17cbee36c 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
@@ -34,8 +34,7 @@ public class plugin extends SubCommand {
MainUtil.sendMessage(plr, String.format("$2>> $1&lPlotSquared $2($1Version$2: $1%s$2)", StringMan.join(PS.get().IMP.getPluginVersion(), ".")));
MainUtil.sendMessage(plr, "$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92");
MainUtil.sendMessage(plr, "$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki");
- MainUtil.sendMessage(plr,
- "$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update));
+ MainUtil.sendMessage(plr, "$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update));
return true;
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java
index 0747d797b..6884787e3 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java
@@ -20,6 +20,25 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
+import java.awt.Rectangle;
+import java.awt.geom.Area;
+import java.awt.geom.PathIterator;
+import java.io.File;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
import com.google.common.collect.BiMap;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
@@ -41,25 +60,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.listener.PlotListener;
-import java.awt.Rectangle;
-import java.awt.geom.Area;
-import java.awt.geom.PathIterator;
-import java.io.File;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
/**
* The plot class
*/
@@ -1206,6 +1206,11 @@ public class Plot {
return map;
}
+ public boolean hasRatings() {
+ Plot base = this.getBasePlot(false);
+ return base.settings != null && base.settings.ratings != null;
+ }
+
/**
* Resend all chunks inside the plot to nearby players
* This should not need to be called
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java b/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
index 7ccf2caf6..c8c03ba02 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
@@ -35,7 +35,6 @@ import java.util.List;
*/
public class ReflectionUtils {
- private static String version;
/**
* prefix of bukkit classes
*/
@@ -46,9 +45,10 @@ public class ReflectionUtils {
private static String preClassM = "net.minecraft.server";
public ReflectionUtils(final String version) {
- ReflectionUtils.version = version;
- preClassB += "." + version;
- preClassM += "." + version;
+ if (version != null) {
+ preClassB += "." + version;
+ preClassM += "." + version;
+ }
}
public static List getStaticFields(Class clazz) {
@@ -66,14 +66,14 @@ public class ReflectionUtils {
}
return list;
}
-
+
public static Class> getNmsClass(final String name) {
- final String className = "net.minecraft.server." + version + "." + name;
+ final String className = preClassM + "." + name;
return getClass(className);
}
public static Class> getCbClass(final String name) {
- final String className = "org.bukkit.craftbukkit." + version + "." + name;
+ final String className = preClassB + "." + name;
return getClass(className);
}
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
index 7106a597a..7f6023daf 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
@@ -1,33 +1,16 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.object.PlotArea;
-import com.intellectualcrafters.plot.object.PlotBlock;
-import com.intellectualcrafters.plot.object.PlotHandler;
-import com.intellectualcrafters.plot.object.PlotId;
-import com.intellectualcrafters.plot.object.PlotInventory;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.object.StringWrapper;
-import com.intellectualcrafters.plot.util.EventUtil;
-import com.intellectualcrafters.plot.util.ExpireManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.MathMan;
-import com.intellectualcrafters.plot.util.Permissions;
-import com.intellectualcrafters.plot.util.RegExUtil;
-import com.intellectualcrafters.plot.util.StringMan;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.intellectualcrafters.plot.util.UUIDHandler;
-import com.plotsquared.bukkit.BukkitMain;
-import com.plotsquared.bukkit.object.BukkitLazyBlock;
-import com.plotsquared.bukkit.object.BukkitPlayer;
-import com.plotsquared.bukkit.util.BukkitUtil;
-import com.plotsquared.listener.PlayerBlockEventType;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -106,16 +89,34 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import java.util.regex.Pattern;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotArea;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotHandler;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotInventory;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.ExpireManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.RegExUtil;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.bukkit.BukkitMain;
+import com.plotsquared.bukkit.object.BukkitLazyBlock;
+import com.plotsquared.bukkit.object.BukkitPlayer;
+import com.plotsquared.bukkit.util.BukkitUtil;
+import com.plotsquared.listener.PlayerBlockEventType;
/**
* Player Events involving plots
@@ -486,7 +487,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
event.setCancelled(true);
return;
}
- } else if (lastPlot != null && now.equals(lastPlot)) {
+ } else if (now.equals(lastPlot)) {
return;
} else if (!plotEntry(pp, now)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
@@ -538,7 +539,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
event.setCancelled(true);
return;
}
- } else if (lastPlot != null && now.equals(lastPlot)) {
+ } else if (now.equals(lastPlot)) {
return;
} else if (!plotEntry(pp, now)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, C.PERMISSION_ADMIN_ENTRY_DENIED);
diff --git a/src/main/java/com/plotsquared/sponge/SpongeMain.java b/src/main/java/com/plotsquared/sponge/SpongeMain.java
index c545084c7..450309f64 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeMain.java
+++ b/src/main/java/com/plotsquared/sponge/SpongeMain.java
@@ -10,6 +10,7 @@ import java.util.UUID;
import org.slf4j.Logger;
import org.spongepowered.api.Game;
import org.spongepowered.api.Server;
+import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent;
@@ -62,8 +63,11 @@ import com.plotsquared.sponge.util.SpongeChunkManager;
import com.plotsquared.sponge.util.SpongeCommand;
import com.plotsquared.sponge.util.SpongeEconHandler;
import com.plotsquared.sponge.util.SpongeEventUtil;
+import com.plotsquared.sponge.util.SpongeHybridUtils;
import com.plotsquared.sponge.util.SpongeInventoryUtil;
import com.plotsquared.sponge.util.SpongeMetrics;
+import com.plotsquared.sponge.util.SpongeSchematicHandler;
+import com.plotsquared.sponge.util.SpongeSetupUtils;
import com.plotsquared.sponge.util.SpongeTaskManager;
import com.plotsquared.sponge.util.SpongeTitleManager;
import com.plotsquared.sponge.util.SpongeUtil;
@@ -77,8 +81,8 @@ import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
* Created by robin on 01/11/2014
*/
-@Plugin(id = "PlotSquared", name = "PlotSquared", version = "3.0.0", dependencies = "before:WorldEdit,required-after:TotalEconomy")
-public class SpongeMain implements IPlotMain, PluginContainer {
+@Plugin(id = "PlotSquared", name = "PlotSquared", version = "3.3.0", dependencies = "before:WorldEdit")
+public class SpongeMain implements IPlotMain {
public static SpongeMain THIS;
@Inject
@@ -89,7 +93,7 @@ public class SpongeMain implements IPlotMain, PluginContainer {
private GameProfileManager resolver;
- @Override
+ // @Override
public Logger getLogger() {
return logger;
}
@@ -103,6 +107,9 @@ public class SpongeMain implements IPlotMain, PluginContainer {
}
public GameProfileManager getResolver() {
+ if (resolver == null) {
+ resolver = game.getServer().getGameProfileManager();
+ }
return resolver;
}
@@ -110,22 +117,22 @@ public class SpongeMain implements IPlotMain, PluginContainer {
return THIS;
}
- @Override
+ // @Override
public String getId() {
return "PlotSquared";
}
- @Override
+ // @Override
public Optional