Add a config setting to allow creative mode players to override inventory setting.

Dieser Commit ist enthalten in:
Wizjany 2013-01-19 19:06:55 -05:00
Ursprung 89bdd8d9ba
Commit 6abd48ab08
6 geänderte Dateien mit 23 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -98,6 +98,7 @@ public abstract class LocalConfiguration {
public boolean noDoubleSlash = false; public boolean noDoubleSlash = false;
public boolean useInventory = false; public boolean useInventory = false;
public boolean useInventoryOverride = false; public boolean useInventoryOverride = false;
public boolean useInventoryCreativeOverride = false;
public int navigationWand = ItemID.COMPASS; public int navigationWand = ItemID.COMPASS;
public int navigationWandMaxDistance = 50; public int navigationWandMaxDistance = 50;
public int scriptTimeout = 3000; public int scriptTimeout = 3000;

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit; package com.sk89q.worldedit;
import java.io.File; import java.io.File;
import com.sk89q.worldedit.bags.BlockBag; import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.BlockType;
@ -669,4 +670,8 @@ public abstract class LocalPlayer {
public boolean isPlayer() { public boolean isPlayer() {
return true; return true;
} }
public boolean hasCreativeMode() {
return false;
}
} }

Datei anzeigen

@ -345,7 +345,8 @@ public class WorldEdit {
// Have the session use inventory if it's enabled and the player // Have the session use inventory if it's enabled and the player
// doesn't have an override // doesn't have an override
session.setUseInventory(config.useInventory session.setUseInventory(config.useInventory
&& !(config.useInventoryOverride && !((config.useInventoryOverride ||
(config.useInventoryCreativeOverride && player.hasCreativeMode()))
&& player.hasPermission("worldedit.inventory.unrestricted"))); && player.hasPermission("worldedit.inventory.unrestricted")));
} }

Datei anzeigen

@ -19,11 +19,17 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.sk89q.util.StringUtil; 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.bags.BlockBag;
import com.sk89q.worldedit.cui.CUIEvent; import com.sk89q.worldedit.cui.CUIEvent;
@ -139,4 +145,9 @@ public class BukkitPlayer extends LocalPlayer {
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
@Override
public boolean hasCreativeMode() {
return player.getGameMode() == GameMode.CREATIVE;
}
} }

Datei anzeigen

@ -93,6 +93,8 @@ public class YAMLConfiguration extends LocalConfiguration {
useInventory = config.getBoolean("use-inventory.enable", useInventory); useInventory = config.getBoolean("use-inventory.enable", useInventory);
useInventoryOverride = config.getBoolean("use-inventory.allow-override", useInventoryOverride = config.getBoolean("use-inventory.allow-override",
useInventoryOverride); useInventoryOverride);
useInventoryCreativeOverride = config.getBoolean("use-inventory.creative-mode-overrides",
useInventoryCreativeOverride);
navigationWand = config.getInt("navigation-wand.item", navigationWand); navigationWand = config.getInt("navigation-wand.item", navigationWand);
navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance); navigationWandMaxDistance = config.getInt("navigation-wand.max-distance", navigationWandMaxDistance);

Datei anzeigen

@ -34,6 +34,7 @@ limits:
use-inventory: use-inventory:
enable: false enable: false
allow-override: true allow-override: true
creative-mode-overrides: false
logging: logging:
log-commands: false log-commands: false