mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
parent
4cc4196487
commit
8606319340
@ -126,6 +126,7 @@ public class DebugExec extends SubCommand {
|
||||
scope.put("Settings", new Settings());
|
||||
scope.put("StringMan", new StringMan());
|
||||
scope.put("MathMan", new MathMan());
|
||||
scope.put("FlagManager", new FlagManager());
|
||||
|
||||
// Classes
|
||||
scope.put("Location", Location.class);
|
||||
|
@ -87,14 +87,13 @@ public abstract class EventUtil {
|
||||
if (!plot.hasOwner()) {
|
||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||
}
|
||||
Flag use = FlagManager.getPlotFlag(plot, "break");
|
||||
Flag use = FlagManager.getPlotFlag(plot, "use");
|
||||
if (use != null) {
|
||||
HashSet<PlotBlock> value = (HashSet<PlotBlock>) use.getValue();
|
||||
if (value.contains(PlotBlock.EVERYTHING) || value.contains(block.getPlotBlock())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Flag destroy = FlagManager.getPlotFlag(plot, "break");
|
||||
if (destroy != null) {
|
||||
HashSet<PlotBlock> value = (HashSet<PlotBlock>) destroy.getValue();
|
||||
|
@ -492,7 +492,6 @@ public class MainUtil {
|
||||
|
||||
public static boolean teleportPlayer(final PlotPlayer player, final Location from, final Plot plot) {
|
||||
final Plot bot = MainUtil.getBottomPlot(plot);
|
||||
|
||||
boolean result = EventUtil.manager.callTeleport(player, from, plot);
|
||||
|
||||
if (result) {
|
||||
|
@ -242,11 +242,11 @@ public class StringMan {
|
||||
}
|
||||
|
||||
public static boolean isEqual(String a, String b) {
|
||||
return (a == b || (a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
|
||||
return (a == b || (a != null && b != null && a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b)));
|
||||
}
|
||||
|
||||
public static boolean isEqualIgnoreCase(String a, String b) {
|
||||
return (a == b || (a.length() == b.length() && a.equalsIgnoreCase(b)));
|
||||
return (a == b || (a != null && b != null && a.length() == b.length() && a.equalsIgnoreCase(b)));
|
||||
}
|
||||
|
||||
public static String repeat(String s, int n) {
|
||||
|
@ -1096,6 +1096,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
case BEACON:
|
||||
case BED_BLOCK:
|
||||
case SIGN:
|
||||
case WALL_SIGN:
|
||||
case SIGN_POST:
|
||||
case ENCHANTMENT_TABLE:
|
||||
case BREWING_STAND:
|
||||
@ -1125,7 +1126,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
if (eventType != null && !player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
if (hand == null) {
|
||||
if (hand == null || hand.getType() == Material.AIR || hand.getType().isBlock()) {
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
lb = new BukkitLazyBlock(block);
|
||||
break;
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.WeatherType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
@ -130,7 +131,7 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
if (Math.abs(loc.getX()) >= 30000000 || Math.abs(loc.getZ()) >= 30000000) {
|
||||
return;
|
||||
}
|
||||
this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()));
|
||||
this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()), TeleportCause.COMMAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,11 +31,11 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
|
||||
public class BukkitUtil extends BlockManager {
|
||||
private static HashMap<String, World> worlds = new HashMap<>();
|
||||
private static String lastString = null;
|
||||
private static World lastWorld = null;
|
||||
|
||||
@ -145,14 +145,12 @@ public class BukkitUtil extends BlockManager {
|
||||
}
|
||||
|
||||
public static World getWorld(final String string) {
|
||||
if (string == lastString) {
|
||||
if (StringMan.isEqual(string,lastString)) {
|
||||
return lastWorld;
|
||||
}
|
||||
World world = worlds.get(string);
|
||||
if (world == null) {
|
||||
world = Bukkit.getWorld(string);
|
||||
worlds.put(string, world);
|
||||
}
|
||||
World world = Bukkit.getWorld(string);
|
||||
lastString = string;
|
||||
lastWorld = world;
|
||||
return world;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user