mirror of
https://github.com/PEXPlugins/Modifyworld.git
synced 2025-02-07 23:51:29 +01:00
Fixed whitelist option
This commit is contained in:
parent
1807d41d84
commit
bcbb15b96d
@ -45,7 +45,8 @@ public abstract class ModifyworldListener implements Listener {
|
||||
protected boolean useMaterialNames = true;
|
||||
protected boolean checkMetadata = false;
|
||||
protected boolean checkItemUse = false;
|
||||
|
||||
protected boolean enableWhitelist = false;
|
||||
|
||||
public ModifyworldListener(Plugin plugin, ConfigurationSection config) {
|
||||
this.permissionsManager = PermissionsEx.getPermissionManager();
|
||||
this.config = config;
|
||||
@ -57,6 +58,7 @@ public abstract class ModifyworldListener implements Listener {
|
||||
this.useMaterialNames = config.getBoolean("use-material-names", useMaterialNames);
|
||||
this.checkMetadata = config.getBoolean("check-metadata", checkMetadata);
|
||||
this.checkItemUse = config.getBoolean("item-use-check", checkItemUse);
|
||||
this.enableWhitelist = config.getBoolean("whitelist", enableWhitelist);
|
||||
}
|
||||
|
||||
protected void informPlayer(Player player, String message) {
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Modifyworld - PermissionsEx ruleset plugin for Bukkit
|
||||
* Copyright (C) 2011 t3hk0d3 http://www.tehkode.ru
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package ru.tehkode.modifyworld;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author t3hk0d3
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Toggleable {
|
||||
String value();
|
||||
boolean byDefault() default false;
|
||||
}
|
@ -31,7 +31,6 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import ru.tehkode.modifyworld.ModifyworldListener;
|
||||
import ru.tehkode.modifyworld.Toggleable;
|
||||
import ru.tehkode.permissions.PermissionUser;
|
||||
|
||||
/**
|
||||
@ -74,8 +73,11 @@ public class PlayerListener extends ModifyworldListener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@Toggleable("whitelist")
|
||||
public void onPlayerPreLogin(PlayerPreLoginEvent event) {
|
||||
if (!enableWhitelist) {
|
||||
return;
|
||||
}
|
||||
|
||||
PermissionUser user = this.permissionsManager.getUser(event.getName());
|
||||
|
||||
if (user != null && !user.has("modifyworld.login", Bukkit.getServer().getWorlds().get(0).getName())) {
|
||||
@ -85,8 +87,11 @@ public class PlayerListener extends ModifyworldListener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@Toggleable("whitelist")
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
if (!enableWhitelist) {
|
||||
return;
|
||||
}
|
||||
|
||||
PermissionUser user = this.permissionsManager.getUser(event.getPlayer());
|
||||
|
||||
if (user != null && !user.has("modifyworld.login", Bukkit.getServer().getWorlds().get(0).getName())) {
|
||||
|
Loading…
Reference in New Issue
Block a user