Converted Permission-Nodes, but missing translation for now

This commit is contained in:
Jascha Starke 2012-11-15 22:00:57 +01:00
parent 251de6aa5c
commit 0587d6a6b7
11 changed files with 313 additions and 125 deletions

156
pom.xml
View file

@ -3,13 +3,19 @@
<groupId>de.jaschastarke</groupId>
<artifactId>LimitedCreative</artifactId>
<name>LimitedCreative</name>
<version>1.4.0a</version>
<version>1.4.1a-SNAPSHOT</version>
<url>https://github.com/possi/LimitedCreative</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<scm>
<connection>scm:git:git://github.com/possi/LimitedCreative.git</connection>
<developerConnection>scm:git:git@github.com:possi/LimitedCreative.git</developerConnection>
<url>https://github.com/possi/LimitedCreative/tree/master</url>
</scm>
<repositories>
<!-- Required dependencies for optional integrations, that aren't hosted yet -->
<repository>
@ -36,6 +42,40 @@
<url>http://ci.herocraftonline.com/plugin/repository/everything</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.2-R0.2</version>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>5.6.3</version>
</dependency>
<dependency>
<groupId>uk.org.whoami</groupId>
<artifactId>authme</artifactId>
<version>2.6.7b5</version>
</dependency>
<dependency>
<groupId>com.onarandombox.multiversecore</groupId>
<artifactId>Multiverse-Core</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.cypherx</groupId>
<artifactId>xauth</artifactId>
<version>2.0.20</version>
</dependency>
<dependency>
<groupId>de.jaschastarke</groupId>
<artifactId>plib</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<finalName>${project.artifactId}</finalName>
@ -65,37 +105,91 @@
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>de.jaschastarke</groupId>
<artifactId>plib</artifactId>
<version>0.1-SNAPSHOT</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>pluginyaml</goal>
</goals>
<configuration>
<!-- plugin.yml -->
<softdepend>
<param>WorldGuard</param>
<param>WorldEdit</param>
<param>MultiInv</param>
</softdepend>
<custom>
<dev-url>http://dev.bukkit.org/server-mods/limited-creative/</dev-url>
</custom>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>de.jaschastarke:plib</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>de.jaschastarke:plib</artifact>
<excludes>
<exclude>de/jaschastarke/bukkit/lib/maven/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>de.jaschastarke</groupId>
<artifactId>plib</artifactId>
<versionRange>
[0.1-SNAPSHOT,)
</versionRange>
<goals>
<goal>pluginyaml</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.2-R0.2</version>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>5.6.3</version>
</dependency>
<dependency>
<groupId>uk.org.whoami</groupId>
<artifactId>authme</artifactId>
<version>2.6.7b5</version>
</dependency>
<dependency>
<groupId>com.onarandombox.multiversecore</groupId>
<artifactId>Multiverse-Core</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.cypherx</groupId>
<artifactId>xauth</artifactId>
<version>2.0.20</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View file

