Skip to content

Commit 57856da

Browse files
Merge branch 'main' into postplotclearevent
2 parents 530e037 + 8c44b2d commit 57856da

File tree

8 files changed

+50
-50
lines changed

8 files changed

+50
-50
lines changed

Bukkit/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ tasks.named<ShadowJar>("shadowJar") {
6767
exclude(dependency("org.checkerframework:"))
6868
}
6969

70+
relocate("net.kyori.option", "com.plotsquared.core.configuration.option")
7071
relocate("net.kyori.adventure", "com.plotsquared.core.configuration.adventure")
7172
relocate("net.kyori.examination", "com.plotsquared.core.configuration.examination")
7273
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")

Bukkit/src/main/java/com/plotsquared/bukkit/listener/BlockEventListener.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ public void onPhysicsEvent(BlockPhysicsEvent event) {
261261
final BlockFace facing = piston.getFacing();
262262
location = location.add(facing.getModX(), facing.getModY(), facing.getModZ());
263263
Plot newPlot = area.getOwnedPlotAbs(location);
264-
if (!plot.equals(newPlot)) {
264+
if (plot.equals(newPlot)) {
265+
return;
266+
}
267+
if (!plot.isMerged() || !plot.getConnectedPlots().contains(newPlot)) {
265268
event.setCancelled(true);
266269
plot.debug("Prevented piston update because of invalid edge piston detection");
267270
}

Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,17 @@ public void onPlayerDyeSign(PlayerInteractEvent event) {
252252
}
253253
Plot plot = location.getOwnedPlot();
254254
if (plot == null) {
255-
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)) {
255+
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)
256+
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString())) {
256257
event.setCancelled(true);
257258
}
258259
return;
259260
}
260261
if (plot.isAdded(event.getPlayer().getUniqueId())) {
261262
return; // allow for added players
262263
}
263-
if (!plot.getFlag(EditSignFlag.class)) {
264+
if (!plot.getFlag(EditSignFlag.class)
265+
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString())) {
264266
plot.debug(event.getPlayer().getName() + " could not color the sign because of edit-sign = false");
265267
event.setCancelled(true);
266268
}

Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener1201.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.plotsquared.bukkit.util.BukkitUtil;
2222
import com.plotsquared.core.location.Location;
23+
import com.plotsquared.core.permissions.Permission;
2324
import com.plotsquared.core.plot.Plot;
2425
import com.plotsquared.core.plot.PlotArea;
2526
import com.plotsquared.core.plot.flag.implementations.EditSignFlag;
@@ -46,15 +47,17 @@ public void onPlayerSignOpenEvent(PlayerSignOpenEvent event) {
4647
}
4748
Plot plot = location.getOwnedPlot();
4849
if (plot == null) {
49-
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)) {
50+
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)
51+
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString())) {
5052
event.setCancelled(true);
5153
}
5254
return;
5355
}
5456
if (plot.isAdded(event.getPlayer().getUniqueId())) {
5557
return; // allow for added players
5658
}
57-
if (!plot.getFlag(EditSignFlag.class)) {
59+
if (!plot.getFlag(EditSignFlag.class)
60+
&& !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString())) {
5861
plot.debug(event.getPlayer().getName() + " could not edit the sign because of edit-sign = false");
5962
event.setCancelled(true);
6063
}

