add PortalIntercept option

This commit is contained in:
cs8425 2021-06-23 22:20:21 +08:00
parent fc6796e20f
commit 126d9ed7f6
4 changed files with 37 additions and 1 deletions

View File

@ -480,6 +480,11 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
this.getMVConfig().setTeleportIntercept(this.multiverseConfig.getBoolean("teleportintercept")); this.getMVConfig().setTeleportIntercept(this.multiverseConfig.getBoolean("teleportintercept"));
this.multiverseConfig.set("teleportintercept", null); this.multiverseConfig.set("teleportintercept", null);
} }
if (this.multiverseConfig.isSet("portalintercept")) {
Logging.config("Migrating 'portalintercept'...");
this.getMVConfig().setPortalIntercept(this.multiverseConfig.getBoolean("portalintercept"));
this.multiverseConfig.set("portalintercept", null);
}
if (this.multiverseConfig.isSet("firstspawnoverride")) { if (this.multiverseConfig.isSet("firstspawnoverride")) {
Logging.config("Migrating 'firstspawnoverride'..."); Logging.config("Migrating 'firstspawnoverride'...");
this.getMVConfig().setFirstSpawnOverride(this.multiverseConfig.getBoolean("firstspawnoverride")); this.getMVConfig().setFirstSpawnOverride(this.multiverseConfig.getBoolean("firstspawnoverride"));

View File

@ -52,6 +52,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
@Property @Property
private volatile boolean teleportintercept; private volatile boolean teleportintercept;
@Property @Property
private volatile boolean portalintercept;
@Property
private volatile boolean firstspawnoverride; private volatile boolean firstspawnoverride;
@Property @Property
private volatile boolean displaypermerrors; private volatile boolean displaypermerrors;
@ -99,6 +101,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
prefixchat = false; prefixchat = false;
prefixchatformat = "[%world%]%chat%"; prefixchatformat = "[%world%]%chat%";
teleportintercept = true; teleportintercept = true;
portalintercept = true;
firstspawnoverride = true; firstspawnoverride = true;
displaypermerrors = true; displaypermerrors = true;
enablebuscript = true; enablebuscript = true;
@ -192,6 +195,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
this.teleportintercept = teleportIntercept; this.teleportintercept = teleportIntercept;
} }
/**
* {@inheritDoc}
*/
@Override
public boolean getPortalIntercept() {
return this.portalintercept;
}
/**
* {@inheritDoc}
*/
@Override
public void setPortalIntercept(boolean portalIntercept) {
this.portalintercept = portalIntercept;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -122,6 +122,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
*/ */
boolean getTeleportIntercept(); boolean getTeleportIntercept();
/**
* Sets portalIntercept.
* @param portalIntercept The new value.
*/
void setPortalIntercept(boolean portalIntercept);
/**
* Gets portalIntercept.
* @return portalIntercept.
*/
boolean getPortalIntercept();
/** /**
* Sets prefixChat. * Sets prefixChat.
* @param prefixChat The new value. * @param prefixChat The new value.

View File

@ -300,7 +300,7 @@ public class MVPlayerListener implements Listener {
+ "' because they don't have the FUNDS required to enter."); + "' because they don't have the FUNDS required to enter.");
return; return;
} }
if (plugin.getMVConfig().getEnforceAccess()) { if (plugin.getMVConfig().getEnforceAccess() && plugin.getMVConfig().getPortalIntercept()) {
event.setCancelled(!pt.playerCanGoFromTo(fromWorld, toWorld, event.getPlayer(), event.getPlayer())); event.setCancelled(!pt.playerCanGoFromTo(fromWorld, toWorld, event.getPlayer(), event.getPlayer()));
if (event.isCancelled()) { if (event.isCancelled()) {
Logging.fine("Player '" + event.getPlayer().getName() Logging.fine("Player '" + event.getPlayer().getName()