mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fixes #681
This commit is contained in:
parent
a6dad4fb7b
commit
6650ea2a4c
2
pom.xml
2
pom.xml
@ -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.13</version>
|
<version>3.2.14</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -46,16 +46,25 @@ public enum C {
|
|||||||
* Static flags
|
* Static flags
|
||||||
*/
|
*/
|
||||||
FLAG_USE("use", "static.flags"),
|
FLAG_USE("use", "static.flags"),
|
||||||
|
FLAG_BREAK("break", "static.flags"),
|
||||||
FLAG_PLACE("place", "static.flags"),
|
FLAG_PLACE("place", "static.flags"),
|
||||||
FLAG_PVP("pvp", "static.flags"),
|
FLAG_PVP("pvp", "static.flags"),
|
||||||
FLAG_HANGING_PLACE("hanging-place", "static.flags"),
|
FLAG_HANGING_PLACE("hanging-place", "static.flags"),
|
||||||
FLAG_HANGING_BREAK("hanging-break", "static.flags"),
|
FLAG_HANGING_BREAK("hanging-break", "static.flags"),
|
||||||
|
FLAG_HANGING_INTERACT("hanging-interact", "static.flags"),
|
||||||
|
FLAG_MISC_INTERACT("misc-interact", "static.flags"),
|
||||||
|
FLAG_MISC_BREAK("misc-break", "static.flags"),
|
||||||
|
FLAG_MISC_PLACE("misc-place", "static.flags"),
|
||||||
|
FLAG_VEHICLE_BREAK("vehicle-break", "static.flags"),
|
||||||
FLAG_HOSTILE_INTERACT("hostile-interact", "static.flags"),
|
FLAG_HOSTILE_INTERACT("hostile-interact", "static.flags"),
|
||||||
|
FLAG_DEVICE_INTERACT("device-interact", "static.flags"),
|
||||||
FLAG_ANIMAL_INTERACT("animal-interact", "static.flags"),
|
FLAG_ANIMAL_INTERACT("animal-interact", "static.flags"),
|
||||||
FLAG_VEHICLE_USE("vehicle-use", "static.flags"),
|
FLAG_VEHICLE_USE("vehicle-use", "static.flags"),
|
||||||
|
FLAG_VEHICLE_PLACE("vehicle-place", "static.flags"),
|
||||||
FLAG_PLAYER_INTERACT("player-interact", "static.flags"),
|
FLAG_PLAYER_INTERACT("player-interact", "static.flags"),
|
||||||
FLAG_TAMED_INTERACT("tamed-interact", "static.flags"),
|
FLAG_TAMED_INTERACT("tamed-interact", "static.flags"),
|
||||||
FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"),
|
FLAG_DISABLE_PHYSICS("disable-physics", "static.flags"),
|
||||||
|
FLAG_MOB_PLACE("mob-place", "static.flags"),
|
||||||
/*
|
/*
|
||||||
* Static permission
|
* Static permission
|
||||||
*/
|
*/
|
||||||
@ -548,6 +557,7 @@ public enum C {
|
|||||||
FLAG_NOT_ADDED("$2The flag could not be added", "Flag"),
|
FLAG_NOT_ADDED("$2The flag could not be added", "Flag"),
|
||||||
FLAG_REMOVED("$4Successfully removed flag", "Flag"),
|
FLAG_REMOVED("$4Successfully removed flag", "Flag"),
|
||||||
FLAG_ADDED("$4Successfully added flag", "Flag"),
|
FLAG_ADDED("$4Successfully added flag", "Flag"),
|
||||||
|
FLAG_TUTORIAL_USAGE("$1Have an admin set the flag: $2%s", "Commands"),
|
||||||
/*
|
/*
|
||||||
* Trusted
|
* Trusted
|
||||||
*/
|
*/
|
||||||
|
@ -61,7 +61,7 @@ public abstract class EventUtil {
|
|||||||
|
|
||||||
public abstract void callMember(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
|
public abstract void callMember(final PlotPlayer initiator, final Plot plot, final UUID player, final boolean added);
|
||||||
|
|
||||||
public boolean checkPlayerBlockEvent(final PlotPlayer pp, final PlayerBlockEventType type, final Location loc, final LazyBlock block, final 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();
|
final UUID uuid = pp.getUUID();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
@ -100,7 +100,10 @@ public abstract class EventUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_BREAK.s()));
|
||||||
}
|
}
|
||||||
case BREAK_HANGING:
|
case BREAK_HANGING:
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
@ -110,7 +113,10 @@ public abstract class EventUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_HANGING_BREAK.s()));
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||||
case BREAK_MISC:
|
case BREAK_MISC:
|
||||||
@ -121,7 +127,10 @@ public abstract class EventUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_BREAK.s()));
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||||
case BREAK_VEHICLE:
|
case BREAK_VEHICLE:
|
||||||
@ -132,7 +141,10 @@ public abstract class EventUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_BREAK.s()));
|
||||||
}
|
}
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
|
||||||
case INTERACT_BLOCK: {
|
case INTERACT_BLOCK: {
|
||||||
@ -145,7 +157,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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -159,7 +174,10 @@ public abstract class EventUtil {
|
|||||||
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
||||||
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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -176,7 +194,12 @@ 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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
long time = System.currentTimeMillis();
|
||||||
|
notifyPerms = notifyPerms && (31 * (time / 31) == time);
|
||||||
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_DEVICE_INTERACT.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -193,7 +216,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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_HANGING_INTERACT.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -210,7 +236,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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_MISC_INTERACT.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -227,7 +256,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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_VEHICLE_USE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -245,7 +277,10 @@ public abstract class EventUtil {
|
|||||||
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
||||||
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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MOB_PLACE.s() + "/" + C.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -281,7 +316,10 @@ public abstract class EventUtil {
|
|||||||
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
||||||
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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_PLACE.s() + "/" + C.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -299,7 +337,10 @@ public abstract class EventUtil {
|
|||||||
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
final Flag flag = FlagManager.getPlotFlagRaw(plot, "place");
|
||||||
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()))) {
|
||||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms);
|
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_PLACE.s() + "/" + C.FLAG_PLACE.s()));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1135,9 +1135,15 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
if ((eventType != null) && !player.isSneaking()) {
|
if ((eventType != null) && !player.isSneaking()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((hand == null) || (hand.getType() == Material.AIR) || hand.getType().isBlock()) {
|
Material type = hand == null ? null : hand.getType();
|
||||||
|
int id = type == null ? 0 : type.getId();
|
||||||
|
if (id == 0) {
|
||||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||||
lb = new BukkitLazyBlock(block);
|
lb = new BukkitLazyBlock(id, block);
|
||||||
|
break;
|
||||||
|
} else if (id < 198) {
|
||||||
|
eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||||
|
lb = new BukkitLazyBlock(id, block);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lb = new BukkitLazyBlock(new PlotBlock((short) hand.getTypeId(), (byte) hand.getDurability()));
|
lb = new BukkitLazyBlock(new PlotBlock((short) hand.getTypeId(), (byte) hand.getDurability()));
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user