mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-01 21:11:44 +01:00
Updated Essentials to work with R5
This commit is contained in:
parent
3b81593ebb
commit
f46948249e
@ -66,7 +66,7 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
public class Essentials extends JavaPlugin implements IEssentials
|
||||
{
|
||||
public static final int BUKKIT_VERSION = 1846;
|
||||
public static final int BUKKIT_VERSION = 1952;
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient ISettings settings;
|
||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
||||
|
@ -3,7 +3,6 @@ package com.earth2me.essentials;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
@ -12,12 +11,14 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
|
||||
|
||||
public class EssentialsConf extends Configuration
|
||||
public class EssentialsConf extends YamlConfiguration
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient File configFile;
|
||||
@ -26,15 +27,10 @@ public class EssentialsConf extends Configuration
|
||||
|
||||
public EssentialsConf(final File configFile)
|
||||
{
|
||||
super(configFile);
|
||||
super();
|
||||
this.configFile = configFile;
|
||||
if (this.root == null)
|
||||
{
|
||||
this.root = new HashMap<String, Object>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
configFile = configFile.getAbsoluteFile();
|
||||
@ -105,20 +101,24 @@ public class EssentialsConf extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
super.load();
|
||||
super.load(configFile);
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (InvalidConfigurationException ex)
|
||||
{
|
||||
File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis());
|
||||
configFile.renameTo(broken);
|
||||
LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), e.getCause());
|
||||
}
|
||||
|
||||
if (this.root == null)
|
||||
{
|
||||
this.root = new HashMap<String, Object>();
|
||||
LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ public class EssentialsConf extends Configuration
|
||||
|
||||
public boolean hasProperty(final String path)
|
||||
{
|
||||
return getProperty(path) != null;
|
||||
return isSet(path);
|
||||
}
|
||||
|
||||
public Location getLocation(final String path, final Server server) throws Exception
|
||||
@ -218,24 +218,25 @@ public class EssentialsConf extends Configuration
|
||||
|
||||
public void setProperty(final String path, final Location loc)
|
||||
{
|
||||
setProperty((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
|
||||
setProperty((path == null ? "" : path + ".") + "x", loc.getX());
|
||||
setProperty((path == null ? "" : path + ".") + "y", loc.getY());
|
||||
setProperty((path == null ? "" : path + ".") + "z", loc.getZ());
|
||||
setProperty((path == null ? "" : path + ".") + "yaw", loc.getYaw());
|
||||
setProperty((path == null ? "" : path + ".") + "pitch", loc.getPitch());
|
||||
set((path == null ? "" : path + ".") + "world", loc.getWorld().getName());
|
||||
set((path == null ? "" : path + ".") + "x", loc.getX());
|
||||
set((path == null ? "" : path + ".") + "y", loc.getY());
|
||||
set((path == null ? "" : path + ".") + "z", loc.getZ());
|
||||
set((path == null ? "" : path + ".") + "yaw", loc.getYaw());
|
||||
set((path == null ? "" : path + ".") + "pitch", loc.getPitch());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(final String path)
|
||||
{
|
||||
final ItemStack stack = new ItemStack(
|
||||
Material.valueOf(getString(path + ".type", "AIR")),
|
||||
getInt(path + ".amount", 1),
|
||||
(short)getInt(path + ".damage", 0));
|
||||
final List<String> enchants = getKeys(path + ".enchant");
|
||||
final ConfigurationSection enchants = getConfigurationSection(path + ".enchant");
|
||||
if (enchants != null)
|
||||
{
|
||||
for (String enchant : enchants)
|
||||
for (String enchant : enchants.getKeys(false))
|
||||
{
|
||||
final Enchantment enchantment = Enchantment.getByName(enchant.toUpperCase(Locale.ENGLISH));
|
||||
if (enchantment == null)
|
||||
@ -271,14 +272,14 @@ public class EssentialsConf extends Configuration
|
||||
}
|
||||
// getData().getData() is broken
|
||||
//map.put("data", stack.getDurability());
|
||||
setProperty(path, map);
|
||||
set(path, map);
|
||||
}
|
||||
|
||||
public long getLong(final String path, final long def)
|
||||
{
|
||||
try
|
||||
{
|
||||
final Number num = (Number)getProperty(path);
|
||||
final Number num = (Number)get(path);
|
||||
return num == null ? def : num.longValue();
|
||||
}
|
||||
catch (ClassCastException ex)
|
||||
@ -292,7 +293,7 @@ public class EssentialsConf extends Configuration
|
||||
{
|
||||
try
|
||||
{
|
||||
Number num = (Number)getProperty(path);
|
||||
Number num = (Number)get(path);
|
||||
return num == null ? def : num.doubleValue();
|
||||
}
|
||||
catch (ClassCastException ex)
|
||||
@ -300,4 +301,27 @@ public class EssentialsConf extends Configuration
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
try
|
||||
{
|
||||
save(configFile);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public Object getProperty(String path) {
|
||||
return get(path);
|
||||
}
|
||||
|
||||
public void setProperty(String path, Object object) {
|
||||
set(path, object);
|
||||
}
|
||||
|
||||
public void removeProperty(String path) {
|
||||
set(path, null);
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class EssentialsUpgrade
|
||||
}
|
||||
final EssentialsConf conf = new EssentialsConf(configFile);
|
||||
conf.load();
|
||||
List<String> lines = conf.getStringList(name, null);
|
||||
List<String> lines = conf.getStringList(name);
|
||||
if (lines != null && !lines.isEmpty())
|
||||
{
|
||||
if (!file.createNewFile())
|
||||
@ -332,7 +332,7 @@ public class EssentialsUpgrade
|
||||
config.setProperty("homes.home", defloc);
|
||||
}
|
||||
|
||||
List<String> worlds = config.getKeys("home.worlds");
|
||||
Set<String> worlds = config.getConfigurationSection("home.worlds").getKeys(false);
|
||||
Location loc;
|
||||
String worldName;
|
||||
|
||||
@ -381,7 +381,7 @@ public class EssentialsUpgrade
|
||||
}
|
||||
final EssentialsConf usersConfig = new EssentialsConf(usersFile);
|
||||
usersConfig.load();
|
||||
for (String username : usersConfig.getKeys(null))
|
||||
for (String username : usersConfig.getKeys(false))
|
||||
{
|
||||
final User user = new User(new OfflinePlayer(username, ess), ess);
|
||||
final String nickname = usersConfig.getString(username + ".nickname");
|
||||
@ -389,7 +389,7 @@ public class EssentialsUpgrade
|
||||
{
|
||||
user.setNickname(nickname);
|
||||
}
|
||||
final List<String> mails = usersConfig.getStringList(username + ".mail", null);
|
||||
final List<String> mails = usersConfig.getStringList(username + ".mail");
|
||||
if (mails != null && !mails.isEmpty())
|
||||
{
|
||||
user.setMails(mails);
|
||||
@ -701,7 +701,7 @@ public class EssentialsUpgrade
|
||||
if (!config.hasProperty("spawns"))
|
||||
{
|
||||
final Spawns spawns = new Spawns();
|
||||
List<String> keys = config.getKeys();
|
||||
Set<String> keys = config.getKeys(false);
|
||||
for (String group : keys)
|
||||
{
|
||||
Location loc = getFakeLocation(config, group);
|
||||
@ -748,7 +748,7 @@ public class EssentialsUpgrade
|
||||
if (!config.hasProperty("jails"))
|
||||
{
|
||||
final com.earth2me.essentials.settings.Jails jails = new com.earth2me.essentials.settings.Jails();
|
||||
List<String> keys = config.getKeys();
|
||||
Set<String> keys = config.getKeys(false);
|
||||
for (String jailName : keys)
|
||||
{
|
||||
Location loc = getFakeLocation(config, jailName);
|
||||
|
@ -65,7 +65,7 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean getRespawnAtHome();
|
||||
|
||||
List getMultipleHomes();
|
||||
Set getMultipleHomes();
|
||||
|
||||
int getHomeLimit(String set);
|
||||
|
||||
|
@ -666,18 +666,6 @@ public class OfflinePlayer implements Player
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExperience()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExperience(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel()
|
||||
{
|
||||
|
@ -45,15 +45,15 @@ public class Settings implements ISettings
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMultipleHomes()
|
||||
public Set<String> getMultipleHomes()
|
||||
{
|
||||
return config.getKeys("sethome-multiple");
|
||||
return config.getConfigurationSection("sethome-multiple").getKeys(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHomeLimit(final User user)
|
||||
{
|
||||
final List<String> homeList = getMultipleHomes();
|
||||
final Set<String> homeList = getMultipleHomes();
|
||||
if (homeList == null)
|
||||
{
|
||||
//TODO: Replace this code to remove backwards compat, after settings are automatically updated
|
||||
@ -116,7 +116,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public boolean isCommandDisabled(String label)
|
||||
{
|
||||
for (String c : config.getStringList("disabled-commands", new ArrayList<String>(0)))
|
||||
for (String c : config.getStringList("disabled-commands"))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
@ -136,7 +136,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public boolean isCommandRestricted(String label)
|
||||
{
|
||||
for (String c : config.getStringList("restricted-commands", new ArrayList<String>(0)))
|
||||
for (String c : config.getStringList("restricted-commands"))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
@ -150,7 +150,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public boolean isPlayerCommand(String label)
|
||||
{
|
||||
for (String c : config.getStringList("player-commands", new ArrayList<String>(0)))
|
||||
for (String c : config.getStringList("player-commands"))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(label))
|
||||
{
|
||||
@ -164,9 +164,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public boolean isCommandOverridden(String name)
|
||||
{
|
||||
List<String> defaultList = new ArrayList<String>(1);
|
||||
defaultList.add("god");
|
||||
for (String c : config.getStringList("overridden-commands", defaultList))
|
||||
for (String c : config.getStringList("overridden-commands"))
|
||||
{
|
||||
if (!c.equalsIgnoreCase(name))
|
||||
{
|
||||
@ -215,7 +213,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public Object getKit(String name)
|
||||
{
|
||||
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
|
||||
Map<String, Object> kits = (Map<String, Object>)config.get("kits");
|
||||
for (Map.Entry<String, Object> entry : kits.entrySet())
|
||||
{
|
||||
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
|
||||
@ -229,7 +227,7 @@ public class Settings implements ISettings
|
||||
@Override
|
||||
public Map<String, Object> getKits()
|
||||
{
|
||||
return (Map<String, Object>)config.getProperty("kits");
|
||||
return (Map<String, Object>)config.get("kits");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -254,7 +252,7 @@ public class Settings implements ISettings
|
||||
{
|
||||
}
|
||||
|
||||
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
|
||||
return ChatColor.getByChar(colorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -355,7 +353,7 @@ public class Settings implements ISettings
|
||||
public void reloadConfig()
|
||||
{
|
||||
config.load();
|
||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
|
||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
||||
enabledSigns = getEnabledSigns();
|
||||
itemSpawnBl = getItemSpawnBlacklist();
|
||||
chatFormats.clear();
|
||||
@ -407,7 +405,7 @@ public class Settings implements ISettings
|
||||
{
|
||||
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
|
||||
|
||||
for (String signName : config.getStringList("enabledSigns", null))
|
||||
for (String signName : config.getStringList("enabledSigns"))
|
||||
{
|
||||
signName = signName.trim().toUpperCase(Locale.ENGLISH);
|
||||
if (signName.isEmpty())
|
||||
|
@ -209,7 +209,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
private List<Integer> _getUnlimited()
|
||||
{
|
||||
return config.getIntList("unlimited", new ArrayList<Integer>());
|
||||
return config.getIntegerList("unlimited");
|
||||
}
|
||||
|
||||
public List<Integer> getUnlimited()
|
||||
@ -383,7 +383,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
private List<String> _getMails()
|
||||
{
|
||||
return config.getStringList("mail", new ArrayList<String>());
|
||||
return config.getStringList("mail");
|
||||
}
|
||||
|
||||
public List<String> getMails()
|
||||
@ -491,7 +491,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public List<String> getIgnoredPlayers()
|
||||
{
|
||||
return config.getStringList("ignore", new ArrayList<String>());
|
||||
return config.getStringList("ignore");
|
||||
}
|
||||
|
||||
public void setIgnoredPlayers(List<String> players)
|
||||
|
@ -231,12 +231,6 @@ public class FakeWorld implements World
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getSpawnLocation()
|
||||
{
|
||||
@ -578,4 +572,16 @@ public class FakeWorld implements World
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Collection<T> getEntitiesByClass(Class<T> type)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Entity> getEntitiesByClasses(Class<?>... types)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EndermanPickupEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ public class SignEntityListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onEndermanPickup(final EndermanPickupEvent event)
|
||||
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.isCancelled() || ess.getSettings().areSignsDisabled())
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -250,7 +251,6 @@ public class FakeServer implements Server
|
||||
return worlds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e)
|
||||
{
|
||||
World w = new FakeWorld(string, e);
|
||||
@ -258,7 +258,6 @@ public class FakeServer implements Server
|
||||
return w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e, long l)
|
||||
{
|
||||
World w = new FakeWorld(string, e);
|
||||
@ -331,18 +330,6 @@ public class FakeServer implements Server
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e, ChunkGenerator cg)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e, long l, ChunkGenerator cg)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(WorldCreator creator)
|
||||
{
|
||||
@ -666,4 +653,28 @@ public class FakeServer implements Server
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Recipe> getRecipesFor(ItemStack is)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Recipe> recipeIterator()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearRecipes()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetRecipes()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ public class WorldDataHolder {
|
||||
PluginManager pm = server.getPluginManager();
|
||||
Plugin[] plugins = pm.getPlugins();
|
||||
for (int i = 0; i < plugins.length; i++) {
|
||||
plugins[i].getConfiguration().load();
|
||||
//plugins[i].getConfiguration().load();
|
||||
try {
|
||||
plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]);
|
||||
} catch (Exception ex) {
|
||||
|
@ -37,7 +37,7 @@ public class GMGroupEvent extends Event {
|
||||
protected Action action;
|
||||
|
||||
public GMGroupEvent(Group group, Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.group = group;
|
||||
this.action = action;
|
||||
@ -45,7 +45,7 @@ public class GMGroupEvent extends Event {
|
||||
}
|
||||
|
||||
public GMGroupEvent(String groupName, Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.groupName = groupName;
|
||||
this.action = action;
|
||||
|
@ -32,7 +32,7 @@ public class GMSystemEvent extends Event {
|
||||
protected Action action;
|
||||
|
||||
public GMSystemEvent(Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.action = action;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class GMUserEvent extends Event {
|
||||
protected Action action;
|
||||
|
||||
public GMUserEvent(User user, Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.user = user;
|
||||
this.action = action;
|
||||
@ -45,7 +45,7 @@ public class GMUserEvent extends Event {
|
||||
}
|
||||
|
||||
public GMUserEvent(String userName, Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.userName = userName;
|
||||
this.action = action;
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockListener;
|
||||
|
||||
@Deprecated
|
||||
public class EmergencyBlockListener extends BlockListener
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onBlockBurn(final BlockBurnEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockIgnite(final BlockIgniteEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockFromTo(final BlockFromToEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockBreak(final BlockBreakEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityListener;
|
||||
|
||||
@Deprecated
|
||||
public class EmergencyEntityListener extends EntityListener
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onEntityExplode(final EntityExplodeEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamage(final EntityDamageEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.earth2me.essentials.protect;
|
||||
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
|
||||
@Deprecated
|
||||
public class EmergencyPlayerListener extends PlayerListener
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
event.getPlayer().sendMessage("Essentials Protect is in emergency mode. Check your log for errors.");
|
||||
}
|
||||
|
||||
}
|
@ -9,8 +9,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -65,21 +63,8 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
|
||||
|
||||
private void enableEmergencyMode(final PluginManager pm)
|
||||
{
|
||||
//final EmergencyListener emListener = new EmergencyListener();
|
||||
//pm.registerEvents(emListener, this);
|
||||
|
||||
//TODO: Remove deprecated listners in a few weeks.
|
||||
|
||||
final EmergencyBlockListener emBlockListener = new EmergencyBlockListener();
|
||||
final EmergencyEntityListener emEntityListener = new EmergencyEntityListener();
|
||||
final EmergencyPlayerListener emPlayerListener = new EmergencyPlayerListener();
|
||||
pm.registerEvent(Type.PLAYER_JOIN, emPlayerListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_BURN, emBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_IGNITE, emBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_FROMTO, emBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_BREAK, emBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.ENTITY_DAMAGE, emEntityListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.ENTITY_EXPLODE, emEntityListener, Priority.Low, this);
|
||||
final EmergencyListener emListener = new EmergencyListener();
|
||||
pm.registerEvents(emListener, this);
|
||||
|
||||
for (Player player : getServer().getOnlinePlayers())
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ public class EssentialsProtectEntityListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEndermanPickup(EndermanPickupEvent event)
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
{
|
||||
|
@ -7,6 +7,6 @@ public class InstallationFinishedEvent extends Event
|
||||
{
|
||||
public InstallationFinishedEvent()
|
||||
{
|
||||
super(Type.CUSTOM_EVENT);
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class UserManager implements IConf
|
||||
|
||||
public final String getUserByAddress(final String search)
|
||||
{
|
||||
final List<String> usernames = users.getKeys(null);
|
||||
final Set<String> usernames = users.getKeys(false);
|
||||
for (String username : usernames)
|
||||
{
|
||||
final String address = users.getString(username + "." + ADDRESS, null);
|
||||
@ -73,7 +73,7 @@ public class UserManager implements IConf
|
||||
{
|
||||
users.load();
|
||||
spyusers.clear();
|
||||
final List<String> keys = users.getKeys(null);
|
||||
final Set<String> keys = users.getKeys(false);
|
||||
for (String key : keys)
|
||||
{
|
||||
if (isSpy(key))
|
||||
|
@ -183,7 +183,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||
if (config.getBoolean("log-enabled", false))
|
||||
{
|
||||
LOGGER.addHandler(this);
|
||||
logUsers = config.getStringList("log-users", new ArrayList<String>());
|
||||
logUsers = config.getStringList("log-users");
|
||||
final String level = config.getString("log-level", "info");
|
||||
try
|
||||
{
|
||||
@ -351,7 +351,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||
|
||||
private void sendCommand(final Chat chat, final String message)
|
||||
{
|
||||
if (config.getStringList("op-users", new ArrayList<String>()).contains(StringUtils.parseBareAddress(chat.getParticipant())))
|
||||
if (config.getStringList("op-users").contains(StringUtils.parseBareAddress(chat.getParticipant())))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user