mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-17 01:42:07 +02:00
Compare commits
157 Commits
stable-2.8
...
stable-2.8
Author | SHA1 | Date | |
---|---|---|---|
|
1e34a396cd | ||
|
ba96117f55 | ||
|
96b217cbe8 | ||
|
0dd5c0370e | ||
|
bdf32cde9e | ||
|
e91ed60441 | ||
|
8577202f48 | ||
|
7819b9d2f0 | ||
|
15c0565923 | ||
|
2b25ca2932 | ||
|
c7a6677d52 | ||
|
c3d5b32986 | ||
|
cbfb524195 | ||
|
b16a1f7237 | ||
|
e28f1b1be3 | ||
|
b512a243e7 | ||
|
873c9880dd | ||
|
e6736e48a5 | ||
|
caf598f55b | ||
|
619e099a04 | ||
|
faba1e3604 | ||
|
7cb728b15f | ||
|
3e3c7f0d54 | ||
|
a45c19a08b | ||
|
eb74a1de9c | ||
|
8450734cf1 | ||
|
016299a1dd | ||
|
d27ff9abb6 | ||
|
cdf5d45483 | ||
|
5622882602 | ||
|
b3d3928db8 | ||
|
6df3b9008a | ||
|
c36ca65e09 | ||
|
2e788802fe | ||
|
b0552019f5 | ||
|
dae69622a5 | ||
|
696b930fb2 | ||
|
e43a62f992 | ||
|
02c1cb05c7 | ||
|
b44d738867 | ||
|
e1818f7e62 | ||
|
e5081db7e4 | ||
|
ba346bd797 | ||
|
0670ece7f3 | ||
|
a8da3eebd7 | ||
|
056303b53c | ||
|
454f7d30de | ||
|
6d1c270976 | ||
|
d1001274bb | ||
|
3099855562 | ||
|
3f26d4ad98 | ||
|
bae337cc49 | ||
|
3823e7a108 | ||
|
1c2221f52f | ||
|
1b780a4364 | ||
|
ac3e65a829 | ||
|
332f19177e | ||
|
6ab57b9abe | ||
|
862f3aad59 | ||
|
e277acf80e | ||
|
9f893e68e9 | ||
|
833a5b2b55 | ||
|
340f0c68eb | ||
|
a5e3182dad | ||
|
10ae9c3aa2 | ||
|
bcf903de92 | ||
|
ad08d27504 | ||
|
d24f77dbd5 | ||
|
a5b38ce1a4 | ||
|
5d048d2c1d | ||
|
13d3cc3306 | ||
|
9f02fb4dd4 | ||
|
07baa6e611 | ||
|
50bd5869bf | ||
|
fa49fc91d2 | ||
|
28f478dd04 | ||
|
6fb8dad0ec | ||
|
9f605e9a88 | ||
|
e5b91dae73 | ||
|
e1749fecd1 | ||
|
358edff798 | ||
|
34f13ba89c | ||
|
945ba6f8ab | ||
|
46f05ee92f | ||
|
6d46fc66ce | ||
|
ed7fe9213f | ||
|
9c68cbae72 | ||
|
c0df771539 | ||
|
9bd0c33fef | ||
|
cf7da7a83f | ||
|
f46948249e | ||
|
3b81593ebb | ||
|
8042cefd3d | ||
|
514f07ce57 | ||
|
4f4d9f6209 | ||
|
3077ea4ef1 | ||
|
945ae71480 | ||
|
3d1c0fd157 | ||
|
fab9688abb | ||
|
b2dbb3f9e3 | ||
|
16a0f44b4d | ||
|
7633b136e3 | ||
|
0252d756f6 | ||
|
ad05516fd5 | ||
|
6d127012d8 | ||
|
c064da9af8 | ||
|
d05f2d7a32 | ||
|
3fc6bb4e4f | ||
|
59679e0423 | ||
|
1a2acb43ae | ||
|
f0c0ee1a8d | ||
|
3c98718387 | ||
|
cfdb2a36c1 | ||
|
3b7d194902 | ||
|
72d514d52f | ||
|
9fe119e720 | ||
|
4a5c431163 | ||
|
a6ac333a74 | ||
|
bc2578b788 | ||
|
36d07cb539 | ||
|
effe0d5ec5 | ||
|
0ab2e745cf | ||
|
57a2ef08d4 | ||
|
2699e02f96 | ||
|
62cd219b4e | ||
|
2d56de1483 | ||
|
bbc6da5106 | ||
|
b0d06ce6ed | ||
|
de1554cb68 | ||
|
c890ea8f87 | ||
|
c0517c1203 | ||
|
9efd0eb6f9 | ||
|
f0ee026fb9 | ||
|
b3fc790000 | ||
|
83f9209bcc | ||
|
691a0ef4ce | ||
|
97bd49e598 | ||
|
e93e50f6d2 | ||
|
76ba5caeec | ||
|
6ca1cdec4f | ||
|
86a1dda46c | ||
|
4326ce0d4a | ||
|
3ff1f4adbb | ||
|
492c4e8521 | ||
|
e3f3fe84ea | ||
|
6e2ac3b56e | ||
|
5c19e71858 | ||
|
a0103afde3 | ||
|
dbf30740fb | ||
|
92fa415848 | ||
|
2942ef40f3 | ||
|
3f02bcd702 | ||
|
fe050dd725 | ||
|
5b4966c888 | ||
|
e2abf05a27 | ||
|
8500542e93 | ||
|
2c8aa20542 |
@@ -66,6 +66,7 @@ endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.BOSEconomy7.jar=../lib/BOSEconomy7.jar
|
||||
file.reference.bPermissions.jar=../lib/bPermissions.jar
|
||||
file.reference.bpermissions2.jar=../lib/bpermissions2.jar
|
||||
file.reference.bukkit.jar=../lib/bukkit.jar
|
||||
file.reference.craftbukkit.jar=../lib/craftbukkit.jar
|
||||
file.reference.iCo4.jar=../lib/iCo4.jar
|
||||
@@ -76,6 +77,7 @@ file.reference.MultiCurrency.jar=../lib/MultiCurrency.jar
|
||||
file.reference.Permissions3.jar=../lib/Permissions3.jar
|
||||
file.reference.PermissionsBukkit-1.2.jar=../lib/PermissionsBukkit-1.2.jar
|
||||
file.reference.PermissionsEx.jar=../lib/PermissionsEx.jar
|
||||
file.reference.Privileges.jar=..\\lib\\Privileges.jar
|
||||
file.reference.Vault.jar=../lib/Vault.jar
|
||||
includes=**
|
||||
jar.archive.disabled=${jnlp.enabled}
|
||||
@@ -95,7 +97,9 @@ javac.classpath=\
|
||||
${reference.EssentialsGroupManager.jar}:\
|
||||
${file.reference.bukkit.jar}:\
|
||||
${file.reference.craftbukkit.jar}:\
|
||||
${file.reference.Vault.jar}
|
||||
${file.reference.Vault.jar}:\
|
||||
${file.reference.Privileges.jar}:\
|
||||
${file.reference.bpermissions2.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
@@ -32,15 +32,20 @@ import com.earth2me.essentials.signs.SignPlayerListener;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -61,7 +66,7 @@ import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
public class Essentials extends JavaPlugin implements IEssentials
|
||||
{
|
||||
public static final int BUKKIT_VERSION = 1818;
|
||||
public static final int BUKKIT_VERSION = 1988;
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private transient ISettings settings;
|
||||
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
|
||||
@@ -124,11 +129,11 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
|
||||
}
|
||||
}
|
||||
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-R[0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
||||
final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
||||
if (versionMatch.matches())
|
||||
{
|
||||
final int versionNumber = Integer.parseInt(versionMatch.group(4));
|
||||
if (versionNumber < BUKKIT_VERSION)
|
||||
final int versionNumber = Integer.parseInt(versionMatch.group(1));
|
||||
if (versionNumber < BUKKIT_VERSION && versionNumber > 100)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, _("notRecommendedBukkit"));
|
||||
LOGGER.log(Level.SEVERE, _("requiredBukkit", Integer.toString(BUKKIT_VERSION)));
|
||||
@@ -277,7 +282,29 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
if (pc != null)
|
||||
{
|
||||
alternativeCommandsHandler.executed(commandLabel, pc.getLabel());
|
||||
return pc.execute(sender, commandLabel, args);
|
||||
try
|
||||
{
|
||||
return pc.execute(sender, commandLabel, args);
|
||||
}
|
||||
catch (final Exception ex)
|
||||
{
|
||||
final ArrayList<StackTraceElement> elements = new ArrayList<StackTraceElement>(Arrays.asList(ex.getStackTrace()));
|
||||
elements.remove(0);
|
||||
final ArrayList<StackTraceElement> toRemove = new ArrayList<StackTraceElement>();
|
||||
for (final StackTraceElement e : elements)
|
||||
{
|
||||
if (e.getClassName().equals("com.earth2me.essentials.Essentials"))
|
||||
{
|
||||
toRemove.add(e);
|
||||
}
|
||||
}
|
||||
elements.removeAll(toRemove);
|
||||
final StackTraceElement[] trace = elements.toArray(new StackTraceElement[elements.size()]);
|
||||
ex.setStackTrace(trace);
|
||||
ex.printStackTrace();
|
||||
sender.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ public class EssentialsBlockListener implements Listener
|
||||
{
|
||||
return;
|
||||
}
|
||||
boolean unlimitedForUser = user.hasUnlimited(is);
|
||||
final boolean unlimitedForUser = user.hasUnlimited(is);
|
||||
if (unlimitedForUser && user.getGameMode() == GameMode.SURVIVAL)
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(
|
||||
|
@@ -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,19 +101,24 @@ public class EssentialsConf extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
super.load();
|
||||
super.load(configFile);
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString());
|
||||
throw e;
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
if (this.root == null)
|
||||
catch (IOException ex)
|
||||
{
|
||||
this.root = new HashMap<String, Object>();
|
||||
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(), ex.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,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
|
||||
@@ -217,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)
|
||||
@@ -270,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)
|
||||
@@ -291,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)
|
||||
@@ -299,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);
|
||||
}
|
||||
}
|
||||
|
@@ -24,48 +24,47 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
public void onEntityDamage(final EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (event instanceof EntityDamageByEntityEvent)
|
||||
final Entity eAttack = event.getDamager();
|
||||
final Entity eDefend = event.getEntity();
|
||||
if (eDefend instanceof Player && eAttack instanceof Player)
|
||||
{
|
||||
EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event;
|
||||
Entity eAttack = edEvent.getDamager();
|
||||
Entity eDefend = edEvent.getEntity();
|
||||
if (eDefend instanceof Player && eAttack instanceof Player)
|
||||
final User defender = ess.getUser(eDefend);
|
||||
final User attacker = ess.getUser(eAttack);
|
||||
attacker.updateActivity(true);
|
||||
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
|
||||
if (commandList != null && !commandList.isEmpty())
|
||||
{
|
||||
User defender = ess.getUser(eDefend);
|
||||
User attacker = ess.getUser(eAttack);
|
||||
attacker.updateActivity(true);
|
||||
ItemStack is = attacker.getItemInHand();
|
||||
List<String> commandList = attacker.getPowertool(is);
|
||||
if (commandList != null && !commandList.isEmpty())
|
||||
for (String command : commandList)
|
||||
{
|
||||
for (String command : commandList)
|
||||
if (command != null && !command.isEmpty())
|
||||
{
|
||||
|
||||
if (command != null && !command.isEmpty())
|
||||
{
|
||||
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", defender.getName()));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (eDefend instanceof Animals && eAttack instanceof Player)
|
||||
}
|
||||
else if (eDefend instanceof Animals && eAttack instanceof Player)
|
||||
{
|
||||
final User player = ess.getUser(eAttack);
|
||||
final ItemStack hand = player.getItemInHand();
|
||||
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||
{
|
||||
User player = ess.getUser(eAttack);
|
||||
ItemStack hand = player.getItemInHand();
|
||||
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||
{
|
||||
((Animals)eDefend).setAge(-24000);
|
||||
hand.setType(Material.BUCKET);
|
||||
player.setItemInHand(hand);
|
||||
player.updateInventory();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
((Animals)eDefend).setAge(-24000);
|
||||
hand.setType(Material.BUCKET);
|
||||
player.setItemInHand(hand);
|
||||
player.updateInventory();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityDamage(final EntityDamageEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
||||
{
|
||||
final Player player = (Player)event.getEntity();
|
||||
@@ -76,7 +75,7 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityCombust(EntityCombustEvent event)
|
||||
public void onEntityCombust(final EntityCombustEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
||||
{
|
||||
@@ -85,26 +84,22 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityDeath(final EntityDeathEvent event)
|
||||
public void onPlayerDeathEvent(final PlayerDeathEvent event)
|
||||
{
|
||||
if (event instanceof PlayerDeathEvent)
|
||||
final User user = ess.getUser(event.getEntity());
|
||||
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
||||
{
|
||||
final PlayerDeathEvent pdevent = (PlayerDeathEvent)event;
|
||||
final User user = ess.getUser(pdevent.getEntity());
|
||||
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
||||
{
|
||||
user.setLastLocation();
|
||||
user.sendMessage(_("backAfterDeath"));
|
||||
}
|
||||
if (!ess.getSettings().areDeathMessagesEnabled())
|
||||
{
|
||||
pdevent.setDeathMessage("");
|
||||
}
|
||||
user.setLastLocation();
|
||||
user.sendMessage(_("backAfterDeath"));
|
||||
}
|
||||
if (!ess.getSettings().areDeathMessagesEnabled())
|
||||
{
|
||||
event.setDeathMessage("");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
||||
public void onFoodLevelChange(final FoodLevelChangeEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
|
||||
{
|
||||
@@ -113,7 +108,7 @@ public class EssentialsEntityListener implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityRegainHealth(EntityRegainHealthEvent event)
|
||||
public void onEntityRegainHealth(final EntityRegainHealthEvent event)
|
||||
{
|
||||
if (event.getRegainReason() == RegainReason.SATIATED && event.getEntity() instanceof Player
|
||||
&& ess.getUser(event.getEntity()).isAfk() && ess.getSettings().getFreezeAfkPlayers())
|
||||
|
@@ -182,10 +182,16 @@ public class EssentialsPlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerLogin(final PlayerLoginEvent event)
|
||||
{
|
||||
if (event.getResult() != Result.ALLOWED && event.getResult() != Result.KICK_FULL && event.getResult() != Result.KICK_BANNED)
|
||||
switch (event.getResult())
|
||||
{
|
||||
case ALLOWED:
|
||||
case KICK_FULL:
|
||||
case KICK_BANNED:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
User user = ess.getUser(event.getPlayer());
|
||||
user.setNPC(false);
|
||||
|
||||
@@ -194,7 +200,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
user.checkMuteTimeout(currentTime);
|
||||
user.checkJailTimeout(currentTime);
|
||||
|
||||
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
|
||||
if (!banExpired && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
|
||||
{
|
||||
final String banReason = user.getBanReason();
|
||||
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : _("defaultBanReason"));
|
||||
@@ -233,18 +239,13 @@ public class EssentialsPlayerListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
//There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
|
||||
if ((event.getCause() == TeleportCause.PLUGIN || event.getCause() == TeleportCause.COMMAND) && ess.getSettings().registerBackInListener())
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.setLastLocation();
|
||||
}
|
||||
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayNick();
|
||||
}
|
||||
updateCompass(user);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
@@ -277,51 +278,6 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerAnimation(final PlayerAnimationEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.updateActivity(true);
|
||||
if (event.getAnimationType() == PlayerAnimationType.ARM_SWING
|
||||
&& user.hasPowerTools() && user.arePowerToolsEnabled())
|
||||
{
|
||||
usePowertools(user);
|
||||
}
|
||||
}
|
||||
|
||||
private void usePowertools(final User user)
|
||||
{
|
||||
final ItemStack is = user.getItemInHand();
|
||||
int id;
|
||||
if (is == null || (id = is.getTypeId()) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final List<String> commandList = user.getPowertool(id);
|
||||
if (commandList == null || commandList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to loop through each command and execute
|
||||
for (String command : commandList)
|
||||
{
|
||||
if (command.matches(".*\\{player\\}.*"))
|
||||
{
|
||||
//user.sendMessage("Click a player to use this command");
|
||||
continue;
|
||||
}
|
||||
else if (command.startsWith("c:"))
|
||||
{
|
||||
user.chat(command.substring(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
user.getServer().dispatchCommand(user.getBase(), command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
@@ -336,7 +292,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
User spyer = ess.getUser(player);
|
||||
final User spyer = ess.getUser(player);
|
||||
if (spyer.isSocialSpyEnabled() && !user.equals(spyer))
|
||||
{
|
||||
player.sendMessage(user.getDisplayName() + " : " + event.getMessage());
|
||||
@@ -352,9 +308,15 @@ public class EssentialsPlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (ess.getSettings().changeDisplayName())
|
||||
{
|
||||
user.setDisplayNick();
|
||||
}
|
||||
updateCompass(user);
|
||||
|
||||
if (ess.getSettings().getNoGodWorlds().contains(event.getPlayer().getLocation().getWorld().getName()))
|
||||
{
|
||||
User user = ess.getUser(event.getPlayer());
|
||||
if (user.isGodModeEnabledRaw())
|
||||
{
|
||||
user.sendMessage(_("noGodWorldWarning"));
|
||||
@@ -362,26 +324,84 @@ public class EssentialsPlayerListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
user.updateActivity(true);
|
||||
switch (event.getAction())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
|
||||
{
|
||||
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ess.getSettings().getUpdateBedAtDaytime() && event.getClickedBlock().getType() == Material.BED_BLOCK)
|
||||
{
|
||||
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
}
|
||||
break;
|
||||
case LEFT_CLICK_AIR:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
if (user.hasPowerTools() && user.arePowerToolsEnabled())
|
||||
{
|
||||
if (usePowertools(user))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean usePowertools(final User user)
|
||||
{
|
||||
final ItemStack is = user.getItemInHand();
|
||||
int id;
|
||||
if (is == null || (id = is.getTypeId()) == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final List<String> commandList = user.getPowertool(id);
|
||||
if (commandList == null || commandList.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
boolean used = false;
|
||||
// We need to loop through each command and execute
|
||||
for (final String command : commandList)
|
||||
{
|
||||
if (command.matches(".*\\{player\\}.*"))
|
||||
{
|
||||
//user.sendMessage("Click a player to use this command");
|
||||
continue;
|
||||
}
|
||||
else if (command.startsWith("c:"))
|
||||
{
|
||||
used = true;
|
||||
user.chat(command.substring(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
used = true;
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
user.getServer().dispatchCommand(user.getBase(), command);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return used;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event)
|
||||
public void onPlayerPickupItem(final PlayerPickupItemEvent event)
|
||||
{
|
||||
if (event.isCancelled() || !ess.getSettings().getDisableItemPickupWhileAfk())
|
||||
{
|
||||
|
@@ -3,6 +3,7 @@ package com.earth2me.essentials;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -22,10 +23,17 @@ public class EssentialsTimer implements Runnable
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
final User user = ess.getUser(player);
|
||||
onlineUsers.add(user);
|
||||
user.setLastOnlineActivity(currentTime);
|
||||
user.checkActivity();
|
||||
try
|
||||
{
|
||||
final User user = ess.getUser(player);
|
||||
onlineUsers.add(user);
|
||||
user.setLastOnlineActivity(currentTime);
|
||||
user.checkActivity();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ess.getLogger().log(Level.WARNING, "EssentialsTimer Error:", e);
|
||||
}
|
||||
}
|
||||
|
||||
final Iterator<User> iterator = onlineUsers.iterator();
|
||||
|
@@ -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())
|
||||
@@ -271,18 +271,18 @@ public class EssentialsUpgrade
|
||||
if (config.hasProperty("powertools"))
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<Integer, Object> powertools = (Map<Integer, Object>)config.getProperty("powertools");
|
||||
final Map<String, Object> powertools = config.getConfigurationSection("powertools").getValues(false);
|
||||
if (powertools == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (Map.Entry<Integer, Object> entry : powertools.entrySet())
|
||||
for (Map.Entry<String, Object> entry : powertools.entrySet())
|
||||
{
|
||||
if (entry.getValue() instanceof String)
|
||||
{
|
||||
List<String> temp = new ArrayList<String>();
|
||||
temp.add((String)entry.getValue());
|
||||
((Map<Integer, Object>)powertools).put(entry.getKey(), temp);
|
||||
((Map<String, Object>)powertools).put(entry.getKey(), temp);
|
||||
}
|
||||
}
|
||||
config.save();
|
||||
@@ -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);
|
||||
|
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated This will be moved to the api package soon
|
||||
*/
|
||||
|
@@ -2,11 +2,13 @@ package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.signs.EssentialsSign;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
|
||||
@@ -14,12 +16,12 @@ public interface ISettings extends IConf
|
||||
{
|
||||
boolean areSignsDisabled();
|
||||
|
||||
String format(String format, IUser user);
|
||||
|
||||
String getAnnounceNewPlayerFormat(IUser user);
|
||||
IText getAnnounceNewPlayerFormat();
|
||||
|
||||
boolean getAnnounceNewPlayers();
|
||||
|
||||
String getNewPlayerKit();
|
||||
|
||||
String getBackupCommand();
|
||||
|
||||
long getBackupInterval();
|
||||
@@ -35,14 +37,14 @@ public interface ISettings extends IConf
|
||||
String getCurrencySymbol();
|
||||
|
||||
int getOversizedStackSize();
|
||||
|
||||
|
||||
int getDefaultStackSize();
|
||||
|
||||
double getHealCooldown();
|
||||
|
||||
Object getKit(String name);
|
||||
Map<String, Object> getKit(String name);
|
||||
|
||||
Map<String, Object> getKits();
|
||||
ConfigurationSection getKits();
|
||||
|
||||
String getLocale();
|
||||
|
||||
@@ -66,7 +68,7 @@ public interface ISettings extends IConf
|
||||
|
||||
boolean getRespawnAtHome();
|
||||
|
||||
List getMultipleHomes();
|
||||
Set getMultipleHomes();
|
||||
|
||||
int getHomeLimit(String set);
|
||||
|
||||
@@ -101,7 +103,7 @@ public interface ISettings extends IConf
|
||||
boolean isTradeInStacks(int id);
|
||||
|
||||
List<Integer> itemSpawnBlacklist();
|
||||
|
||||
|
||||
List<EssentialsSign> enabledSigns();
|
||||
|
||||
boolean permissionBasedItemSpawn();
|
||||
@@ -116,8 +118,12 @@ public interface ISettings extends IConf
|
||||
|
||||
double getMaxMoney();
|
||||
|
||||
double getMinMoney();
|
||||
|
||||
boolean isEcoLogEnabled();
|
||||
|
||||
boolean isEcoLogUpdateEnabled();
|
||||
|
||||
boolean removeGodOnDisconnect();
|
||||
|
||||
boolean changeDisplayName();
|
||||
@@ -143,18 +149,18 @@ public interface ISettings extends IConf
|
||||
public void setDebug(boolean debug);
|
||||
|
||||
Set<String> getNoGodWorlds();
|
||||
|
||||
|
||||
boolean getUpdateBedAtDaytime();
|
||||
|
||||
|
||||
boolean getRepairEnchanted();
|
||||
|
||||
|
||||
boolean getIsWorldTeleportPermissions();
|
||||
|
||||
|
||||
boolean registerBackInListener();
|
||||
|
||||
boolean getDisableItemPickupWhileAfk();
|
||||
|
||||
EventPriority getRespawnPriority();
|
||||
|
||||
|
||||
long getTpaAcceptCancellation();
|
||||
}
|
||||
|
@@ -32,6 +32,8 @@ public interface IUser extends Player
|
||||
void takeMoney(double value);
|
||||
|
||||
void giveMoney(double value);
|
||||
|
||||
boolean canAfford(double value);
|
||||
|
||||
String getGroup();
|
||||
|
||||
|
@@ -1,18 +1,24 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IJails;
|
||||
import com.earth2me.essentials.storage.AsyncStorageObjectHolder;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
@@ -33,13 +39,8 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
final PluginManager pluginManager = ess.getServer().getPluginManager();
|
||||
final JailBlockListener blockListener = new JailBlockListener();
|
||||
final JailPlayerListener playerListener = new JailPlayerListener();
|
||||
pluginManager.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Low, ess);
|
||||
pluginManager.registerEvent(Type.BLOCK_DAMAGE, blockListener, Priority.Low, ess);
|
||||
pluginManager.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Low, ess);
|
||||
pluginManager.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.Low, ess);
|
||||
pluginManager.registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.High, ess);
|
||||
pluginManager.registerEvent(Type.PLAYER_TELEPORT, playerListener, Priority.High, ess);
|
||||
pluginManager.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.High, ess);
|
||||
pluginManager.registerEvents(blockListener, ess);
|
||||
pluginManager.registerEvents(playerListener, ess);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,9 +147,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
|
||||
|
||||
private class JailBlockListener extends BlockListener
|
||||
private class JailBlockListener implements Listener
|
||||
{
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockBreak(final BlockBreakEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -158,7 +159,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockPlace(final BlockPlaceEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -168,7 +169,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onBlockDamage(final BlockDamageEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -180,9 +181,9 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
|
||||
|
||||
private class JailPlayerListener extends PlayerListener
|
||||
private class JailPlayerListener implements Listener
|
||||
{
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -192,7 +193,7 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerRespawn(final PlayerRespawnEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -207,11 +208,18 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerTeleport(final PlayerTeleportEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -226,12 +234,19 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
user.sendMessage(_("jailMessage"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@@ -246,7 +261,14 @@ public class Jails extends AsyncStorageObjectHolder<com.earth2me.essentials.sett
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
|
||||
if (ess.getSettings().isDebug())
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.log(Level.INFO, _("returnPlayerToJailError", user.getName(), ex.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
user.sendMessage(_("jailMessage"));
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import static com.earth2me.essentials.I18n.capitalCase;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import java.util.*;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@@ -15,16 +17,16 @@ public class Kit
|
||||
{
|
||||
try
|
||||
{
|
||||
final Map<String, Object> kits = ess.getSettings().getKits();
|
||||
final ConfigurationSection kits = ess.getSettings().getKits();
|
||||
final StringBuilder list = new StringBuilder();
|
||||
for (String kiteItem : kits.keySet())
|
||||
for (String kiteItem : kits.getKeys(false))
|
||||
{
|
||||
if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
list.append(" ").append(kiteItem);
|
||||
list.append(" ").append(capitalCase(kiteItem));
|
||||
}
|
||||
}
|
||||
return list.toString();
|
||||
return list.toString().trim();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -59,11 +61,16 @@ public class Kit
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getItems(final User user, final Map<String, Object> els) throws Exception
|
||||
public static List<String> getItems(final User user, final Map<String, Object> kit) throws Exception
|
||||
{
|
||||
if (kit == null)
|
||||
{
|
||||
throw new Exception(_("kitError2"));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return (List<String>)els.get("items");
|
||||
return (List<String>)kit.get("items");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -9,40 +10,40 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public enum Mob
|
||||
{
|
||||
CHICKEN("Chicken", Enemies.FRIENDLY, CreatureType.CHICKEN),
|
||||
COW("Cow", Enemies.FRIENDLY, CreatureType.COW),
|
||||
CREEPER("Creeper", Enemies.ENEMY, CreatureType.CREEPER),
|
||||
GHAST("Ghast", Enemies.ENEMY, CreatureType.GHAST),
|
||||
GIANT("Giant", Enemies.ENEMY, CreatureType.GIANT),
|
||||
PIG("Pig", Enemies.FRIENDLY, CreatureType.PIG),
|
||||
PIGZOMB("PigZombie", Enemies.NEUTRAL, CreatureType.PIG_ZOMBIE),
|
||||
SHEEP("Sheep", Enemies.FRIENDLY, "", CreatureType.SHEEP),
|
||||
SKELETON("Skeleton", Enemies.ENEMY, CreatureType.SKELETON),
|
||||
SLIME("Slime", Enemies.ENEMY, CreatureType.SLIME),
|
||||
SPIDER("Spider", Enemies.ENEMY, CreatureType.SPIDER),
|
||||
SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID),
|
||||
ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE),
|
||||
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF),
|
||||
CAVESPIDER("CaveSpider", Enemies.ENEMY, CreatureType.CAVE_SPIDER),
|
||||
ENDERMAN("Enderman", Enemies.ENEMY, "", CreatureType.ENDERMAN),
|
||||
SILVERFISH("Silverfish", Enemies.ENEMY, "", CreatureType.SILVERFISH),
|
||||
ENDERDRAGON("EnderDragon", Enemies.ENEMY, CreatureType.ENDER_DRAGON),
|
||||
VILLAGER("Villager", Enemies.FRIENDLY, CreatureType.VILLAGER),
|
||||
BLAZE("Blaze", Enemies.ENEMY, CreatureType.BLAZE),
|
||||
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, CreatureType.MUSHROOM_COW),
|
||||
MAGMACUBE("MagmaCube", Enemies.ENEMY, CreatureType.MAGMA_CUBE),
|
||||
SNOWMAN("Snowman", Enemies.FRIENDLY, "", CreatureType.SNOWMAN);
|
||||
CHICKEN("Chicken", Enemies.FRIENDLY, EntityType.CHICKEN),
|
||||
COW("Cow", Enemies.FRIENDLY, EntityType.COW),
|
||||
CREEPER("Creeper", Enemies.ENEMY, EntityType.CREEPER),
|
||||
GHAST("Ghast", Enemies.ENEMY, EntityType.GHAST),
|
||||
GIANT("Giant", Enemies.ENEMY, EntityType.GIANT),
|
||||
PIG("Pig", Enemies.FRIENDLY, EntityType.PIG),
|
||||
PIGZOMB("PigZombie", Enemies.NEUTRAL, EntityType.PIG_ZOMBIE),
|
||||
SHEEP("Sheep", Enemies.FRIENDLY, "", EntityType.SHEEP),
|
||||
SKELETON("Skeleton", Enemies.ENEMY, EntityType.SKELETON),
|
||||
SLIME("Slime", Enemies.ENEMY, EntityType.SLIME),
|
||||
SPIDER("Spider", Enemies.ENEMY, EntityType.SPIDER),
|
||||
SQUID("Squid", Enemies.FRIENDLY, EntityType.SQUID),
|
||||
ZOMBIE("Zombie", Enemies.ENEMY, EntityType.ZOMBIE),
|
||||
WOLF("Wolf", Enemies.NEUTRAL, EntityType.WOLF),
|
||||
CAVESPIDER("CaveSpider", Enemies.ENEMY, EntityType.CAVE_SPIDER),
|
||||
ENDERMAN("Enderman", Enemies.ENEMY, "", EntityType.ENDERMAN),
|
||||
SILVERFISH("Silverfish", Enemies.ENEMY, "", EntityType.SILVERFISH),
|
||||
ENDERDRAGON("EnderDragon", Enemies.ENEMY, EntityType.ENDER_DRAGON),
|
||||
VILLAGER("Villager", Enemies.FRIENDLY, EntityType.VILLAGER),
|
||||
BLAZE("Blaze", Enemies.ENEMY, EntityType.BLAZE),
|
||||
MUSHROOMCOW("MushroomCow", Enemies.FRIENDLY, EntityType.MUSHROOM_COW),
|
||||
MAGMACUBE("MagmaCube", Enemies.ENEMY, EntityType.MAGMA_CUBE),
|
||||
SNOWMAN("Snowman", Enemies.FRIENDLY, "", EntityType.SNOWMAN);
|
||||
|
||||
public static final Logger logger = Logger.getLogger("Minecraft");
|
||||
|
||||
private Mob(String n, Enemies en, String s, CreatureType type)
|
||||
private Mob(String n, Enemies en, String s, EntityType type)
|
||||
{
|
||||
this.suffix = s;
|
||||
this.name = n;
|
||||
@@ -50,7 +51,7 @@ public enum Mob
|
||||
this.bukkitType = type;
|
||||
}
|
||||
|
||||
private Mob(String n, Enemies en, CreatureType type)
|
||||
private Mob(String n, Enemies en, EntityType type)
|
||||
{
|
||||
this.name = n;
|
||||
this.type = en;
|
||||
@@ -59,7 +60,7 @@ public enum Mob
|
||||
public String suffix = "s";
|
||||
final public String name;
|
||||
final public Enemies type;
|
||||
final private CreatureType bukkitType;
|
||||
final private EntityType bukkitType;
|
||||
private static final Map<String, Mob> hashMap = new HashMap<String, Mob>();
|
||||
|
||||
static
|
||||
@@ -71,7 +72,7 @@ public enum Mob
|
||||
}
|
||||
|
||||
public static Set<String> getMobList() {
|
||||
return hashMap.keySet();
|
||||
return Collections.unmodifiableSet(hashMap.keySet());
|
||||
}
|
||||
|
||||
public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException
|
||||
@@ -99,7 +100,7 @@ public enum Mob
|
||||
final protected String type;
|
||||
}
|
||||
|
||||
public CreatureType getType()
|
||||
public EntityType getType()
|
||||
{
|
||||
return bukkitType;
|
||||
}
|
||||
|
@@ -1,22 +1,28 @@
|
||||
package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.craftbukkit.OfflineBedLocation;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.*;
|
||||
import lombok.Delegate;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.inventory.InventoryView.Property;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
||||
@@ -170,11 +176,6 @@ public class OfflinePlayer implements Player
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPlayer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemainingAir()
|
||||
{
|
||||
@@ -664,18 +665,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()
|
||||
{
|
||||
@@ -857,4 +846,185 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidePlayer(Player player)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPlayer(Player player)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSee(Player player)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPotionEffect(PotionEffect pe)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPotionEffect(PotionEffect pe, boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addPotionEffects(Collection<PotionEffect> clctn)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPotionEffect(PotionEffectType pet)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePotionEffect(PotionEffectType pet)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PotionEffect> getActivePotionEffects()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Projectile> T launchProjectile(Class<? extends T> arg0)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getType()
|
||||
{
|
||||
return EntityType.PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void playEffect(Location lctn, Effect effect, T t)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setWindowProperty(Property prprt, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryView getOpenInventory()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryView openInventory(Inventory invntr)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryView openWorkbench(Location lctn, boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryView openEnchanting(Location lctn, boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(InventoryView iv)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemOnCursor()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemOnCursor(ItemStack is)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadata(String string, MetadataValue mv)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MetadataValue> getMetadata(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMetadata(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMetadata(String string, Plugin plugin)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isConversing()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptConversationInput(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean beginConversation(Conversation c)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abandonConversation(Conversation c)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String[] strings)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -4,12 +4,16 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.signs.EssentialsSign;
|
||||
import com.earth2me.essentials.signs.Signs;
|
||||
import com.earth2me.essentials.textreader.IText;
|
||||
import com.earth2me.essentials.textreader.SimpleTextInput;
|
||||
import java.io.File;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.MemoryConfiguration;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -41,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
|
||||
@@ -112,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))
|
||||
{
|
||||
@@ -132,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))
|
||||
{
|
||||
@@ -146,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))
|
||||
{
|
||||
@@ -160,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))
|
||||
{
|
||||
@@ -207,25 +209,45 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getDouble("heal-cooldown", 0);
|
||||
}
|
||||
private ConfigurationSection kits;
|
||||
|
||||
@Override
|
||||
public Object getKit(String name)
|
||||
public ConfigurationSection _getKits()
|
||||
{
|
||||
Map<String, Object> kits = (Map<String, Object>)config.getProperty("kits");
|
||||
for (Map.Entry<String, Object> entry : kits.entrySet())
|
||||
if (config.isConfigurationSection("kits"))
|
||||
{
|
||||
if (entry.getKey().equalsIgnoreCase(name.replace('.', '_').replace('/', '_')))
|
||||
final ConfigurationSection section = config.getConfigurationSection("kits");
|
||||
final ConfigurationSection newSection = new MemoryConfiguration();
|
||||
for (String kitItem : section.getKeys(false))
|
||||
{
|
||||
return entry.getValue();
|
||||
if (section.isConfigurationSection(kitItem))
|
||||
{
|
||||
newSection.set(kitItem.toLowerCase(Locale.ENGLISH), section.getConfigurationSection(kitItem));
|
||||
}
|
||||
}
|
||||
return newSection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getKits()
|
||||
public ConfigurationSection getKits()
|
||||
{
|
||||
return (Map<String, Object>)config.getProperty("kits");
|
||||
return kits;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getKit(String name)
|
||||
{
|
||||
name = name.replace('.', '_').replace('/', '_');
|
||||
if (config.isConfigurationSection("kits"))
|
||||
{
|
||||
final ConfigurationSection kits = getKits();
|
||||
if (kits.isConfigurationSection(name))
|
||||
{
|
||||
return kits.getConfigurationSection(name).getValues(true);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,7 +272,7 @@ public class Settings implements ISettings
|
||||
{
|
||||
}
|
||||
|
||||
return ChatColor.getByCode(Integer.parseInt(colorName, 16));
|
||||
return ChatColor.getByChar(colorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -324,15 +346,15 @@ public class Settings implements ISettings
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAnnounceNewPlayerFormat(IUser user)
|
||||
public IText getAnnounceNewPlayerFormat()
|
||||
{
|
||||
return format(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!"), user);
|
||||
return new SimpleTextInput(Util.replaceColor(config.getString("newbies.announce-format", "&dWelcome {DISPLAYNAME} to the server!")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(String format, IUser user)
|
||||
public String getNewPlayerKit()
|
||||
{
|
||||
return format.replace('&', '§').replace("§§", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", user.getGroup()).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString());
|
||||
return config.getString("newbies.kit", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,30 +379,35 @@ public class Settings implements ISettings
|
||||
public void reloadConfig()
|
||||
{
|
||||
config.load();
|
||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
|
||||
enabledSigns = getEnabledSigns();
|
||||
itemSpawnBl = getItemSpawnBlacklist();
|
||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
||||
enabledSigns = _getEnabledSigns();
|
||||
itemSpawnBl = _getItemSpawnBlacklist();
|
||||
kits = _getKits();
|
||||
chatFormats.clear();
|
||||
}
|
||||
|
||||
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
|
||||
|
||||
|
||||
@Override
|
||||
public List<Integer> itemSpawnBlacklist()
|
||||
{
|
||||
return itemSpawnBl;
|
||||
}
|
||||
|
||||
private List<Integer> getItemSpawnBlacklist()
|
||||
|
||||
private List<Integer> _getItemSpawnBlacklist()
|
||||
{
|
||||
final List<Integer> epItemSpwn = new ArrayList<Integer>();
|
||||
if (ess.getItemDb() == null)
|
||||
{
|
||||
logger.log(Level.FINE, "Aborting ItemSpawnBL read, itemDB not yet loaded.");
|
||||
return epItemSpwn;
|
||||
}
|
||||
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
|
||||
{
|
||||
itemName = itemName.trim();
|
||||
if (itemName.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
final ItemStack iStack = ess.getItemDb().get(itemName);
|
||||
@@ -393,20 +420,19 @@ public class Settings implements ISettings
|
||||
}
|
||||
return epItemSpwn;
|
||||
}
|
||||
|
||||
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
||||
|
||||
|
||||
@Override
|
||||
public List<EssentialsSign> enabledSigns()
|
||||
{
|
||||
return enabledSigns;
|
||||
}
|
||||
|
||||
private List<EssentialsSign> getEnabledSigns()
|
||||
|
||||
private List<EssentialsSign> _getEnabledSigns()
|
||||
{
|
||||
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())
|
||||
@@ -534,6 +560,22 @@ public class Settings implements ISettings
|
||||
}
|
||||
return max;
|
||||
}
|
||||
private final static double MINMONEY = -10000000000000.0;
|
||||
|
||||
@Override
|
||||
public double getMinMoney()
|
||||
{
|
||||
double min = config.getDouble("min-money", MINMONEY);
|
||||
if (min > 0)
|
||||
{
|
||||
min = -min;
|
||||
}
|
||||
if (min < MINMONEY)
|
||||
{
|
||||
min = MINMONEY;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEcoLogEnabled()
|
||||
@@ -541,6 +583,12 @@ public class Settings implements ISettings
|
||||
return config.getBoolean("economy-log-enabled", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEcoLogUpdateEnabled()
|
||||
{
|
||||
return config.getBoolean("economy-log-update-enabled", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeGodOnDisconnect()
|
||||
{
|
||||
@@ -600,7 +648,6 @@ public class Settings implements ISettings
|
||||
{
|
||||
return config.getBoolean("death-messages", true);
|
||||
}
|
||||
|
||||
private Set<String> noGodWorlds = new HashSet<String>();
|
||||
|
||||
@Override
|
||||
|
@@ -13,6 +13,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@@ -38,7 +39,7 @@ public class Trade
|
||||
{
|
||||
this(null, null, items, null, ess);
|
||||
}
|
||||
|
||||
|
||||
public Trade(final int exp, final IEssentials ess)
|
||||
{
|
||||
this(null, null, null, exp, ess);
|
||||
@@ -79,9 +80,10 @@ public class Trade
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
}
|
||||
|
||||
if (exp != null && exp > 0
|
||||
&& SetExpFix.getTotalExperience(user) < exp) {
|
||||
|
||||
if (exp != null && exp > 0
|
||||
&& SetExpFix.getTotalExperience(user) < exp)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughExperience"));
|
||||
}
|
||||
}
|
||||
@@ -103,9 +105,25 @@ public class Trade
|
||||
if (dropItems)
|
||||
{
|
||||
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
|
||||
final Location loc = user.getLocation();
|
||||
for (ItemStack itemStack : leftOver.values())
|
||||
{
|
||||
InventoryWorkaround.dropItem(user.getLocation(), itemStack);
|
||||
final int maxStackSize = itemStack.getType().getMaxStackSize();
|
||||
final int stacks = itemStack.getAmount() / maxStackSize;
|
||||
final int leftover = itemStack.getAmount() % maxStackSize;
|
||||
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
|
||||
for (int i = 0; i < stacks; i++)
|
||||
{
|
||||
final ItemStack stack = itemStack.clone();
|
||||
stack.setAmount(maxStackSize);
|
||||
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
|
||||
}
|
||||
if (leftover > 0)
|
||||
{
|
||||
final ItemStack stack = itemStack.clone();
|
||||
stack.setAmount(leftover);
|
||||
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -125,8 +143,7 @@ public class Trade
|
||||
{
|
||||
if (getMoney() != null)
|
||||
{
|
||||
final double mon = user.getMoney();
|
||||
if (mon < getMoney() && getMoney() > 0 && !user.isAuthorized("essentials.eco.loan"))
|
||||
if (!user.canAfford(getMoney()) && getMoney() > 0)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
}
|
||||
@@ -145,9 +162,8 @@ public class Trade
|
||||
&& !user.isAuthorized("essentials.nocommandcost.all")
|
||||
&& !user.isAuthorized("essentials.nocommandcost." + command))
|
||||
{
|
||||
final double mon = user.getMoney();
|
||||
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
|
||||
if (mon < cost && cost > 0 && !user.isAuthorized("essentials.eco.loan"))
|
||||
if (!user.canAfford(cost) && cost > 0)
|
||||
{
|
||||
throw new ChargeException(_("notEnoughMoney"));
|
||||
}
|
||||
@@ -173,7 +189,7 @@ public class Trade
|
||||
{
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
public Integer getExperience()
|
||||
{
|
||||
return exp;
|
||||
@@ -182,7 +198,8 @@ public class Trade
|
||||
|
||||
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
|
||||
{
|
||||
if (!ess.getSettings().isEcoLogEnabled())
|
||||
if ((loc == null && !ess.getSettings().isEcoLogUpdateEnabled())
|
||||
|| (loc != null && !ess.getSettings().isEcoLogEnabled()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -7,7 +7,6 @@ import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -106,10 +105,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return;
|
||||
}
|
||||
setMoney(getMoney() + value);
|
||||
sendMessage(_("addedToAccount", Util.formatCurrency(value, ess)));
|
||||
sendMessage(_("addedToAccount", Util.displayCurrency(value, ess)));
|
||||
if (initiator != null)
|
||||
{
|
||||
initiator.sendMessage(_("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
|
||||
initiator.sendMessage(_("addedToOthersAccount", Util.displayCurrency(value, ess), this.getDisplayName(), Util.displayCurrency(getMoney(), ess)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +122,8 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
setMoney(getMoney() - value);
|
||||
reciever.setMoney(reciever.getMoney() + value);
|
||||
sendMessage(_("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
|
||||
reciever.sendMessage(_("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
|
||||
sendMessage(_("moneySentTo", Util.displayCurrency(value, ess), reciever.getDisplayName()));
|
||||
reciever.sendMessage(_("moneyRecievedFrom", Util.displayCurrency(value, ess), getDisplayName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -145,17 +144,26 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return;
|
||||
}
|
||||
setMoney(getMoney() - value);
|
||||
sendMessage(_("takenFromAccount", Util.formatCurrency(value, ess)));
|
||||
sendMessage(_("takenFromAccount", Util.displayCurrency(value, ess)));
|
||||
if (initiator != null)
|
||||
{
|
||||
initiator.sendMessage(_("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
|
||||
initiator.sendMessage(_("takenFromOthersAccount", Util.displayCurrency(value, ess), this.getDisplayName(), Util.displayCurrency(getMoney(), ess)));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canAfford(final double cost)
|
||||
{
|
||||
return canAfford(cost, true);
|
||||
}
|
||||
|
||||
public boolean canAfford(final double cost, final boolean permcheck)
|
||||
{
|
||||
final double mon = getMoney();
|
||||
return mon >= cost || isAuthorized("essentials.eco.loan");
|
||||
if (!permcheck || isAuthorized("essentials.eco.loan"))
|
||||
{
|
||||
return (mon - cost) >= ess.getSettings().getMinMoney();
|
||||
}
|
||||
return cost <= mon;
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
@@ -241,7 +249,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return teleportRequestHere;
|
||||
}
|
||||
|
||||
public String getNick(boolean addprefixsuffix)
|
||||
public String getNick(final boolean addprefixsuffix)
|
||||
{
|
||||
final StringBuilder nickname = new StringBuilder();
|
||||
final String nick = getNickname();
|
||||
@@ -253,28 +261,31 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
{
|
||||
nickname.append(ess.getSettings().getNicknamePrefix()).append(nick);
|
||||
}
|
||||
if (isOp())
|
||||
|
||||
if (addprefixsuffix && isOp())
|
||||
{
|
||||
try
|
||||
{
|
||||
nickname.insert(0, ess.getSettings().getOperatorColor().toString());
|
||||
nickname.append("§f");
|
||||
final String opPrefix = ess.getSettings().getOperatorColor().toString();
|
||||
if (opPrefix.length() > 0) {
|
||||
nickname.insert(0, opPrefix);
|
||||
nickname.append("§f");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (addprefixsuffix && ess.getSettings().addPrefixSuffix())
|
||||
{
|
||||
if (!ess.getSettings().disablePrefix())
|
||||
{
|
||||
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
||||
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§');
|
||||
nickname.insert(0, prefix);
|
||||
}
|
||||
if (!ess.getSettings().disableSuffix())
|
||||
{
|
||||
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
||||
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§');
|
||||
nickname.append(suffix);
|
||||
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
|
||||
{
|
||||
@@ -322,6 +333,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
return super.getDisplayName() == null ? super.getName() : super.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Teleport getTeleport()
|
||||
{
|
||||
return teleport;
|
||||
@@ -379,6 +391,15 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
}
|
||||
}
|
||||
super.setMoney(value);
|
||||
Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
|
||||
}
|
||||
|
||||
public void updateMoneyCache(final double value)
|
||||
{
|
||||
if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value)
|
||||
{
|
||||
super.setMoney(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -544,6 +565,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
||||
|
||||
public boolean canBuild()
|
||||
{
|
||||
if (isOp())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return ess.getPermissionsHandler().canBuild(base, getGroup());
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
savedInventory = _getSavedInventory();
|
||||
teleportEnabled = getTeleportEnabled();
|
||||
ignoredPlayers = getIgnoredPlayers();
|
||||
godmode = getGodModeEnabled();
|
||||
godmode = _getGodModeEnabled();
|
||||
muted = getMuted();
|
||||
muteTimeout = _getMuteTimeout();
|
||||
jailed = getJailed();
|
||||
@@ -58,6 +58,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
isNPC = _isNPC();
|
||||
arePowerToolsEnabled = _arePowerToolsEnabled();
|
||||
kitTimestamps = _getKitTimestamps();
|
||||
nickname = _getNickname();
|
||||
}
|
||||
private double money;
|
||||
|
||||
@@ -94,17 +95,11 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
private Map<String, Object> _getHomes()
|
||||
{
|
||||
Object o = config.getProperty("homes");
|
||||
|
||||
if (o instanceof Map)
|
||||
if (config.isConfigurationSection("homes"))
|
||||
{
|
||||
return (Map<String, Object>)o;
|
||||
return config.getConfigurationSection("homes").getValues(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
public Location getHome(String name) throws Exception
|
||||
@@ -195,13 +190,21 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getNickname()
|
||||
private String nickname;
|
||||
|
||||
public String _getNickname()
|
||||
{
|
||||
return config.getString("nickname");
|
||||
}
|
||||
|
||||
public String getNickname()
|
||||
{
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nick)
|
||||
{
|
||||
nickname = nick;
|
||||
config.setProperty("nickname", nick);
|
||||
config.save();
|
||||
}
|
||||
@@ -209,7 +212,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()
|
||||
@@ -235,22 +238,15 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
config.setProperty("unlimited", unlimited);
|
||||
config.save();
|
||||
}
|
||||
private Map<Integer, Object> powertools;
|
||||
private Map<String, Object> powertools;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<Integer, Object> _getPowertools()
|
||||
private Map<String, Object> _getPowertools()
|
||||
{
|
||||
Object o = config.getProperty("powertools");
|
||||
|
||||
if (o instanceof Map)
|
||||
if (config.isConfigurationSection("powertools"))
|
||||
{
|
||||
return (Map<Integer, Object>)o;
|
||||
return config.getConfigurationSection("powertools").getValues(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new HashMap<Integer, Object>();
|
||||
}
|
||||
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
public void clearAllPowertools()
|
||||
@@ -262,23 +258,23 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
public List<String> getPowertool(ItemStack stack)
|
||||
{
|
||||
return (List<String>)powertools.get(stack.getTypeId());
|
||||
return (List<String>)powertools.get("" + stack.getTypeId());
|
||||
}
|
||||
|
||||
|
||||
public List<String> getPowertool(int id)
|
||||
{
|
||||
return (List<String>)powertools.get(id);
|
||||
return (List<String>)powertools.get("" + id);
|
||||
}
|
||||
|
||||
public void setPowertool(ItemStack stack, List<String> commandList)
|
||||
{
|
||||
if (commandList == null || commandList.isEmpty())
|
||||
{
|
||||
powertools.remove(stack.getTypeId());
|
||||
powertools.remove("" + stack.getTypeId());
|
||||
}
|
||||
else
|
||||
{
|
||||
powertools.put(stack.getTypeId(), commandList);
|
||||
powertools.put("" + stack.getTypeId(), commandList);
|
||||
}
|
||||
config.setProperty("powertools", powertools);
|
||||
config.save();
|
||||
@@ -383,7 +379,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 +487,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)
|
||||
@@ -528,7 +524,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
}
|
||||
private boolean godmode;
|
||||
|
||||
private boolean getGodModeEnabled()
|
||||
private boolean _getGodModeEnabled()
|
||||
{
|
||||
return config.getBoolean("godmode", false);
|
||||
}
|
||||
@@ -739,7 +735,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
return ret;
|
||||
}
|
||||
private boolean newplayer;
|
||||
|
||||
private String geolocation;
|
||||
|
||||
private String _getGeoLocation()
|
||||
@@ -831,16 +826,12 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
|
||||
private Map<String, Object> _getKitTimestamps()
|
||||
{
|
||||
final Object map = config.getProperty("timestamps.kits");
|
||||
|
||||
if (map instanceof Map)
|
||||
if (config.isConfigurationSection("timestamps.kits"))
|
||||
{
|
||||
return (Map<String, Object>)map;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new HashMap<String, Object>();
|
||||
return config.getConfigurationSection("timestamps.kits").getValues(false);
|
||||
}
|
||||
return new HashMap<String, Object>();
|
||||
}
|
||||
|
||||
public Long getKitTimestamp(final String name)
|
||||
|
@@ -61,7 +61,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
{
|
||||
try
|
||||
{
|
||||
return users.get(Util.sanitizeFileName(name));
|
||||
return users.get(name);
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
@@ -76,18 +76,31 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
@Override
|
||||
public User load(final String name) throws Exception
|
||||
{
|
||||
String sanitizedName = Util.sanitizeFileName(name);
|
||||
if (!sanitizedName.equals(name))
|
||||
{
|
||||
User user = getUser(sanitizedName);
|
||||
if (user == null)
|
||||
{
|
||||
throw new Exception("User not found!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return user;
|
||||
}
|
||||
}
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
{
|
||||
if (player.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
keys.add(Util.sanitizeFileName(name));
|
||||
keys.add(sanitizedName);
|
||||
return new User(player, ess);
|
||||
}
|
||||
}
|
||||
final File userFile = getUserFile(name);
|
||||
final File userFile = getUserFile2(sanitizedName);
|
||||
if (userFile.exists())
|
||||
{
|
||||
keys.add(Util.sanitizeFileName(name));
|
||||
keys.add(sanitizedName);
|
||||
return new User(new OfflinePlayer(name, ess), ess);
|
||||
}
|
||||
throw new Exception("User not found!");
|
||||
@@ -103,6 +116,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
{
|
||||
keys.remove(Util.sanitizeFileName(name));
|
||||
users.invalidate(Util.sanitizeFileName(name));
|
||||
users.invalidate(name);
|
||||
}
|
||||
|
||||
public Set<String> getAllUniqueUsers()
|
||||
@@ -114,10 +128,15 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
||||
{
|
||||
return keys.size();
|
||||
}
|
||||
|
||||
|
||||
public File getUserFile(final String name)
|
||||
{
|
||||
return getUserFile2(Util.sanitizeFileName(name));
|
||||
}
|
||||
|
||||
private File getUserFile2(final String name)
|
||||
{
|
||||
final File userFolder = new File(ess.getDataFolder(), "userdata");
|
||||
return new File(userFolder, Util.sanitizeFileName(name) + ".yml");
|
||||
return new File(userFolder, name + ".yml");
|
||||
}
|
||||
}
|
||||
|
@@ -21,11 +21,18 @@ public class Util
|
||||
{
|
||||
}
|
||||
private final static Logger logger = Logger.getLogger("Minecraft");
|
||||
private final static Pattern INVALIDCHARS = Pattern.compile("[^a-z0-9]");
|
||||
private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]");
|
||||
private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]");
|
||||
|
||||
public static String sanitizeFileName(final String name)
|
||||
{
|
||||
return INVALIDCHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
final String newName = INVALIDFILECHARS.matcher(name.toLowerCase(Locale.ENGLISH)).replaceAll("_");
|
||||
return newName;
|
||||
}
|
||||
|
||||
public static String sanitizeString(final String string)
|
||||
{
|
||||
return INVALIDCHARS.matcher(string).replaceAll("");
|
||||
}
|
||||
|
||||
public static String formatDateDiff(long date)
|
||||
@@ -415,11 +422,11 @@ public class Util
|
||||
}
|
||||
return is;
|
||||
}
|
||||
private static DecimalFormat df = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
|
||||
private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US));
|
||||
|
||||
public static String formatCurrency(final double value, final IEssentials ess)
|
||||
public static String formatAsCurrency(final double value)
|
||||
{
|
||||
String str = ess.getSettings().getCurrencySymbol() + df.format(value);
|
||||
String str = dFormat.format(value);
|
||||
if (str.endsWith(".00"))
|
||||
{
|
||||
str = str.substring(0, str.length() - 3);
|
||||
@@ -427,6 +434,16 @@ public class Util
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String displayCurrency(final double value, final IEssentials ess)
|
||||
{
|
||||
return _("currency", ess.getSettings().getCurrencySymbol(), formatAsCurrency(value));
|
||||
}
|
||||
|
||||
public static String shortCurrency(final double value, final IEssentials ess)
|
||||
{
|
||||
return ess.getSettings().getCurrencySymbol() + formatAsCurrency(value);
|
||||
}
|
||||
|
||||
public static double roundDouble(final double d)
|
||||
{
|
||||
return Math.round(d * 100.0) / 100.0;
|
||||
|
@@ -115,6 +115,10 @@ public final class Economy
|
||||
{
|
||||
throw new UserDoesNotExistException(name);
|
||||
}
|
||||
if (balance < ess.getSettings().getMinMoney())
|
||||
{
|
||||
throw new NoLoanPermittedException();
|
||||
}
|
||||
if (balance < 0.0 && !user.isAuthorized("essentials.eco.loan"))
|
||||
{
|
||||
throw new NoLoanPermittedException();
|
||||
@@ -245,7 +249,7 @@ public final class Economy
|
||||
{
|
||||
throw new RuntimeException(noCallBeforeLoad);
|
||||
}
|
||||
return Util.formatCurrency(amount, ess);
|
||||
return Util.displayCurrency(amount, ess);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,8 +17,11 @@ public class Commandantioch extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
|
||||
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
|
||||
if (args.length > 0)
|
||||
{
|
||||
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
|
||||
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
|
||||
}
|
||||
|
||||
final Location loc = Util.getTarget(user);
|
||||
loc.getWorld().spawn(loc, TNTPrimed.class);
|
||||
|
@@ -20,5 +20,6 @@ public class Commandback extends EssentialsCommand
|
||||
charge.isAffordableFor(user);
|
||||
user.sendMessage(_("backUsageMsg"));
|
||||
user.getTeleport().back(charge);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ public class Commandbalance extends EssentialsCommand
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
sender.sendMessage(_("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
|
||||
sender.sendMessage(_("balance", Util.displayCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,6 +32,6 @@ public class Commandbalance extends EssentialsCommand
|
||||
|| user.isAuthorized("essentials.balance.other"))
|
||||
? user
|
||||
: getPlayer(server, args, 0, true)).getMoney();
|
||||
user.sendMessage(_("balance", Util.formatCurrency(bal, ess)));
|
||||
user.sendMessage(_("balance", Util.displayCurrency(bal, ess)));
|
||||
}
|
||||
}
|
||||
|
@@ -105,14 +105,18 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
{
|
||||
if (force || cacheage <= System.currentTimeMillis() - CACHETIME)
|
||||
{
|
||||
cache.getLines().clear();
|
||||
cache.getLines().clear();
|
||||
final Map<String, Double> balances = new HashMap<String, Double>();
|
||||
double totalMoney = 0d;
|
||||
for (String u : ess.getUserMap().getAllUniqueUsers())
|
||||
{
|
||||
final User user = ess.getUserMap().getUser(u);
|
||||
if (user != null)
|
||||
{
|
||||
balances.put(user.getDisplayName(), user.getMoney());
|
||||
final double userMoney = user.getMoney();
|
||||
user.updateMoneyCache(userMoney);
|
||||
totalMoney += userMoney;
|
||||
balances.put(user.getDisplayName(), userMoney);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,10 +129,12 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
return -entry1.getValue().compareTo(entry2.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
cache.getLines().add(_("serverTotal", Util.displayCurrency(totalMoney, ess)));
|
||||
int pos = 1;
|
||||
for (Map.Entry<String, Double> entry : sortedEntries)
|
||||
{
|
||||
cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.formatCurrency(entry.getValue(), ess));
|
||||
cache.getLines().add(pos + ". " + entry.getKey() + ", " + Util.displayCurrency(entry.getValue(), ess));
|
||||
pos++;
|
||||
}
|
||||
cacheage = System.currentTimeMillis();
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Server;
|
||||
@@ -33,7 +34,31 @@ public class Commandeco extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException(ex);
|
||||
}
|
||||
|
||||
if (args[1].contentEquals("*"))
|
||||
if (args[1].contentEquals("**"))
|
||||
{
|
||||
for (String sUser : ess.getUserMap().getAllUniqueUsers())
|
||||
{
|
||||
final User player = ess.getUser(sUser);
|
||||
switch (cmd)
|
||||
{
|
||||
case GIVE:
|
||||
player.giveMoney(amount);
|
||||
break;
|
||||
|
||||
case TAKE:
|
||||
if (player.canAfford(amount, false))
|
||||
{
|
||||
player.takeMoney(amount);
|
||||
}
|
||||
break;
|
||||
|
||||
case RESET:
|
||||
player.setMoney(amount == 0 ? ess.getSettings().getStartingBalance() : amount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args[1].contentEquals("*"))
|
||||
{
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
@@ -45,6 +70,10 @@ public class Commandeco extends EssentialsCommand
|
||||
break;
|
||||
|
||||
case TAKE:
|
||||
if (!player.canAfford(amount, false))
|
||||
{
|
||||
throw new Exception(_("notEnoughMoney"));
|
||||
}
|
||||
player.takeMoney(amount);
|
||||
break;
|
||||
|
||||
@@ -64,6 +93,10 @@ public class Commandeco extends EssentialsCommand
|
||||
break;
|
||||
|
||||
case TAKE:
|
||||
if (!player.canAfford(amount, false))
|
||||
{
|
||||
throw new Exception(_("notEnoughMoney"));
|
||||
}
|
||||
player.takeMoney(amount, sender);
|
||||
break;
|
||||
|
||||
|
@@ -9,6 +9,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
@@ -35,6 +36,10 @@ public class Commandessentials extends EssentialsCommand
|
||||
{
|
||||
run_nya(server, sender, commandLabel, args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("moo"))
|
||||
{
|
||||
run_moo(server, sender, commandLabel, args);
|
||||
}
|
||||
else {
|
||||
run_reload(server, sender, commandLabel, args);
|
||||
}
|
||||
@@ -112,7 +117,7 @@ public class Commandessentials extends EssentialsCommand
|
||||
if (loc.getBlock().getTypeId() == 0)
|
||||
{
|
||||
noteBlocks.put(player, loc.getBlock());
|
||||
loc.getBlock().setType(Material.NOTE_BLOCK);
|
||||
player.sendBlockChange(loc, Material.NOTE_BLOCK, (byte)0);
|
||||
}
|
||||
}
|
||||
taskid = ess.scheduleSyncRepeatingTask(new Runnable()
|
||||
@@ -144,7 +149,6 @@ public class Commandessentials extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
}, 20, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
private void stopTune()
|
||||
@@ -159,4 +163,12 @@ public class Commandessentials extends EssentialsCommand
|
||||
}
|
||||
noteBlocks.clear();
|
||||
}
|
||||
|
||||
private void run_moo(final Server server, final CommandSender sender, final String command, final String args[])
|
||||
{
|
||||
if(sender instanceof ConsoleCommandSender)
|
||||
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | ||", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
|
||||
else
|
||||
sender.sendMessage(new String[]{" (__)", " (oo)", " /------\\/", " / | | |", " * /\\---/\\", " ~~ ~~", "....\"Have you mooed today?\"..." } );
|
||||
}
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ public class Commandkillall extends EssentialsCommand
|
||||
{
|
||||
if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob)
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
@@ -135,7 +135,7 @@ public class Commandkillall extends EssentialsCommand
|
||||
{
|
||||
if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime)
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
@@ -143,14 +143,14 @@ public class Commandkillall extends EssentialsCommand
|
||||
}
|
||||
else if (all)
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
}
|
||||
else if (entityClass != null && entityClass.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST);
|
||||
EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST);
|
||||
ess.getServer().getPluginManager().callEvent(event);
|
||||
entity.remove();
|
||||
numKills++;
|
||||
|
@@ -32,22 +32,22 @@ public class Commandkit extends EssentialsCommand
|
||||
else
|
||||
{
|
||||
final String kitName = args[0].toLowerCase(Locale.ENGLISH);
|
||||
final Object kit = ess.getSettings().getKit(kitName);
|
||||
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
|
||||
|
||||
if (!user.isAuthorized("essentials.kit." + kitName))
|
||||
{
|
||||
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
|
||||
}
|
||||
final Map<String, Object> els = (Map<String, Object>)kit;
|
||||
final List<String> items = Kit.getItems(user, els);
|
||||
|
||||
Kit.checkTime(user, kitName, els);
|
||||
final List<String> items = Kit.getItems(user, kit);
|
||||
|
||||
Kit.checkTime(user, kitName, kit);
|
||||
|
||||
final Trade charge = new Trade("kit-" + kitName, ess);
|
||||
charge.isAffordableFor(user);
|
||||
|
||||
Kit.expandItems(ess, user, items);
|
||||
|
||||
|
||||
charge.charge(user);
|
||||
user.sendMessage(_("kitGive", kitName));
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.*;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -72,7 +73,7 @@ public class Commandlist extends EssentialsCommand
|
||||
for (String group : groups)
|
||||
{
|
||||
final StringBuilder groupString = new StringBuilder();
|
||||
groupString.append(group).append(": ");
|
||||
groupString.append(_("listGroupTag",Util.replaceColor(group)));
|
||||
final List<User> users = sort.get(group);
|
||||
Collections.sort(users);
|
||||
boolean first = true;
|
||||
|
@@ -40,7 +40,7 @@ public class Commandmail extends EssentialsCommand
|
||||
{
|
||||
if (!user.isAuthorized("essentials.mail.send"))
|
||||
{
|
||||
throw new Exception(_("noPerm","essentials.mail.send"));
|
||||
throw new Exception(_("noPerm", "essentials.mail.send"));
|
||||
}
|
||||
|
||||
Player player = server.getPlayer(args[1]);
|
||||
@@ -59,7 +59,8 @@ public class Commandmail extends EssentialsCommand
|
||||
}
|
||||
if (!u.isIgnoredPlayer(user.getName()))
|
||||
{
|
||||
u.addMail(user.getName() + ": " + Util.stripColor(getFinalArg(args, 2)));
|
||||
final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2)));
|
||||
u.addMail(user.getName() + ": " + mail);
|
||||
}
|
||||
user.sendMessage(_("mailSent"));
|
||||
return;
|
||||
@@ -68,7 +69,7 @@ public class Commandmail extends EssentialsCommand
|
||||
{
|
||||
if (!user.isAuthorized("essentials.mail.sendall"))
|
||||
{
|
||||
throw new Exception(_("noPerm","essentials.mail.sendall"));
|
||||
throw new Exception(_("noPerm", "essentials.mail.sendall"));
|
||||
}
|
||||
ess.scheduleAsyncDelayedTask(new SendAll(user.getName() + ": " + Util.stripColor(getFinalArg(args, 1))));
|
||||
user.sendMessage(_("mailSent"));
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class Commandping extends EssentialsCommand
|
||||
@@ -13,8 +14,16 @@ public class Commandping extends EssentialsCommand
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
player.sendMessage(_("pong"));
|
||||
if (args.length < 1)
|
||||
{
|
||||
|
||||
sender.sendMessage(_("pong"));
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(Util.replaceColor(getFinalArg(args, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ public class Commandrepair extends EssentialsCommand
|
||||
private void repairItem(final ItemStack item) throws Exception
|
||||
{
|
||||
final Material material = Material.getMaterial(item.getTypeId());
|
||||
if (material.isBlock() || material.getMaxDurability() < 0)
|
||||
if (material.isBlock() || material.getMaxDurability() < 1)
|
||||
{
|
||||
throw new Exception(_("repairInvalidType"));
|
||||
}
|
||||
|
@@ -160,8 +160,8 @@ public class Commandsell extends EssentialsCommand
|
||||
user.updateInventory();
|
||||
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
|
||||
user.giveMoney(worth * amount);
|
||||
user.sendMessage(_("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth, ess)));
|
||||
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
|
||||
user.sendMessage(_("itemSold", Util.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth, ess)));
|
||||
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth * amount, ess), amount, Util.displayCurrency(worth, ess)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Locale;
|
||||
@@ -9,6 +10,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
|
||||
public class Commandspawner extends EssentialsCommand
|
||||
@@ -47,11 +49,14 @@ public class Commandspawner extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("unableToSpawnMob"));
|
||||
}
|
||||
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase()))
|
||||
if (!user.isAuthorized("essentials.spawner." + mob.name.toLowerCase(Locale.ENGLISH)))
|
||||
{
|
||||
throw new Exception(_("unableToSpawnMob"));
|
||||
}
|
||||
((CreatureSpawner)target.getBlock().getState()).setCreatureType(mob.getType());
|
||||
final Trade charge = new Trade("spawner-" + mob.name.toLowerCase(Locale.ENGLISH), ess);
|
||||
charge.isAffordableFor(user);
|
||||
((CreatureSpawner)target.getBlock().getState()).setSpawnedType(mob.getType());
|
||||
charge.charge(user);
|
||||
user.sendMessage(_("setSpawner", mob.name));
|
||||
}
|
||||
catch (Throwable ex)
|
||||
|
@@ -5,8 +5,7 @@ import com.earth2me.essentials.Mob;
|
||||
import com.earth2me.essentials.Mob.MobException;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -26,7 +25,20 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(Mob.getMobList())));
|
||||
final Set<String> mobList = Mob.getMobList();
|
||||
final Set<String> availableList = new HashSet<String>();
|
||||
for (String mob : mobList)
|
||||
{
|
||||
if (user.isAuthorized("essentials.spawnmob." + mob.toLowerCase()))
|
||||
{
|
||||
availableList.add(mob);
|
||||
}
|
||||
}
|
||||
if (availableList.isEmpty())
|
||||
{
|
||||
availableList.add(_("none"));
|
||||
}
|
||||
throw new NotEnoughArgumentsException(_("mobsAvailable", Util.joinList(availableList)));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +91,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
User otherUser = null;
|
||||
if (args.length >= 3)
|
||||
{
|
||||
otherUser = getPlayer(ess.getServer(), args, 2);
|
||||
otherUser = getPlayer(ess.getServer(), args, 2);
|
||||
}
|
||||
final Location loc = (otherUser == null) ? block.getLocation() : otherUser.getLocation();
|
||||
final Location sloc = Util.getSafeDestination(loc);
|
||||
@@ -163,7 +175,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
changeMobData(mobMount.getType(), spawnedMount, mountData, user);
|
||||
}
|
||||
}
|
||||
user.sendMessage(args[1] + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
|
||||
user.sendMessage(mobCount + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
|
||||
}
|
||||
catch (MobException e1)
|
||||
{
|
||||
@@ -184,9 +196,9 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
private void changeMobData(final CreatureType type, final Entity spawned, final String data, final User user) throws Exception
|
||||
private void changeMobData(final EntityType type, final Entity spawned, final String data, final User user) throws Exception
|
||||
{
|
||||
if (type == CreatureType.SLIME || type == CreatureType.MAGMA_CUBE)
|
||||
if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -197,18 +209,18 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
throw new Exception(_("slimeMalformedSize"), e);
|
||||
}
|
||||
}
|
||||
if ((type == CreatureType.SHEEP
|
||||
|| type == CreatureType.COW
|
||||
|| type == CreatureType.MUSHROOM_COW
|
||||
|| type == CreatureType.CHICKEN
|
||||
|| type == CreatureType.PIG
|
||||
|| type == CreatureType.WOLF)
|
||||
if ((type == EntityType.SHEEP
|
||||
|| type == EntityType.COW
|
||||
|| type == EntityType.MUSHROOM_COW
|
||||
|| type == EntityType.CHICKEN
|
||||
|| type == EntityType.PIG
|
||||
|| type == EntityType.WOLF)
|
||||
&& data.equalsIgnoreCase("baby"))
|
||||
{
|
||||
((Animals)spawned).setAge(-24000);
|
||||
return;
|
||||
}
|
||||
if (type == CreatureType.SHEEP)
|
||||
if (type == EntityType.SHEEP)
|
||||
{
|
||||
if (data.toLowerCase(Locale.ENGLISH).contains("baby"))
|
||||
{
|
||||
@@ -233,7 +245,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
throw new Exception(_("sheepMalformedColor"), e);
|
||||
}
|
||||
}
|
||||
if (type == CreatureType.WOLF
|
||||
if (type == EntityType.WOLF
|
||||
&& data.toLowerCase(Locale.ENGLISH).startsWith("tamed"))
|
||||
{
|
||||
final Wolf wolf = ((Wolf)spawned);
|
||||
@@ -245,7 +257,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
((Animals)spawned).setAge(-24000);
|
||||
}
|
||||
}
|
||||
if (type == CreatureType.WOLF
|
||||
if (type == EntityType.WOLF
|
||||
&& data.toLowerCase(Locale.ENGLISH).startsWith("angry"))
|
||||
{
|
||||
((Wolf)spawned).setAngry(true);
|
||||
@@ -254,7 +266,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
((Animals)spawned).setAge(-24000);
|
||||
}
|
||||
}
|
||||
if (type == CreatureType.CREEPER && data.equalsIgnoreCase("powered"))
|
||||
if (type == EntityType.CREEPER && data.equalsIgnoreCase("powered"))
|
||||
{
|
||||
((Creeper)spawned).setPowered(true);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
@@ -30,7 +31,13 @@ public class Commandsudo extends EssentialsCommand
|
||||
}
|
||||
|
||||
//TODO: Translate this.
|
||||
sender.sendMessage("Running the command as " + user.getDisplayName());
|
||||
if (user.isAuthorized("essentials.sudo.exempt"))
|
||||
{
|
||||
throw new Exception("You cannot sudo this user");
|
||||
}
|
||||
|
||||
//TODO: Translate this.
|
||||
sender.sendMessage("Forcing " + user.getDisplayName() + " to run: /" + command + " " + getFinalArg(arguments, 0));
|
||||
|
||||
final PluginCommand execCommand = ess.getServer().getPluginCommand(command);
|
||||
if (execCommand != null)
|
||||
|
@@ -16,7 +16,7 @@ public class Commandsuicide extends EssentialsCommand
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
EntityDamageEvent ede = new EntityDamageEvent(user, EntityDamageEvent.DamageCause.SUICIDE, 1000);
|
||||
EntityDamageEvent ede = new EntityDamageEvent(user.getBase(), EntityDamageEvent.DamageCause.SUICIDE, 1000);
|
||||
server.getPluginManager().callEvent(ede);
|
||||
user.damage(1000);
|
||||
user.setHealth(0);
|
||||
|
@@ -22,7 +22,9 @@ public class Commandtpaccept extends EssentialsCommand
|
||||
final User target = user.getTeleportRequest();
|
||||
if (target == null
|
||||
|| target.getBase() instanceof OfflinePlayer
|
||||
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|
||||
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere"))
|
||||
|| (!user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall"))
|
||||
)
|
||||
{
|
||||
throw new Exception(_("noPendingRequest"));
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import com.earth2me.essentials.Warps;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
@@ -44,10 +45,10 @@ public class Commandwarp extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("playerNotFound"));
|
||||
}
|
||||
warpUser(otherUser, args[0]);
|
||||
warpUser(user, otherUser, args[0]);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
warpUser(user, args[0]);
|
||||
warpUser(user, user, args[0]);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
@@ -65,7 +66,7 @@ public class Commandwarp extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("playerNotFound"));
|
||||
}
|
||||
warpUser(otherUser, args[0]);
|
||||
otherUser.getTeleport().warp(args[0], null, TeleportCause.COMMAND);
|
||||
throw new NoChargeException();
|
||||
|
||||
}
|
||||
@@ -112,17 +113,12 @@ public class Commandwarp extends EssentialsCommand
|
||||
}
|
||||
}
|
||||
|
||||
private void warpUser(final User user, final String name) throws Exception
|
||||
private void warpUser(final User owner, final User user, final String name) throws Exception
|
||||
{
|
||||
final Trade charge = new Trade(this.getName(), ess);
|
||||
charge.isAffordableFor(user);
|
||||
if (ess.getSettings().getPerWarpPermission())
|
||||
final Trade charge = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess);
|
||||
charge.isAffordableFor(owner);
|
||||
if (ess.getSettings().getPerWarpPermission() && !owner.isAuthorized("essentials.warp." + name))
|
||||
{
|
||||
if (user.isAuthorized("essentials.warp." + name))
|
||||
{
|
||||
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
|
||||
return;
|
||||
}
|
||||
throw new Exception(_("warpUsePermission"));
|
||||
}
|
||||
user.getTeleport().warp(name, charge, TeleportCause.COMMAND);
|
||||
|
@@ -60,7 +60,7 @@ public class Commandwhois extends EssentialsCommand
|
||||
sender.sendMessage(_("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ()));
|
||||
if (!ess.getSettings().isEcoDisabled())
|
||||
{
|
||||
sender.sendMessage(_("whoisMoney", Util.formatCurrency(user.getMoney(), ess)));
|
||||
sender.sendMessage(_("whoisMoney", Util.displayCurrency(user.getMoney(), ess)));
|
||||
}
|
||||
sender.sendMessage(user.isAfk()
|
||||
? _("whoisStatusAway")
|
||||
|
@@ -51,14 +51,14 @@ public class Commandworth extends EssentialsCommand
|
||||
? _("worthMeta",
|
||||
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
|
||||
iStack.getDurability(),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
Util.displayCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess))
|
||||
Util.displayCurrency(worth, ess))
|
||||
: _("worth",
|
||||
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
Util.displayCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
Util.displayCurrency(worth, ess)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,14 +95,14 @@ public class Commandworth extends EssentialsCommand
|
||||
? _("worthMeta",
|
||||
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
|
||||
iStack.getDurability(),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
Util.displayCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess))
|
||||
Util.displayCurrency(worth, ess))
|
||||
: _("worth",
|
||||
iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""),
|
||||
Util.formatCurrency(worth * amount, ess),
|
||||
Util.displayCurrency(worth * amount, ess),
|
||||
amount,
|
||||
Util.formatCurrency(worth, ess)));
|
||||
Util.displayCurrency(worth, ess)));
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,13 @@
|
||||
package com.earth2me.essentials.craftbukkit;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@@ -187,4 +192,34 @@ public class FakeInventory implements Inventory
|
||||
items[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HumanEntity> getViewers()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryType getType()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryHolder getHolder()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<ItemStack> iterator()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ import org.bukkit.entity.*;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@@ -231,12 +232,6 @@ public class FakeWorld implements World
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getSpawnLocation()
|
||||
{
|
||||
@@ -554,4 +549,82 @@ public class FakeWorld implements World
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTicksPerAnimalSpawns()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTicksPerAnimalSpawns(int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTicksPerMonsterSpawns()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTicksPerMonsterSpawns(int i)
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LivingEntity spawnCreature(Location arg0, EntityType arg1)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void playEffect(Location lctn, Effect effect, T t)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void playEffect(Location lctn, Effect effect, T t, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMetadata(String string, MetadataValue mv)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MetadataValue> getMetadata(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMetadata(String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMetadata(String string, Plugin plugin)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,12 @@
|
||||
package com.earth2me.essentials.craftbukkit;
|
||||
|
||||
import com.earth2me.essentials.craftbukkit.FakeInventory;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/*
|
||||
* This class can be removed when
|
||||
* https://github.com/Bukkit/CraftBukkit/pull/193
|
||||
* is accepted to CraftBukkit
|
||||
* This class can be removed when https://github.com/Bukkit/CraftBukkit/pull/193 is accepted to CraftBukkit
|
||||
*/
|
||||
|
||||
public final class InventoryWorkaround
|
||||
@@ -47,7 +42,7 @@ public final class InventoryWorkaround
|
||||
{
|
||||
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
|
||||
}
|
||||
|
||||
|
||||
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
|
||||
{
|
||||
if (item == null)
|
||||
@@ -93,10 +88,9 @@ public final class InventoryWorkaround
|
||||
{
|
||||
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||
|
||||
/* TODO: some optimization
|
||||
* - Create a 'firstPartial' with a 'fromIndex'
|
||||
* - Record the lastPartial per Material
|
||||
* - Cache firstEmpty result
|
||||
/*
|
||||
* TODO: some optimization - Create a 'firstPartial' with a 'fromIndex' - Record the lastPartial per Material -
|
||||
* Cache firstEmpty result
|
||||
*/
|
||||
|
||||
// combine items
|
||||
@@ -175,7 +169,7 @@ public final class InventoryWorkaround
|
||||
|
||||
final int amount = item.getAmount();
|
||||
final int partialAmount = partialItem.getAmount();
|
||||
|
||||
|
||||
// Check if it fully fits
|
||||
if (amount + partialAmount <= maxAmount)
|
||||
{
|
||||
@@ -325,25 +319,4 @@ public final class InventoryWorkaround
|
||||
}
|
||||
return leftover.isEmpty();
|
||||
}
|
||||
|
||||
public static Item[] dropItem(final Location loc, final ItemStack itm)
|
||||
{
|
||||
final int maxStackSize = itm.getType().getMaxStackSize();
|
||||
final int stacks = itm.getAmount() / maxStackSize;
|
||||
final int leftover = itm.getAmount() % maxStackSize;
|
||||
final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
|
||||
for (int i = 0; i < stacks; i++)
|
||||
{
|
||||
final ItemStack stack = itm.clone();
|
||||
stack.setAmount(maxStackSize);
|
||||
itemStacks[i] = loc.getWorld().dropItem(loc, stack);
|
||||
}
|
||||
if (leftover > 0)
|
||||
{
|
||||
final ItemStack stack = itm.clone();
|
||||
stack.setAmount(leftover);
|
||||
itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
|
||||
}
|
||||
return itemStacks;
|
||||
}
|
||||
}
|
||||
|
@@ -1,46 +0,0 @@
|
||||
package com.earth2me.essentials.craftbukkit;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.IInventory;
|
||||
import net.minecraft.server.PlayerInventory;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class ShowInventory
|
||||
{
|
||||
public static void showEmptyInventory(final Player player)
|
||||
{
|
||||
try
|
||||
{
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle()));
|
||||
inv.clear();
|
||||
entityPlayer.a((IInventory)inv.getInventory());
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showFilledInventory(final Player player, final ItemStack stack)
|
||||
{
|
||||
try
|
||||
{
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle()));
|
||||
inv.clear();
|
||||
InventoryWorkaround.addItem(inv, true, stack);
|
||||
entityPlayer.a((IInventory)inv.getInventory());
|
||||
}
|
||||
catch (Throwable ex)
|
||||
{
|
||||
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import de.bananaco.bpermissions.api.ApiLayer;
|
||||
import de.bananaco.bpermissions.api.World;
|
||||
import de.bananaco.bpermissions.api.WorldManager;
|
||||
import de.bananaco.bpermissions.api.util.Calculable;
|
||||
import de.bananaco.bpermissions.api.util.CalculableType;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class BPermissions2Handler extends SuperpermsHandler
|
||||
{
|
||||
public BPermissions2Handler()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
final List<String> groups = getGroups(base);
|
||||
if (groups == null || groups.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return groups.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
final String[] groups = ApiLayer.getGroups(base.getWorld().getName(), CalculableType.USER, base.getName());
|
||||
return Arrays.asList(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return ApiLayer.hasGroup(base.getWorld().getName(), CalculableType.USER, base.getName(), group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(final Player base, final String group)
|
||||
{
|
||||
return hasPermission(base, "essentials.build") || hasPermission(base, "bPermissions.build");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrefix(final Player base)
|
||||
{
|
||||
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "prefix");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSuffix(final Player base)
|
||||
{
|
||||
return ApiLayer.getValue(base.getWorld().getName(), CalculableType.USER, base.getName(), "suffix");
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@@ -111,17 +112,6 @@ public class PermissionsHandler implements IPermissionsHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
|
||||
if (bPermPlugin != null && bPermPlugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof BPermissionsHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
|
||||
handler = new BPermissionsHandler();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin GMplugin = pluginManager.getPlugin("GroupManager");
|
||||
if (GMplugin != null && GMplugin.isEnabled())
|
||||
{
|
||||
@@ -144,6 +134,38 @@ public class PermissionsHandler implements IPermissionsHandler
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin privPlugin = pluginManager.getPlugin("Privileges");
|
||||
if (privPlugin != null && privPlugin.isEnabled())
|
||||
{
|
||||
if (!(handler instanceof PrivilegesHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using Privileges based permissions.");
|
||||
handler = new PrivilegesHandler(privPlugin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final Plugin bPermPlugin = pluginManager.getPlugin("bPermissions");
|
||||
if (bPermPlugin != null && bPermPlugin.isEnabled())
|
||||
{
|
||||
final String bVer = bPermPlugin.getDescription().getVersion().replace(".", "");
|
||||
if (Util.isInt(bVer) && Integer.parseInt(bVer) < 284)
|
||||
{
|
||||
if (!(handler instanceof BPermissionsHandler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions based permissions.");
|
||||
handler = new BPermissionsHandler();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!(handler instanceof BPermissions2Handler))
|
||||
{
|
||||
LOGGER.log(Level.INFO, "Essentials: Using bPermissions2 based permissions.");
|
||||
handler = new BPermissions2Handler();
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
final Plugin permPlugin = pluginManager.getPlugin("Permissions");
|
||||
if (permPlugin != null && permPlugin.isEnabled())
|
||||
{
|
||||
|
@@ -0,0 +1,61 @@
|
||||
package com.earth2me.essentials.perm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.krinsoft.privileges.Privileges;
|
||||
import net.krinsoft.privileges.groups.Group;
|
||||
import net.krinsoft.privileges.groups.GroupManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PrivilegesHandler extends SuperpermsHandler
|
||||
{
|
||||
private final transient Privileges plugin;
|
||||
private final GroupManager manager;
|
||||
|
||||
public PrivilegesHandler(final Plugin plugin)
|
||||
{
|
||||
this.plugin = (Privileges) plugin;
|
||||
this.manager = this.plugin.getGroupManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroup(final Player base)
|
||||
{
|
||||
Group group = manager.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups(final Player base)
|
||||
{
|
||||
Group group = manager.getGroup(base);
|
||||
if (group == null)
|
||||
{
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
return group.getGroupTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
Group pGroup = manager.getGroup(base);
|
||||
if (pGroup == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return pGroup.isMemberOf(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player base, String group)
|
||||
{
|
||||
return base.hasPermission("essentials.build") || base.hasPermission("privileges.build");
|
||||
}
|
||||
|
||||
}
|
@@ -27,7 +27,7 @@ public class SuperpermsHandler implements IPermissionsHandler
|
||||
@Override
|
||||
public boolean inGroup(final Player base, final String group)
|
||||
{
|
||||
return false;
|
||||
return hasPermission(base, "group." + group);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -266,7 +266,7 @@ public class EssentialsSign
|
||||
final Double money = trade.getMoney();
|
||||
if (money != null)
|
||||
{
|
||||
sign.setLine(index, Util.formatCurrency(money, ess));
|
||||
sign.setLine(index, Util.shortCurrency(money, ess));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@ package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.ShowInventory;
|
||||
|
||||
|
||||
public class SignDisposal extends EssentialsSign
|
||||
@@ -15,7 +14,10 @@ public class SignDisposal extends EssentialsSign
|
||||
@Override
|
||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess)
|
||||
{
|
||||
ShowInventory.showEmptyInventory(player.getBase());
|
||||
player.sendMessage("Bukkit broke this sign :(");
|
||||
//TODO: wait for a fix in bukkit
|
||||
//Problem: Items can be duplicated
|
||||
//player.getBase().openInventory(ess.getServer().createInventory(player, 36));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -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())
|
||||
{
|
||||
|
@@ -4,8 +4,10 @@ import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.craftbukkit.ShowInventory;
|
||||
import com.earth2me.essentials.craftbukkit.InventoryWorkaround;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@@ -32,8 +34,15 @@ public class SignFree extends EssentialsSign
|
||||
throw new SignException(_("cantSpawnItem", "Air"));
|
||||
}
|
||||
|
||||
item.setAmount(item.getType().getMaxStackSize() * 9 * 4);
|
||||
ShowInventory.showFilledInventory(player.getBase(), item);
|
||||
item.setAmount(item.getType().getMaxStackSize());
|
||||
InventoryWorkaround.addItem(player.getInventory(), true, item);
|
||||
player.sendMessage("Item added to your inventory.");
|
||||
player.updateInventory();
|
||||
//TODO: wait for a fix in bukkit
|
||||
//Problem: Items can be duplicated
|
||||
//Inventory i = ess.getServer().createInventory(player, InventoryType.CHEST);
|
||||
//i.addItem(item);
|
||||
//player.openInventory(i);
|
||||
Trade.log("Sign", "Free", "Interact", username, null, username, new Trade(item, ess), sign.getBlock().getLocation(), ess);
|
||||
return true;
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ public class SignKit extends EssentialsSign
|
||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
|
||||
{
|
||||
validateTrade(sign, 3, ess);
|
||||
|
||||
|
||||
final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (kitName.isEmpty())
|
||||
@@ -56,10 +56,9 @@ public class SignKit extends EssentialsSign
|
||||
charge.isAffordableFor(player);
|
||||
try
|
||||
{
|
||||
final Object kit = ess.getSettings().getKit(kitName);
|
||||
final Map<String, Object> els = (Map<String, Object>)kit;
|
||||
final List<String> items = Kit.getItems(player, els);
|
||||
Kit.expandItems(ess, player, items);
|
||||
final Map<String, Object> kit = ess.getSettings().getKit(kitName);
|
||||
final List<String> items = Kit.getItems(player, kit);
|
||||
Kit.expandItems(ess, player, items);
|
||||
charge.charge(player);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@@ -129,7 +129,7 @@ public class SignProtection extends EssentialsSign
|
||||
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
|
||||
{
|
||||
final BlockSign sign = new BlockSign(block);
|
||||
if (sign.getLine(0).equalsIgnoreCase(this.getSuccessName()))
|
||||
if (sign.getLine(0).equals(this.getSuccessName()))
|
||||
{
|
||||
return checkProtectionSign(sign, user, username);
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public class SignTrade extends EssentialsSign
|
||||
try
|
||||
{
|
||||
stored = getTrade(sign, 1, true, true, ess);
|
||||
substractAmount(sign, 1, stored, ess);
|
||||
subtractAmount(sign, 1, stored, ess);
|
||||
stored.pay(player);
|
||||
}
|
||||
catch (SignException e)
|
||||
@@ -53,12 +53,14 @@ public class SignTrade extends EssentialsSign
|
||||
final Trade charge = getTrade(sign, 1, false, false, ess);
|
||||
final Trade trade = getTrade(sign, 2, false, true, ess);
|
||||
charge.isAffordableFor(player);
|
||||
addAmount(sign, 1, charge, ess);
|
||||
subtractAmount(sign, 2, trade, ess);
|
||||
if (!trade.pay(player, false))
|
||||
{
|
||||
subtractAmount(sign, 1, charge, ess);
|
||||
addAmount(sign, 2, trade, ess);
|
||||
throw new ChargeException("Full inventory");
|
||||
}
|
||||
substractAmount(sign, 2, trade, ess);
|
||||
addAmount(sign, 1, charge, ess);
|
||||
charge.charge(player);
|
||||
Trade.log("Sign", "Trade", "Interact", sign.getLine(3), charge, username, trade, sign.getBlock().getLocation(), ess);
|
||||
}
|
||||
@@ -133,11 +135,11 @@ public class SignTrade extends EssentialsSign
|
||||
final Double money = getMoney(split[0]);
|
||||
if (money != null)
|
||||
{
|
||||
if (Util.formatCurrency(money, ess).length() * 2 > 15)
|
||||
if (Util.shortCurrency(money, ess).length() * 2 > 15)
|
||||
{
|
||||
throw new SignException("Line can be too long!");
|
||||
}
|
||||
sign.setLine(index, Util.formatCurrency(money, ess) + ":0");
|
||||
sign.setLine(index, Util.shortCurrency(money, ess) + ":0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +155,7 @@ public class SignTrade extends EssentialsSign
|
||||
{
|
||||
throw new SignException(_("moreThanZero"));
|
||||
}
|
||||
sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1));
|
||||
sign.setLine(index, Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount, ess).substring(1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +258,7 @@ public class SignTrade extends EssentialsSign
|
||||
throw new SignException(_("invalidSignLine", index + 1));
|
||||
}
|
||||
|
||||
protected final void substractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
|
||||
protected final void subtractAmount(final ISign sign, final int index, final Trade trade, final IEssentials ess) throws SignException
|
||||
{
|
||||
final Double money = trade.getMoney();
|
||||
if (money != null)
|
||||
@@ -294,6 +296,7 @@ public class SignTrade extends EssentialsSign
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Translate these exceptions.
|
||||
private void changeAmount(final ISign sign, final int index, final double value, final IEssentials ess) throws SignException
|
||||
{
|
||||
|
||||
@@ -310,10 +313,10 @@ public class SignTrade extends EssentialsSign
|
||||
final Double amount = getDouble(split[1]);
|
||||
if (money != null && amount != null)
|
||||
{
|
||||
final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
|
||||
final String newline = Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount + value, ess).substring(1);
|
||||
if (newline.length() > 15)
|
||||
{
|
||||
throw new SignException("Line too long!");
|
||||
throw new SignException("This sign is full: Line too long!");
|
||||
}
|
||||
sign.setLine(index, newline);
|
||||
return;
|
||||
@@ -329,7 +332,7 @@ public class SignTrade extends EssentialsSign
|
||||
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
|
||||
if (newline.length() > 15)
|
||||
{
|
||||
throw new SignException("Line too long!");
|
||||
throw new SignException("This sign is full: Line too long!");
|
||||
}
|
||||
sign.setLine(index, newline);
|
||||
return;
|
||||
@@ -343,7 +346,7 @@ public class SignTrade extends EssentialsSign
|
||||
final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
|
||||
if (newline.length() > 15)
|
||||
{
|
||||
throw new SignException("Line too long!");
|
||||
throw new SignException("This sign is full: Line too long!");
|
||||
}
|
||||
sign.setLine(index, newline);
|
||||
return;
|
||||
|
@@ -30,9 +30,9 @@ public class HelpInput implements IText
|
||||
try
|
||||
{
|
||||
final PluginDescriptionFile desc = p.getDescription();
|
||||
final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands();
|
||||
final Map<String, Map<String, Object>> cmds = desc.getCommands();
|
||||
pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH);
|
||||
for (Map.Entry<String, HashMap<String, Object>> k : cmds.entrySet())
|
||||
for (Map.Entry<String, Map<String, Object>> k : cmds.entrySet())
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -57,7 +57,7 @@ public class HelpInput implements IText
|
||||
{
|
||||
if (ess.getSettings().showNonEssCommandsInHelp())
|
||||
{
|
||||
final HashMap<String, Object> value = k.getValue();
|
||||
final Map<String, Object> value = k.getValue();
|
||||
Object permissions = null;
|
||||
if (value.containsKey(PERMISSION))
|
||||
{
|
||||
|
@@ -33,12 +33,14 @@ public class KeywordReplacer implements IText
|
||||
String displayName, ipAddress, balance, mails, world;
|
||||
String worlds, online, unique, playerlist, date, time;
|
||||
String worldTime12, worldTime24, worldDate, plugins;
|
||||
String version;
|
||||
String userName, address, version;
|
||||
if (sender instanceof Player)
|
||||
{
|
||||
final User user = ess.getUser(sender);
|
||||
displayName = user.getDisplayName();
|
||||
userName = user.getName();
|
||||
ipAddress = user.getAddress().getAddress().toString();
|
||||
address = user.getAddress().toString();
|
||||
balance = Double.toString(user.getMoney());
|
||||
mails = Integer.toString(user.getMails().size());
|
||||
world = user.getLocation().getWorld().getName();
|
||||
@@ -107,8 +109,12 @@ public class KeywordReplacer implements IText
|
||||
for (int i = 0; i < input.getLines().size(); i++)
|
||||
{
|
||||
String line = input.getLines().get(i);
|
||||
|
||||
line = line.replace("{PLAYER}", displayName);
|
||||
line = line.replace("{DISPLAYNAME}", displayName);
|
||||
line = line.replace("{USERNAME}", displayName);
|
||||
line = line.replace("{IP}", ipAddress);
|
||||
line = line.replace("{ADDRESS}", ipAddress);
|
||||
line = line.replace("{BALANCE}", balance);
|
||||
line = line.replace("{MAILS}", mails);
|
||||
line = line.replace("{WORLD}", world);
|
||||
|
@@ -0,0 +1,35 @@
|
||||
package com.earth2me.essentials.textreader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class SimpleTextInput implements IText
|
||||
{
|
||||
private final transient List<String> lines = new ArrayList<String>();
|
||||
|
||||
public SimpleTextInput (final String input) {
|
||||
lines.add(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLines()
|
||||
{
|
||||
return lines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getChapters()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getBookmarks()
|
||||
{
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package com.earth2me.essentials.textreader;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
||||
public class SimpleTextPager
|
||||
{
|
||||
private final transient IText text;
|
||||
|
||||
public SimpleTextPager(final IText text)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void showPage(final CommandSender sender)
|
||||
{
|
||||
for (String line : text.getLines())
|
||||
{
|
||||
sender.sendMessage(line);
|
||||
}
|
||||
}
|
||||
|
||||
public String getString(int line)
|
||||
{
|
||||
if (text.getLines().size() < line)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return text.getLines().get(line);
|
||||
}
|
||||
}
|
@@ -196,4 +196,15 @@ public class User extends UserBase implements IUser
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAfford(final double cost)
|
||||
{
|
||||
final double mon = getMoney();
|
||||
if (isAuthorized("essentials.eco.loan"))
|
||||
{
|
||||
return (mon - cost) >= ess.getSettings().getMinMoney();
|
||||
}
|
||||
return cost <= mon;
|
||||
}
|
||||
}
|
||||
|
@@ -18,8 +18,6 @@
|
||||
# - CraftBukkit and Permissions have been updated: CraftBukkit and Essentials almost always line up, but sometimes other plugins fall behind CraftBukkit's multiple daily updates
|
||||
# - You have saved the document as UTF-8, NOT the default, ANSI
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | Essentials (Global) | #
|
||||
@@ -160,12 +158,19 @@ player-commands:
|
||||
# All kit names should be lower case, and will be treated as lower in permissions/costs.
|
||||
# Times are measured in seconds.
|
||||
kits:
|
||||
tools:
|
||||
dtools:
|
||||
delay: 10
|
||||
items:
|
||||
- 277 1
|
||||
- 278 1
|
||||
- 279 1
|
||||
tools:
|
||||
delay: 10
|
||||
items:
|
||||
- 272 1
|
||||
- 273 1
|
||||
- 274 1
|
||||
- 275 1
|
||||
|
||||
# Essentials Sign Control
|
||||
# See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these.
|
||||
@@ -281,18 +286,18 @@ spawn-if-no-home: true
|
||||
update-bed-at-daytime: true
|
||||
|
||||
# Allow players to have multiple homes.
|
||||
# Players need essentials.sethome.multiple before they can have more than 1 home, default to 'default' below.
|
||||
# Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip
|
||||
# People with essentials.sethome.multiple.unlimited are not limited by these numbers.
|
||||
sethome-multiple:
|
||||
# essentials.sethome.multiple
|
||||
default: 3
|
||||
# essentials.sethome.multiple.vip
|
||||
vip: 5
|
||||
# essentials.sethome.multiple.staff
|
||||
staff: 10
|
||||
|
||||
#Set timeout in seconds for players to accept tpa before request is cancelled.
|
||||
#Set to 0 for no timeout
|
||||
# Set timeout in seconds for players to accept tpa before request is cancelled.
|
||||
# Set to 0 for no timeout
|
||||
tpa-accept-cancellation: 0
|
||||
|
||||
############################################################
|
||||
@@ -313,7 +318,7 @@ command-costs:
|
||||
#example: 1000
|
||||
# /kit tools costs $1500 PER USE
|
||||
#kit-tools: 1500
|
||||
|
||||
|
||||
# Set this to a currency symbol you want to use.
|
||||
currency-symbol: '$'
|
||||
|
||||
@@ -321,6 +326,10 @@ currency-symbol: '$'
|
||||
# The amount is always limited to 10 trillions because of the limitations of a java double
|
||||
max-money: 10000000000000
|
||||
|
||||
# Set the minimum amount of money a player can have
|
||||
# Setting this to 0, will disable overdrafts/loans compeltely. Users need 'essentials.eco.loan' perm to go below 0.
|
||||
min-money: -10000000000000
|
||||
|
||||
# Enable this to log all interactions with trade/buy/sell signs and sell command
|
||||
economy-log-enabled: false
|
||||
|
||||
@@ -335,7 +344,7 @@ non-ess-in-help: true
|
||||
|
||||
# Hide plugins which dont give a permission
|
||||
# You can override a true value here for a single plugin by adding a permission to a user/group.
|
||||
# The indervidual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.
|
||||
# The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.
|
||||
# You can use negitive permissions to remove access to just a single plugins help if the following is enabled.
|
||||
hide-permissionless-help: true
|
||||
|
||||
@@ -346,30 +355,28 @@ hide-permissionless-help: true
|
||||
############################################################
|
||||
|
||||
chat:
|
||||
|
||||
|
||||
# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.
|
||||
# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
|
||||
# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
|
||||
# Or with essentials.chat.question can override this by prefixing text with a question mark (?)
|
||||
# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
|
||||
radius: 0
|
||||
|
||||
|
||||
# Chat formatting can be done in two ways, you can either define a standard format for all chat
|
||||
# Or you can give a group specific chat format, to give some extra variation.
|
||||
# If set to the default chat format which "should" be compatible with ichat.
|
||||
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
|
||||
|
||||
|
||||
format: '<{DISPLAYNAME}> {MESSAGE}'
|
||||
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
|
||||
|
||||
|
||||
group-formats:
|
||||
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
|
||||
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
|
||||
|
||||
# If your using group formats make sure to remove the '#' to allow the setting to be read.
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
# +------------------------------------------------------+ #
|
||||
# | EssentialsProtect | #
|
||||
@@ -400,13 +407,13 @@ protect:
|
||||
|
||||
# Which blocks should people be prevented from placing
|
||||
placement: 10,11,46,327
|
||||
|
||||
|
||||
# Which items should people be prevented from using
|
||||
usage: 327
|
||||
|
||||
|
||||
# Which blocks should people be prevented from breaking
|
||||
break:
|
||||
|
||||
|
||||
# Which blocks should not be pushed by pistons
|
||||
piston:
|
||||
|
||||
@@ -460,12 +467,12 @@ protect:
|
||||
mushroom_cow: false
|
||||
magma_cube: false
|
||||
snowman: false
|
||||
|
||||
|
||||
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
|
||||
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
|
||||
creeper:
|
||||
max-height: -1
|
||||
|
||||
|
||||
# Protect various blocks.
|
||||
protect:
|
||||
# Protect all signs
|
||||
@@ -481,7 +488,7 @@ protect:
|
||||
|
||||
# Prevent placing blocks above protected rails, this is to stop a potential griefing
|
||||
prevent-block-on-rails: false
|
||||
|
||||
|
||||
# Store blocks / signs in memory before writing
|
||||
memstore: false
|
||||
|
||||
@@ -510,22 +517,21 @@ protect:
|
||||
|
||||
# Burn, baby, burn! Should fire damage be disabled?
|
||||
firedmg: false
|
||||
|
||||
|
||||
# Should the damage after hit by a lightning be disabled?
|
||||
lightning: false
|
||||
|
||||
# Should people with build: false in permissions be allowed to build
|
||||
# Set true to disable building for those people
|
||||
build: true
|
||||
|
||||
|
||||
# Should people with build: false in permissions be allowed to use items
|
||||
# Set true to disable useing for those people
|
||||
# Set true to disable using for those people
|
||||
use: true
|
||||
|
||||
# Should we tell people they are not allowed to build
|
||||
warn-on-build-disallow: true
|
||||
|
||||
|
||||
# Disable weather options
|
||||
weather:
|
||||
storm: false
|
||||
@@ -544,10 +550,15 @@ newbies:
|
||||
# If not, set to ''
|
||||
#announce-format: ''
|
||||
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
|
||||
|
||||
|
||||
# When we spawn for the first time, which spawnpoint do we use?
|
||||
# Set to "none" if you want to use the spawn point of the world.
|
||||
spawnpoint: newbies
|
||||
|
||||
# Do we want to give users anything on first join? Set to '' to disable
|
||||
# This kit will be given reguardless of cost, and permissions.
|
||||
#kit: ''
|
||||
kit: tools
|
||||
|
||||
# Set this to lowest, if you want Multiverse to handle the respawning
|
||||
# Set this to high, if you want EssentialsSpawn to handle the respawning
|
||||
|
@@ -7,6 +7,10 @@ Name it info_username.txt or info_groupname.txt
|
||||
|
||||
This also works with motd and rules.
|
||||
|
||||
Extra pages:
|
||||
Type /info Colours
|
||||
Type /info Tags
|
||||
|
||||
It can contain chapters like the Chapter1 below:
|
||||
|
||||
#Chapter1
|
||||
@@ -25,7 +29,9 @@ Minecraft colors:
|
||||
|
||||
#Tags
|
||||
PLAYER: {PLAYER}
|
||||
USERNAME: {PLAYER}
|
||||
IP: {IP}
|
||||
ADDRESS: {ADDRESS}
|
||||
BALANCE: {BALANCE}
|
||||
MAILS: {MAILS}
|
||||
WORLD: {WORLD}
|
||||
@@ -39,3 +45,4 @@ WORLDTIME12: {WORLDTIME12}
|
||||
WORLDTIME24: {WORLDTIME24}
|
||||
WORLDDATE: {WORLDDATE}
|
||||
PLUGINS: {PLUGINS}
|
||||
VERSION: {VERSION}
|
@@ -4,7 +4,7 @@
|
||||
# by:
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} has been added to your account.
|
||||
addedToOthersAccount=\u00a7a{0} has been added to {1} account.
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=broke:
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3}
|
||||
alertPlaced=placed:
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=Could not find template {0}
|
||||
creatingConfigFromTemplate=Creating config from template: {0}
|
||||
creatingEmptyConfig=Creating empty config: {0}
|
||||
creative=creative
|
||||
currency={0}{1}
|
||||
day=day
|
||||
days=days
|
||||
defaultBanReason=The Ban Hammer has spoken!
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77Smiting {0}
|
||||
listAfkTag = \u00a77[AFK]\u00a7f
|
||||
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
|
||||
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[HIDDEN]\u00a7f
|
||||
loadWarpError=Failed to load warp {0}
|
||||
localFormat=Local: <{0}> {1}
|
||||
@@ -294,13 +296,14 @@ requestDenied=\u00a77Teleport request denied.
|
||||
requestDeniedFrom=\u00a77{0} denied your teleport request.
|
||||
requestSent=\u00a77Request sent to {0}\u00a77.
|
||||
requestTimedOut=\u00a7cTeleport request has timed out
|
||||
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
|
||||
returnPlayerToJailError=Error occurred when trying to return player to jail.
|
||||
requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=second
|
||||
seconds=seconds
|
||||
seenOffline=Player {0} is offline since {1}
|
||||
seenOnline=Player {0} is online since {1}
|
||||
serverFull=Server is full
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=Changed spawner type to {0}
|
||||
sheepMalformedColor=Malformed color.
|
||||
shoutFormat=\u00a77[Shout]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Goodbye Cruel World...
|
||||
suicideSuccess= \u00a77{0} took their own life
|
||||
survival=survival
|
||||
takenFromAccount=\u00a7c{0} has been taken from your account.
|
||||
takenFromOthersAccount=\u00a7c{0} has been taken from {1} account.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Teleporting request sent to all players...
|
||||
teleportAll=\u00a77Teleporting all players...
|
||||
teleportAtoB=\u00a77{0}\u00a77 teleported you to {1}\u00a77.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# by: Dysp, dysperen@gmail.com
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} er blevet tilf\u00f8jet til din konto.
|
||||
addedToOthersAccount=\u00a7a{0} er blevet tilf\u00f8jet til {1} konto.
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=\u00f8delagde:
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} ved: {3}
|
||||
alertPlaced=placerede:
|
||||
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Teleporterer til tidligere placering.
|
||||
backupFinished=Backup sluttet
|
||||
backupStarted=Backup startet
|
||||
balance=\u00a77Saldo: {0}
|
||||
balanceTop=\u00a77 Top saldoer ({0})
|
||||
balanceTop=\u00a77Top saldoer ({0})
|
||||
banExempt=\u00a7cDu kan ikke banne den p\u00e5g\u00e6ldende spiller.
|
||||
banIpAddress=\u00a77Bannede IP addresse
|
||||
bannedIpsFileError=Fejl i afl\u00e6sning af banned-ips.txt
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=Kunne ikke finde skabelon {0}
|
||||
creatingConfigFromTemplate=Opretter config fra skabelon: {0}
|
||||
creatingEmptyConfig=Opretter tom config: {0}
|
||||
creative=creative
|
||||
currency={0}{1}
|
||||
day=dag
|
||||
days=dage
|
||||
defaultBanReason=Banhammeren har talt!
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77Kaster lyn efter {0}
|
||||
listAfkTag = \u00a77[AFK]\u00a7f
|
||||
listAmount = \u00a79Der er \u00a7c{0}\u00a79 ud af maksimum\u00a7c{1}\u00a79 spillere online.
|
||||
listAmountHidden = \u00a79Der er \u00a7c{0}\u00a77/{1}\u00a79 ud af maksimum \u00a7c{2}\u00a79 spillere online.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[HIDDEN]\u00a7f
|
||||
loadWarpError=Kunne ikke l\u00c3\u00a6se warp {0}
|
||||
localFormat=Local: <{0}> {1}
|
||||
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport.
|
||||
requestSent=\u00a77Anmodning sendt til {0}\u00a77.
|
||||
requestTimedOut=\u00a7cTeleport request has timed out
|
||||
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
|
||||
returnPlayerToJailError=En fejl opstod ved fors\u00f8g p\u00e5 at returnere spilleren til f\u00e6ngsel.
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=sekund
|
||||
seconds=sekunder
|
||||
seenOffline=Spilleren {0} har v\u00c3\u00a6ret offline i {1}
|
||||
seenOnline=Spilleren {0} har v\u00c3\u00a6ret online i {1}
|
||||
serverFull=Serveren er sgu fuld. Den b\u00c3\u00b8r melde sig til AA.
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=\u00c3\u0086ndrede spawner type til {0}
|
||||
sheepMalformedColor=Forkert farve. (Korrekt oversat?)
|
||||
shoutFormat=\u00a77[Shout]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Farvel grusomme verden...
|
||||
suicideSuccess= \u00a77{0} tog sit eget liv
|
||||
survival=survival
|
||||
takenFromAccount=\u00a7c{0} er blevet taget fra din konto.
|
||||
takenFromOthersAccount=\u00a7c{0} er blevet taget fra {1}''s konto.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Anmodning om teleport er sendt til alle spillere.
|
||||
teleportAll=\u00a77Teleporterer alle spillere...
|
||||
teleportAtoB=\u00a77{0}\u00a77 teleporterede dig til {1}\u00a77.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# by:
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} wurden zu deiner Geldb\u00f6rse hinzugef\u00fcgt.
|
||||
addedToOthersAccount=\u00a7a{0} wurden zu {1}s Konto hinzugef\u00fcgt.
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=zerst\u00f6rt:
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} bei: {3}
|
||||
alertPlaced=platziert:
|
||||
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Kehre zur letzten Position zur\u00fcck.
|
||||
backupFinished=Backup beendet
|
||||
backupStarted=Backup gestartet
|
||||
balance=\u00a77Geldb\u00f6rse: {0}
|
||||
balanceTop=\u00a77 Top Guthaben ({0})
|
||||
balanceTop=\u00a77Top Guthaben ({0})
|
||||
banExempt=\u00a7cDu kannst diesen Spieler nicht sperren.
|
||||
banIpAddress=\u00a77IP-Adresse gesperrt.
|
||||
bannedIpsFileError=Fehler beim Lesen von banned-ips.txt
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=Vorlage {0} konnte nicht gefunden werden.
|
||||
creatingConfigFromTemplate=Erstelle Konfiguration aus Vorlage: {0}
|
||||
creatingEmptyConfig=Erstelle leere Konfiguration: {0}
|
||||
creative=creative
|
||||
currency={0}{1}
|
||||
day=Tag
|
||||
days=Tage
|
||||
defaultBanReason=Der Bann-Hammer hat gesprochen!
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77Peinige {0}
|
||||
listAfkTag = \u00a77[Inaktiv]\u00a7f
|
||||
listAmount = \u00a79Es sind \u00a7c{0}\u00a79 von maximal \u00a7c{1}\u00a79 Spielern online.
|
||||
listAmountHidden = \u00a79Es sind \u00a7c{0}\u00a77/{1}\u00a79 von maximal \u00a7c{2}\u00a79 Spielern online.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[Versteckt]\u00a7f
|
||||
loadWarpError=Fehler beim Laden von Warp-Punkt {0}
|
||||
localFormat=Lokal: <{0}> {1}
|
||||
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt.
|
||||
requestSent=\u00a77Anfrage gesendet an {0}\u00a77.
|
||||
requestTimedOut=\u00a7cTeleport request has timed out
|
||||
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
|
||||
returnPlayerToJailError=Fehler beim Versuch, den Spieler ins Gef\u00e4ngnis zu teleportieren.
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=Sekunde
|
||||
seconds=Sekunden
|
||||
seenOffline=Spieler {0} ist offline seit {1}
|
||||
seenOnline=Spieler {0} ist online seit {1}
|
||||
serverFull=Server ist voll
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=\u00c4ndere Mob-Spawner zu {0}
|
||||
sheepMalformedColor=Ung\u00fcltige Farbe.
|
||||
shoutFormat=\u00a77[Schrei]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Lebewohl grausame Welt...
|
||||
suicideSuccess= \u00a77{0} hat sich das Leben genommen.
|
||||
survival=survival
|
||||
takenFromAccount=\u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen.
|
||||
takenFromOthersAccount=\u00a7c{0} wurde von {1} wurde Rechnung getragen.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Teleportierungsanfrage zu allen Spielern gesendet...
|
||||
teleportAll=\u00a77Teleportiere alle Spieler...
|
||||
teleportAtoB=\u00a77{0}\u00a77 teleportiert dich zu {1}\u00a77.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# by:
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} has been added to your account.
|
||||
addedToOthersAccount=\u00a7a{0} has been added to {1} account.
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=broke:
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3}
|
||||
alertPlaced=placed:
|
||||
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Returning to previous location.
|
||||
backupFinished=Backup finished
|
||||
backupStarted=Backup started
|
||||
balance=\u00a77Balance: {0}
|
||||
balanceTop=\u00a77 Top balances ({0})
|
||||
balanceTop=\u00a77Top balances ({0})
|
||||
banExempt=\u00a7cYou can not ban that player.
|
||||
banIpAddress=\u00a77Banned IP address
|
||||
bannedIpsFileError=Error reading banned-ips.txt
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=Could not find template {0}
|
||||
creatingConfigFromTemplate=Creating config from template: {0}
|
||||
creatingEmptyConfig=Creating empty config: {0}
|
||||
creative=creative
|
||||
currency={0}{1}
|
||||
day=day
|
||||
days=days
|
||||
defaultBanReason=The Ban Hammer has spoken!
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77Smiting {0}
|
||||
listAfkTag = \u00a77[AFK]\u00a7f
|
||||
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
|
||||
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[HIDDEN]\u00a7f
|
||||
loadWarpError=Failed to load warp {0}
|
||||
localFormat=Local: <{0}> {1}
|
||||
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} denied your teleport request
|
||||
requestSent=\u00a77Request sent to {0}\u00a77.
|
||||
requestTimedOut=\u00a7cTeleport request has timed out
|
||||
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
|
||||
returnPlayerToJailError=Error occurred when trying to return player to jail.
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=second
|
||||
seconds=seconds
|
||||
seenOffline=Player {0} is offline since {1}
|
||||
seenOnline=Player {0} is online since {1}
|
||||
serverFull=Server is full
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=Changed spawner type to {0}
|
||||
sheepMalformedColor=Malformed color.
|
||||
shoutFormat=\u00a77[Shout]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Goodbye Cruel World...
|
||||
suicideSuccess= \u00a77{0} took their own life
|
||||
survival=survival
|
||||
takenFromAccount=\u00a7c{0} has been taken from your account.
|
||||
takenFromOthersAccount=\u00a7c{0} has been taken from {1} account.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Teleporting request sent to all players...
|
||||
teleportAll=\u00a77Teleporting all players...
|
||||
teleportAtoB=\u00a77{0}\u00a77 teleported you to {1}\u00a77.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# by:
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} ha sido agregado a tu cuenta.
|
||||
addedToOthersAccount=\u00a7a{0} ha sido agregado a la cuenta de {1}.
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=roto:
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} en: {3}
|
||||
alertPlaced=situado:
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=No se puede encontrar el template {0}
|
||||
creatingConfigFromTemplate=Creando configuracion desde el template: {0}
|
||||
creatingEmptyConfig=Creando configuracion vacia: {0}
|
||||
creative=creative
|
||||
currency={0}{1}
|
||||
day=dia
|
||||
days=dias
|
||||
defaultBanReason=Baneado por incumplir las normas!
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77Golpeando a {0}
|
||||
listAfkTag = \u00a77[AFK]\u00a7f
|
||||
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
|
||||
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[HIDDEN]\u00a7f
|
||||
loadWarpError=Error al cargar el tenetransporte {0}
|
||||
localFormat=Local: <{0}> {1}
|
||||
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte.
|
||||
requestSent=\u00a77Peticion enviada a {0}\u00a77.
|
||||
requestTimedOut=\u00a7cTeleport request has timed out
|
||||
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
|
||||
returnPlayerToJailError=Error al intentar quitar al jugador de la carcel.
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=segundo
|
||||
seconds=segundos
|
||||
seenOffline=El jugador {0} esta desconectado desde {1}
|
||||
seenOnline=El jugador {0} lleva conectado desde {1}
|
||||
serverFull=Servidor lleno
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=Cambiado tipo de lugar de nacimiento a {0}
|
||||
sheepMalformedColor=Color malformado.
|
||||
shoutFormat=\u00a77[Shout]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Adios mundo cruel...
|
||||
suicideSuccess= \u00a77{0} se quito su propia vida
|
||||
survival=survival
|
||||
takenFromAccount=\u00a7c{0} ha sido sacado de tu cuenta.
|
||||
takenFromOthersAccount=\u00a7c{0} ha sido sacado de la cuenta de {1}.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Peticion de teletransporte enviada a todos los jugadores...
|
||||
teleportAll=\u00a77Teletransportando a todos los jugadores...
|
||||
teleportAtoB=\u00a77{0}\u00a77 te teletransporto a {1}\u00a77.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# by: L\u00e9a Gris
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 \u00e0 votre compte.
|
||||
addedToOthersAccount=\u00a7a{0} a \u00e9t\u00e9 ajout\u00e9 \u00e0 {1} compte.
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=a cass\u00e9 :
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} \u00e0:{3}
|
||||
alertPlaced=a plac\u00e9 :
|
||||
@@ -15,7 +15,7 @@ backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9c\u00c3\u00a8dent.
|
||||
backupFinished=Sauvegarde termin\u00e9
|
||||
backupStarted=D\u00e9but de la sauvegarde...
|
||||
balance=\u00a77Solde : {0}
|
||||
balanceTop=\u00a77 Meilleurs soldes au ({0})
|
||||
balanceTop=\u00a77Meilleurs soldes au ({0})
|
||||
banExempt=\u00a77Vous ne pouvez pas bannir ce joueur.
|
||||
banIpAddress=\u00a77Adresse IP bannie.
|
||||
bannedIpsFileError=Erreur de lecture de banned-ips.txt
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=Le mod\u00c3\u00a8le {0} est introuvable
|
||||
creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du mod\u00c3\u00a8le : {0}
|
||||
creatingEmptyConfig=Cr\u00e9ation d''une configuration vierge : {0}
|
||||
creative=cr\u00e9atif
|
||||
currency={0}{1}
|
||||
day=jour
|
||||
days=jours
|
||||
defaultBanReason=Le marteau du bannissement a frapp\u00e9 !
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77{0} a \u00e9t\u00e9 foudroy\u00e9.
|
||||
listAfkTag = \u00a77[AFK]\u00a7f
|
||||
listAmount = \u00a79Il y a \u00a7c{0}\u00a79 joueurs en ligne sur \u00a7c{1}\u00a79 au total.
|
||||
listAmountHidden = \u00a79Il y a \u00a7c{0}\u00a77/{1}\u00a79 sur un maximum de \u00a7c{2}\u00a79 joueurs en ligne.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[MASQU\u00c9]\u00a7f
|
||||
loadWarpError=\u00c9chec du chargement du point de t\u00e9l\u00e9portation {0}.
|
||||
localFormat=Locale : <{0}> {1}
|
||||
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portat
|
||||
requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77.
|
||||
requestTimedOut=\u00a7cLa de mande de t\u00e9l\u00e9portation a expir\u00e9.
|
||||
requiredBukkit=* ! * Vous avez besoin au moins de la version {0} de CraftBukkit. T\u00e9l\u00e9chargez-la ici http://ci.bukkit.org.
|
||||
returnPlayerToJailError=Erreur survenue lors de la tentative d'emprisonner de nouveau un joueur.
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=seconde
|
||||
seconds=secondes
|
||||
seenOffline=Le joueur {0} est hors ligne depuis {1}
|
||||
seenOnline=Le joueur {0} est en ligne depuis {1}
|
||||
serverFull=Le serveur est plein.
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=Type de g\u00e9n\u00e9rateur chang\u00e9 en {0}
|
||||
sheepMalformedColor=Couleur mal form\u00e9e.
|
||||
shoutFormat=\u00a77[Crie]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Au revoir monde cruel...
|
||||
suicideSuccess=\u00a77{0} s''est suicid\u00e9.
|
||||
survival=survie
|
||||
takenFromAccount=\u00a7c{0} ont \u00e9t\u00e9 retir\u00e9 de votre compte.
|
||||
takenFromOthersAccount=\u00a7c{0} a \u00e9t\u00e9 r\u00e9tir\u00e9 du compte de {1}.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Demande de t\u00e9l\u00e9portation envoy\u00e9e \u00e0 tous les joueurs...
|
||||
teleportAll=\u00a77T\u00e9l\u00e9poration de tous les joueurs.
|
||||
teleportAtoB=\u00a77{0}\u00a77 vous a t\u00e9l\u00e9port\u00e9 \u00e0 {1}\u00a77.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# by: Geertje123
|
||||
action=* {0} {1}
|
||||
addedToAccount=\u00a7a{0} is gestort op je account.
|
||||
addedToOthersAccount=\u00a7a{0} is overgemaakt naar {1}''s rekening
|
||||
addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2}
|
||||
alertBroke=gebroken:
|
||||
alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} bij: {3}
|
||||
alertPlaced=geplaatst:
|
||||
@@ -49,6 +49,7 @@ couldNotFindTemplate=Het sjabloon kon niet worden gevonden {0}
|
||||
creatingConfigFromTemplate=Bezig met aanmaken van een config vanaf sjabloon: {0}
|
||||
creatingEmptyConfig=Bezig met een lege config aanmaken: {0}
|
||||
creative=creative
|
||||
currency={0}{1}
|
||||
day=dag
|
||||
days=dagen
|
||||
defaultBanReason=De Ban Hamer heeft gesproken!
|
||||
@@ -169,6 +170,7 @@ lightningUse=\u00a77Brand {0}
|
||||
listAfkTag = \u00a77[AFK]\u00a7f
|
||||
listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online.
|
||||
listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online.
|
||||
listGroupTag={0}\u00a7f:
|
||||
listHiddenTag = \u00a77[HIDDEN]\u00a7f
|
||||
loadWarpError=Fout bij het laden van warp {0}
|
||||
localFormat=Local: <{0}> {1}
|
||||
@@ -295,12 +297,13 @@ requestDeniedFrom=\u00a77{0} denied your teleport request.
|
||||
requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77.
|
||||
requestTimedOut=\u00a7cTeleport request has timed out
|
||||
requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org.
|
||||
returnPlayerToJailError=Fout opgetreden bij terugzetten van speler in gevangenis.
|
||||
returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1}
|
||||
second=seconde
|
||||
seconds=seconde
|
||||
seenOffline=Speler {0} is offline vanaf {1}
|
||||
seenOnline=Speler {0} is online vanaf {1}
|
||||
serverFull=Server is vol
|
||||
serverTotal=Server Total: {0}
|
||||
setSpawner=Changed spawner type to {0}
|
||||
sheepMalformedColor=Misvoormde kleur.
|
||||
shoutFormat=\u00a77[Shout]\u00a7f {0}
|
||||
@@ -317,7 +320,7 @@ suicideMessage=\u00a77Vaarwel vreedzame wereld...
|
||||
suicideSuccess= \u00a77{0} pleegde zelfmoord
|
||||
survival=survival
|
||||
takenFromAccount=\u00a7c{0} is van je bank rekening afgehaald.
|
||||
takenFromOthersAccount=\u00a7c{0} is overgenomen uit {1} account.
|
||||
takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2}
|
||||
teleportAAll=\u00a77Teleporting request sent to all players...
|
||||
teleportAll=\u00a77Bezig met teleporteren van alle spelers...
|
||||
teleportAtoB=\u00a77{0}\u00a77 is naar {1}\u00a77 geteleporteerd.
|
||||
|
@@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials
|
||||
version: TeamCity
|
||||
website: http://tiny.cc/EssentialsCommands
|
||||
description: Provides an essential, core set of commands for Bukkit.
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5]
|
||||
commands:
|
||||
afk:
|
||||
description: Marks you as away-from-keyboard.
|
||||
@@ -13,8 +13,8 @@ commands:
|
||||
aliases: [eafk]
|
||||
antioch:
|
||||
description: 'A little surprise for operators.'
|
||||
usage: /<command>
|
||||
aliases: [eantioch]
|
||||
usage: /<command> [message]
|
||||
aliases: [eantioch,grenade,tnt,egrenade,etnt]
|
||||
back:
|
||||
description: Teleports you to your location prior to tp/spawn/warp.
|
||||
usage: /<command>
|
||||
@@ -26,7 +26,7 @@ commands:
|
||||
balance:
|
||||
description: States the current balance of a player.
|
||||
usage: /<command> [player]
|
||||
aliases: [bal,emoney,ebalance,ebal]
|
||||
aliases: [bal,money,emoney,ebalance,ebal]
|
||||
balancetop:
|
||||
description: Gets the top balance values.
|
||||
usage: /<command> <page>
|
||||
@@ -58,11 +58,11 @@ commands:
|
||||
clearinventory:
|
||||
description: Clear all items in your inventory.
|
||||
usage: /<command>
|
||||
aliases: [ci,eci,eclearinventory]
|
||||
aliases: [ci,eci,clearinvent,clean,eclean,eclearinvent,eclearinventory]
|
||||
compass:
|
||||
description: Describes your current bearing.
|
||||
usage: /<command>
|
||||
aliases: [ecompass]
|
||||
aliases: [ecompass,direction,edirection]
|
||||
delhome:
|
||||
description: Removes a home
|
||||
usage: /<command> [player:]<name>
|
||||
@@ -97,7 +97,7 @@ commands:
|
||||
feed:
|
||||
description: Satisfy the hunger.
|
||||
usage: /<command> [player]
|
||||
aliases: [efeed]
|
||||
aliases: [efeed,eat,eeat]
|
||||
itemdb:
|
||||
description: Searches for an item.
|
||||
usage: /<command> <item>
|
||||
@@ -113,14 +113,14 @@ commands:
|
||||
getpos:
|
||||
description: Get your current coordinates or those of a player.
|
||||
usage: /<command> [player]
|
||||
aliases: [coords,egetpos,whereami,ewhereami]
|
||||
aliases: [coords,egetpos,position,eposition,whereami,ewhereami]
|
||||
gc:
|
||||
description: Reports garbage collection info; useful to developers.
|
||||
usage: /<command>
|
||||
aliases: [mem,memory,egc,emem,ememory]
|
||||
give:
|
||||
description: Give a player an item.
|
||||
usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
|
||||
usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
|
||||
aliases: [egive]
|
||||
god:
|
||||
description: Enables your godly powers.
|
||||
@@ -141,7 +141,7 @@ commands:
|
||||
home:
|
||||
description: Teleport to your home.
|
||||
usage: /<command> [player:][name]
|
||||
aliases: [ehome]
|
||||
aliases: [ehome,homes,ehomes]
|
||||
ignore:
|
||||
description: Ignore other players.
|
||||
usage: /<command> <player>
|
||||
@@ -165,7 +165,7 @@ commands:
|
||||
jump:
|
||||
description: Jumps to the nearest block in the line of sight.
|
||||
usage: /<command>
|
||||
aliases: [j,ejump]
|
||||
aliases: [j,ej,jumpto,ejumpto,ejump]
|
||||
kick:
|
||||
description: Kicks a specified player with a reason.
|
||||
usage: /<command> <player> [reason]
|
||||
@@ -177,7 +177,7 @@ commands:
|
||||
kit:
|
||||
description: Obtains the specified kit or views all available kits.
|
||||
usage: /<command> [kit]
|
||||
aliases: [ekit,kits]
|
||||
aliases: [ekit,kits,ekits]
|
||||
kill:
|
||||
description: Kills specified player.
|
||||
usage: /<command> <player>
|
||||
@@ -189,7 +189,7 @@ commands:
|
||||
list:
|
||||
description: List all online players.
|
||||
usage: /<command>
|
||||
aliases: [playerlist,who,online,elist,ewho,eplayerlist,eonline]
|
||||
aliases: [playerlist,who,online,plist,eplist,elist,ewho,eplayerlist,eonline]
|
||||
lightning:
|
||||
description: The power of Thor. Strike at cursor or player.
|
||||
usage: /<command> [player] [power]
|
||||
@@ -220,7 +220,7 @@ commands:
|
||||
aliases: [emute]
|
||||
near:
|
||||
description: Lists the players near by or around a player
|
||||
usage: /<command> [playername] [radius]
|
||||
usage: /<command> [playername] [radius]
|
||||
aliases: [nearby,enear,enearby]
|
||||
nick:
|
||||
description: Change your nickname or that of another player.
|
||||
@@ -237,7 +237,7 @@ commands:
|
||||
ping:
|
||||
description: Pong!
|
||||
usage: /<command>
|
||||
aliases: [pong,eping,epong]
|
||||
aliases: [pong,echo,echo,eping,epong]
|
||||
powertool:
|
||||
description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click.
|
||||
usage: /<command> [l:|a:|r:|c:|d:][command] [arguments]
|
||||
@@ -245,7 +245,7 @@ commands:
|
||||
powertooltoggle:
|
||||
description: Enables or disables all current powertools
|
||||
usage: /<command>
|
||||
aliases: [ptt,epowertooltoggle,eptt]
|
||||
aliases: [ptt,epowertooltoggle,pttoggle,epttoggle,eptt]
|
||||
ptime:
|
||||
description: Adjust player's client time. Add @ prefix to fix.
|
||||
usage: /<command> [list|reset|day|night|dawn|17:30|4pm|4000ticks] [player|*]
|
||||
@@ -337,11 +337,11 @@ commands:
|
||||
tp:
|
||||
description: Teleport to a player.
|
||||
usage: /<command> <player> [otherplayer]
|
||||
aliases: [tele,etele,etp,tp2p,etp2p]
|
||||
aliases: [tele,teleport,eteleport,etele,etp,tp2p,etp2p]
|
||||
tpa:
|
||||
description: Request to teleport to the specified player.
|
||||
usage: /<command> <player>
|
||||
aliases: [call,etpa,ecall]
|
||||
aliases: [call,tpask,etpask,etpa,ecall]
|
||||
tpaall:
|
||||
description: Requests all players online to teleport to you.
|
||||
usage: /<command> <player>
|
||||
@@ -389,11 +389,11 @@ commands:
|
||||
unban:
|
||||
description: Unbans the specified player.
|
||||
usage: /<command> <player>
|
||||
aliases: [pardon,eunban]
|
||||
aliases: [pardon,eunban,epardon]
|
||||
unbanip:
|
||||
description: Unbans the specified IP address.
|
||||
usage: /<command> <address>
|
||||
aliases: [eunbanip,pardonip]
|
||||
aliases: [eunbanip,pardonip,epardonip]
|
||||
unlimited:
|
||||
description: Allows the unlimited placing of items.
|
||||
usage: /<command> <list|item|clear> [player]
|
||||
@@ -401,7 +401,7 @@ commands:
|
||||
warp:
|
||||
description: List all warps or warp to the specified location.
|
||||
usage: /<command> <pagenumber|warp> [player]
|
||||
aliases: [ewarp,warps]
|
||||
aliases: [ewarp,warps,ewarps]
|
||||
weather:
|
||||
description: Setting the weather.
|
||||
usage: /<command> <storm/sun> [duration]
|
||||
@@ -417,4 +417,4 @@ commands:
|
||||
worth:
|
||||
description: Calculates the worth of items in hand or as specified.
|
||||
usage: /<command> [item] [amount]
|
||||
aliases: [eworth]
|
||||
aliases: [eworth,price,eprice]
|
||||
|
@@ -13,7 +13,12 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.help.HelpMap;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.map.MapView;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -250,7 +255,6 @@ public class FakeServer implements Server
|
||||
return worlds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World createWorld(String string, Environment e)
|
||||
{
|
||||
World w = new FakeWorld(string, e);
|
||||
@@ -258,7 +262,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 +334,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)
|
||||
{
|
||||
@@ -654,4 +645,64 @@ public class FakeServer implements Server
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksPerAnimalSpawns()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksPerMonsterSpawns()
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HelpMap getHelpMap()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(InventoryHolder ih, InventoryType it)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(InventoryHolder ih, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory createInventory(InventoryHolder ih, int i, String string)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public class ChatStore
|
||||
|
||||
public String getLongType()
|
||||
{
|
||||
return type.length() > 0 ? "chat" : "chat-" + type;
|
||||
return type.length() == 0 ? "chat" : "chat-" + type;
|
||||
}
|
||||
|
||||
public long getRadius()
|
||||
|
@@ -7,8 +7,6 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@@ -5,6 +5,6 @@ main: com.earth2me.essentials.chat.EssentialsChat
|
||||
version: TeamCity
|
||||
website: http://tiny.cc/EssentialsCommands
|
||||
description: Provides chat control features for Essentials. Requires Permissions.
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Okamosy]
|
||||
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy]
|
||||
depend: [Essentials]
|
||||
#softdepend: [Factions]
|
@@ -1,3 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
@@ -125,4 +125,25 @@ v 1.9:
|
||||
- Fixed an infinite loop error when using '/manudel' on a logged in player. It caused setDefaultGroup to trigger a bukkit update when no GM User existed yet.
|
||||
- do not allow inherited permissions to negate higher perms.
|
||||
- Fixed a bug when pushing superperms in the wrong order.
|
||||
- Fix players retaining permissions when demoted.
|
||||
- Fix players retaining permissions when demoted.
|
||||
- Auto sort permissions on load to speed up population of superperms.
|
||||
- Negating a parent node after adding all nodes with * will now correctly remove all child nodes of that parent before populating superperms.
|
||||
eg.
|
||||
- '*'
|
||||
- -vanish.*
|
||||
- vanish.standard
|
||||
- Track the 'onPlayerChangeWorld' event as some teleports seem to not be triggering a world move.
|
||||
- Catch all errors in badly formatted groups.
|
||||
- Fix a bug with getWorldData return the main world data for all mirrors, instead of the worlds parent data.
|
||||
- Prevent getAllPlayersPermissions() processing a group more than once. Improves performance when using complex inheritance structures.
|
||||
- Fix world mirroring so it correctly creates data files and data sources for partially mirrored worlds.
|
||||
- Fixed world mirroring so it returns the correct data for the requested world.
|
||||
- Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data.
|
||||
- Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent.
|
||||
This also means we no longer update permissions before we change worlds.
|
||||
- A command of '/manload' with no world arguments now performs a full reload of GM.
|
||||
- Update for Bukkit R5 compatability.
|
||||
- Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
|
||||
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
|
||||
- Prevent promoting players to, and demoting to GlobalGroups.
|
||||
- Make 'manload' reload the config correctly.
|
@@ -4,10 +4,6 @@ settings:
|
||||
# The user will be able to promote players to the same group or even above.
|
||||
opOverrides: true
|
||||
|
||||
# If enabled any bukkit permissiosn which default to true will be left enabled.
|
||||
# If the player is op any permissions set to Op will follow suit.
|
||||
bukkit_perms_override: true
|
||||
|
||||
# Default setting for 'mantoglevalidate'
|
||||
# true will cause GroupManager to attempt name matching by default.
|
||||
validate_toggle: true
|
||||
|
@@ -57,9 +57,6 @@ public class GMConfiguration {
|
||||
public boolean isOpOverride() {
|
||||
return GMconfig.getBoolean("settings.config.opOverrides", true);
|
||||
}
|
||||
public boolean isBukkitPermsOverride() {
|
||||
return GMconfig.getBoolean("settings.config.bukkit_perms_override", false);
|
||||
}
|
||||
public boolean isToggleValidate() {
|
||||
return GMconfig.getBoolean("settings.config.validate_toggle", true);
|
||||
}
|
||||
|
@@ -25,7 +25,10 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder;
|
||||
import org.anjocaido.groupmanager.events.GMSystemEvent;
|
||||
import org.anjocaido.groupmanager.events.GMWorldListener;
|
||||
import org.anjocaido.groupmanager.events.GroupManagerEventHandler;
|
||||
import org.anjocaido.groupmanager.events.GMGroupEvent.Action;
|
||||
import org.anjocaido.groupmanager.utils.GMLoggerHandler;
|
||||
import org.anjocaido.groupmanager.utils.PermissionCheckResult;
|
||||
import org.anjocaido.groupmanager.utils.Tasks;
|
||||
@@ -118,15 +121,15 @@ public class GroupManager extends JavaPlugin {
|
||||
ch = new GMLoggerHandler();
|
||||
GroupManager.logger.addHandler(ch);
|
||||
logger.setLevel(Level.ALL);
|
||||
if (worldsHolder == null) {
|
||||
// Create the backup folder, if it doesn't exist.
|
||||
prepareFileFields();
|
||||
// Load the config.yml
|
||||
prepareConfig();
|
||||
// Load the global groups
|
||||
globalGroups = new GlobalGroups(this);
|
||||
worldsHolder = new WorldsHolder(this);
|
||||
}
|
||||
|
||||
// Create the backup folder, if it doesn't exist.
|
||||
prepareFileFields();
|
||||
// Load the config.yml
|
||||
prepareConfig();
|
||||
// Load the global groups
|
||||
globalGroups = new GlobalGroups(this);
|
||||
worldsHolder = new WorldsHolder(this);
|
||||
|
||||
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
if (worldsHolder == null) {
|
||||
@@ -158,7 +161,7 @@ public class GroupManager extends JavaPlugin {
|
||||
System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
|
||||
|
||||
// Register as a service
|
||||
this.getServer().getServicesManager().register(AnjoPermissionsHandler.class, this.permissionHandler, this, ServicePriority.Lowest);
|
||||
this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest);
|
||||
}
|
||||
|
||||
public static boolean isLoaded() {
|
||||
@@ -395,6 +398,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||
@@ -1016,6 +1023,11 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// VALIDANDO PERMISSAO
|
||||
if (permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
|
||||
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)");
|
||||
@@ -1049,6 +1061,11 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group 2 does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) {
|
||||
sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + ".");
|
||||
@@ -1219,6 +1236,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
// PARECE OK
|
||||
auxString = "";
|
||||
@@ -1248,6 +1269,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!auxGroup.getVariables().hasVar(args[1])) {
|
||||
sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!");
|
||||
@@ -1273,6 +1298,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
// PARECE OK
|
||||
auxString = "";
|
||||
@@ -1310,6 +1339,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group does not exists!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null);
|
||||
if (auxGroup2 == null) {
|
||||
@@ -1485,14 +1518,16 @@ public class GroupManager extends JavaPlugin {
|
||||
|
||||
try {
|
||||
worldsHolder.saveChanges(forced);
|
||||
sender.sendMessage(ChatColor.YELLOW + " The changes were saved.");
|
||||
sender.sendMessage(ChatColor.YELLOW + " All changes were saved.");
|
||||
} catch (IllegalStateException ex) {
|
||||
sender.sendMessage(ChatColor.RED + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
|
||||
case manload:
|
||||
// THIS CASE DONT NEED SENDER
|
||||
/**
|
||||
* Attempt to reload a specific world
|
||||
*/
|
||||
if (args.length > 0) {
|
||||
auxString = "";
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
@@ -1502,50 +1537,34 @@ public class GroupManager extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
isLoaded = false; // Disable Bukkit Perms update
|
||||
isLoaded = false; // Disable Bukkit Perms update and event triggers
|
||||
|
||||
globalGroups.load();
|
||||
worldsHolder.loadWorld(auxString);
|
||||
|
||||
sender.sendMessage("The request to world '" + auxString + "' was sent.");
|
||||
sender.sendMessage("The request to reload world '" + auxString + "' was attempted.");
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
BukkitPermissions.updateAllPlayers();
|
||||
|
||||
return true;
|
||||
}
|
||||
// VALIDANDO ESTADO DO SENDER
|
||||
if (dataHolder == null || permissionHandler == null) {
|
||||
if (!setDefaultWorldHandler(sender))
|
||||
return true;
|
||||
}
|
||||
// WORKING
|
||||
config.load();
|
||||
worldsHolder.mirrorSetUp();
|
||||
|
||||
isLoaded = false;
|
||||
|
||||
if (args.length > 0) {
|
||||
auxString = "";
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
auxString += args[i];
|
||||
if ((i + 1) < args.length) {
|
||||
auxString += " ";
|
||||
}
|
||||
}
|
||||
worldsHolder.loadWorld(auxString);
|
||||
sender.sendMessage("The request to world '" + auxString + "' was sent.");
|
||||
} else {
|
||||
worldsHolder.reloadAll();
|
||||
sender.sendMessage(ChatColor.YELLOW + " The current world was reloaded.");
|
||||
|
||||
/**
|
||||
* Reload all settings and data as no world was specified.
|
||||
*/
|
||||
onDisable();
|
||||
onEnable();
|
||||
}
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
BukkitPermissions.updateAllPlayers();
|
||||
|
||||
/**
|
||||
* Fire an event as none will have been triggered in the reload.
|
||||
*/
|
||||
if (GroupManager.isLoaded())
|
||||
GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED);
|
||||
|
||||
return true;
|
||||
|
||||
case listgroups:
|
||||
// VALIDANDO ESTADO DO SENDER
|
||||
if (dataHolder == null || permissionHandler == null) {
|
||||
@@ -1589,6 +1608,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||
@@ -1645,6 +1668,10 @@ public class GroupManager extends JavaPlugin {
|
||||
sender.sendMessage(ChatColor.RED + "Group not found!");
|
||||
return false;
|
||||
}
|
||||
if (auxGroup.isGlobal()) {
|
||||
sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly.");
|
||||
return false;
|
||||
}
|
||||
// VALIDANDO PERMISSAO
|
||||
if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) {
|
||||
sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher.");
|
||||
@@ -1762,9 +1789,9 @@ public class GroupManager extends JavaPlugin {
|
||||
|
||||
dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName());
|
||||
permissionHandler = dataHolder.getPermissionsHandler();
|
||||
selectedWorlds.put(sender, dataHolder.getName());
|
||||
|
||||
if ((dataHolder != null) && (permissionHandler != null)) {
|
||||
selectedWorlds.put(sender, dataHolder.getName());
|
||||
sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. Default world '" + worldsHolder.getDefaultWorld().getName() + "' selected.");
|
||||
return true;
|
||||
}
|
||||
|
@@ -65,8 +65,19 @@ public abstract class DataUnit {
|
||||
hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data source to point to a different worldDataHolder
|
||||
*
|
||||
* @param source
|
||||
*/
|
||||
public void setDataSource(WorldDataHolder source) {
|
||||
this.dataSource = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current worldDataHolder this object is pointing to
|
||||
*
|
||||
* @return the dataSource
|
||||
*/
|
||||
public WorldDataHolder getDataSource() {
|
||||
|
@@ -48,6 +48,15 @@ public class Group extends DataUnit implements Cloneable {
|
||||
public Group(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a GlobalGroup
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isGlobal() {
|
||||
return (getDataSource() == null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone this group
|
||||
@@ -57,7 +66,7 @@ public class Group extends DataUnit implements Cloneable {
|
||||
public Group clone() {
|
||||
Group clone;
|
||||
|
||||
if (getDataSource() == null) {
|
||||
if (isGlobal()) {
|
||||
clone = new Group(this.getName());
|
||||
} else {
|
||||
clone = new Group(getDataSource(), this.getName());
|
||||
@@ -85,7 +94,7 @@ public class Group extends DataUnit implements Cloneable {
|
||||
Group clone = dataSource.createGroup(this.getName());
|
||||
|
||||
// Don't add inheritance for GlobalGroups
|
||||
if (getDataSource() != null) {
|
||||
if (!isGlobal()) {
|
||||
clone.inherits = new ArrayList<String>(this.getInherits());
|
||||
}
|
||||
for (String perm : this.getPermissionList()) {
|
||||
@@ -110,26 +119,30 @@ public class Group extends DataUnit implements Cloneable {
|
||||
* @param inherit the inherits to set
|
||||
*/
|
||||
public void addInherits(Group inherit) {
|
||||
if (!this.getDataSource().groupExists(inherit.getName())) {
|
||||
getDataSource().addGroup(inherit);
|
||||
}
|
||||
if (!inherits.contains(inherit.getName().toLowerCase())) {
|
||||
inherits.add(inherit.getName().toLowerCase());
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
}
|
||||
if (!isGlobal()) {
|
||||
if (!this.getDataSource().groupExists(inherit.getName())) {
|
||||
getDataSource().addGroup(inherit);
|
||||
}
|
||||
if (!inherits.contains(inherit.getName().toLowerCase())) {
|
||||
inherits.add(inherit.getName().toLowerCase());
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeInherits(String inherit) {
|
||||
if (this.inherits.contains(inherit.toLowerCase())) {
|
||||
this.inherits.remove(inherit.toLowerCase());
|
||||
flagAsChanged();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
return true;
|
||||
}
|
||||
if (!isGlobal()) {
|
||||
if (this.inherits.contains(inherit.toLowerCase())) {
|
||||
this.inherits.remove(inherit.toLowerCase());
|
||||
flagAsChanged();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,15 +158,17 @@ public class Group extends DataUnit implements Cloneable {
|
||||
* @param varList
|
||||
*/
|
||||
public void setVariables(Map<String, Object> varList) {
|
||||
GroupVariables temp = new GroupVariables(this, varList);
|
||||
variables.clearVars();
|
||||
for (String key : temp.getVarKeyList()) {
|
||||
variables.addVar(key, temp.getVarObject(key));
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
|
||||
}
|
||||
if (!isGlobal()) {
|
||||
GroupVariables temp = new GroupVariables(this, varList);
|
||||
variables.clearVars();
|
||||
for (String key : temp.getVarKeyList()) {
|
||||
variables.addVar(key, temp.getVarObject(key));
|
||||
}
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded()) {
|
||||
GroupManager.BukkitPermissions.updateAllPlayers();
|
||||
GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -138,8 +138,8 @@ public class User extends DataUnit implements Cloneable {
|
||||
String oldGroup = this.group;
|
||||
this.group = group.getName();
|
||||
flagAsChanged();
|
||||
if (GroupManager.isLoaded() && (updatePerms)) {
|
||||
if (!GroupManager.BukkitPermissions.isPlayer_join())
|
||||
if (GroupManager.isLoaded()) {
|
||||
if (!GroupManager.BukkitPermissions.isPlayer_join() && (updatePerms))
|
||||
GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
|
||||
|
||||
// Do we notify of the group change?
|
||||
|
@@ -9,15 +9,14 @@ import org.anjocaido.groupmanager.data.Group;
|
||||
|
||||
|
||||
/**
|
||||
* This container holds all Groups loaded from the relevant groupsFile.
|
||||
*
|
||||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public class GroupsDataHolder {
|
||||
|
||||
/**
|
||||
* Root World name this set of groups is associated with.
|
||||
*/
|
||||
private String name;
|
||||
private WorldDataHolder dataSource;
|
||||
private Group defaultGroup = null;
|
||||
private File groupsFile;
|
||||
private boolean haveGroupsChanged = false;
|
||||
@@ -33,16 +32,12 @@ public class GroupsDataHolder {
|
||||
*/
|
||||
protected GroupsDataHolder() {
|
||||
}
|
||||
|
||||
protected void setWorldName(String worldName) {
|
||||
name = worldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getWorldName() {
|
||||
return name;
|
||||
|
||||
public void setDataSource(WorldDataHolder dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
//push this data source to the users, so they pull the correct groups data.
|
||||
for (Group group : groups.values())
|
||||
group.setDataSource(this.dataSource);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -9,15 +9,14 @@ import org.anjocaido.groupmanager.data.User;
|
||||
|
||||
|
||||
/**
|
||||
* This container holds all Users loaded from the relevant usersFile.
|
||||
*
|
||||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
public class UsersDataHolder {
|
||||
|
||||
/**
|
||||
* Root World name this set of groups is associated with.
|
||||
*/
|
||||
private String name;
|
||||
private WorldDataHolder dataSource;
|
||||
private File usersFile;
|
||||
private boolean haveUsersChanged = false;
|
||||
private long timeStampUsers = 0;
|
||||
@@ -32,19 +31,13 @@ public class UsersDataHolder {
|
||||
*/
|
||||
protected UsersDataHolder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param worldName
|
||||
*/
|
||||
public void setWorldName(String worldName) {
|
||||
this.name = worldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getWorldName() {
|
||||
return this.name;
|
||||
public void setDataSource(WorldDataHolder dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
//push this data source to the users, so they pull the correct groups data.
|
||||
for (User user : users.values())
|
||||
user.setDataSource(this.dataSource);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,8 +36,11 @@ import org.yaml.snakeyaml.constructor.SafeConstructor;
|
||||
import org.yaml.snakeyaml.reader.UnicodeReader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gabrielcouto
|
||||
* One instance of this should exist per world/mirror
|
||||
* it contains all functions to manage these data sets
|
||||
* and points to the relevant users and groups objects.
|
||||
*
|
||||
* @author gabrielcouto, ElgarL
|
||||
*/
|
||||
public class WorldDataHolder {
|
||||
|
||||
@@ -80,6 +83,16 @@ public class WorldDataHolder {
|
||||
|
||||
//this.defaultGroup = defaultGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* update the dataSource to point to this object.
|
||||
*
|
||||
* This should be called whenever a set of world data is fetched.
|
||||
*/
|
||||
public void updateDataSource() {
|
||||
this.groups.setDataSource(this);
|
||||
this.users.setDataSource(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a user. If it doesn't exist, create a new one with
|
||||
@@ -445,13 +458,13 @@ public class WorldDataHolder {
|
||||
|
||||
//PROCESS GROUPS FILE
|
||||
Map<String, List<String>> inheritance = new HashMap<String, List<String>>();
|
||||
//try {
|
||||
try {
|
||||
Map<String, Object> allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups");
|
||||
for (String groupKey : allGroupsNode.keySet()) {
|
||||
Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey);
|
||||
Group thisGrp = ph.createGroup(groupKey);
|
||||
if (thisGrp == null) {
|
||||
throw new IllegalArgumentException("I think this user was declared more than once: " + groupKey + " in file: " + groupsFile.getPath());
|
||||
throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
if (thisGroupNode.get("default") == null) {
|
||||
thisGroupNode.put("default", false);
|
||||
@@ -465,57 +478,72 @@ public class WorldDataHolder {
|
||||
}
|
||||
|
||||
//PERMISSIONS NODE
|
||||
if (thisGroupNode.get("permissions") == null) {
|
||||
thisGroupNode.put("permissions", new ArrayList<String>());
|
||||
}
|
||||
if (thisGroupNode.get("permissions") instanceof List) {
|
||||
for (Object o : ((List) thisGroupNode.get("permissions"))) {
|
||||
try {
|
||||
thisGrp.addPermission(o.toString());
|
||||
} catch (NullPointerException e) {
|
||||
// Ignore this entry as it's null.
|
||||
//throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
}
|
||||
} else if (thisGroupNode.get("permissions") instanceof String) {
|
||||
thisGrp.addPermission((String) thisGroupNode.get("permissions"));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
try {
|
||||
if (thisGroupNode.get("permissions") == null) {
|
||||
thisGroupNode.put("permissions", new ArrayList<String>());
|
||||
} else {
|
||||
if (thisGroupNode.get("permissions") instanceof List) {
|
||||
for (Object o : ((List) thisGroupNode.get("permissions"))) {
|
||||
try {
|
||||
thisGrp.addPermission(o.toString());
|
||||
} catch (NullPointerException e) {
|
||||
// Ignore this entry as it's null.
|
||||
//throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
}
|
||||
} else if (thisGroupNode.get("permissions") instanceof String) {
|
||||
thisGrp.addPermission((String) thisGroupNode.get("permissions"));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
thisGrp.sortPermissions();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("Invalid formatting found in permissions section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
|
||||
//INFO NODE
|
||||
if (thisGroupNode.get("info") instanceof Map) {
|
||||
Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info");
|
||||
if (infoNode != null) {
|
||||
thisGrp.setVariables(infoNode);
|
||||
}
|
||||
} else
|
||||
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
try {
|
||||
if (thisGroupNode.get("info") instanceof Map) {
|
||||
Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info");
|
||||
if (infoNode != null) {
|
||||
thisGrp.setVariables(infoNode);
|
||||
}
|
||||
} else
|
||||
throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
} catch (Exception e1) {
|
||||
throw new IllegalArgumentException("Invalid formatting found in info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
|
||||
//END INFO NODE
|
||||
|
||||
if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
|
||||
Object inheritNode = thisGroupNode.get("inheritance");
|
||||
if (inheritNode == null) {
|
||||
thisGroupNode.put("inheritance", new ArrayList<String>());
|
||||
} else if (inheritNode instanceof List) {
|
||||
List<String> groupsInh = (List<String>) inheritNode;
|
||||
for (String grp : groupsInh) {
|
||||
if (inheritance.get(groupKey) == null) {
|
||||
List<String> thisInherits = new ArrayList<String>();
|
||||
inheritance.put(groupKey, thisInherits);
|
||||
}
|
||||
inheritance.get(groupKey).add(grp);
|
||||
|
||||
}
|
||||
}
|
||||
}else
|
||||
throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
try {
|
||||
if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) {
|
||||
Object inheritNode = thisGroupNode.get("inheritance");
|
||||
if (inheritNode == null) {
|
||||
thisGroupNode.put("inheritance", new ArrayList<String>());
|
||||
} else if (inheritNode instanceof List) {
|
||||
List<String> groupsInh = (List<String>) inheritNode;
|
||||
for (String grp : groupsInh) {
|
||||
if (inheritance.get(groupKey) == null) {
|
||||
List<String> thisInherits = new ArrayList<String>();
|
||||
inheritance.put(groupKey, thisInherits);
|
||||
}
|
||||
inheritance.get(groupKey).add(grp);
|
||||
|
||||
}
|
||||
}
|
||||
}else
|
||||
throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
} catch (Exception e2) {
|
||||
throw new IllegalArgumentException("Invalid formatting found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
|
||||
}
|
||||
}
|
||||
//} catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// throw new IllegalArgumentException("Your Permissions config file is invalid. See console for details.");
|
||||
//}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details.");
|
||||
}
|
||||
|
||||
if (ph.getDefaultGroup() == null) {
|
||||
throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath());
|
||||
}
|
||||
@@ -581,18 +609,20 @@ public class WorldDataHolder {
|
||||
}
|
||||
if (thisUserNode.get("permissions") == null) {
|
||||
thisUserNode.put("permissions", new ArrayList<String>());
|
||||
}
|
||||
if (thisUserNode.get("permissions") instanceof List) {
|
||||
for (Object o : ((List) thisUserNode.get("permissions"))) {
|
||||
thisUser.addPermission(o.toString());
|
||||
}
|
||||
} else if (thisUserNode.get("permissions") instanceof String) {
|
||||
try {
|
||||
thisUser.addPermission(thisUserNode.get("permissions").toString());
|
||||
} catch (NullPointerException e) {
|
||||
// Ignore this entry as it's null.
|
||||
//throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath());
|
||||
}
|
||||
} else {
|
||||
if (thisUserNode.get("permissions") instanceof List) {
|
||||
for (Object o : ((List) thisUserNode.get("permissions"))) {
|
||||
thisUser.addPermission(o.toString());
|
||||
}
|
||||
} else if (thisUserNode.get("permissions") instanceof String) {
|
||||
try {
|
||||
thisUser.addPermission(thisUserNode.get("permissions").toString());
|
||||
} catch (NullPointerException e) {
|
||||
// Ignore this entry as it's null.
|
||||
//throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath());
|
||||
}
|
||||
}
|
||||
thisUser.sortPermissions();
|
||||
}
|
||||
|
||||
//SUBGROUPS LOADING
|
||||
@@ -826,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) {
|
||||
|
@@ -10,6 +10,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -45,7 +46,7 @@ public class WorldsHolder {
|
||||
private Map<String, String> mirrorsGroup = new HashMap<String, String>();
|
||||
private Map<String, String> mirrorsUser = new HashMap<String, String>();
|
||||
|
||||
private OverloadedWorldHolder defaultWorld;
|
||||
//private OverloadedWorldHolder defaultWorld;
|
||||
private String serverDefaultWorldName;
|
||||
private GroupManager plugin;
|
||||
private File worldsFolder;
|
||||
@@ -59,7 +60,7 @@ public class WorldsHolder {
|
||||
// Setup folders and check files exist for the primary world
|
||||
verifyFirstRun();
|
||||
initialLoad();
|
||||
if (defaultWorld == null) {
|
||||
if (serverDefaultWorldName == null) {
|
||||
throw new IllegalStateException("There is no default group! OMG!");
|
||||
}
|
||||
}
|
||||
@@ -76,7 +77,7 @@ public class WorldsHolder {
|
||||
private void initialWorldLoading() {
|
||||
//Load the default world
|
||||
loadWorld(serverDefaultWorldName);
|
||||
defaultWorld = worldsData.get(serverDefaultWorldName);
|
||||
//defaultWorld = getUpdatedWorldData(serverDefaultWorldName);
|
||||
}
|
||||
|
||||
private void loadAllSearchedWorlds() {
|
||||
@@ -117,6 +118,8 @@ public class WorldsHolder {
|
||||
mirrorsGroup.clear();
|
||||
mirrorsUser.clear();
|
||||
Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap();
|
||||
|
||||
HashSet<String> mirroredWorlds = new HashSet<String>();
|
||||
|
||||
if (mirrorsMap != null) {
|
||||
for (String source : mirrorsMap.keySet()) {
|
||||
@@ -140,6 +143,10 @@ public class WorldsHolder {
|
||||
}
|
||||
mirrorsGroup.put(world, getWorldData(source).getName());
|
||||
mirrorsUser.put(world, getWorldData(source).getName());
|
||||
|
||||
// Track this world so we can create a datasource for it later
|
||||
mirroredWorlds.add(o.toString());
|
||||
|
||||
} else
|
||||
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!");
|
||||
}
|
||||
@@ -171,11 +178,13 @@ public class WorldsHolder {
|
||||
if (type.equals("users"))
|
||||
mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName());
|
||||
}
|
||||
|
||||
// Track this world so we can create a datasource for it later
|
||||
mirroredWorlds.add(key);
|
||||
|
||||
} else
|
||||
GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!");
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
throw new IllegalStateException("Unknown mirroring format for " + key);
|
||||
}
|
||||
@@ -183,6 +192,14 @@ public class WorldsHolder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a datasource for any worlds not already loaded
|
||||
for (String world : mirroredWorlds){
|
||||
if (!worldsData.containsKey(world.toLowerCase())) {
|
||||
setupWorldFolder(world);
|
||||
loadWorld(world, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +337,8 @@ public class WorldsHolder {
|
||||
* If the world is not on the worlds list, returns the default world
|
||||
* holder.
|
||||
*
|
||||
* Mirrors return original world data.
|
||||
* Mirrors return their parent world data.
|
||||
* If no mirroring data it returns the default world.
|
||||
*
|
||||
* @param worldName
|
||||
* @return OverloadedWorldHolder
|
||||
@@ -328,12 +346,55 @@ public class WorldsHolder {
|
||||
public OverloadedWorldHolder getWorldData(String worldName) {
|
||||
String worldNameLowered = worldName.toLowerCase();
|
||||
|
||||
if (worldsData.containsKey(worldNameLowered))
|
||||
return worldsData.get(worldNameLowered);
|
||||
|
||||
// Find this worlds data
|
||||
if (worldsData.containsKey(worldNameLowered)) {
|
||||
|
||||
String usersMirror = mirrorsUser.get(worldNameLowered);
|
||||
String groupsMirror = mirrorsGroup.get(worldNameLowered);
|
||||
|
||||
if (usersMirror != null) {
|
||||
|
||||
// If both are mirrored
|
||||
if (groupsMirror != null) {
|
||||
|
||||
// if the data sources are the same, return the parent
|
||||
if (usersMirror == groupsMirror)
|
||||
return getUpdatedWorldData(usersMirror.toLowerCase());
|
||||
|
||||
// Both data sources are mirrors, but they are from different parents
|
||||
// so we return the actual data object.
|
||||
return getUpdatedWorldData(worldNameLowered);
|
||||
}
|
||||
|
||||
// Groups isn't a mirror so return this this worlds data source
|
||||
return getUpdatedWorldData(worldNameLowered);
|
||||
}
|
||||
|
||||
// users isn't mirrored so we need to return this worlds data source
|
||||
return getUpdatedWorldData(worldNameLowered);
|
||||
}
|
||||
|
||||
// Oddly no data source was found for this world so return the default.
|
||||
GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world...");
|
||||
return getDefaultWorld();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the requested world data and update it's dataSource to be relevant for this world
|
||||
*
|
||||
* @param worldName
|
||||
* @return updated world holder
|
||||
*/
|
||||
private OverloadedWorldHolder getUpdatedWorldData(String worldName) {
|
||||
|
||||
if (worldsData.containsKey(worldName.toLowerCase())) {
|
||||
OverloadedWorldHolder data = worldsData.get(worldName.toLowerCase());
|
||||
data.updateDataSource();
|
||||
return data;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a matching of playerName, if its found only one player, do
|
||||
@@ -353,6 +414,7 @@ public class WorldsHolder {
|
||||
/**
|
||||
* Retrieves the field player.getWorld().getName() and do
|
||||
* getWorld(worldName)
|
||||
*
|
||||
* @param player
|
||||
* @return OverloadedWorldHolder
|
||||
*/
|
||||
@@ -476,18 +538,29 @@ public class WorldsHolder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for LoadWorld(String,Boolean) for backwards compatibility
|
||||
*
|
||||
* Load a world from file.
|
||||
* If it already been loaded, summon reload method from dataHolder.
|
||||
* @param worldName
|
||||
*/
|
||||
public void loadWorld(String worldName) {
|
||||
loadWorld(worldName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a world from file.
|
||||
* If it already been loaded, summon reload method from dataHolder.
|
||||
* @param worldName
|
||||
*/
|
||||
public void loadWorld(String worldName, Boolean isMirror) {
|
||||
if (worldsData.containsKey(worldName.toLowerCase())) {
|
||||
worldsData.get(worldName.toLowerCase()).reload();
|
||||
return;
|
||||
}
|
||||
GroupManager.logger.finest("Trying to load world " + worldName + "...");
|
||||
File thisWorldFolder = new File(worldsFolder, worldName);
|
||||
if (thisWorldFolder.exists() && thisWorldFolder.isDirectory()) {
|
||||
if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) {
|
||||
|
||||
// Setup file handles, if not mirrored
|
||||
File groupsFile = (mirrorsGroup.containsKey(worldName.toLowerCase()))? null : new File(thisWorldFolder, "groups.yml");
|
||||
@@ -564,17 +637,43 @@ public class WorldsHolder {
|
||||
* @return the defaultWorld
|
||||
*/
|
||||
public OverloadedWorldHolder getDefaultWorld() {
|
||||
return defaultWorld;
|
||||
return getUpdatedWorldData(serverDefaultWorldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all physically loaded worlds.
|
||||
* Returns all physically loaded worlds which have at least
|
||||
* one of their own data sets for users or groups.
|
||||
*
|
||||
* @return ArrayList<OverloadedWorldHolder> of all loaded worlds
|
||||
*/
|
||||
public ArrayList<OverloadedWorldHolder> allWorldsDataList() {
|
||||
ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>();
|
||||
for (OverloadedWorldHolder data : worldsData.values()) {
|
||||
if (!list.contains(data)) {
|
||||
if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) {
|
||||
|
||||
String worldNameLowered = data.getName().toLowerCase();
|
||||
String usersMirror = mirrorsUser.get(worldNameLowered);
|
||||
String groupsMirror = mirrorsGroup.get(worldNameLowered);
|
||||
|
||||
// is users mirrored?
|
||||
if (usersMirror != null) {
|
||||
|
||||
// If both are mirrored
|
||||
if (groupsMirror != null) {
|
||||
|
||||
// if the data sources are the same, return the parent
|
||||
if (usersMirror == groupsMirror) {
|
||||
if (!list.contains(usersMirror.toLowerCase()))
|
||||
list.add(worldsData.get(usersMirror.toLowerCase()));
|
||||
continue;
|
||||
}
|
||||
// Both data sources are mirrors, but they are from different parents
|
||||
// so fall through to add the actual data object.
|
||||
}
|
||||
// Groups isn't a mirror so fall through to add this this worlds data source
|
||||
}
|
||||
|
||||
// users isn't mirrored so we need to add this worlds data source
|
||||
list.add(data);
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ public class GMGroupEvent extends Event {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5294917600434510451L;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
@@ -37,7 +36,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 +44,7 @@ public class GMGroupEvent extends Event {
|
||||
}
|
||||
|
||||
public GMGroupEvent(String groupName, Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.groupName = groupName;
|
||||
this.action = action;
|
||||
|
@@ -15,7 +15,6 @@ public class GMSystemEvent extends Event {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8786811924448821548L;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
@@ -32,7 +31,7 @@ public class GMSystemEvent extends Event {
|
||||
protected Action action;
|
||||
|
||||
public GMSystemEvent(Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.action = action;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ public class GMUserEvent extends Event {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5294917600434510451L;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@Override
|
||||
@@ -37,7 +36,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 +44,7 @@ public class GMUserEvent extends Event {
|
||||
}
|
||||
|
||||
public GMUserEvent(String userName, Action action) {
|
||||
super(action.toString());
|
||||
super();
|
||||
|
||||
this.userName = userName;
|
||||
this.action = action;
|
||||
|
@@ -121,27 +121,34 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||
// Add the players own permissions.
|
||||
playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren));
|
||||
|
||||
ArrayList<String> alreadyProcessed = new ArrayList<String>();
|
||||
|
||||
// fetch all group permissions
|
||||
for (String group : getGroups(userName)) {
|
||||
Set<String> groupPermArray = new HashSet<String>();
|
||||
|
||||
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
|
||||
// GlobalGroups
|
||||
groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren);
|
||||
// Don't process a group more than once.
|
||||
if (!alreadyProcessed.contains(group)) {
|
||||
alreadyProcessed.add(group);
|
||||
|
||||
} else {
|
||||
// World Groups
|
||||
groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren);
|
||||
}
|
||||
|
||||
// Add all group permissions, unless negated by earlier permissions.
|
||||
for (String perm : groupPermArray) {
|
||||
boolean negated = (perm.startsWith("-"));
|
||||
// Perm doesn't already exists and there is no negation for it
|
||||
// or It's a negated perm where a normal perm doesn't exists (don't allow inheritance to negate higher perms)
|
||||
if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm))
|
||||
|| (negated && !playerPermArray.contains(perm.substring(1))))
|
||||
playerPermArray.add(perm);
|
||||
Set<String> groupPermArray = new HashSet<String>();
|
||||
|
||||
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
|
||||
// GlobalGroups
|
||||
groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren);
|
||||
|
||||
} else {
|
||||
// World Groups
|
||||
groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren);
|
||||
}
|
||||
|
||||
// Add all group permissions, unless negated by earlier permissions.
|
||||
for (String perm : groupPermArray) {
|
||||
boolean negated = (perm.startsWith("-"));
|
||||
// Perm doesn't already exists and there is no negation for it
|
||||
// or It's a negated perm where a normal perm doesn't exists (don't allow inheritance to negate higher perms)
|
||||
if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm))
|
||||
|| (negated && !playerPermArray.contains(perm.substring(1))))
|
||||
playerPermArray.add(perm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -153,15 +160,23 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||
private Set<String> populatePerms (List<String> perms, boolean includeChildren) {
|
||||
|
||||
Set<String> permArray = new HashSet<String>();
|
||||
Boolean allPerms = false;
|
||||
|
||||
// Allow * node to populate ALL perms in Bukkit.
|
||||
// Allow * node to populate ALL permissions to Bukkit.
|
||||
if (perms.contains("*")) {
|
||||
permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren));
|
||||
allPerms = true;
|
||||
}
|
||||
|
||||
for (String perm : perms) {
|
||||
|
||||
if (!perm.equalsIgnoreCase("*")) {
|
||||
|
||||
/**
|
||||
* all permission sets are passed here pre-sorted, alphabetically.
|
||||
* This means negated nodes will be processed before all permissions
|
||||
* other than *.
|
||||
*/
|
||||
boolean negated = false;
|
||||
if (perm.startsWith("-"))
|
||||
negated = true;
|
||||
@@ -172,12 +187,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||
if ((negated) && (permArray.contains(perm.substring(1))))
|
||||
permArray.remove(perm.substring(1));
|
||||
|
||||
if (includeChildren) {
|
||||
/**
|
||||
* Process child nodes if required,
|
||||
* or this is a negated node AND we used * to include all permissions,
|
||||
* in which case we need to remove all children of that node.
|
||||
*/
|
||||
if ((includeChildren) || (negated && allPerms)) {
|
||||
|
||||
Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>());
|
||||
|
||||
if (children != null) {
|
||||
if (negated) {
|
||||
if (negated || (negated && allPerms)) {
|
||||
|
||||
// Remove children of negated nodes
|
||||
for (String child : children.keySet())
|
||||
@@ -185,7 +205,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
||||
if (permArray.contains(child))
|
||||
permArray.remove(child);
|
||||
|
||||
} else {
|
||||
} else if (!negated){
|
||||
|
||||
// Add child nodes
|
||||
for (String child : children.keySet())
|
||||
|
@@ -34,12 +34,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
import org.bukkit.permissions.Permission;
|
||||
@@ -345,6 +343,12 @@ public class BukkitPermissions {
|
||||
this.updatePermissions(player, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Player events tracked to cause Superperms updates
|
||||
*
|
||||
* @author ElgarL
|
||||
*
|
||||
*/
|
||||
protected class PlayerEvents implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@@ -358,24 +362,10 @@ public class BukkitPermissions {
|
||||
}
|
||||
setPlayer_join(false);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world
|
||||
if ((event.getTo() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed
|
||||
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world
|
||||
updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world
|
||||
if ((event.getTo() != null) && (event.getPlayer() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed
|
||||
updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
|
||||
}
|
||||
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // has changed worlds
|
||||
updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@@ -1 +0,0 @@
|
||||
Manifest-Version: 1.0
|
@@ -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())
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user