diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml
index dc434168b..bb4bf17f9 100644
--- a/PlotSquared/pom.xml
+++ b/PlotSquared/pom.xml
@@ -8,7 +8,7 @@
UTF-8
PlotSquared
- 2.12.0
+ 2.12.4
PlotSquared
jar
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java
index f0e8838b7..8b5d05537 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java
@@ -224,7 +224,9 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
try {
unloadRecursively(this);
}
- catch (Exception e) {};
+ catch (Exception e) {
+ e.printStackTrace();
+ };
THIS = null;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java
index 7c50bddea..5156c1e99 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java
@@ -112,6 +112,7 @@ public class PS {
private File storageFile;
private File FILE = null; // This file
private String VERSION = null;
+ private String LAST_VERSION;
private boolean LOADING_WORLD = false;
private LinkedHashMap> plots;
private Database database;
@@ -200,6 +201,9 @@ public class PS {
log("&8 - &3Use: &7/plot update");
log("&8 - &3Or: &7" + url);
}
+ else if (LAST_VERSION != null && !VERSION.equals(LAST_VERSION)) {
+ log("&aThanks for updating from: " + LAST_VERSION + " to " + VERSION);
+ }
}
});
@@ -240,6 +244,22 @@ public class PS {
public static PS get() {
return instance;
}
+
+ /**
+ * Get the last PlotSquared version
+ * @return last version in config or null
+ */
+ public String getLastVersion() {
+ return LAST_VERSION;
+ }
+
+ /**
+ * Get the current PlotSquared version
+ * @return current version in config or null
+ */
+ public String getVersion() {
+ return VERSION;
+ }
/**
* Log a message to the IPlotMain logger
@@ -1179,6 +1199,7 @@ public class PS {
* Setup the default configuration (settings.yml)
*/
public void setupConfig() {
+ LAST_VERSION = config.getString("version");
config.set("version", VERSION);
final Map options = new HashMap<>();
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
index 3e8c1d047..91d971378 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
@@ -92,7 +92,7 @@ public class DebugExec extends SubCommand {
}
case "remove-flag": {
if (args.length != 2) {
- MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot debugexec reset-flat ");
+ MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot debugexec remove-flag ");
return false;
}
String flag = args[1];
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java
index 7d82d7353..7d81d6948 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Download.java
@@ -5,6 +5,7 @@ import java.net.URL;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
@@ -19,6 +20,10 @@ public class Download extends SubCommand {
@Override
public boolean execute(final PlotPlayer plr, String... args) {
+ if (!Settings.METRICS) {
+ MainUtil.sendMessage(plr, "&cPlease enable metrics in order to use this command.\n&7 - Or host it yourself if you don't like the free service");
+ return false;
+ }
final String world = plr.getLocation().getWorld();
if (!PS.get().isPlotWorld(world)) {
return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
index 5f48d8765..ce8348092 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang.StringUtils;
+import org.bukkit.Material;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@@ -240,10 +241,6 @@ public class Set extends SubCommand {
MainUtil.sendMessage(plr, C.NEED_BLOCK);
return true;
}
-// if (!Configuration.BLOCKLIST.validateValue(args[1])) {
-// MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, args[1]);
-// return false;
-// }
String[] split = args[1].split(",");
blocks = Configuration.BLOCKLIST.parseString(args[1]);
for (int i = 0; i < blocks.length; i++) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
index 8b3be7efc..d71a1ea9f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
@@ -144,55 +144,100 @@ public class SQLManager implements AbstractDB {
@Override
public void run() {
try {
+ connection.setAutoCommit(false);
+
// Create the plots
- createPlots(myList);
+ createPlots(myList, new Runnable() {
+ @Override
+ public void run() {
+ try {
+ // Creating datastructures
+ HashMap plotMap = new HashMap<>();
+ for (Plot plot : myList) {
+ plotMap.put(plot.id, plot);
+ }
+ final ArrayList settings = new ArrayList<>();
+ final ArrayList helpers = new ArrayList<>();
+ final ArrayList trusted = new ArrayList<>();
+ final ArrayList denied = new ArrayList<>();
- // Creating datastructures
- HashMap plotMap = new HashMap<>();
- for (Plot plot : myList) {
- plotMap.put(plot.id, plot);
- }
- ArrayList settings = new ArrayList<>();
- ArrayList helpers = new ArrayList<>();
- ArrayList trusted = new ArrayList<>();
- ArrayList denied = new ArrayList<>();
-
- // Populating structures
- final PreparedStatement stmt = connection.prepareStatement(GET_ALL_PLOTS);
- final ResultSet result = stmt.executeQuery();
- while (result.next()) {
- final int id = result.getInt("id");
- int x = result.getInt("plot_id_x");
- int y = result.getInt("plot_id_z");
- PlotId plotId = new PlotId(x, y);
- Plot plot = plotMap.get(plotId);
- if (plot != null) {
- settings.add(new SettingsPair(id, plot.settings));
- if (plot.denied != null) {
- for (UUID uuid : plot.denied) {
- denied.add(new UUIDPair(id, uuid));
+ // Populating structures
+ final PreparedStatement stmt = connection.prepareStatement(GET_ALL_PLOTS);
+ final ResultSet result = stmt.executeQuery();
+ while (result.next()) {
+ final int id = result.getInt("id");
+ int x = result.getInt("plot_id_x");
+ int y = result.getInt("plot_id_z");
+ PlotId plotId = new PlotId(x, y);
+ Plot plot = plotMap.get(plotId);
+ if (plot != null) {
+ settings.add(new SettingsPair(id, plot.settings));
+ if (plot.denied != null) {
+ for (UUID uuid : plot.denied) {
+ denied.add(new UUIDPair(id, uuid));
+ }
+ }
+ if (plot.members != null) {
+ for (UUID uuid : plot.members) {
+ trusted.add(new UUIDPair(id, uuid));
+ }
+ }
+ if (plot.trusted != null) {
+ for (UUID uuid : plot.trusted) {
+ helpers.add(new UUIDPair(id, uuid));
+ }
+ }
}
}
- if (plot.members != null) {
- for (UUID uuid : plot.members) {
- trusted.add(new UUIDPair(id, uuid));
+ createSettings(settings, new Runnable() {
+ @Override
+ public void run() {
+ createTiers(helpers, "helpers", new Runnable() {
+ @Override
+ public void run() {
+ createTiers(trusted, "trusted", new Runnable() {
+ @Override
+ public void run() {
+ createTiers(denied, "denied", new Runnable() {
+ @Override
+ public void run() {
+ try {
+ connection.commit();
+ connection.setAutoCommit(true);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ if (whenDone != null) whenDone.run();
+ }
+ });
+ }
+ });
+ }
+ });
}
+ });
}
- if (plot.trusted != null) {
- for (UUID uuid : plot.trusted) {
- helpers.add(new UUIDPair(id, uuid));
+ catch (SQLException e) {
+ e.printStackTrace();
+ PS.log("&7[WARN] " + "Failed to set all helpers for plots");
+ try {
+ connection.commit();
+ connection.setAutoCommit(true);
+ } catch (SQLException e1) {
+ e1.printStackTrace();
}
}
}
- }
- createSettings(settings);
- createTiers(helpers, "helpers");
- createTiers(trusted, "trusted");
- createTiers(denied, "denied");
- TaskManager.runTaskLater(whenDone, 60);
+ });
} catch (SQLException e) {
e.printStackTrace();
PS.log("&7[WARN] " + "Failed to set all helpers for plots");
+ try {
+ connection.commit();
+ connection.setAutoCommit(true);
+ } catch (SQLException e1) {
+ e1.printStackTrace();
+ }
}
}
});
@@ -203,7 +248,7 @@ public class SQLManager implements AbstractDB {
*
* @param myList list of plots to be created
*/
- public void createTiers(final ArrayList myList, final String tier) {
+ public void createTiers(final ArrayList myList, final String tier, final Runnable whenDone) {
final StmtMod mod = new StmtMod() {
@Override
public String getCreateMySQL(int size) {
@@ -239,7 +284,7 @@ public class SQLManager implements AbstractDB {
stmt.setString(2, pair.uuid.toString());
}
};
- setBulk(myList, mod);
+ setBulk(myList, mod, whenDone);
}
/**
@@ -247,7 +292,7 @@ public class SQLManager implements AbstractDB {
*
* @param myList list of plots to be created
*/
- public void createPlots(final ArrayList myList) {
+ public void createPlots(final ArrayList myList, final Runnable whenDone) {
final StmtMod mod = new StmtMod() {
@Override
public String getCreateMySQL(int size) {
@@ -298,12 +343,13 @@ public class SQLManager implements AbstractDB {
stmt.setString(4, plot.world);
}
};
- setBulk(myList, mod);
+ setBulk(myList, mod, whenDone);
}
- public void setBulk(ArrayList objList, StmtMod mod) {
+ public void setBulk(ArrayList objList, StmtMod mod, Runnable whenDone) {
final int size = objList.size();
if (size == 0) {
+ if (whenDone != null) whenDone.run();
return;
}
int packet;
@@ -313,7 +359,6 @@ public class SQLManager implements AbstractDB {
packet = Math.min(size, 50);
}
final int amount = size / packet;
-
try {
int count = 0;
PreparedStatement preparedStmt = null;
@@ -347,6 +392,7 @@ public class SQLManager implements AbstractDB {
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
+ if (whenDone != null) whenDone.run();
return;
} catch (Exception e) {
if (Settings.DB.USE_MYSQL) {
@@ -371,8 +417,7 @@ public class SQLManager implements AbstractDB {
}
if (subList.size() != last || (count % 5000 == 0 && count > 0)) {
preparedStmt.executeBatch();
- preparedStmt.close();
-
+ preparedStmt.clearParameters();
statement = mod.getCreateSQLite(subList.size());
preparedStmt = this.connection.prepareStatement(statement.toString());
}
@@ -388,35 +433,34 @@ public class SQLManager implements AbstractDB {
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
- return;
} catch (Exception e) {
e.printStackTrace();
PS.log("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName());
- }
-
- PS.log("&6[WARN] " + "Could not bulk save!");
- try {
- PreparedStatement preparedStmt = null;
- String nonBulk = mod.getCreateSQL();
- preparedStmt = this.connection.prepareStatement(nonBulk.toString());
- for (final T obj : objList) {
- try {
- mod.setSQL(preparedStmt, obj);
- preparedStmt.addBatch();
- } catch (final Exception e3) {
- PS.log("&c[ERROR] " + "Failed to save " + obj + "!");
+ PS.log("&6[WARN] " + "Could not bulk save!");
+ try {
+ PreparedStatement preparedStmt = null;
+ String nonBulk = mod.getCreateSQL();
+ preparedStmt = this.connection.prepareStatement(nonBulk.toString());
+ for (final T obj : objList) {
+ try {
+ mod.setSQL(preparedStmt, obj);
+ preparedStmt.addBatch();
+ } catch (final Exception e3) {
+ PS.log("&c[ERROR] " + "Failed to save " + obj + "!");
+ }
}
+ PS.log("&aBatch 3");
+ preparedStmt.executeBatch();
+ preparedStmt.close();
+ } catch (Exception e3) {
+ e3.printStackTrace();
+ PS.log("&c[ERROR] " + "Failed to save all!");
}
- PS.log("&aBatch 3");
- preparedStmt.executeBatch();
- preparedStmt.close();
- } catch (Exception e3) {
- e3.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to save all!");
}
+ if (whenDone != null) whenDone.run();
}
- public void createSettings(final ArrayList myList) {
+ public void createSettings(final ArrayList myList, final Runnable whenDone) {
final StmtMod mod = new StmtMod() {
@Override
public String getCreateMySQL(int size) {
@@ -527,12 +571,12 @@ public class SQLManager implements AbstractDB {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
- setBulk(myList, mod);
+ setBulk(myList, mod, whenDone);
}
});
}
- public void createEmptySettings(final ArrayList myList) {
+ public void createEmptySettings(final ArrayList myList, final Runnable whenDone) {
final StmtMod mod = new StmtMod() {
@Override
public String getCreateMySQL(int size) {
@@ -576,7 +620,7 @@ public class SQLManager implements AbstractDB {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
- setBulk(myList, mod);
+ setBulk(myList, mod, whenDone);
}
});
}
@@ -648,6 +692,7 @@ public class SQLManager implements AbstractDB {
} else {
tables = new String[]{"plot", "plot_denied", "plot_helpers", "plot_comments", "plot_trusted", "plot_rating", "plot_settings"};
}
+ final boolean mysql = database.equals("mysql");
final DatabaseMetaData meta = connection.getMetaData();
int create = 0;
for (final String s : tables) {
@@ -663,7 +708,6 @@ public class SQLManager implements AbstractDB {
boolean add_constraint;
add_constraint = create == tables.length;
PS.log("Creating tables");
- final boolean mysql = database.equals("mysql");
final Statement stmt = this.connection.createStatement();
if (mysql) {
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` (" + "`id` INT(11) NOT NULL AUTO_INCREMENT," + "`plot_id_x` INT(11) NOT NULL," + "`plot_id_z` INT(11) NOT NULL," + "`owner` VARCHAR(40) NOT NULL," + "`world` VARCHAR(45) NOT NULL," + "`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP," + "PRIMARY KEY (`id`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0");
@@ -791,6 +835,9 @@ public class SQLManager implements AbstractDB {
}
public void updateTables() {
+ if (PS.get().getVersion().equals(PS.get().getLastVersion()) || PS.get().getLastVersion() == null) {
+ return;
+ }
try {
final DatabaseMetaData data = this.connection.getMetaData();
ResultSet rs = data.getColumns(null, null, this.prefix + "plot_comments", "plot_plot_id");
@@ -820,9 +867,28 @@ public class SQLManager implements AbstractDB {
}
}
rs.close();
- } catch (SQLException e) {
+ try (Statement statement = connection.createStatement();) {
+ for (String table : new String[]{"plot_denied", "plot_helpers", "plot_trusted"} ) {
+ ResultSet result = statement.executeQuery("SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table + " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
+ if (result.next()) {
+ PS.log("BACKING UP: " + table);
+ result.close();
+ statement.executeUpdate("CREATE TABLE " + table + "_tmp AS SELECT * FROM " + this.prefix + table + " GROUP BY plot_plot_id, user_uuid");
+ statement.executeUpdate("DROP TABLE " + this.prefix + table);
+ statement.executeUpdate("CREATE TABLE " + this.prefix + table + " AS SELECT * FROM " + table + "_tmp");
+ statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
+ PS.log("RESTORING: " + table);
+ }
+ }
+ }
+ catch (Exception e2) {
+ e2.printStackTrace();
+ }
+ }
+ catch (Exception e) {
e.printStackTrace();
}
+
}
/**
@@ -906,7 +972,7 @@ public class SQLManager implements AbstractDB {
}
final Plot plot = plots.get(id);
if (plot != null) {
- plot.addTrusted(user);
+ plot.trusted.add(user);
} else {
PS.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
}
@@ -926,7 +992,7 @@ public class SQLManager implements AbstractDB {
}
final Plot plot = plots.get(id);
if (plot != null) {
- plot.addMember(user);
+ plot.members.add(user);
} else {
PS.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
}
@@ -946,7 +1012,7 @@ public class SQLManager implements AbstractDB {
}
final Plot plot = plots.get(id);
if (plot != null) {
- plot.addDenied(user);
+ plot.denied.add(user);
} else {
PS.log("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
}
@@ -1045,7 +1111,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
r.close();
if (plots.keySet().size() > 0) {
- createEmptySettings(new ArrayList(plots.keySet()));
+ createEmptySettings(new ArrayList(plots.keySet()), null);
}
boolean invalidPlot = false;
for (final String worldname : noExist.keySet()) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index 3d9c49c4a..eac376539 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -843,12 +843,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
}
Location loc = BukkitUtil.getLocation(block.getLocation());
PlotPlayer pp = BukkitUtil.getPlayer(player);
-
PlayerBlockEventType eventType = null;
-
-
BukkitLazyBlock lb;
-
switch (action) {
case PHYSICAL: {
eventType = PlayerBlockEventType.TRIGGER_PHYSICAL;
@@ -925,6 +921,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
break;
}
+
// TODO calls both:
// redstone ore
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java
index f94732058..9709779eb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java
@@ -89,6 +89,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.BREAK_OTHER.s, notifyPerms);
}
+ return true;
}
case BREAK_HANGING:
if (plot == null) {
@@ -135,6 +136,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
}
+ return true;
}
case PLACE_BLOCK: {
if (plot == null) {
@@ -148,6 +150,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.BUILD_OTHER.s, notifyPerms);
}
+ return true;
}
case TRIGGER_PHYSICAL: {
if (plot == null) {
@@ -164,6 +167,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
}
+ return true;
}
case INTERACT_HANGING: {
if (plot == null) {
@@ -180,6 +184,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
}
+ return true;
}
case INTERACT_MISC: {
if (plot == null) {
@@ -196,6 +201,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
}
+ return true;
}
case INTERACT_VEHICLE: {
if (plot == null) {
@@ -212,6 +218,7 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
}
+ return true;
}
case SPAWN_MOB: {
if (plot == null) {
@@ -229,13 +236,62 @@ public abstract class EventUtil {
if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
}
+ return true;
+ }
+ case PLACE_HANGING: {
+// if (plot == null) {
+// return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
+// }
+// if (!plot.hasOwner()) {
+// return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
+// }
+//
+// if (FlagManager.isPlotFlagTrue(plot, "hanging-place")) {
+// return true;
+// }
+// Flag flag = FlagManager.getPlotFlag(plot, "place");
+// HashSet value = flag == null ? null : (HashSet) flag.getValue();
+// if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
+// return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
+// }
+ return true;
+ }
+ case PLACE_MISC: {
+ if (plot == null) {
+ return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
+ }
+ if (!plot.hasOwner()) {
+ return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
+ }
+
+ if (FlagManager.isPlotFlagTrue(plot, "misc-place")) {
+ return true;
+ }
+ Flag flag = FlagManager.getPlotFlag(plot, "place");
+ HashSet value = flag == null ? null : (HashSet) flag.getValue();
+ if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
+ return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
+ }
+ return true;
+ }
+ case PLACE_VEHICLE: {
+ if (plot == null) {
+ return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
+ }
+ if (!plot.hasOwner()) {
+ return Permissions.hasPermission(pp, Permissions.INTERACT_UNOWNED.s, notifyPerms);
+ }
+
+ if (FlagManager.isPlotFlagTrue(plot, "vehicle-place")) {
+ return true;
+ }
+ Flag flag = FlagManager.getPlotFlag(plot, "place");
+ HashSet value = flag == null ? null : (HashSet) flag.getValue();
+ if (value == null || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
+ return Permissions.hasPermission(pp, Permissions.INTERACT_OTHER.s, notifyPerms);
+ }
+ return true;
}
- case PLACE_HANGING:
- break;
- case PLACE_MISC:
- break;
- case PLACE_VEHICLE:
- break;
default:
break;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java
index 8499ef658..c584cb7fd 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java
@@ -326,8 +326,16 @@ public class BukkitUtil extends BlockManager {
Material material = Material.getMaterial(block.id);
if (material.isBlock() && material.isSolid() && !material.hasGravity()) {
Class extends MaterialData> data = material.getData();
- if (data.equals(MaterialData.class) || data.equals(Tree.class) || data.equals(Sandstone.class) || data.equals(Wool.class) || data.equals(Step.class)) {
- return true;
+ if ((data.equals(MaterialData.class) && !material.isTransparent() && material.isOccluding()) || data.equals(Tree.class) || data.equals(Sandstone.class) || data.equals(Wool.class) || data.equals(Step.class)) {
+ System.out.print((data.equals(MaterialData.class) && !material.isTransparent() && material.isOccluding()) + " | " + data.getCanonicalName());
+ switch (material) {
+ case NOTE_BLOCK:
+ case MOB_SPAWNER: {
+ return false;
+ }
+ default:
+ return true;
+ }
}
}
return false;