Core/src/main/java/com/plotsquared/core/listener/PlotListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
364364
public boolean plotExit(final PlotPlayer<?> player, Plot plot) {
365365
try (final MetaDataAccess<Plot> lastPlot = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
366366
final Plot previous = lastPlot.remove();
367-
this.eventDispatcher.callLeave(player, plot);
368367

369368
List<StatusEffect> effects = playerEffects.remove(player.getUUID());
370369
if (effects != null) {
@@ -467,6 +466,8 @@ public boolean plotExit(final PlotPlayer<?> player, Plot plot) {
467466
feedRunnable.remove(player.getUUID());
468467
healRunnable.remove(player.getUUID());
469468
}
469+
} finally {
470+
this.eventDispatcher.callLeave(player, plot);
470471
}
471472
return true;
472473
}

Core/src/main/java/com/plotsquared/core/permissions/Permission.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ public enum Permission implements ComponentLike {
5959
PERMISSION_ADMIN_DESTROY_VEHICLE_UNOWNED("plots.admin.vehicle.break.unowned"),
6060
PERMISSION_ADMIN_DESTROY_VEHICLE_OTHER("plots.admin.vehicle.break.other"),
6161
PERMISSION_ADMIN_PVE("plots.admin.pve"),
62+
PERMISSION_ADMIN_PLACE_VEHICLE_ROAD("plots.admin.vehicle.place.road"),
63+
PERMISSION_ADMIN_PLACE_VEHICLE_UNOWNED("plots.admin.vehicle.place.unowned"),
64+
PERMISSION_ADMIN_PLACE_VEHICLE_OTHER("plots.admin.vehicle.place.other"),
6265
PERMISSION_ADMIN_PVP("plots.admin.pvp"),
6366
PERMISSION_ADMIN_BUILD_ROAD("plots.admin.build.road"),
6467
PERMISSION_ADMIN_PROJECTILE_ROAD("plots.admin.projectile.road"),

Core/src/main/java/com/plotsquared/core/util/EventDispatcher.java

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -389,14 +389,10 @@ public boolean checkPlayerBlockEvent(
389389
return true;
390390
}
391391
}
392-
return player.hasPermission(
393-
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
394-
);
392+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD, notifyPerms);
395393
}
396394
if (!plot.hasOwner()) {
397-
return player.hasPermission(
398-
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
399-
);
395+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED, notifyPerms);
400396
}
401397
final List<BlockTypeWrapper> use = plot.getFlag(UseFlag.class);
402398
for (final BlockTypeWrapper blockTypeWrapper : use) {
@@ -405,7 +401,7 @@ public boolean checkPlayerBlockEvent(
405401
return true;
406402
}
407403
}
408-
if (player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(), false)) {
404+
if (player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER, false)) {
409405
return true;
410406
}
411407
// we check for the EditSignFlag in the PlayerSignOpenEvent again, but we must not cancel the interact event
@@ -430,14 +426,10 @@ public boolean checkPlayerBlockEvent(
430426
return true;
431427
}
432428
}
433-
return player.hasPermission(
434-
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), false
435-
);
429+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD, false);
436430
}
437431
if (!plot.hasOwner()) {
438-
return player.hasPermission(
439-
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), false
440-
);
432+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED, false);
441433
}
442434
if (plot.getFlag(DeviceInteractFlag.class)) {
443435
return true;
@@ -449,21 +441,14 @@ public boolean checkPlayerBlockEvent(
449441
return true;
450442
}
451443
}
452-
return player.hasPermission(
453-
Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
454-
false
455-
);
444+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER, false);
456445
}
457446
case SPAWN_MOB -> {
458447
if (plot == null) {
459-
return player.hasPermission(
460-
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
461-
);
448+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD, notifyPerms);
462449
}
463450
if (!plot.hasOwner()) {
464-
return player.hasPermission(
465-
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
466-
);
451+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED, notifyPerms);
467452
}
468453
if (plot.getFlag(MobPlaceFlag.class)) {
469454
return true;
@@ -475,10 +460,7 @@ public boolean checkPlayerBlockEvent(
475460
return true;
476461
}
477462
}
478-
if (player.hasPermission(
479-
Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
480-
false
481-
)) {
463+
if (player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER, false)) {
482464
return true;
483465
}
484466
if (notifyPerms) {
@@ -498,14 +480,10 @@ public boolean checkPlayerBlockEvent(
498480
}
499481
case PLACE_MISC -> {
500482
if (plot == null) {
501-
return player.hasPermission(
502-
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
503-
);
483+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD, notifyPerms);
504484
}
505485
if (!plot.hasOwner()) {
506-
return player.hasPermission(
507-
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
508-
);
486+
return player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_UNOWNED, notifyPerms);
509487
}
510488
if (plot.getFlag(MiscPlaceFlag.class)) {
511489
return true;
@@ -517,10 +495,7 @@ public boolean checkPlayerBlockEvent(
517495
return true;
518496
}
519497
}
520-
if (player.hasPermission(
521-
Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString(),
522-
false
523-
)) {
498+
if (player.hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER, false)) {
524499
return true;
525500
}
526501
if (notifyPerms) {
@@ -540,16 +515,28 @@ public boolean checkPlayerBlockEvent(
540515
}
541516
case PLACE_VEHICLE -> {
542517
if (plot == null) {
543-
return player.hasPermission(
544-
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
545-
);
518+
return player.hasPermission(Permission.PERMISSION_ADMIN_PLACE_VEHICLE_ROAD, notifyPerms);
546519
}
547520
if (!plot.hasOwner()) {
548-
return player.hasPermission(
549-
Permission.PERMISSION_ADMIN_INTERACT_UNOWNED.toString(), notifyPerms
521+
return player.hasPermission(Permission.PERMISSION_ADMIN_PLACE_VEHICLE_UNOWNED, notifyPerms);
522+
}
523+
if (plot.getFlag(VehiclePlaceFlag.class)) {
524+
return true;
525+
}
526+
if (player.hasPermission(Permission.PERMISSION_ADMIN_PLACE_VEHICLE_OTHER, false)) {
527+
return true;
528+
}
529+
if (notifyPerms) {
530+
player.sendMessage(
531+
TranslatableCaption.of("commandconfig.flag_tutorial_usage"),
532+
TagResolver.resolver(
533+
"flag",
534+
Tag.inserting(
535+
PlotFlag.getFlagNameComponent(VehiclePlaceFlag.class)
536+
)
537+
)
550538
);
551539
}
552-
return plot.getFlag(VehiclePlaceFlag.class);
553540
}
554541
default -> {
555542
}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins {
2222
}
2323

2424
group = "com.intellectualsites.plotsquared"
25-
version = "7.3.1-SNAPSHOT"
25+
version = "7.3.2-SNAPSHOT"
2626

2727
if (!File("$rootDir/.git").exists()) {
2828
logger.lifecycle("""

0 commit comments

Comments
 (0)