Skip to content

Commit 29efd5f

Browse files
author
david
committed
Remove unused bottle and washing methods
Removed redundant methods related to bottle emptying/filling and washing effects in `ProtectionService`, associated flags, and permissions. This cleanup simplifies the codebase and removes unnecessary complexity.
1 parent b06e1c1 commit 29efd5f

6 files changed

Lines changed: 5 additions & 121 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ BStats can be found [here](https://bstats.org/plugin/bukkit/TheNextLvl%2520Prote
8080
| Flag | Description |
8181
|---------------------------------------|--------------------------------------------------------------------------------------------------------|
8282
| protect:armor_stand_manipulate | allows or denies armor stand manipulations |
83-
| protect:armor_washing | allows or denies washing off the color of armor<br/>(in cauldrons) |
84-
| protect:banner_washing | allows or denies washing off the color of banners<br/>(in cauldrons) |
8583
| protect:block_absorb | controls whether sponges can absorb water |
86-
| protect:block_break | allows or denies block breaking |
8784
| protect:block_burning | controls whether blocks can burn |
8885
| protect:block_drying | controls whether blocks can dry out<br/>(farmland) |
8986
| protect:block_fading | controls whether blocks can fade away<br/>(like ice or snow melting or corals fading) |
@@ -92,30 +89,24 @@ BStats can be found [here](https://bstats.org/plugin/bukkit/TheNextLvl%2520Prote
9289
| protect:block_growth | controls whether blocks can grow<br/>(like wheat or carrots) |
9390
| protect:block_igniting | controls whether blocks can ignite<br/>(like fire spreading or lightning striking) |
9491
| protect:block_moisturising | controls whether blocks can moisturise<br/>(farmland) |
95-
| protect:block_place | allows or denies block placing |
9692
| protect:block_spread | controls whether blocks can spread<br/>(like grass or fire) |
9793
| protect:cauldron_evaporation | controls whether cauldrons can evaporate from biome dryness |
9894
| protect:cauldron_extinguish_entity | controls whether cauldrons can extinguish flaming entities |
99-
| protect:cauldron_level_change_unknown | controls whether cauldrons can change their level for unknown reasons |
10095
| protect:crop_trample | allows or denies crop trampling |
101-
| protect:empty_bottle | allows or denies emptying a bottle |
102-
| protect:empty_bucket | allows or denies emptying a bucket |
96+
| protect:destroy | allows or denies destroying objects (like blocks or entities) |
10397
| protect:entity_attack_entity | controls whether entities can attack other entities |
10498
| protect:entity_attack_player | controls whether entities can attack players |
10599
| protect:entity_interact | allows or denies interaction with entities<br/>(like trading with merchants) |
106-
| protect:entity_place | allows or denies placing entities<br/>(like boats or minecarts) |
107100
| protect:entity_shear | allows or denies shearing entities<br/>(like sheep or snow golems) |
108101
| protect:explosions | controls whether explosions can do block damage |
109-
| protect:fill_bottle | allows or denies filling a bottle |
110-
| protect:fill_bucket | allows or denies filling a bucket |
111102
| protect:interact | allows or denies block interactions<br/>(like opening chests or doors) |
112103
| protect:leaves_decay | controls whether leaves can decay |
113-
| protect:natural_cauldron_fill | controls whether cauldrons can fill naturally<br/>(from rain) |
104+
| protect:natural_cauldron_fill | controls whether cauldrons can fill naturally<br/>(like from rain or dripstone) |
114105
| protect:physical_interact | allows or denies physical interactions<br/>(like standing on pressure plates or drip leaves) |
106+
| protect:place | allows or denies placing objects (like blocks or entities) |
115107
| protect:player_attack_entity | controls whether players can attack entities |
116108
| protect:player_attack_player | controls whether players can attack players |
117109
| protect:player_item_drop | controls whether players can drop items |
118-
| protect:shulker_washing | allows or denies washing off color the color of shulker chests<br/>(in cauldrons) |
119110

120111
## Permission Packs
121112

@@ -145,19 +136,14 @@ Allows players to bypass any restriction
145136

146137
protect.bypass.attack
147138
protect.bypass.destroy
148-
protect.bypass.empty-bottle
149139
protect.bypass.enter
150140
protect.bypass.entity-interact
151141
protect.bypass.entity-shear
152-
protect.bypass.fill-bottle
153142
protect.bypass.interact
154143
protect.bypass.leave
155144
protect.bypass.physical-interact
156145
protect.bypass.place
157146
protect.bypass.trample
158-
protect.bypass.wash-armor
159-
protect.bypass.wash-banner
160-
protect.bypass.wash-shulker
161147

162148
### protect.command.area.flag
163149

‎api/src/main/java/net/thenextlvl/protect/service/ProtectionService.java‎

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -67,51 +67,6 @@ public interface ProtectionService {
6767
*/
6868
boolean canDestroy(@Nullable Entity entity, Location location);
6969

70-
/**
71-
* Determines whether an entity can empty a bottle at a given location.
72-
*
73-
* @param entity the entity that wants to empty a bottle
74-
* @param location the location where the entity intends to empty the bottle
75-
* @return true if the entity can empty the bottle at the location, false otherwise
76-
*/
77-
boolean canEmptyBottle(@Nullable Entity entity, Location location);
78-
79-
/**
80-
* Determines whether an entity can fill a bottle at a given location.
81-
*
82-
* @param entity the entity that wants to fill a bottle
83-
* @param location the location where the entity intends to fill the bottle
84-
* @return true if the entity can fill the bottle at the location, false otherwise
85-
*/
86-
boolean canFillBottle(@Nullable Entity entity, Location location);
87-
88-
/**
89-
* Determines whether an entity can wash a banner at a given location.
90-
*
91-
* @param entity the entity that wants to wash a banner
92-
* @param location the location where the entity intends to wash the banner
93-
* @return true if the entity can wash the banner at the location, false otherwise
94-
*/
95-
boolean canWashBanner(@Nullable Entity entity, Location location);
96-
97-
/**
98-
* Determines whether an entity can wash a shulker at a given location.
99-
*
100-
* @param entity the entity that wants to wash a shulker
101-
* @param location the location where the entity intends to wash the shulker
102-
* @return true if the entity can wash the shulker at the location, false otherwise
103-
*/
104-
boolean canWashShulker(@Nullable Entity entity, Location location);
105-
106-
/**
107-
* Determines whether an entity can wash an armor at a given location.
108-
*
109-
* @param entity the entity that wants to wash an armor
110-
* @param location the location where the entity intends to wash the armor
111-
* @return true if the entity can wash the armor at the location, false otherwise
112-
*/
113-
boolean canWashArmor(@Nullable Entity entity, Location location);
114-
11570
/**
11671
* Determines whether an entity can interact with an object at a given location.
11772
*

‎plugin/build.gradle.kts‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ paper {
6060
main = "net.thenextlvl.protect.ProtectPlugin"
6161
description = "Protect certain areas or entire worlds"
6262
apiVersion = "1.21"
63+
foliaSupported = true
6364
load = BukkitPluginDescription.PluginLoadOrder.STARTUP
6465
authors = listOf("NonSwag")
6566
website = "https://thenextlvl.net"
@@ -96,19 +97,14 @@ paper {
9697
children = listOf(
9798
"protect.bypass.attack",
9899
"protect.bypass.destroy",
99-
"protect.bypass.empty-bottle",
100100
"protect.bypass.enter",
101101
"protect.bypass.entity-interact",
102102
"protect.bypass.entity-shear",
103-
"protect.bypass.fill-bottle",
104103
"protect.bypass.interact",
105104
"protect.bypass.leave",
106105
"protect.bypass.physical-interact",
107106
"protect.bypass.place",
108-
"protect.bypass.trample",
109-
"protect.bypass.wash-armor",
110-
"protect.bypass.wash-banner",
111-
"protect.bypass.wash-shulker"
107+
"protect.bypass.trample"
112108
)
113109
}
114110

‎plugin/src/main/java/net/thenextlvl/protect/ProtectPlugin.java‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ public class Flags {
215215
public final Flag<Boolean> shoot = flagRegistry().register(ProtectPlugin.this, "shoot", true);
216216

217217
public final ProtectionFlag<Boolean> armorStandManipulate = flagRegistry().register(ProtectPlugin.this, "armor_stand_manipulate", true, false);
218-
public final ProtectionFlag<Boolean> armorWashing = flagRegistry().register(ProtectPlugin.this, "armor_washing", true, false);
219-
public final ProtectionFlag<Boolean> bannerWashing = flagRegistry().register(ProtectPlugin.this, "banner_washing", true, false);
220218
public final ProtectionFlag<Boolean> blockAbsorb = flagRegistry().register(ProtectPlugin.this, "block_absorb", true, false);
221219
public final ProtectionFlag<Boolean> blockBurning = flagRegistry().register(ProtectPlugin.this, "block_burning", true, false);
222220
public final ProtectionFlag<Boolean> blockDrying = flagRegistry().register(ProtectPlugin.this, "block_drying", true, false);
@@ -229,16 +227,13 @@ public class Flags {
229227
public final ProtectionFlag<Boolean> blockSpread = flagRegistry().register(ProtectPlugin.this, "block_spread", true, false);
230228
public final ProtectionFlag<Boolean> cauldronEvaporation = flagRegistry().register(ProtectPlugin.this, "cauldron_evaporation", true, false);
231229
public final ProtectionFlag<Boolean> cauldronExtinguishEntity = flagRegistry().register(ProtectPlugin.this, "cauldron_extinguish_entity", true, false);
232-
public final ProtectionFlag<Boolean> cauldronLevelChangeUnknown = flagRegistry().register(ProtectPlugin.this, "cauldron_level_change_unknown", true, false);
233230
public final ProtectionFlag<Boolean> cropTrample = flagRegistry().register(ProtectPlugin.this, "crop_trample", true, false);
234231
public final ProtectionFlag<Boolean> destroy = flagRegistry().register(ProtectPlugin.this, "destroy", true, false);
235-
public final ProtectionFlag<Boolean> emptyBottle = flagRegistry().register(ProtectPlugin.this, "empty_bottle", true, false);
236232
public final ProtectionFlag<Boolean> entityAttackEntity = flagRegistry().register(ProtectPlugin.this, "entity_attack_entity", true, false);
237233
public final ProtectionFlag<Boolean> entityAttackPlayer = flagRegistry().register(ProtectPlugin.this, "entity_attack_player", true, false);
238234
public final ProtectionFlag<Boolean> entityInteract = flagRegistry().register(ProtectPlugin.this, "entity_interact", true, false);
239235
public final ProtectionFlag<Boolean> entityShear = flagRegistry().register(ProtectPlugin.this, "entity_shear", true, false);
240236
public final ProtectionFlag<Boolean> explosions = flagRegistry().register(ProtectPlugin.this, "explosions", true, false);
241-
public final ProtectionFlag<Boolean> fillBottle = flagRegistry().register(ProtectPlugin.this, "fill_bottle", true, false);
242237
public final ProtectionFlag<Boolean> interact = flagRegistry().register(ProtectPlugin.this, "interact", true, false);
243238
public final ProtectionFlag<Boolean> leavesDecay = flagRegistry().register(ProtectPlugin.this, "leaves_decay", true, false);
244239
public final ProtectionFlag<Boolean> naturalCauldronFill = flagRegistry().register(ProtectPlugin.this, "natural_cauldron_fill", true, false);
@@ -247,6 +242,5 @@ public class Flags {
247242
public final ProtectionFlag<Boolean> playerAttackEntity = flagRegistry().register(ProtectPlugin.this, "player_attack_entity", true, false);
248243
public final ProtectionFlag<Boolean> playerAttackPlayer = flagRegistry().register(ProtectPlugin.this, "player_attack_player", true, false);
249244
public final ProtectionFlag<Boolean> playerItemDrop = flagRegistry().register(ProtectPlugin.this, "player_item_drop", true, false);
250-
public final ProtectionFlag<Boolean> shulkerWashing = flagRegistry().register(ProtectPlugin.this, "shulker_washing", true, false);
251245
}
252246
}

‎plugin/src/main/java/net/thenextlvl/protect/listener/WorldListener.java‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -222,30 +222,13 @@ public void onLeavesDecay(LeavesDecayEvent event) {
222222
event.setCancelled(!area.getFlag(plugin.flags.leavesDecay));
223223
}
224224

225-
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
226-
public void onPlayerChangeCauldronLevel(CauldronLevelChangeEvent event) {
227-
if (!(event.getEntity() instanceof Player player)) return;
228-
event.setCancelled(!switch (event.getReason()) {
229-
case ARMOR_WASH -> plugin.protectionService().canWashArmor(player, event.getBlock().getLocation());
230-
case BANNER_WASH -> plugin.protectionService().canWashBanner(player, event.getBlock().getLocation());
231-
case BOTTLE_EMPTY -> plugin.protectionService().canEmptyBottle(player, event.getBlock().getLocation());
232-
case BOTTLE_FILL -> plugin.protectionService().canFillBottle(player, event.getBlock().getLocation());
233-
case BUCKET_EMPTY -> plugin.protectionService().canPlace(player, event.getBlock().getLocation());
234-
case BUCKET_FILL -> plugin.protectionService().canDestroy(player, event.getBlock().getLocation());
235-
case SHULKER_WASH -> plugin.protectionService().canWashShulker(player, event.getBlock().getLocation());
236-
default -> true;
237-
});
238-
plugin.failed(player, event, plugin.areaProvider().getArea(event.getBlock()), "area.failed.interact");
239-
}
240-
241225
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
242226
public void onCauldronLevelChange(CauldronLevelChangeEvent event) {
243227
var area = plugin.areaProvider().getArea(event.getBlock());
244228
var flag = switch (event.getReason()) {
245229
case EXTINGUISH -> plugin.flags.cauldronExtinguishEntity;
246230
case EVAPORATE -> plugin.flags.cauldronEvaporation;
247231
case NATURAL_FILL -> plugin.flags.naturalCauldronFill;
248-
case UNKNOWN -> plugin.flags.cauldronLevelChangeUnknown;
249232
default -> null;
250233
};
251234
if (flag != null) event.setCancelled(!area.getFlag(flag));

‎plugin/src/main/java/net/thenextlvl/protect/service/CraftProtectionService.java‎

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,36 +47,6 @@ public boolean canDestroy(@Nullable Entity entity, Location location) {
4747
return canDestroy(entity, plugin.areaProvider().getArea(location));
4848
}
4949

50-
@Override
51-
public boolean canEmptyBottle(@Nullable Entity entity, Location location) {
52-
return canPerformAction(entity, plugin.areaProvider().getArea(location),
53-
plugin.flags.emptyBottle, "protect.bypass.empty-bottle");
54-
}
55-
56-
@Override
57-
public boolean canFillBottle(@Nullable Entity entity, Location location) {
58-
return canPerformAction(entity, plugin.areaProvider().getArea(location),
59-
plugin.flags.fillBottle, "protect.bypass.fill-bottle");
60-
}
61-
62-
@Override
63-
public boolean canWashBanner(@Nullable Entity entity, Location location) {
64-
return canPerformAction(entity, plugin.areaProvider().getArea(location),
65-
plugin.flags.bannerWashing, "protect.bypass.wash-banner");
66-
}
67-
68-
@Override
69-
public boolean canWashShulker(@Nullable Entity entity, Location location) {
70-
return canPerformAction(entity, plugin.areaProvider().getArea(location),
71-
plugin.flags.shulkerWashing, "protect.bypass.wash-shulker");
72-
}
73-
74-
@Override
75-
public boolean canWashArmor(@Nullable Entity entity, Location location) {
76-
return canPerformAction(entity, plugin.areaProvider().getArea(location),
77-
plugin.flags.armorWashing, "protect.bypass.wash-armor");
78-
}
79-
8050
@Override
8151
public boolean canInteract(@Nullable Entity entity, Location location) {
8252
return canPerformAction(entity, plugin.areaProvider().getArea(location),

0 commit comments

Comments
 (0)