mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-24 23:23:44 +02:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			feat/v7/pa
			...
			feature/v6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 21b3fc294e | ||
|   | 73d57937bb | 
| @@ -166,7 +166,7 @@ public class BlockEventListener implements Listener { | ||||
|         } | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null) { | ||||
|             if (area.isRoadFlags() && !area.getRoadFlag(RedstoneFlag.class)) { | ||||
|             if (area.isRoadFlagsAndFlagEquals(RedstoneFlag.class, false)) { | ||||
|                 event.setNewCurrent(0); | ||||
|             } | ||||
|             return; | ||||
| @@ -1084,7 +1084,10 @@ public class BlockEventListener implements Listener { | ||||
|                 return; | ||||
|             } | ||||
|             if (plot == null) { | ||||
|                 if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) { | ||||
|                 if (!area.isRoadFlagsAndFlagEquals(BlockIgnitionFlag.class, true) && !Permissions.hasPermission( | ||||
|                         pp, | ||||
|                         Permission.PERMISSION_ADMIN_BUILD_ROAD | ||||
|                 )) { | ||||
|                     pp.sendMessage( | ||||
|                             TranslatableCaption.of("permission.no_permission_event"), | ||||
|                             Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD)) | ||||
| @@ -1092,7 +1095,10 @@ public class BlockEventListener implements Listener { | ||||
|                     event.setCancelled(true); | ||||
|                 } | ||||
|             } else if (!plot.hasOwner()) { | ||||
|                 if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) { | ||||
|                 if (!area.isRoadFlagsAndFlagEquals(BlockIgnitionFlag.class, true) && !Permissions.hasPermission( | ||||
|                         pp, | ||||
|                         Permission.PERMISSION_ADMIN_BUILD_UNOWNED | ||||
|                 )) { | ||||
|                     pp.sendMessage( | ||||
|                             TranslatableCaption.of("permission.no_permission_event"), | ||||
|                             Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) | ||||
|   | ||||
| @@ -91,7 +91,8 @@ public class BlockEventListener117 implements Listener { | ||||
|         } | ||||
|  | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null || !plot.getFlag(MiscInteractFlag.class)) { | ||||
|         if (plot == null && !area.isRoadFlagsAndFlagEquals(MiscInteractFlag.class, true) || plot != null && !plot.getFlag( | ||||
|                 MiscInteractFlag.class)) { | ||||
|             if (plotPlayer != null) { | ||||
|                 if (plot != null) { | ||||
|                     if (!plot.isAdded(plotPlayer.getUUID())) { | ||||
|   | ||||
| @@ -261,7 +261,7 @@ public class EntityEventListener implements Listener { | ||||
|         } | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null) { | ||||
|             if (area.isRoadFlags() && area.getRoadFlag(InvincibleFlag.class)) { | ||||
|             if (area.isRoadFlagsAndFlagEquals(InvincibleFlag.class, true)) { | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             return; | ||||
|   | ||||
| @@ -326,14 +326,18 @@ public class PaperListener implements Listener { | ||||
|             return; | ||||
|         } | ||||
|         Location location = BukkitUtil.adapt(entity.getLocation()); | ||||
|         if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) { | ||||
|         PlotArea area = location.getPlotArea(); | ||||
|         if (area == null) { | ||||
|             return; | ||||
|         } | ||||
|         PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter); | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|  | ||||
|         if (plot == null) { | ||||
|             if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) { | ||||
|             if (!area.isRoadFlagsAndFlagEquals(ProjectilesFlag.class, true) && !Permissions.hasPermission( | ||||
|                     pp, | ||||
|                     Permission.PERMISSION_ADMIN_PROJECTILE_ROAD | ||||
|             )) { | ||||
|                 pp.sendMessage( | ||||
|                         TranslatableCaption.of("permission.no_permission_event"), | ||||
|                         Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) | ||||
|   | ||||
| @@ -889,8 +889,7 @@ public class PlayerEventListener implements Listener { | ||||
|                 } | ||||
|             } else { | ||||
|                 PlotArea area = pp.getPlotAreaAbs(); | ||||
|                 if (area != null && area.isRoadFlags() && area | ||||
|                         .getRoadFlag(PreventCreativeCopyFlag.class)) { | ||||
|                 if (area != null && area.isRoadFlagsAndFlagEquals(PreventCreativeCopyFlag.class, true)) { | ||||
|                     final ItemStack newStack = | ||||
|                             new ItemStack(newItem.getType(), newItem.getAmount()); | ||||
|                     event.setCursor(newStack); | ||||
| @@ -998,8 +997,10 @@ public class PlayerEventListener implements Listener { | ||||
|         Plot plot = location.getPlotAbs(); | ||||
|         BukkitPlayer pp = BukkitUtil.adapt(e.getPlayer()); | ||||
|         if (plot == null) { | ||||
|             if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions | ||||
|                     .hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) { | ||||
|             if (!area.isRoadFlagsAndFlagEquals(MiscInteractFlag.class, true) && !Permissions.hasPermission( | ||||
|                     pp, | ||||
|                     Permission.PERMISSION_ADMIN_INTERACT_ROAD | ||||
|             )) { | ||||
|                 pp.sendMessage( | ||||
|                         TranslatableCaption.of("permission.no_permission_event"), | ||||
|                         Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD)) | ||||
| @@ -1009,9 +1010,7 @@ public class PlayerEventListener implements Listener { | ||||
|         } else { | ||||
|             if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { | ||||
|                 if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) { | ||||
|                     pp.sendMessage( | ||||
|                             TranslatableCaption.of("done.building_restricted") | ||||
|                     ); | ||||
|                     pp.sendMessage(TranslatableCaption.of("done.building_restricted")); | ||||
|                     e.setCancelled(true); | ||||
|                     return; | ||||
|                 } | ||||
| @@ -1594,7 +1593,10 @@ public class PlayerEventListener implements Listener { | ||||
|             BukkitPlayer pp = BukkitUtil.adapt(p); | ||||
|             Plot plot = area.getPlot(location); | ||||
|             if (plot == null) { | ||||
|                 if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) { | ||||
|                 if (!area.isRoadFlagsAndFlagEquals(VehicleBreakFlag.class, true) && !Permissions.hasPermission( | ||||
|                         pp, | ||||
|                         Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD | ||||
|                 )) { | ||||
|                     pp.sendMessage( | ||||
|                             TranslatableCaption.of("permission.no_permission_event"), | ||||
|                             Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) | ||||
| @@ -1642,7 +1644,7 @@ public class PlayerEventListener implements Listener { | ||||
|         } | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null) { | ||||
|             if (area.isRoadFlags() && !area.getRoadFlag(ItemDropFlag.class)) { | ||||
|             if (area.isRoadFlagsAndFlagEquals(ItemDropFlag.class, false)) { | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             return; | ||||
| @@ -1668,7 +1670,7 @@ public class PlayerEventListener implements Listener { | ||||
|             } | ||||
|             Plot plot = location.getOwnedPlot(); | ||||
|             if (plot == null) { | ||||
|                 if (area.isRoadFlags() && area.getRoadFlag(DropProtectionFlag.class)) { | ||||
|                 if (area.isRoadFlagsAndFlagEquals(DropProtectionFlag.class, true)) { | ||||
|                     event.setCancelled(true); | ||||
|                 } | ||||
|                 return; | ||||
| @@ -1690,17 +1692,15 @@ public class PlayerEventListener implements Listener { | ||||
|         } | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null) { | ||||
|             if (area.isRoadFlags() && area.getRoadFlag(KeepInventoryFlag.class)) { | ||||
|             if (area.isRoadFlagsAndFlagEquals(KeepInventoryFlag.class, true)) { | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
|         if (plot.getFlag(KeepInventoryFlag.class)) { | ||||
|             if (plot.getFlag(KeepInventoryFlag.class)) { | ||||
|                 plot.debug(event.getEntity().getName() + " kept their inventory because of keep-inventory = true"); | ||||
|                 event.getDrops().clear(); | ||||
|                 event.setKeepInventory(true); | ||||
|             } | ||||
|             plot.debug(event.getEntity().getName() + " kept their inventory because of keep-inventory = true"); | ||||
|             event.getDrops().clear(); | ||||
|             event.setKeepInventory(true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -1725,16 +1725,14 @@ public class PlayerEventListener implements Listener { | ||||
|         } | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null) { | ||||
|             if (area.isRoadFlags() && area.getRoadFlag(DenyPortalTravelFlag.class)) { | ||||
|             if (area.isRoadFlagsAndFlagEquals(DenyPortalTravelFlag.class, true)) { | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
|         if (plot.getFlag(DenyPortalTravelFlag.class)) { | ||||
|             if (plot.getFlag(DenyPortalTravelFlag.class)) { | ||||
|                 plot.debug(event.getPlayer().getName() + " did not travel thru a portal because of deny-portal-travel = true"); | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             plot.debug(event.getPlayer().getName() + " did not travel thru a portal because of deny-portal-travel = true"); | ||||
|             event.setCancelled(true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -1772,7 +1770,7 @@ public class PlayerEventListener implements Listener { | ||||
|             } | ||||
|             Plot plot = location.getOwnedPlot(); | ||||
|             if (plot == null) { | ||||
|                 if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) { | ||||
|                 if (area.isRoadFlagsAndFlagEquals(DenyPortalsFlag.class, true)) { | ||||
|                     event.setCancelled(true); | ||||
|                     return; | ||||
|                 } | ||||
| @@ -1801,16 +1799,14 @@ public class PlayerEventListener implements Listener { | ||||
|         } | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|         if (plot == null) { | ||||
|             if (area.isRoadFlags() && area.getRoadFlag(LecternReadBookFlag.class)) { | ||||
|             if (area.isRoadFlagsAndFlagEquals(LecternReadBookFlag.class, true)) { | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
|         if (plot.getFlag(LecternReadBookFlag.class)) { | ||||
|             if (plot.getFlag(LecternReadBookFlag.class)) { | ||||
|                 plot.debug(event.getPlayer().getName() + " could not take the book because of lectern-read-book = true"); | ||||
|                 event.setCancelled(true); | ||||
|             } | ||||
|             plot.debug(event.getPlayer().getName() + " could not take the book because of lectern-read-book = true"); | ||||
|             event.setCancelled(true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -97,14 +97,18 @@ public class ProjectileEventListener implements Listener { | ||||
|             return; | ||||
|         } | ||||
|         Location location = BukkitUtil.adapt(entity.getLocation()); | ||||
|         if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) { | ||||
|         PlotArea area = location.getPlotArea(); | ||||
|         if (area == null) { | ||||
|             return; | ||||
|         } | ||||
|         PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter); | ||||
|         Plot plot = location.getOwnedPlot(); | ||||
|  | ||||
|         if (plot == null) { | ||||
|             if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) { | ||||
|             if (!area.isRoadFlagsAndFlagEquals(ProjectilesFlag.class, true) && !Permissions.hasPermission( | ||||
|                     pp, | ||||
|                     Permission.PERMISSION_ADMIN_PROJECTILE_ROAD | ||||
|             )) { | ||||
|                 pp.sendMessage( | ||||
|                         TranslatableCaption.of("permission.no_permission_event"), | ||||
|                         Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) | ||||
| @@ -154,6 +158,8 @@ public class ProjectileEventListener implements Listener { | ||||
|                     if (plot.isAdded(((Player) shooter).getUniqueId()) || plot.getFlag(ProjectilesFlag.class)) { | ||||
|                         return; | ||||
|                     } | ||||
|                 } else if (area.isRoadFlagsAndFlagEquals(ProjectilesFlag.class, true)) { | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 entity.remove(); | ||||
| @@ -163,7 +169,10 @@ public class ProjectileEventListener implements Listener { | ||||
|  | ||||
|             PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter); | ||||
|             if (plot == null) { | ||||
|                 if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) { | ||||
|                 if (!area.isRoadFlagsAndFlagEquals(ProjectilesFlag.class, true) && !Permissions.hasPermission( | ||||
|                         pp, | ||||
|                         Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED | ||||
|                 )) { | ||||
|                     entity.remove(); | ||||
|                     event.setCancelled(true); | ||||
|                 } | ||||
| @@ -194,7 +203,6 @@ public class ProjectileEventListener implements Listener { | ||||
|             if (sPlot == null || !PlotHandler.sameOwners(plot, sPlot)) { | ||||
|                 entity.remove(); | ||||
|                 event.setCancelled(true); | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -46,6 +46,7 @@ import com.plotsquared.core.plot.flag.FlagParseException; | ||||
| import com.plotsquared.core.plot.flag.GlobalFlagContainer; | ||||
| import com.plotsquared.core.plot.flag.PlotFlag; | ||||
| import com.plotsquared.core.plot.flag.implementations.DoneFlag; | ||||
| import com.plotsquared.core.plot.flag.types.BooleanFlag; | ||||
| import com.plotsquared.core.queue.GlobalBlockQueue; | ||||
| import com.plotsquared.core.queue.QueueCoordinator; | ||||
| import com.plotsquared.core.util.MathMan; | ||||
| @@ -1242,6 +1243,19 @@ public abstract class PlotArea { | ||||
|         return this.roadFlagContainer.getFlag(flagClass).getValue(); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Check if the value of a {@link BooleanFlag} matches the given boolean. If | ||||
|      * road flags are disabled, returns false. | ||||
|      * | ||||
|      * @param flagClass boolean flag to get value of | ||||
|      * @param value     boolean value to check flag value against | ||||
|      * @return Flag value or false if road flags disabled | ||||
|      * @since TODO | ||||
|      */ | ||||
|     public boolean isRoadFlagsAndFlagEquals(final Class<? extends BooleanFlag<?>> flagClass, boolean value) { | ||||
|         return this.roadFlags && (getRoadFlag(flagClass) == value); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Get the value associated with the specified road flag. This will look at | ||||
|      * the default values stored in {@link GlobalFlagContainer}. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user