fixes #763
This commit is contained in:
Jesse Boyd 2015-11-29 19:21:32 +11:00
parent c2b781da98
commit 9118f111e4
17 changed files with 100 additions and 92 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>3.2.19</version> <version>3.2.20</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -699,7 +699,7 @@ public class PS {
try { try {
final ArrayList<Plot> overflow = new ArrayList<>(); final ArrayList<Plot> overflow = new ArrayList<>();
if ((range > limit) && (size > 1024)) { if ((range > limit) && (size > 1024)) {
plots = new Plot[Math.min((int) range, limit)]; plots = new Plot[limit];
final int factor = (int) ((range / limit)); final int factor = (int) ((range / limit));
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Plot plot = list.get(i); Plot plot = list.get(i);

View File

@ -134,12 +134,9 @@ public class Info extends SubCommand {
full = false; full = false;
} }
MainUtil.format(info, plot, player, full, new RunnableVal<String>() { MainUtil.format(info, plot, player, full, new RunnableVal<String>() {
@Override @Override
public void run() { public void run() {
MainUtil.sendMessage(player, C.PLOT_INFO_HEADER); MainUtil.sendMessage(player, C.PLOT_INFO_HEADER.s() + '\n' + value + '\n' + C.PLOT_INFO_FOOTER.s(), false);
MainUtil.sendMessage(player, value, false);
MainUtil.sendMessage(player, C.PLOT_INFO_FOOTER);
} }
}); });
return true; return true;

View File

@ -320,6 +320,9 @@ public class MainCommand extends CommandManager<PlotPlayer> {
@Override @Override
public int handle(final PlotPlayer plr, final String input) { public int handle(final PlotPlayer plr, final String input) {
// Clear perm caching //
plr.deleteMeta("perm");
////////////////////////
final String[] parts = input.split(" "); final String[] parts = input.split(" ");
String[] args; String[] args;
String label; String label;

View File

@ -331,7 +331,7 @@ public class list extends SubCommand {
} }
} }
if (sort) { if (sort) {
plots = PS.get().sortPlots(plots, SortType.CREATION_DATE_TIMESTAMP, world); plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, world);
} }
if (page < 0) { if (page < 0) {
page = 0; page = 0;

View File

@ -675,14 +675,18 @@ public enum C {
final Map<String, String> map = new LinkedHashMap<String, String>(); final Map<String, String> map = new LinkedHashMap<String, String>();
if (args.length > 0) { if (args.length > 0) {
for (int i = args.length - 1; i >= 0; i--) { for (int i = args.length - 1; i >= 0; i--) {
if (args[i] == null) { String arg = args[i].toString();
args[i] = ""; if (arg == null || arg.length() == 0) {
map.put("%s" + i, "");
} else {
arg = C.color(arg);
map.put("%s" + i, arg);
}
if (i == 0) {
map.put("%s", arg);
} }
map.put("%s" + i, args[i].toString());
} }
map.put("%s", args[0].toString());
} }
map.putAll(replacements);
m = StringMan.replaceFromMap(m, map); m = StringMan.replaceFromMap(m, map);
return m; return m;
} }

View File

@ -40,7 +40,7 @@ public class Settings {
/** /**
* Default UUID_FECTHING: false * Default UUID_FECTHING: false
*/ */
public static boolean PERMISSION_CACHING = false; public static boolean PERMISSION_CACHING = true;
public static boolean CACHE_RATINGS = true; public static boolean CACHE_RATINGS = true;
public static boolean UUID_FROM_DISK = false; public static boolean UUID_FROM_DISK = false;

View File

@ -2819,7 +2819,7 @@ public class SQLManager implements AbstractDB {
final ConcurrentHashMap<PlotId, Plot> map = entry.getValue(); final ConcurrentHashMap<PlotId, Plot> map = entry.getValue();
if (map.size() > 0) { if (map.size() > 0) {
for (final Entry<PlotId, Plot> entry2 : map.entrySet()) { for (final Entry<PlotId, Plot> entry2 : map.entrySet()) {
PS.debug("$1Plot was deleted: " + entry.getValue() + "// TODO implement this when sure safe"); PS.debug("$1Plot was deleted: " + entry2.getValue() + "// TODO implement this when sure safe");
} }
} }
} }

View File

@ -157,8 +157,16 @@ public class FlagManager {
return result == null ? null : (Flag) result.clone(); return result == null ? null : (Flag) result.clone();
} }
/**
* Returns the raw flag<br>
* - Faster
* - You should not modify the flag
* @param plot
* @param flag
* @return
*/
public static Flag getPlotFlagRaw(final Plot plot, final String flag) { public static Flag getPlotFlagRaw(final Plot plot, final String flag) {
if (!plot.hasOwner()) { if (plot.owner == null) {
return null; return null;
} }
return getSettingFlag(plot.world, plot.getSettings(), flag); return getSettingFlag(plot.world, plot.getSettings(), flag);

View File

@ -63,12 +63,11 @@ public abstract class EventUtil {
public boolean checkPlayerBlockEvent(final PlotPlayer pp, final PlayerBlockEventType type, final Location loc, final LazyBlock block, boolean notifyPerms) { public boolean checkPlayerBlockEvent(final PlotPlayer pp, final PlayerBlockEventType type, final Location loc, final LazyBlock block, boolean notifyPerms) {
final Plot plot = MainUtil.getPlotAbs(loc); final Plot plot = MainUtil.getPlotAbs(loc);
final UUID uuid = pp.getUUID();
if (plot == null) { if (plot == null) {
if (!MainUtil.isPlotAreaAbs(loc)) { if (!MainUtil.isPlotAreaAbs(loc)) {
return true; return true;
} }
} else if (plot.isAdded(uuid)) { } else if (plot.isAdded(pp.getUUID())) {
return true; return true;
} }
switch (type) { switch (type) {
@ -83,7 +82,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
final Flag use = FlagManager.getPlotFlagRaw(plot, "use"); final Flag use = FlagManager.getPlotFlagRaw(plot, "use");
@ -151,7 +150,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
final Flag flag = FlagManager.getPlotFlagRaw(plot, "use"); final Flag flag = FlagManager.getPlotFlagRaw(plot, "use");
@ -168,7 +167,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_UNOWNED.s(), notifyPerms);
} }
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place"); final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
@ -185,7 +184,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), false); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), false);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), false); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), false);
} }
if (FlagManager.isPlotFlagTrue(plot, "device-interact")) { if (FlagManager.isPlotFlagTrue(plot, "device-interact")) {
@ -194,12 +193,10 @@ public abstract class EventUtil {
final Flag flag = FlagManager.getPlotFlagRaw(plot, "use"); final Flag flag = FlagManager.getPlotFlagRaw(plot, "use");
final HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue(); final HashSet<PlotBlock> value = flag == null ? null : (HashSet<PlotBlock>) flag.getValue();
if ((value == null) || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) { if ((value == null) || (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock()))) {
long time = System.currentTimeMillis(); if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), false)) {
notifyPerms = notifyPerms && (31 * (time / 31) == time);
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true; return true;
} }
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_DEVICE_INTERACT.s())); return !(!false || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_DEVICE_INTERACT.s()));
} }
return true; return true;
} }
@ -207,7 +204,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
if (FlagManager.isPlotFlagTrue(plot, "hanging-interact")) { if (FlagManager.isPlotFlagTrue(plot, "hanging-interact")) {
@ -227,7 +224,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
if (FlagManager.isPlotFlagTrue(plot, "misc-interact")) { if (FlagManager.isPlotFlagTrue(plot, "misc-interact")) {
@ -247,7 +244,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
if (FlagManager.isPlotFlagTrue(plot, "vehicle-use")) { if (FlagManager.isPlotFlagTrue(plot, "vehicle-use")) {
@ -267,7 +264,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
@ -288,7 +285,7 @@ public abstract class EventUtil {
// if (plot == null) { // if (plot == null) {
// return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms); // return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
// } // }
// if (!plot.hasOwner()) { // if (plot.owner == null) {
// return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); // return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
// } // }
// //
@ -306,7 +303,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }
@ -327,7 +324,7 @@ public abstract class EventUtil {
if (plot == null) { if (plot == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
} }
if (!plot.hasOwner()) { if (plot.owner == null) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
} }

View File

@ -2177,18 +2177,7 @@ public class MainUtil {
* @return boolean success * @return boolean success
*/ */
public static boolean sendMessage(final PlotPlayer plr, final C c, final String... args) { public static boolean sendMessage(final PlotPlayer plr, final C c, final String... args) {
if (c.s().length() > 1) { return sendMessage(plr, c, (Object[]) args);
String msg = c.s();
if ((args != null) && (args.length > 0)) {
msg = C.format(c, args);
}
if (plr == null) {
ConsolePlayer.getConsole().sendMessage(msg);
} else {
sendMessage(plr, msg, c.usePrefix());
}
}
return true;
} }
/** /**
@ -2200,17 +2189,23 @@ public class MainUtil {
* @return boolean success * @return boolean success
*/ */
public static boolean sendMessage(final PlotPlayer plr, final C c, final Object... args) { public static boolean sendMessage(final PlotPlayer plr, final C c, final Object... args) {
if (c.s().length() > 1) { if (c.s().length() == 0) {
return true;
}
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
String msg = c.s(); String msg = c.s();
if ((args != null) && (args.length > 0)) { if (args.length != 0) {
msg = C.format(c, args); msg = c.format(c, args);
} }
if (plr == null) { if (plr != null) {
ConsolePlayer.getConsole().sendMessage(msg); plr.sendMessage((c.usePrefix() ? C.PREFIX.s() + msg : msg));
} else { } else {
sendMessage(plr, msg, c.usePrefix()); ConsolePlayer.getConsole().sendMessage((c.usePrefix() ? C.PREFIX.s() : "") + msg);
} }
} }
});
return true; return true;
} }

View File

@ -1,6 +1,9 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import java.util.HashMap;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.general.commands.CommandCaller; import com.plotsquared.general.commands.CommandCaller;
@ -10,8 +13,23 @@ public class Permissions {
} }
public static boolean hasPermission(final PlotPlayer player, final String perm) { public static boolean hasPermission(final PlotPlayer player, final String perm) {
if (!Settings.PERMISSION_CACHING) {
return hasPermission((CommandCaller) player, perm); return hasPermission((CommandCaller) player, perm);
} }
HashMap<String, Boolean> map = (HashMap<String, Boolean>) player.getMeta("perm");
if (map != null) {
Boolean result = map.get(perm);
if (result != null) {
return result;
}
} else {
map = new HashMap<>();
player.setMeta("perm", map);
}
boolean result = hasPermission((CommandCaller) player, perm);
map.put(perm, result);
return result;
}
public static boolean hasPermission(final CommandCaller player, String perm) { public static boolean hasPermission(final CommandCaller player, String perm) {
if (player.hasPermission(perm) || player.hasPermission(C.PERMISSION_ADMIN.s())) { if (player.hasPermission(perm) || player.hasPermission(C.PERMISSION_ADMIN.s())) {

View File

@ -116,11 +116,11 @@ public abstract class UUIDHandlerImplementation {
offline = null; offline = null;
} }
} }
if (offline != null) { if (offline != null && !offline.equals(uuid)) {
unknown.remove(offline); unknown.remove(offline);
final Set<Plot> plots = PS.get().getPlots(offline); final Set<Plot> plots = PS.get().getPlots(offline);
if (plots.size() > 0) { if (plots.size() > 0) {
for (final Plot plot : PS.get().getPlots(offline)) { for (final Plot plot : plots) {
plot.owner = uuid; plot.owner = uuid;
} }
DBFunc.replaceUUID(offline, uuid); DBFunc.replaceUUID(offline, uuid);
@ -136,7 +136,7 @@ public abstract class UUIDHandlerImplementation {
if (!offline.equals(uuid)) { if (!offline.equals(uuid)) {
final Set<Plot> plots = PS.get().getPlots(offline); final Set<Plot> plots = PS.get().getPlots(offline);
if (plots.size() > 0) { if (plots.size() > 0) {
for (final Plot plot : PS.get().getPlots(offline)) { for (final Plot plot : plots) {
plot.owner = uuid; plot.owner = uuid;
} }
DBFunc.replaceUUID(offline, uuid); DBFunc.replaceUUID(offline, uuid);

View File

@ -334,7 +334,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
} }
} }
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(player); final BukkitPlayer pp = (BukkitPlayer) BukkitUtil.getPlayer(player);
Plot plot = pp.getCurrentPlot(); Plot plot = pp.getCurrentPlot();
if (plot == null) { if (plot == null) {
return; return;
@ -1035,27 +1035,26 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onInteract(final PlayerInteractEvent event) { public void onInteract(final PlayerInteractEvent event) {
final Action action = event.getAction();
final Block block = event.getClickedBlock();
if (block == null) {
return;
}
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final String world = player.getWorld().getName(); final PlotPlayer pp = BukkitUtil.getPlayer(player);
if (!PS.get().isPlotWorld(world)) { if (pp.getPlotWorld() == null) {
return; return;
} }
final Location loc = BukkitUtil.getLocation(block.getLocation());
final PlotPlayer pp = BukkitUtil.getPlayer(player);
PlayerBlockEventType eventType = null; PlayerBlockEventType eventType = null;
BukkitLazyBlock lb; BukkitLazyBlock lb;
Location loc;
final Action action = event.getAction();
switch (action) { switch (action) {
case PHYSICAL: { case PHYSICAL: {
eventType = PlayerBlockEventType.TRIGGER_PHYSICAL; eventType = PlayerBlockEventType.TRIGGER_PHYSICAL;
Block block = event.getClickedBlock();
lb = new BukkitLazyBlock(block); lb = new BukkitLazyBlock(block);
loc = BukkitUtil.getLocation(block.getLocation());
break; break;
} }
case RIGHT_CLICK_BLOCK: { case RIGHT_CLICK_BLOCK: {
Block block = event.getClickedBlock();
loc = BukkitUtil.getLocation(block.getLocation());
final Material blockType = block.getType(); final Material blockType = block.getType();
final int blockId = blockType.getId(); final int blockId = blockType.getId();
switch (blockType) { switch (blockType) {
@ -1137,8 +1136,9 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
lb = new BukkitLazyBlock(id, block); lb = new BukkitLazyBlock(id, block);
break; break;
} }
lb = new BukkitLazyBlock(new PlotBlock((short) hand.getTypeId(), (byte) hand.getDurability())); Material handType = hand.getType();
switch (hand.getType()) { lb = new BukkitLazyBlock(new PlotBlock((short) handType.getId(), (byte) 0));
switch (handType) {
case MONSTER_EGG: case MONSTER_EGG:
case MONSTER_EGGS: { case MONSTER_EGGS: {
eventType = PlayerBlockEventType.SPAWN_MOB; eventType = PlayerBlockEventType.SPAWN_MOB;
@ -1181,7 +1181,6 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
eventType = PlayerBlockEventType.EAT; eventType = PlayerBlockEventType.EAT;
break; break;
} }
case MINECART: case MINECART:
case STORAGE_MINECART: case STORAGE_MINECART:
case POWERED_MINECART: case POWERED_MINECART:
@ -1205,6 +1204,8 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
break; break;
} }
case LEFT_CLICK_BLOCK: { case LEFT_CLICK_BLOCK: {
Block block = event.getClickedBlock();
loc = BukkitUtil.getLocation(block.getLocation());
eventType = PlayerBlockEventType.BREAK_BLOCK; eventType = PlayerBlockEventType.BREAK_BLOCK;
lb = new BukkitLazyBlock(block); lb = new BukkitLazyBlock(block);
break; break;

View File

@ -7,7 +7,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
public class BukkitLazyBlock extends LazyBlock { public class BukkitLazyBlock extends LazyBlock {
private int id = -1; private int id;
private Block block; private Block block;
private PlotBlock pb; private PlotBlock pb;
@ -30,7 +30,7 @@ public class BukkitLazyBlock extends LazyBlock {
if (pb != null) { if (pb != null) {
return pb; return pb;
} }
if (id == -1) { if (id == 0) {
id = block.getTypeId(); id = block.getTypeId();
} }
byte data; byte data;
@ -121,8 +121,10 @@ public class BukkitLazyBlock extends LazyBlock {
case 191: case 191:
case 192: case 192:
data = 0; data = 0;
break;
default: default:
data = block.getData(); data = block.getData();
break;
} }
pb = new PlotBlock((short) id, data); pb = new PlotBlock((short) id, data);
return pb; return pb;
@ -131,7 +133,7 @@ public class BukkitLazyBlock extends LazyBlock {
@Override @Override
public int getId() { public int getId() {
if (id == -1) { if (id == 0) {
id = block.getTypeId(); id = block.getTypeId();
} }
return id; return id;

View File

@ -14,7 +14,6 @@ import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EconHandler;
@ -71,26 +70,10 @@ public class BukkitPlayer extends PlotPlayer {
@Override @Override
public boolean hasPermission(final String node) { public boolean hasPermission(final String node) {
if (Settings.PERMISSION_CACHING) {
if (noPerm.contains(node)) {
return false;
}
if (hasPerm.contains(node)) {
return true;
}
}
if (offline && (EconHandler.manager != null)) { if (offline && (EconHandler.manager != null)) {
return EconHandler.manager.hasPermission(getName(), node); return EconHandler.manager.hasPermission(getName(), node);
} }
final boolean value = player.hasPermission(node); return player.hasPermission(node);
if (Settings.PERMISSION_CACHING) {
if (value) {
hasPerm.add(node);
} else {
noPerm.add(node);
}
}
return value;
} }
public Permission getPermission(final String node) { public Permission getPermission(final String node) {

Binary file not shown.