@ -18,6 +18,7 @@
package de.jaschastarke.minecraft.limitedcreative;
import static de.jaschastarke.minecraft.utils.Locale.L;
import static de.jaschastarke.bukkit.lib.permissions.PermissionManager.hasPermission;
import java.util.Arrays;
import java.util.List;
@ -29,7 +30,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import de.jaschastarke.minecraft.utils.IPermission;
import de.jaschastarke.minecraft.utils.Util;
public class Commands {
@ -202,9 +202,6 @@ public class Commands {
plugin.getCommand("/region").setExecutor(new NotAvailableCommandExecutor());
}
}
private static boolean hasPermission(CommandSender sender, IPermission permission) {
return plugin.perm.hasPermission(sender, permission);
}
abstract static public class CommandException extends Exception {
private static final long serialVersionUID = 1L;

View file

@ -18,23 +18,21 @@
package de.jaschastarke.minecraft.limitedcreative;
import static de.jaschastarke.minecraft.utils.Locale.L;
import java.util.logging.Logger;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import de.jaschastarke.minecraft.integration.Communicator;
import de.jaschastarke.minecraft.lib.annotations.PermissionGroup;
import de.jaschastarke.minecraft.limitedcreative.cmdblock.CommandBlocker;
import de.jaschastarke.minecraft.limitedcreative.listeners.LimitListener;
import de.jaschastarke.minecraft.limitedcreative.limits.LimitListener;
import de.jaschastarke.minecraft.limitedcreative.listeners.MainListener;
import de.jaschastarke.minecraft.limitedcreative.regions.WorldGuardIntegration;
import de.jaschastarke.minecraft.utils.Locale;
import de.jaschastarke.minecraft.utils.Permissions;
public class Core extends JavaPlugin {
public final Logger logger = Logger.getLogger("Minecraft");
@PermissionGroup("limitedcreative")
public class Core extends de.jaschastarke.bukkit.lib.Core {
public Configuration config;
public Permissions perm;
public WorldGuardIntegration worldguard;
@ -109,9 +107,9 @@ public class Core extends JavaPlugin {
PluginDescriptionFile df = this.getDescription();
if (worldguard != null)
logger.info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.worldguard"));
getLog().info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.worldguard"));
else
logger.info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.no_worldguard"));
getLog().info("["+df.getName() + " v" + df.getVersion() + "] "+L("basic.loaded.no_worldguard"));
}
public void reload() {
@ -122,13 +120,13 @@ public class Core extends JavaPlugin {
setEnabled(true);
}
public void info(String s) {
logger.info("["+this.getDescription().getName()+"] " + s);
getLog().info("["+this.getDescription().getName()+"] " + s);
}
public void warn(String s) {
logger.warning("["+this.getDescription().getName()+"] " + s);
getLog().warning("["+this.getDescription().getName()+"] " + s);
}
public void error(String s) {
logger.severe("["+this.getDescription().getName()+"] " + s);
getLog().severe("["+this.getDescription().getName()+"] " + s);
}
public static void debug(String s) {
if (isDebug())

View file

@ -44,7 +44,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Lever;
import org.bukkit.material.MaterialData;
import de.jaschastarke.minecraft.utils.IPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
import de.jaschastarke.minecraft.limitedcreative.limits.NoLimitPerms;
import de.jaschastarke.minecraft.worldguard.events.PlayerAreaEvent;
import de.jaschastarke.minecraft.worldguard.events.PlayerChangedAreaEvent;
@ -252,7 +253,7 @@ public class LCPlayer {
public void onDropItem(PlayerDropItemEvent event) {
Core.debug(getName() + " ("+getPlayer().getGameMode()+") drops items " + event.getItemDrop().getItemStack().getType());
if (getPlayer().getGameMode() == GameMode.CREATIVE) {
if (hasPermission(Perms.NoLimit.DROP))
if (hasPermission(NoLimitPerms.DROP))
return;
Core.debug("removed");
if (plugin.config.getRemoveDrop())
@ -263,7 +264,7 @@ public class LCPlayer {
}
public void onPickupItem(PlayerPickupItemEvent event) {
if (getPlayer().getGameMode() == GameMode.CREATIVE) {
if (hasPermission(Perms.NoLimit.PICKUP))
if (hasPermission(NoLimitPerms.PICKUP))
return;
if (plugin.config.getBlockPickupInCreative()) {
event.setCancelled(true);
@ -276,7 +277,7 @@ public class LCPlayer {
public void onDie(EntityDeathEvent event) {
if (getPlayer().getGameMode() == GameMode.CREATIVE) {
if (!hasPermission(Perms.NoLimit.DROP)) {
if (!hasPermission(NoLimitPerms.DROP)) {
event.getDrops().clear();
//getInv().storeTemp();
}
@ -285,7 +286,7 @@ public class LCPlayer {
/* removed, because much to insecure. also we can save memory with out this
public void onRespawn(PlayerRespawnEvent event) {
if (getPlayer().getGameMode() == GameMode.CREATIVE) {
if (!plugin.config.getPermissionsEnabled() || !hasPermission(Perms.NoLimit.DROP)) {
if (!plugin.config.getPermissionsEnabled() || !hasPermission(NoLimitPerms.DROP)) {
getInv().restoreTemp();
}
}
@ -297,13 +298,13 @@ public class LCPlayer {
// its PVP
Player attacker = (Player) from;
if (attacker.getGameMode() == GameMode.CREATIVE) {
if (!Players.get(attacker).hasPermission(Perms.NoLimit.PVP)) {
if (!Players.get(attacker).hasPermission(NoLimitPerms.PVP)) {
event.setCancelled(true);
return; // skip next check
}
}
if (getPlayer().getGameMode() == GameMode.CREATIVE) {
if (!hasPermission(Perms.NoLimit.PVP)) {
if (!hasPermission(NoLimitPerms.PVP)) {
event.setCancelled(true);
}
}
@ -312,7 +313,7 @@ public class LCPlayer {
public void onDealDamage(EntityDamageByEntityEvent event) { // deals damage
if (event.getEntity() instanceof Creature) {
if (getPlayer().getGameMode() == GameMode.CREATIVE && plugin.config.getMobDamageBlock()) {
if (!hasPermission(Perms.NoLimit.MOB_DAMAGE)) {
if (!hasPermission(NoLimitPerms.MOB_DAMAGE)) {
event.setCancelled(true);
}
}
@ -325,7 +326,7 @@ public class LCPlayer {
public void onTarget(EntityTargetEvent event) {
if (event.getEntity() instanceof Creature) {
if (((Player) event.getTarget()).getGameMode() == GameMode.CREATIVE && plugin.config.getMobDamageBlock()) {
if (!hasPermission(Perms.NoLimit.MOB_DAMAGE)) {
if (!hasPermission(NoLimitPerms.MOB_DAMAGE)) {
event.setCancelled(true);
}
}
@ -335,7 +336,7 @@ public class LCPlayer {
public void onChestAccess(PlayerInteractEvent event) {
if (event.getPlayer().getGameMode() != GameMode.CREATIVE)
return;
if (hasPermission(Perms.NoLimit.CHEST))
if (hasPermission(NoLimitPerms.CHEST))
return;
event.getPlayer().sendMessage(L("blocked.chest"));
event.setCancelled(true);
@ -343,7 +344,7 @@ public class LCPlayer {
public void onChestAccess(PlayerInteractEntityEvent event) { // chest-minecarts are different events
if (getPlayer().getGameMode() != GameMode.CREATIVE)
return;
if (hasPermission(Perms.NoLimit.CHEST))
if (hasPermission(NoLimitPerms.CHEST))
return;
event.getPlayer().sendMessage(L("blocked.chest"));
event.setCancelled(true);
@ -351,7 +352,7 @@ public class LCPlayer {
public void onBenchAccess(PlayerInteractEvent event) {
if (!plugin.config.getBenchBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE)
return;
if (hasPermission(Perms.NoLimit.CHEST))
if (hasPermission(NoLimitPerms.CHEST))
return;
event.getPlayer().sendMessage(L("blocked.chest"));
event.setCancelled(true);
@ -359,7 +360,7 @@ public class LCPlayer {
public void onSignAccess(PlayerInteractEvent event) {
if (!plugin.config.getSignBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE)
return;
if (hasPermission(Perms.NoLimit.SIGN))
if (hasPermission(NoLimitPerms.SIGN))
return;
event.getPlayer().sendMessage(L("blocked.sign"));
event.setCancelled(true);
@ -368,12 +369,12 @@ public class LCPlayer {
if (!plugin.config.getButtonBlock() || event.getPlayer().getGameMode() != GameMode.CREATIVE)
return;
if (event.getClickedBlock().getState() instanceof Lever) {
if (hasPermission(Perms.NoLimit.LEVER))
if (hasPermission(NoLimitPerms.LEVER))
return;
event.getPlayer().sendMessage(L("blocked.lever"));
event.setCancelled(true);
} else {
if (hasPermission(Perms.NoLimit.BUTTON))
if (hasPermission(NoLimitPerms.BUTTON))
return;
event.getPlayer().sendMessage(L("blocked.button"));
event.setCancelled(true);
@ -511,7 +512,7 @@ public class LCPlayer {
}
public boolean hasPermission(IPermission permission) {
return plugin.perm.hasPermission(this.getPlayer(), permission);
return de.jaschastarke.bukkit.lib.permissions.PermissionManager.hasPermission(getPlayer(), permission);
}
public boolean isGameModeAllowed(GameMode gm) {

View file

@ -17,62 +17,56 @@
*/
package de.jaschastarke.minecraft.limitedcreative;
import de.jaschastarke.minecraft.utils.IPermission;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermissionContainer;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
public enum Perms implements IPermission {
CONFIG("config"),
REGIONS("regions"),
REGIONS_BYPASS("regions_bypass"),
GM("switch_gamemode"),
GM_BACKONLY("switch_gamemode.backonly"),
GM_SURVIVAL("switch_gamemode.survival"),
GM_CREATIVE("switch_gamemode.creative"),
GM_ADVENTURE("switch_gamemode.adventure"),
GM_OTHER("switch_gamemode.other"),
KEEPINVENTORY("keepinventory");
CONFIG("config", PermissionDefault.OP),
REGIONS("regions", PermissionDefault.OP),
REGIONS_BYPASS("regions_bypass", PermissionDefault.FALSE),
GM("switch_gamemode", PermissionDefault.OP),
GM_BACKONLY("switch_gamemode.backonly", PermissionDefault.FALSE),
GM_SURVIVAL("switch_gamemode.survival", PermissionDefault.FALSE),
GM_CREATIVE("switch_gamemode.creative", PermissionDefault.FALSE),
GM_ADVENTURE("switch_gamemode.adventure", PermissionDefault.FALSE),
GM_OTHER("switch_gamemode.other", PermissionDefault.OP),
KEEPINVENTORY("keepinventory", PermissionDefault.FALSE);
private static final String NS = "limitedcreative";
private String perm;
private Perms(String permission) {
perm = permission;
public static final IPermissionContainer Root = new IPermissionContainer() {
@Override
public IPermission[] getPermissions() {
return Perms.values();
}
@Override
public String toString() {
return NS + SEP + perm;
}
public enum NoLimit implements IPermission {
DROP("drop"),
PICKUP("pickup"),
CHEST("chest"),
SIGN("sign"),
BUTTON("button"),
LEVER("lever"),
PVP("pvp"),
MOB_DAMAGE("mob_damage"),
USE("use"),
BREAK("break");
private static final String NS = "nolimit";
private String perm;
private NoLimit(String permission) {
perm = permission;
public String getFullString() {
return "limitedcreative";
}
@Override
public String toString() {
return Perms.NS + SEP + NoLimit.NS + SEP + perm;
}
}
public static final class CmdBlock { // not the best way, but this matches to everything in this plugin ;)
public static final String NS = "cmdblock";
public static IPermission ALL = new IPermission() {
public String toString() {
return Perms.NS + SEP + CmdBlock.NS + SEP + "all";
public IAbstractPermission getParent() {
return null;
}
};
private String perm;
private PermissionDefault def;
private Perms(String permission, PermissionDefault pdefault) {
perm = permission;
def = pdefault;
}
@Override
public IAbstractPermission getParent() {
return Root;
}
@Override
public String getFullString() {
return getParent().getFullString() + SEP + perm;
}
@Override
public PermissionDefault getDefault() {
return def;
}
}

View file

@ -0,0 +1,48 @@
package de.jaschastarke.minecraft.limitedcreative.cmdblock;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermissionContainer;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
import de.jaschastarke.minecraft.limitedcreative.Perms;
public enum CmdBlockPerms implements IPermission {
ALL("all", PermissionDefault.FALSE),;
public static final IPermissionContainer Parent = new IPermissionContainer() {
@Override
public IAbstractPermission getParent() {
return Perms.Root;
}
@Override
public IPermission[] getPermissions() {
return CmdBlockPerms.values();
}
@Override
public String getFullString() {
return "cmdblock";
}
};
private String perm;
private PermissionDefault def;
private CmdBlockPerms(String permission, PermissionDefault pdefault) {
perm = permission;
def = pdefault;
}
@Override
public IAbstractPermission getParent() {
return Parent;
}
@Override
public PermissionDefault getDefault() {
return def;
}
@Override
public String getFullString() {
return getParent().getFullString() + SEP + perm;
}
}

View file

@ -7,7 +7,6 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import de.jaschastarke.minecraft.limitedcreative.Core;
import de.jaschastarke.minecraft.limitedcreative.LCPlayer;
import de.jaschastarke.minecraft.limitedcreative.Perms;
import de.jaschastarke.minecraft.limitedcreative.Players;
public class CommandBlocker {
@ -28,7 +27,7 @@ public class CommandBlocker {
for (ICmdBlockEntry blockentry : plugin.config.getCommandBlockList()) {
if (blockentry.test(cmd)) {
LCPlayer player = Players.get(event.getPlayer());
if (!player.hasPermission(Perms.CmdBlock.ALL)) {
if (!player.hasPermission(CmdBlockPerms.ALL)) {
Core.debug("CmdBlock: "+event.getPlayer().getName()+": '/"+cmd+"' blocked by rule '"+blockentry.toString()+"'");
event.setCancelled(true);
event.getPlayer().sendMessage(L("cmdblock.blocked"));

View file

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.jaschastarke.minecraft.limitedcreative.listeners;
package de.jaschastarke.minecraft.limitedcreative.limits;
import static de.jaschastarke.minecraft.utils.Locale.L;
@ -52,8 +52,8 @@ import org.bukkit.material.Lever;
import de.jaschastarke.minecraft.limitedcreative.BlackList;
import de.jaschastarke.minecraft.limitedcreative.Core;
import de.jaschastarke.minecraft.limitedcreative.LCPlayer;
import de.jaschastarke.minecraft.limitedcreative.Perms;
import de.jaschastarke.minecraft.limitedcreative.Players;
import de.jaschastarke.minecraft.limitedcreative.listeners.MainListener;
public class LimitListener implements Listener {
private Core plugin;
@ -78,7 +78,7 @@ public class LimitListener implements Listener {
return;
LCPlayer player = Players.get(event.getPlayer());
if (!player.hasPermission(Perms.NoLimit.USE)) {
if (!player.hasPermission(NoLimitPerms.USE)) {
if (event.getItem() != null && BlackList.isBlackListed(plugin.config.getBlockedUse(), event.getItem())) {
event.setCancelled(true);
event.setUseItemInHand(Event.Result.DENY);
@ -109,7 +109,7 @@ public class LimitListener implements Listener {
return;
LCPlayer player = Players.get(event.getPlayer());
if (!player.hasPermission(Perms.NoLimit.USE)) {
if (!player.hasPermission(NoLimitPerms.USE)) {
if (event.getPlayer().getItemInHand() != null && BlackList.isBlackListed(plugin.config.getBlockedUse(), event.getPlayer().getItemInHand())) {
event.setCancelled(true);
event.getPlayer().sendMessage(L("blocked.use"));
@ -120,7 +120,7 @@ public class LimitListener implements Listener {
// Temporary Solution: While dropping of Items is prevented we don't allow Interaction with ItemFrames, so no
// Items can be "placed" anywhere.
if (!player.hasPermission(Perms.NoLimit.DROP)) {
if (!player.hasPermission(NoLimitPerms.DROP)) {
if (entity instanceof ItemFrame && plugin.config.getRemoveDrop()) {
event.setCancelled(true);
event.getPlayer().sendMessage(L("blocked.use"));
@ -183,14 +183,14 @@ public class LimitListener implements Listener {
private void whenBlockBreak(Cancellable event, Block block, Player eventPlayer) {
if (eventPlayer.getGameMode() == GameMode.CREATIVE) {
LCPlayer player = Players.get(eventPlayer);
if (!player.hasPermission(Perms.NoLimit.BREAK)) {
if (!player.hasPermission(NoLimitPerms.BREAK)) {
if (BlackList.isBlackListed(plugin.config.getBlockedBreaks(), block)) {
event.setCancelled(true);
eventPlayer.sendMessage(L("blocked.break"));
}
}
if (player.hasPermission(Perms.NoLimit.DROP))
if (player.hasPermission(NoLimitPerms.DROP))
return;
// Prevent dropping of doors and beds when destroying the wrong part
@ -240,7 +240,7 @@ public class LimitListener implements Listener {
return;
if (event.getPlayer().getGameMode() == GameMode.CREATIVE) {
LCPlayer player = Players.get(event.getPlayer());
if (!player.hasPermission(Perms.NoLimit.USE)) {
if (!player.hasPermission(NoLimitPerms.USE)) {
if (BlackList.isBlackListed(plugin.config.getBlockedUse(), event.getBlock())) {
event.setCancelled(true);
event.getPlayer().sendMessage(L("blocked.place"));

View file

@ -0,0 +1,57 @@
package de.jaschastarke.minecraft.limitedcreative.limits;
import org.bukkit.permissions.PermissionDefault;
import de.jaschastarke.minecraft.lib.permissions.IAbstractPermission;
import de.jaschastarke.minecraft.lib.permissions.IPermissionContainer;
import de.jaschastarke.minecraft.lib.permissions.IPermission;
import de.jaschastarke.minecraft.limitedcreative.Perms;
public enum NoLimitPerms implements IPermission {
DROP("drop", PermissionDefault.FALSE),
PICKUP("pickup", PermissionDefault.FALSE),
CHEST("chest", PermissionDefault.FALSE),
SIGN("sign", PermissionDefault.FALSE),
BUTTON("button", PermissionDefault.FALSE),
LEVER("lever", PermissionDefault.FALSE),
PVP("pvp", PermissionDefault.FALSE),
MOB_DAMAGE("mob_damage", PermissionDefault.FALSE),
USE("use", PermissionDefault.FALSE),
BREAK("break", PermissionDefault.FALSE);
public static final IPermissionContainer Parent = new IPermissionContainer() {
@Override
public IAbstractPermission getParent() {
return Perms.Root;
}
@Override
public IPermission[] getPermissions() {
return NoLimitPerms.values();
}
@Override
public String getFullString() {
return "nolimit";
}
};
private String perm;
private PermissionDefault def;
private NoLimitPerms(String permission, PermissionDefault pdefault) {
perm = permission;
def = pdefault;
}
@Override
public IAbstractPermission getParent() {
return Parent;
}
@Override
public PermissionDefault getDefault() {
return def;
}
@Override
public String getFullString() {
return getParent().getFullString() + SEP + perm;
}
}

View file

@ -133,7 +133,7 @@ public class RegionListener implements Listener {
Block dest = source.getRelative(event.getDirection(), i);
Core.debug("dest "+i+": "+dest.getType());
if (regionSet(dest).getFlag(Flags.GAMEMODE) != GameMode.CREATIVE) {
plugin.logger.warning(L("blocked.piston", source.getRelative(event.getDirection(), i - 1).getType().toString(), Util.toString(source.getLocation())));
plugin.getLog().warning(L("blocked.piston", source.getRelative(event.getDirection(), i - 1).getType().toString(), Util.toString(source.getLocation())));
event.setCancelled(true);
break;
} else if (dest.getType() == Material.AIR) {
@ -155,12 +155,12 @@ public class RegionListener implements Listener {
Core.debug("dest "+dest.getType());
if (regionSet(source).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) {
if (regionSet(dest).getFlag(Flags.GAMEMODE) != GameMode.CREATIVE) {
plugin.logger.warning(L("blocked.piston", source.getType().toString(), Util.toString(source.getLocation())));
plugin.getLog().warning(L("blocked.piston", source.getType().toString(), Util.toString(source.getLocation())));
event.setCancelled(true);
}
} else if (regionSet(dest).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) {
// source isn't creative
plugin.logger.warning(L("blocked.piston_in", source.getType().toString(), Util.toString(source.getLocation())));
plugin.getLog().warning(L("blocked.piston_in", source.getType().toString(), Util.toString(source.getLocation())));
event.setCancelled(true);
}
}

View file

@ -82,7 +82,7 @@ public class PlayerOptions {
try {
store.save(_store_file);
} catch (IOException e) {
Core.plugin.logger.severe("Failed to save players.yml");
Core.plugin.getLog().severe("Failed to save players.yml");
e.printStackTrace();
}
}