mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-16 03:24:31 +02:00
Cleanup
This commit is contained in:
@@ -335,7 +335,7 @@ public class Essentials implements IEssentials
|
|||||||
{
|
{
|
||||||
return spawns;
|
return spawns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reload()
|
public void reload()
|
||||||
{
|
{
|
||||||
|
@@ -72,7 +72,8 @@ public class I18n implements II18n
|
|||||||
|
|
||||||
public static String _(final String string, final Object... objects)
|
public static String _(final String string, final Object... objects)
|
||||||
{
|
{
|
||||||
if (instance == null) {
|
if (instance == null)
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (objects.length == 0)
|
if (objects.length == 0)
|
||||||
|
@@ -59,7 +59,7 @@ public class Warps extends StorageObjectMap<IWarp> implements IWarps
|
|||||||
{
|
{
|
||||||
setWarp(name, new net.ess3.storage.StoredLocation(loc));
|
setWarp(name, new net.ess3.storage.StoredLocation(loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarp(final String name, final net.ess3.storage.StoredLocation loc) throws Exception
|
public void setWarp(final String name, final net.ess3.storage.StoredLocation loc) throws Exception
|
||||||
{
|
{
|
||||||
IWarp warp = getObject(name);
|
IWarp warp = getObject(name);
|
||||||
|
@@ -11,25 +11,25 @@ import org.bukkit.plugin.Plugin;
|
|||||||
public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
|
public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
|
||||||
{
|
{
|
||||||
private final transient Plugin geoip;
|
private final transient Plugin geoip;
|
||||||
|
|
||||||
public ConfigHolder(final IEssentials ess, final Plugin geoip)
|
public ConfigHolder(final IEssentials ess, final Plugin geoip)
|
||||||
{
|
{
|
||||||
super(ess, GeoIP.class);
|
super(ess, GeoIP.class);
|
||||||
this.geoip = geoip;
|
this.geoip = geoip;
|
||||||
onReload(true);
|
onReload(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getStorageFile() throws IOException
|
public File getStorageFile() throws IOException
|
||||||
{
|
{
|
||||||
return new File(geoip.getDataFolder(), "config.yml");
|
return new File(geoip.getDataFolder(), "config.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishRead()
|
public void finishRead()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finishWrite()
|
public void finishWrite()
|
||||||
{
|
{
|
||||||
|
@@ -29,5 +29,4 @@ public class EssentialsConnect
|
|||||||
{
|
{
|
||||||
return ess;
|
return ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -13,7 +13,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
|
|||||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||||
private transient EssentialsConnect ess = null;
|
private transient EssentialsConnect ess = null;
|
||||||
private transient ProtectHolder settings = null;
|
private transient ProtectHolder settings = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
|
|||||||
enableEmergencyMode(pm);
|
enableEmergencyMode(pm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ess = new EssentialsConnect(essPlugin, this);
|
ess = new EssentialsConnect(essPlugin, this);
|
||||||
|
|
||||||
final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this);
|
final EssentialsProtectBlockListener blockListener = new EssentialsProtectBlockListener(this);
|
||||||
pm.registerEvents(blockListener, this);
|
pm.registerEvents(blockListener, this);
|
||||||
@@ -48,12 +48,11 @@ public class EssentialsProtect extends JavaPlugin implements IProtect
|
|||||||
LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essenials Protect is in emergency mode now.");
|
LOGGER.log(Level.SEVERE, "Essentials not installed or failed to load. Essenials Protect is in emergency mode now.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EssentialsConnect getEssentialsConnect()
|
public EssentialsConnect getEssentialsConnect()
|
||||||
{
|
{
|
||||||
return ess;
|
return ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProtectHolder getSettings()
|
public ProtectHolder getSettings()
|
||||||
|
@@ -8,7 +8,7 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
|
|
||||||
|
|
||||||
public enum Permissions implements IPermission
|
public enum Permissions implements IPermission
|
||||||
{
|
{
|
||||||
ENTITYTARGET(PermissionDefault.TRUE),
|
ENTITYTARGET(PermissionDefault.TRUE),
|
||||||
PVP(PermissionDefault.TRUE),
|
PVP(PermissionDefault.TRUE),
|
||||||
PREVENTDAMAGE_FALL(PermissionDefault.FALSE),
|
PREVENTDAMAGE_FALL(PermissionDefault.FALSE),
|
||||||
@@ -22,7 +22,7 @@ public enum Permissions implements IPermission
|
|||||||
PREVENTDAMAGE_FIRE(PermissionDefault.FALSE),
|
PREVENTDAMAGE_FIRE(PermissionDefault.FALSE),
|
||||||
PREVENTDAMAGE_DROWNING(PermissionDefault.FALSE),
|
PREVENTDAMAGE_DROWNING(PermissionDefault.FALSE),
|
||||||
PREVENTDAMAGE_LIGHTNING(PermissionDefault.FALSE),
|
PREVENTDAMAGE_LIGHTNING(PermissionDefault.FALSE),
|
||||||
PREVENTDAMAGE_NONE(PermissionDefault.FALSE),
|
PREVENTDAMAGE_NONE(PermissionDefault.FALSE),
|
||||||
USEFLINTSTEEL(PermissionDefault.TRUE);
|
USEFLINTSTEEL(PermissionDefault.TRUE);
|
||||||
private static final String base = "essentials.protect.";
|
private static final String base = "essentials.protect.";
|
||||||
private final String permission;
|
private final String permission;
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package net.ess3.signs;
|
package net.ess3.signs;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -23,12 +22,12 @@ public class EssentialsSign
|
|||||||
{
|
{
|
||||||
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
|
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
|
||||||
protected transient final String signName;
|
protected transient final String signName;
|
||||||
|
|
||||||
public EssentialsSign(final String signName)
|
public EssentialsSign(final String signName)
|
||||||
{
|
{
|
||||||
this.signName = signName;
|
this.signName = signName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess)
|
public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final ISign sign = new EventSign(event);
|
final ISign sign = new EventSign(event);
|
||||||
@@ -60,22 +59,22 @@ public class EssentialsSign
|
|||||||
// Return true, so the player sees the wrong sign.
|
// Return true, so the player sees the wrong sign.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSuccessName()
|
public String getSuccessName()
|
||||||
{
|
{
|
||||||
return _("signFormatSuccess", this.signName);
|
return _("signFormatSuccess", this.signName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTemplateName()
|
public String getTemplateName()
|
||||||
{
|
{
|
||||||
return _("signFormatTemplate", this.signName);
|
return _("signFormatTemplate", this.signName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUsername(final IUser user)
|
private String getUsername(final IUser user)
|
||||||
{
|
{
|
||||||
return user.getName().substring(0, user.getName().length() > 13 ? 13 : user.getName().length());
|
return user.getName().substring(0, user.getName().length() > 13 ? 13 : user.getName().length());
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean onSignInteract(final Block block, final Player player, final IEssentials ess)
|
public final boolean onSignInteract(final Block block, final Player player, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final ISign sign = new BlockSign(block);
|
final ISign sign = new BlockSign(block);
|
||||||
@@ -96,7 +95,7 @@ public class EssentialsSign
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean onSignBreak(final Block block, final Player player, final IEssentials ess)
|
public final boolean onSignBreak(final Block block, final Player player, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final ISign sign = new BlockSign(block);
|
final ISign sign = new BlockSign(block);
|
||||||
@@ -112,22 +111,22 @@ public class EssentialsSign
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onSignCreate(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
protected boolean onSignCreate(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onSignBreak(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException
|
protected boolean onSignBreak(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean onBlockPlace(final Block block, final Player player, final IEssentials ess)
|
public final boolean onBlockPlace(final Block block, final Player player, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final IUser user = ess.getUserMap().getUser(player);
|
final IUser user = ess.getUserMap().getUser(player);
|
||||||
@@ -145,7 +144,7 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean onBlockInteract(final Block block, final Player player, final IEssentials ess)
|
public final boolean onBlockInteract(final Block block, final Player player, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final IUser user = ess.getUserMap().getUser(player);
|
final IUser user = ess.getUserMap().getUser(player);
|
||||||
@@ -163,7 +162,7 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean onBlockBreak(final Block block, final Player player, final IEssentials ess)
|
public final boolean onBlockBreak(final Block block, final Player player, final IEssentials ess)
|
||||||
{
|
{
|
||||||
final IUser user = ess.getUserMap().getUser(player);
|
final IUser user = ess.getUserMap().getUser(player);
|
||||||
@@ -177,32 +176,32 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockBreak(final Block block, final IEssentials ess)
|
public boolean onBlockBreak(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockExplode(final Block block, final IEssentials ess)
|
public boolean onBlockExplode(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockBurn(final Block block, final IEssentials ess)
|
public boolean onBlockBurn(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockIgnite(final Block block, final IEssentials ess)
|
public boolean onBlockIgnite(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockPush(final Block block, final IEssentials ess)
|
public boolean onBlockPush(final Block block, final IEssentials ess)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkIfBlockBreaksSigns(final Block block)
|
public static boolean checkIfBlockBreaksSigns(final Block block)
|
||||||
{
|
{
|
||||||
final Block sign = block.getRelative(BlockFace.UP);
|
final Block sign = block.getRelative(BlockFace.UP);
|
||||||
@@ -231,32 +230,32 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidSign(final ISign sign)
|
public static boolean isValidSign(final ISign sign)
|
||||||
{
|
{
|
||||||
return sign.getLine(0).matches("§1\\[.*\\]");
|
return sign.getLine(0).matches("§1\\[.*\\]");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onBlockPlace(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
protected boolean onBlockPlace(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onBlockInteract(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
protected boolean onBlockInteract(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean onBlockBreak(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException
|
protected boolean onBlockBreak(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Material> getBlocks()
|
public Set<Material> getBlocks()
|
||||||
{
|
{
|
||||||
return EMPTY_SET;
|
return EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
|
protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
final String line = sign.getLine(index).trim();
|
final String line = sign.getLine(index).trim();
|
||||||
@@ -271,7 +270,7 @@ public class EssentialsSign
|
|||||||
sign.setLine(index, FormatUtil.shortCurrency(money, ess));
|
sign.setLine(index, FormatUtil.shortCurrency(money, ess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void validateTrade(final ISign sign, final int amountIndex, final int itemIndex,
|
protected final void validateTrade(final ISign sign, final int amountIndex, final int itemIndex,
|
||||||
final IUser player, final IEssentials ess) throws SignException
|
final IUser player, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
@@ -287,7 +286,7 @@ public class EssentialsSign
|
|||||||
sign.setLine(amountIndex, Integer.toString(item.getAmount()));
|
sign.setLine(amountIndex, Integer.toString(item.getAmount()));
|
||||||
sign.setLine(itemIndex, sign.getLine(itemIndex).trim());
|
sign.setLine(itemIndex, sign.getLine(itemIndex).trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Trade getTrade(final ISign sign, final int amountIndex, final int itemIndex,
|
protected final Trade getTrade(final ISign sign, final int amountIndex, final int itemIndex,
|
||||||
final IUser player, final IEssentials ess) throws SignException
|
final IUser player, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
@@ -305,7 +304,7 @@ public class EssentialsSign
|
|||||||
item.setAmount(amount);
|
item.setAmount(amount);
|
||||||
return new Trade(item, ess);
|
return new Trade(item, ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void validateInteger(final ISign sign, final int index) throws SignException
|
protected final void validateInteger(final ISign sign, final int index) throws SignException
|
||||||
{
|
{
|
||||||
final String line = sign.getLine(index).trim();
|
final String line = sign.getLine(index).trim();
|
||||||
@@ -316,7 +315,7 @@ public class EssentialsSign
|
|||||||
final int quantity = getIntegerPositive(line);
|
final int quantity = getIntegerPositive(line);
|
||||||
sign.setLine(index, Integer.toString(quantity));
|
sign.setLine(index, Integer.toString(quantity));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final int getIntegerPositive(final String line) throws SignException
|
protected final int getIntegerPositive(final String line) throws SignException
|
||||||
{
|
{
|
||||||
final int quantity = getInteger(line);
|
final int quantity = getInteger(line);
|
||||||
@@ -326,13 +325,13 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final int getInteger(final String line) throws SignException
|
protected final int getInteger(final String line) throws SignException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final int quantity = Integer.parseInt(line);
|
final int quantity = Integer.parseInt(line);
|
||||||
|
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex)
|
catch (NumberFormatException ex)
|
||||||
@@ -340,7 +339,7 @@ public class EssentialsSign
|
|||||||
throw new SignException("Invalid sign", ex);
|
throw new SignException("Invalid sign", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final ItemStack getItemStack(final String itemName, final int quantity, final IEssentials ess) throws SignException
|
protected final ItemStack getItemStack(final String itemName, final int quantity, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -354,13 +353,13 @@ public class EssentialsSign
|
|||||||
throw new SignException(ex.getMessage(), ex);
|
throw new SignException(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Double getMoney(final String line) throws SignException
|
protected final Double getMoney(final String line) throws SignException
|
||||||
{
|
{
|
||||||
final boolean isMoney = line.matches("^[^0-9-\\.][\\.0-9]+$");
|
final boolean isMoney = line.matches("^[^0-9-\\.][\\.0-9]+$");
|
||||||
return isMoney ? getDoublePositive(line.substring(1)) : null;
|
return isMoney ? getDoublePositive(line.substring(1)) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Double getDoublePositive(final String line) throws SignException
|
protected final Double getDoublePositive(final String line) throws SignException
|
||||||
{
|
{
|
||||||
final double quantity = getDouble(line);
|
final double quantity = getDouble(line);
|
||||||
@@ -370,7 +369,7 @@ public class EssentialsSign
|
|||||||
}
|
}
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Double getDouble(final String line) throws SignException
|
protected final Double getDouble(final String line) throws SignException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -382,12 +381,12 @@ public class EssentialsSign
|
|||||||
throw new SignException(ex.getMessage(), ex);
|
throw new SignException(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Trade getTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
|
protected final Trade getTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
return getTrade(sign, index, 1, ess);
|
return getTrade(sign, index, 1, ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Trade getTrade(final ISign sign, final int index, final int decrement, final IEssentials ess) throws SignException
|
protected final Trade getTrade(final ISign sign, final int index, final int decrement, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
final String line = sign.getLine(index).trim();
|
final String line = sign.getLine(index).trim();
|
||||||
@@ -395,7 +394,7 @@ public class EssentialsSign
|
|||||||
{
|
{
|
||||||
return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess);
|
return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Double money = getMoney(line);
|
final Double money = getMoney(line);
|
||||||
if (money == null)
|
if (money == null)
|
||||||
{
|
{
|
||||||
@@ -405,7 +404,7 @@ public class EssentialsSign
|
|||||||
throw new SignException(_("invalidCharge"));
|
throw new SignException(_("invalidCharge"));
|
||||||
}
|
}
|
||||||
final int quantity = getIntegerPositive(split[0]);
|
final int quantity = getIntegerPositive(split[0]);
|
||||||
|
|
||||||
final String item = split[1].toLowerCase(Locale.ENGLISH);
|
final String item = split[1].toLowerCase(Locale.ENGLISH);
|
||||||
if (item.equalsIgnoreCase("times"))
|
if (item.equalsIgnoreCase("times"))
|
||||||
{
|
{
|
||||||
@@ -429,89 +428,89 @@ public class EssentialsSign
|
|||||||
return new Trade(money, ess);
|
return new Trade(money, ess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class EventSign implements ISign
|
static class EventSign implements ISign
|
||||||
{
|
{
|
||||||
private final transient SignChangeEvent event;
|
private final transient SignChangeEvent event;
|
||||||
private final transient Block block;
|
private final transient Block block;
|
||||||
|
|
||||||
public EventSign(final SignChangeEvent event)
|
public EventSign(final SignChangeEvent event)
|
||||||
{
|
{
|
||||||
this.event = event;
|
this.event = event;
|
||||||
this.block = event.getBlock();
|
this.block = event.getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String getLine(final int index)
|
public final String getLine(final int index)
|
||||||
{
|
{
|
||||||
return event.getLine(index);
|
return event.getLine(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setLine(final int index, final String text)
|
public final void setLine(final int index, final String text)
|
||||||
{
|
{
|
||||||
event.setLine(index, text);
|
event.setLine(index, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block getBlock()
|
public Block getBlock()
|
||||||
{
|
{
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSign()
|
public void updateSign()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static class BlockSign implements ISign
|
static class BlockSign implements ISign
|
||||||
{
|
{
|
||||||
private final transient Sign sign;
|
private final transient Sign sign;
|
||||||
private final transient Block block;
|
private final transient Block block;
|
||||||
|
|
||||||
public BlockSign(final Block block)
|
public BlockSign(final Block block)
|
||||||
{
|
{
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.sign = (Sign)block.getState();
|
this.sign = (Sign)block.getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String getLine(final int index)
|
public final String getLine(final int index)
|
||||||
{
|
{
|
||||||
return sign.getLine(index);
|
return sign.getLine(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setLine(final int index, final String text)
|
public final void setLine(final int index, final String text)
|
||||||
{
|
{
|
||||||
sign.setLine(index, text);
|
sign.setLine(index, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Block getBlock()
|
public final Block getBlock()
|
||||||
{
|
{
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void updateSign()
|
public final void updateSign()
|
||||||
{
|
{
|
||||||
sign.update();
|
sign.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface ISign
|
public interface ISign
|
||||||
{
|
{
|
||||||
String getLine(final int index);
|
String getLine(final int index);
|
||||||
|
|
||||||
void setLine(final int index, final String text);
|
void setLine(final int index, final String text);
|
||||||
|
|
||||||
public Block getBlock();
|
public Block getBlock();
|
||||||
|
|
||||||
void updateSign();
|
void updateSign();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -69,14 +69,14 @@ public class SignBlockListener implements Listener
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (EssentialsSign sign : plugin.getSettings().getEnabledSigns())
|
for (EssentialsSign sign : plugin.getSettings().getEnabledSigns())
|
||||||
|
{
|
||||||
|
if (sign.getBlocks().contains(block.getType())
|
||||||
|
&& !sign.onBlockBreak(block, player, ess))
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
||||||
&& !sign.onBlockBreak(block, player, ess))
|
return true;
|
||||||
{
|
}
|
||||||
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ public class SignBlockListener implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Block block : event.getBlocks())
|
for (Block block : event.getBlocks())
|
||||||
{
|
{
|
||||||
if (((block.getTypeId() == WALL_SIGN
|
if (((block.getTypeId() == WALL_SIGN
|
||||||
@@ -238,7 +238,7 @@ public class SignBlockListener implements Listener
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.isSticky())
|
if (event.isSticky())
|
||||||
{
|
{
|
||||||
final Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
|
@@ -35,13 +35,13 @@ public class SignGameMode extends EssentialsSign
|
|||||||
{
|
{
|
||||||
final Trade charge = getTrade(sign, 2, ess);
|
final Trade charge = getTrade(sign, 2, ess);
|
||||||
final String mode = sign.getLine(1).trim();
|
final String mode = sign.getLine(1).trim();
|
||||||
|
|
||||||
if (mode.isEmpty())
|
if (mode.isEmpty())
|
||||||
{
|
{
|
||||||
throw new SignException(_("invalidSignLine", 2));
|
throw new SignException(_("invalidSignLine", 2));
|
||||||
}
|
}
|
||||||
charge.isAffordableFor(player);
|
charge.isAffordableFor(player);
|
||||||
|
|
||||||
//this needs to be fixed
|
//this needs to be fixed
|
||||||
player.getPlayer().setGameMode(player.getPlayer().getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
player.getPlayer().setGameMode(player.getPlayer().getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||||
player.sendMessage(_("gameMode", _(player.getPlayer().getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getPlayer().getDisplayName()));
|
player.sendMessage(_("gameMode", _(player.getPlayer().getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getPlayer().getDisplayName()));
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package net.ess3.signs;
|
package net.ess3.signs;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import net.ess3.api.ChargeException;
|
import net.ess3.api.ChargeException;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
@@ -53,6 +52,3 @@ public class SignInfo extends EssentialsSign
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,10 +23,10 @@ public class SignRepair extends EssentialsSign
|
|||||||
{
|
{
|
||||||
sign.setLine(1, "Hand");
|
sign.setLine(1, "Hand");
|
||||||
}
|
}
|
||||||
else if (!repairTarget.equalsIgnoreCase("all") && !repairTarget.equalsIgnoreCase("hand") )
|
else if (!repairTarget.equalsIgnoreCase("all") && !repairTarget.equalsIgnoreCase("hand"))
|
||||||
{
|
{
|
||||||
throw new SignException(_("invalidSignLine", 2));
|
throw new SignException(_("invalidSignLine", 2));
|
||||||
}
|
}
|
||||||
validateTrade(sign, 2, ess);
|
validateTrade(sign, 2, ess);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ public class SignRepair extends EssentialsSign
|
|||||||
{
|
{
|
||||||
final Trade charge = getTrade(sign, 2, ess);
|
final Trade charge = getTrade(sign, 2, ess);
|
||||||
charge.isAffordableFor(player);
|
charge.isAffordableFor(player);
|
||||||
|
|
||||||
Commandrepair command = new Commandrepair();
|
Commandrepair command = new Commandrepair();
|
||||||
command.init(ess, "repair");
|
command.init(ess, "repair");
|
||||||
String[] args = new String[]
|
String[] args = new String[]
|
||||||
@@ -51,7 +51,7 @@ public class SignRepair extends EssentialsSign
|
|||||||
{
|
{
|
||||||
throw new SignException(ex.getMessage(), ex);
|
throw new SignException(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
charge.charge(player);
|
charge.charge(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,8 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
//TODO: Sell Enchantment on Trade signs?
|
//TODO: Sell Enchantment on Trade signs?
|
||||||
public class SignTrade extends EssentialsSign
|
public class SignTrade extends EssentialsSign
|
||||||
{
|
{
|
||||||
|
|
||||||
public SignTrade()
|
public SignTrade()
|
||||||
{
|
{
|
||||||
super("Trade");
|
super("Trade");
|
||||||
|
@@ -19,19 +19,19 @@ class EssentialsXMPPPlayerListener implements Listener
|
|||||||
this.ess = ess;
|
this.ess = ess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority= EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(final PlayerJoinEvent event)
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
sendMessageToSpyUsers("Player " + event.getPlayer().getDisplayName() + " joined the game");
|
sendMessageToSpyUsers("Player " + event.getPlayer().getDisplayName() + " joined the game");
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority= EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerChat(final PlayerChatEvent event)
|
public void onPlayerChat(final PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
sendMessageToSpyUsers(String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()));
|
sendMessageToSpyUsers(String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority= EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(final PlayerQuitEvent event)
|
public void onPlayerQuit(final PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
sendMessageToSpyUsers("Player " + event.getPlayer().getDisplayName() + " left the game");
|
sendMessageToSpyUsers("Player " + event.getPlayer().getDisplayName() + " left the game");
|
||||||
|
Reference in New Issue
Block a user