Fix #14
This commit is contained in:
parent
2a1e9a6211
commit
ddd00cf9e8
|
@ -4,5 +4,8 @@ ask-for-name-after-taming: true
|
|||
max-fox-tames: 0
|
||||
prefix: "&c[Tamable Foxes] "
|
||||
|
||||
no-tame-worlds:
|
||||
- world_nether
|
||||
|
||||
tamed-behavior:
|
||||
attack-wild-animals: true
|
|
@ -20,3 +20,6 @@ permissions:
|
|||
tamablefoxes.tame.unlimited:
|
||||
description: "Lets players bypass the tame limit."
|
||||
default: op
|
||||
tamablefoxes.tame.anywhere:
|
||||
description: "Lets players bypass the banned worlds in config.yml (so they can tame in any world)."
|
||||
default: op
|
||||
|
|
|
@ -5,6 +5,9 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Config {
|
||||
private static FileConfiguration config = null;
|
||||
|
||||
|
@ -23,9 +26,15 @@ public class Config {
|
|||
// Check if a tamed fox attacks wild animals.
|
||||
public static boolean doesTamedAttackWildAnimals() { return config.getBoolean("tamed-behavior.attack-wild-animals"); }
|
||||
|
||||
// Get worlds that taming is not allowed in.
|
||||
public static List<String> BannedWorlds() {
|
||||
return config.contains("no-tame-worlds") ? config.getStringList("no-tame-worlds") : new ArrayList<>();
|
||||
}
|
||||
|
||||
// Check if the player can tame the fox.
|
||||
public static boolean canPlayerTameFox(Player player) {
|
||||
return player.hasPermission("tamablefoxes.tame") || player.isOp();
|
||||
return ( player.hasPermission("tamablefoxes.tame") || player.isOp() ) &&
|
||||
( !BannedWorlds().contains(player.getWorld().getName()) || player.hasPermission("tamablefoxes.tame.anywhere") );
|
||||
}
|
||||
|
||||
public static int getMaxPlayerFoxTames() {
|
||||
|
|
Loading…
Reference in New Issue