mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-25 20:15:58 +01:00
Added no spectator mode setting
This commit is contained in:
parent
bfc473ec85
commit
1cd97d2bc1
@ -70,6 +70,8 @@ CustomPrefix: '&a[&eAdvancedPortals&a]'
|
||||
|
||||
CustomPrefixFail: '&c[&7AdvancedPortals&c]'
|
||||
|
||||
BlockSpectatorMode: false
|
||||
|
||||
PortalCooldown: 5 # How long after trying to enter a portal until the player can try to enter another. 0 or lower to deactivate.
|
||||
ThrowbackAmount: 0.7 # How fast to throw them back, 0 or lower to disable throwback
|
||||
|
||||
|
@ -33,10 +33,11 @@ public class Portal {
|
||||
private static double throwback;
|
||||
private static Sound portalSound;
|
||||
private static int portalProtectionRadius;
|
||||
private static boolean blockSpectatorMode;
|
||||
|
||||
public Portal(AdvancedPortalsPlugin plugin) {
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "config.yml");
|
||||
this.showBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
|
||||
this.showBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage", false);
|
||||
this.cooldelay = config.getConfig().getInt("PortalCooldown", 5);
|
||||
|
||||
this.portalProtectionRadius = config.getConfig().getInt("PortalProtectionRadius");
|
||||
@ -44,6 +45,7 @@ public class Portal {
|
||||
this.throwback = config.getConfig().getDouble("ThrowbackAmount", 0.7);
|
||||
|
||||
this.portalSound = WarpEffects.findSound(plugin, "BLOCK_PORTAL_TRAVEL", "PORTAL_TRAVEL");
|
||||
this.blockSpectatorMode = config.getConfig().getBoolean("BlockSpectatorMode", false);
|
||||
|
||||
Portal.plugin = plugin;
|
||||
Portal.loadPortals();
|
||||
@ -209,7 +211,6 @@ public class Portal {
|
||||
return "\u00A7aPortal creation successful!";
|
||||
}
|
||||
|
||||
// make this actually work!
|
||||
private static boolean checkPortalOverlap(Location pos1, Location pos2) {
|
||||
|
||||
if (portalsActive) {
|
||||
@ -365,6 +366,7 @@ public class Portal {
|
||||
return posX != null;
|
||||
}
|
||||
|
||||
|
||||
public static boolean activate(Player player, String portalName) {
|
||||
for (AdvancedPortal portal : Portal.portals) {
|
||||
if (portal.getName().equals(portalName)) return activate(player, portal);
|
||||
@ -382,6 +384,11 @@ public class Portal {
|
||||
// check they havent been registered before too and store a list of ones made by this plugin to remove when portals are unloaded.
|
||||
// When a portal is added or removed it reloads all portals(i think) so add code for unloading too.
|
||||
|
||||
if(blockSpectatorMode && player.getGameMode() == GameMode.SPECTATOR) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7c You cannot enter a portal in spectator mode!");
|
||||
return false;
|
||||
}
|
||||
|
||||
String permission = portal.getArg("permission");
|
||||
/*if((permission == null || (permission != null && player.hasPermission(permission)) || player.isOp())){*/
|
||||
// 3 checks, 1st is if it doesnt need perms. 2nd is if it does do they have it. And third is are they op.
|
||||
|
Loading…
Reference in New Issue
Block a user