Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bucketFilling config option #656

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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