mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 10:57:11 +00:00
Add a config setting to allow creative mode players to override inventory setting.
This commit is contained in:
parent
89bdd8d9ba
commit
6abd48ab08
@ -98,6 +98,7 @@ public abstract class LocalConfiguration {
|
||||
public boolean noDoubleSlash = false;
|
||||
public boolean useInventory = false;
|
||||
public boolean useInventoryOverride = false;
|
||||
public boolean useInventoryCreativeOverride = false;
|
||||
public int navigationWand = ItemID.COMPASS;
|
||||
public int navigationWandMaxDistance = 50;
|
||||
public int scriptTimeout = 3000;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.sk89q.worldedit.bags.BlockBag;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
@ -669,4 +670,8 @@ public abstract class LocalPlayer {
|
||||
public boolean isPlayer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasCreativeMode() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +345,8 @@ public class WorldEdit {
|
||||
// Have the session use inventory if it's enabled and the player
|
||||
// doesn't have an override
|
||||
session.setUseInventory(config.useInventory
|
||||
&& !(config.useInventoryOverride
|
||||
&& !((config.useInventoryOverride ||
|
||||
(config.useInventoryCreativeOverride && player.hasCreativeMode()))
|
||||
&& player.hasPermission("worldedit.inventory.unrestricted")));
|
||||
|
||||
}
|
||||
|
@ -19,11 +19,17 @@
|
||||
|
||||
package com.sk89q.worldedit.bukkit;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.sk89q.util.StringUtil;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.ServerInterface;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldVector;
|
||||
import com.sk89q.worldedit.bags.BlockBag;
|
||||
import com.sk89q.worldedit.cui.CUIEvent;
|
||||
|
||||
@ -139,4 +145,9 @@ public class BukkitPlayer extends LocalPlayer {
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCreativeMode() {
|
||||
return player.getGameMode() == GameMode.CREATIVE;
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,8 @@ public class YAMLConfiguration extends LocalConfiguration {
|
||||
useInventory = config.getBoolean("use-inventory.enable", useInventory);
|
||||
useInventoryOverride = config.getBoolean("use-inventory.allow-override",
|
||||
useInventoryOverride);
|
||||
useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides",
|
||||
useInventoryCreativeOverride);
|
||||
|
||||
navigationWand = config.getInt("navigation-wand.item", navigationWand);
|
||||
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);
|
||||
|
@ -34,6 +34,7 @@ limits:
|
||||
use-inventory:
|
||||
enable: false
|
||||
allow-override: true
|
||||
creative-mode-overrides: false
|
||||
|
||||
logging:
|
||||
log-commands: false
|
||||
|
Loading…
Reference in New Issue
Block a user