mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Don't send duplicate messages
This commit is contained in:
@ -9,6 +9,8 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
|
||||
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
|
||||
import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
@ -223,13 +225,17 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
rz[i] = v;
|
||||
}
|
||||
LocalBlockQueue queue = null;
|
||||
for (short x = 0; x < 16; x++) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
int pair = MathMan.pair(rx[x], rz[z]);
|
||||
HashMap<Integer, CompoundTag> map = hpw.G_SCH_STATE.get(pair);
|
||||
if (map != null) {
|
||||
for (Entry<Integer, CompoundTag> entry : map.entrySet()) {
|
||||
SchematicHandler.manager.restoreTile(hpw.worldname, entry.getValue(), p1x + x, entry.getKey(), p1z + z);
|
||||
if (queue == null) {
|
||||
queue = GlobalBlockQueue.IMP.getNewQueue(hpw.worldname, false);
|
||||
}
|
||||
SchematicHandler.manager.restoreTile(queue, entry.getValue(), p1x + x, entry.getKey(), p1z + z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public abstract class EventUtil {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_BREAK.s()));
|
||||
@ -149,8 +149,7 @@ public abstract class EventUtil {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms) || !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s()));
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s()));
|
||||
}
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||
case BREAK_MISC:
|
||||
@ -161,7 +160,7 @@ public abstract class EventUtil {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms) || !(!notifyPerms || MainUtil
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_BREAK.s()));
|
||||
}
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||
@ -173,7 +172,7 @@ public abstract class EventUtil {
|
||||
return true;
|
||||
}
|
||||
if (plot.hasOwner()) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_BREAK.s()));
|
||||
@ -194,7 +193,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms) || !(!notifyPerms || MainUtil
|
||||
return Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false) || !(!notifyPerms || MainUtil
|
||||
.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s()));
|
||||
}
|
||||
return true;
|
||||
@ -214,7 +213,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_BUILD_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_BUILD_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_PLACE.s()));
|
||||
@ -264,7 +263,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_HANGING_INTERACT.s()));
|
||||
@ -289,7 +288,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_MISC_INTERACT.s()));
|
||||
@ -314,7 +313,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_VEHICLE_USE.s()));
|
||||
@ -339,7 +338,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MOB_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
||||
@ -366,7 +365,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
||||
@ -392,7 +391,7 @@ public abstract class EventUtil {
|
||||
value = null;
|
||||
}
|
||||
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
if (Permissions.hasPermission(player, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(player, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
||||
|
@ -334,15 +334,15 @@ public abstract class SchematicHandler {
|
||||
if (!chunks.isEmpty()) {
|
||||
this.run();
|
||||
} else {
|
||||
queue.flush();
|
||||
for (Map.Entry<BlockLoc, CompoundTag> entry : schematic.getTiles().entrySet()) {
|
||||
BlockLoc loc = entry.getKey();
|
||||
restoreTile(plot.getArea().worldname, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z);
|
||||
restoreTile(queue, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z);
|
||||
}
|
||||
if (whenDone != null) {
|
||||
whenDone.value = true;
|
||||
whenDone.run();
|
||||
}
|
||||
queue.flush();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -426,7 +426,7 @@ public abstract class SchematicHandler {
|
||||
return schem;
|
||||
}
|
||||
|
||||
public abstract void restoreTile(String world, CompoundTag tag, int x, int y, int z);
|
||||
public abstract boolean restoreTile(LocalBlockQueue queue, CompoundTag tag, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Get a schematic
|
||||
|
@ -57,7 +57,11 @@ public class GlobalBlockQueue {
|
||||
}
|
||||
};
|
||||
|
||||
public void GlobalBlockQueueProvider(QueueProvider provider) {
|
||||
public QueueProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(QueueProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.intellectualcrafters.plot.util.block;
|
||||
|
||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
@ -44,6 +46,11 @@ public abstract class LocalBlockQueue {
|
||||
return setBlock(x, y, z, block.id, block.data);
|
||||
}
|
||||
|
||||
public boolean setTile(int x, int y, int z, CompoundTag tag) {
|
||||
SchematicHandler.manager.restoreTile(this, tag, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract PlotBlock getBlock(int x, int y, int z);
|
||||
|
||||
public abstract boolean setBiome(int x, int z, String biome);
|
||||
|
Reference in New Issue
Block a user