Skip to content

Commit

Permalink
Merge pull request #656 from Multiverse/feat-bucketFilling
Browse files Browse the repository at this point in the history
Add bucketFilling config option
  • Loading branch information
benwoo1110 authored Jul 14, 2024
2 parents 1c4cf65 + b639f66 commit 191ea31
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class MultiversePortals extends JavaPlugin implements MVPlugin {
private long portalCooldown = 0;
private final static int requiresProtocol = 24;
public static boolean UseOnMove = true;
public static boolean bucketFilling = true;
public static boolean EnforcePortalAccess = true;
public static boolean WandEnabled = true;
public static boolean ClearOnRemove = false;
Expand Down Expand Up @@ -275,12 +276,14 @@ public void loadConfig() {
this.MVPConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml"));

MultiversePortals.UseOnMove = this.MVPConfig.getBoolean("useonmove", true);
MultiversePortals.bucketFilling = this.MVPConfig.getBoolean("bucketfilling", true);
MultiversePortals.EnforcePortalAccess = this.MVPConfig.getBoolean("enforceportalaccess", true);
this.portalCooldown = this.MVPConfig.getInt("portalcooldown", 1000);
MultiversePortals.ClearOnRemove = this.MVPConfig.getBoolean("clearonremove", false);
MultiversePortals.TeleportVehicles = this.MVPConfig.getBoolean("teleportvehicles", true);
MultiversePortals.NetherAnimation = this.MVPConfig.getBoolean("netheranimation", true);
MultiversePortals.FrameMaterials = migrateFrameMaterials(this.MVPConfig);

// Migrate useportalaccess -> enforceportalaccess
if (this.MVPConfig.get("useportalaccess") != null) {
this.MVPConfig.set("enforceportalaccess", this.MVPConfig.getBoolean("useportalaccess", true));
Expand Down Expand Up @@ -519,6 +522,7 @@ public String getVersionInfo() {
+ "[Multiverse-Portals] Dumping Portal Values: (version " + this.getMainConfig().getDouble("version", -1) + ')' + '\n'
+ "[Multiverse-Portals] wand: " + this.getMainConfig().get("wand", "NOT SET") + '\n'
+ "[Multiverse-Portals] useonmove: " + this.getMainConfig().get("useonmove", "NOT SET") + '\n'
+ "[Multiverse-Portals] bucketfilling: " + this.getMainConfig().get("bucketfilling", "NOT SET") + '\n'
+ "[Multiverse-Portals] portalsdefaulttonether: " + this.getMainConfig().get("portalsdefaulttonether", "NOT SET") + '\n'
+ "[Multiverse-Portals] enforceportalaccess: " + this.getMainConfig().get("enforceportalaccess", "NOT SET") + '\n'
+ "[Multiverse-Portals] portalcooldown: " + this.getMainConfig().get("portalcooldown", "NOT SET") + '\n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ public void playerBucketEmpty(PlayerBucketEmptyEvent event) {
return;
}

if (!MultiversePortals.bucketFilling) {
Logging.fine("The bucket filling functionality has been disabled in config, doing nothing");
return;
}

Location translatedLocation = this.getTranslatedLocation(event.getBlockClicked(), event.getBlockFace());
Logging.finer("Fill: ");
Logging.finer("Block Clicked: " + event.getBlockClicked() + ":" + event.getBlockClicked().getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void blockFromTo(BlockFromToEvent event) {
event.setCancelled(true);
return;
}
// If something is trying to flow out, stop that too.
if (plugin.getPortalManager().isPortal(event.getBlock().getLocation())) {
// If something is trying to flow out, stop that too, unless bucketFilling has been disabled
if (plugin.getPortalManager().isPortal(event.getBlock().getLocation()) && MultiversePortals.bucketFilling) {
event.setCancelled(true);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/defaults/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

wand: 271
useonmove: true
bucketfilling: true
portalsdefaulttonether: false
enforceportalaccess: true
portalcooldown: 1000
Expand Down

0 comments on commit 191ea31

Please sign in to comment.