Moved the tpdelay to the mstore conf.
This commit is contained in:
parent
edabc02555
commit
61d7b7cb12
@ -4,8 +4,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.permissions.Permissible;
|
||||
|
||||
import com.massivecraft.mcore.cmd.CmdMcore;
|
||||
import com.massivecraft.mcore.usys.cmd.CmdUsys;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
@ -43,11 +41,4 @@ public class ConfServer extends SimpleConfig
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static int tpdelay = 10;
|
||||
public static int getTpdelay(Permissible permissible)
|
||||
{
|
||||
if (Perm.NOTPDELAY.has(permissible, false)) return 0;
|
||||
return Math.max(tpdelay, 0);
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,12 @@ package com.massivecraft.mcore;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.permissions.Permissible;
|
||||
|
||||
import com.massivecraft.mcore.MCore;
|
||||
import com.massivecraft.mcore.store.Entity;
|
||||
import com.massivecraft.mcore.util.MUtil;
|
||||
import com.massivecraft.mcore.util.PermUtil;
|
||||
|
||||
public class MCoreConf extends Entity<MCoreConf, String>
|
||||
{
|
||||
@ -42,6 +45,13 @@ public class MCoreConf extends Entity<MCoreConf, String>
|
||||
public Map<String, String> getPermissionDeniedFormats() { return this.permissionDeniedFormats == null ? new LinkedHashMap<String, String>() : new LinkedHashMap<String, String>(this.permissionDeniedFormats); }
|
||||
public void setPermissionDeniedFormats(Map<String, String> permissionDeniedFormats) { this.permissionDeniedFormats = permissionDeniedFormats == null ? new LinkedHashMap<String, String>() : new LinkedHashMap<String, String>(permissionDeniedFormats); this.changed(); }
|
||||
|
||||
private Map<String, Integer> permissionToTpdelay = MUtil.map(
|
||||
"mcore.notpdelay", 0,
|
||||
"default", 10
|
||||
);
|
||||
public Map<String, Integer> getPermissionToTpdelay() { return this.permissionToTpdelay == null ? new LinkedHashMap<String, Integer>() : new LinkedHashMap<String, Integer>(this.permissionToTpdelay); }
|
||||
public void setPermissionToTpdelay(Map<String, Integer> permissionToTpdelay) { this.permissionToTpdelay = permissionToTpdelay == null ? new LinkedHashMap<String, Integer>() : new LinkedHashMap<String, Integer>(permissionToTpdelay); this.changed(); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// HELP ACCESS
|
||||
// -------------------------------------------- //
|
||||
@ -67,5 +77,11 @@ public class MCoreConf extends Entity<MCoreConf, String>
|
||||
return this.getPermissionDeniedFormats().get(permissionName);
|
||||
}
|
||||
|
||||
|
||||
public int getTpdelay(Permissible permissible)
|
||||
{
|
||||
Integer ret = PermUtil.pickFirstVal(permissible, this.getPermissionToTpdelay());
|
||||
if (ret == null) ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
|
||||
import com.massivecraft.mcore.ConfServer;
|
||||
import com.massivecraft.mcore.MCoreConf;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
|
||||
@ -72,7 +72,7 @@ public abstract class TeleportMixinAbstract implements TeleportMixin
|
||||
|
||||
public static int getTpdelay(Permissible delayPermissible)
|
||||
{
|
||||
return ConfServer.getTpdelay(delayPermissible);
|
||||
return MCoreConf.get().getTpdelay(delayPermissible);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class PermUtil
|
||||
// RANDOM UTILS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static <T> T pickFirstVal(CommandSender me, Map<String, T> perm2val)
|
||||
public static <T> T pickFirstVal(Permissible permissible, Map<String, T> perm2val)
|
||||
{
|
||||
if (perm2val == null) return null;
|
||||
T ret = null;
|
||||
@ -102,7 +102,7 @@ public class PermUtil
|
||||
for ( Entry<String, T> entry : perm2val.entrySet())
|
||||
{
|
||||
ret = entry.getValue();
|
||||
if (has(me, entry.getKey())) break;
|
||||
if (has(permissible, entry.getKey())) break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user