mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-01 10:42:41 +02:00
Merge branch 'master' of https://github.com/essentials/Essentials
This commit is contained in:
@@ -10,6 +10,7 @@ import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.II18n;
|
||||
|
||||
@@ -97,6 +98,7 @@ public class I18n implements II18n
|
||||
}
|
||||
return messageFormat.format(objects);
|
||||
}
|
||||
private final Pattern partSplit = Pattern.compile("[_\\.]");
|
||||
|
||||
public void updateLocale(final String loc)
|
||||
{
|
||||
@@ -104,7 +106,7 @@ public class I18n implements II18n
|
||||
{
|
||||
return;
|
||||
}
|
||||
final String[] parts = loc.split("[_\\.]");
|
||||
final String[] parts = partSplit.split(loc);
|
||||
if (parts.length == 1)
|
||||
{
|
||||
currentLocale = new Locale(parts[0]);
|
||||
|
@@ -84,31 +84,39 @@ public class ItemDb implements IItemDb
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(final String id, final int quantity) throws Exception
|
||||
{
|
||||
final ItemStack retval = get(id.toLowerCase(Locale.ENGLISH));
|
||||
retval.setAmount(quantity);
|
||||
return retval;
|
||||
}
|
||||
private final Pattern idMatch = Pattern.compile("^\\d+[:+',;.]\\d+$");
|
||||
private final Pattern metaSplit = Pattern.compile("[:+',;.]");
|
||||
private final Pattern number = Pattern.compile("^\\d+$");
|
||||
private final Pattern conjoined = Pattern.compile("^[^:+',;.]+[:+',;.]\\d+$");
|
||||
|
||||
@Override
|
||||
public ItemStack get(final String id) throws Exception
|
||||
{
|
||||
int itemid = 0;
|
||||
String itemname = null;
|
||||
short metaData = 0;
|
||||
if (id.matches("^\\d+[:+',;.]\\d+$"))
|
||||
if (idMatch.matcher(id).matches())
|
||||
{
|
||||
itemid = Integer.parseInt(id.split("[:+',;.]")[0]);
|
||||
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
|
||||
String[] split = metaSplit.split(id);
|
||||
itemid = Integer.parseInt(split[0]);
|
||||
metaData = Short.parseShort(split[1]);
|
||||
}
|
||||
else if (id.matches("^\\d+$"))
|
||||
else if (number.matcher(id).matches())
|
||||
{
|
||||
itemid = Integer.parseInt(id);
|
||||
}
|
||||
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
|
||||
else if (conjoined.matcher(id).matches())
|
||||
{
|
||||
itemname = id.split("[:+',;.]")[0].toLowerCase(Locale.ENGLISH);
|
||||
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
|
||||
String[] split = metaSplit.split(id);
|
||||
itemname = split[0].toLowerCase(Locale.ENGLISH);
|
||||
metaData = Short.parseShort(split[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -102,16 +102,6 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
|
||||
queueSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount()
|
||||
{
|
||||
|
@@ -69,16 +69,6 @@ public class Kits extends AsyncStorageObjectHolder<net.ess3.settings.Kits> imple
|
||||
return getData().getKits().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkTime(IUser user, Kit kit) throws NoChargeException
|
||||
{
|
||||
|
@@ -13,6 +13,7 @@ import net.ess3.user.CooldownException;
|
||||
import net.ess3.user.UserData.TimestampType;
|
||||
import net.ess3.utils.DateUtil;
|
||||
import net.ess3.utils.LocationUtil;
|
||||
import net.ess3.utils.Target;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
@@ -22,37 +23,11 @@ public class Teleport implements Runnable, ITeleport
|
||||
{
|
||||
private static final double MOVE_CONSTANT = 0.3;
|
||||
|
||||
|
||||
private static class Target
|
||||
{
|
||||
private final Location location;
|
||||
private final Entity entity;
|
||||
|
||||
Target(Location location)
|
||||
{
|
||||
this.location = location;
|
||||
this.entity = null;
|
||||
}
|
||||
|
||||
Target(Entity entity)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.location = null;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
if (this.entity != null)
|
||||
{
|
||||
return this.entity.getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
}
|
||||
private IUser user;
|
||||
private IUser teleportUser;
|
||||
private int teleTimer = -1;
|
||||
private long started; // time this task was initiated
|
||||
private long delay; // how long to delay the teleport
|
||||
private long tpDelay; // how long to delay the teleport
|
||||
private int health;
|
||||
// note that I initially stored a clone of the location for reference, but...
|
||||
// when comparing locations, I got incorrect mismatches (rounding errors, looked like)
|
||||
@@ -67,13 +42,19 @@ public class Teleport implements Runnable, ITeleport
|
||||
private TeleportCause cause;
|
||||
|
||||
private void initTimer(long delay, Target target, Trade chargeFor, TeleportCause cause)
|
||||
{
|
||||
initTimer(delay, user, target, chargeFor, cause);
|
||||
}
|
||||
|
||||
private void initTimer(long delay, IUser teleportUser, Target target, Trade chargeFor, TeleportCause cause)
|
||||
{
|
||||
this.started = System.currentTimeMillis();
|
||||
this.delay = delay;
|
||||
this.health = user.getPlayer().getHealth();
|
||||
this.initX = Math.round(user.getPlayer().getLocation().getX() * MOVE_CONSTANT);
|
||||
this.initY = Math.round(user.getPlayer().getLocation().getY() * MOVE_CONSTANT);
|
||||
this.initZ = Math.round(user.getPlayer().getLocation().getZ() * MOVE_CONSTANT);
|
||||
this.tpDelay = delay;
|
||||
this.health = teleportUser.getPlayer().getHealth();
|
||||
this.initX = Math.round(teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT);
|
||||
this.initY = Math.round(teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT);
|
||||
this.initZ = Math.round(teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT);
|
||||
this.teleportUser = teleportUser;
|
||||
this.teleportTarget = target;
|
||||
this.chargeFor = chargeFor;
|
||||
this.cause = cause;
|
||||
@@ -88,28 +69,36 @@ public class Teleport implements Runnable, ITeleport
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
if (Math.round(user.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX
|
||||
|| Math.round(user.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY
|
||||
|| Math.round(user.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ
|
||||
|| user.getPlayer().getHealth() < health)
|
||||
|
||||
if (teleportUser == null || !teleportUser.isOnline() || teleportUser.getPlayer().getLocation() == null)
|
||||
{
|
||||
cancel(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.TELEPORT_TIMER_MOVE.isAuthorized(user)
|
||||
&&(Math.round(teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX
|
||||
|| Math.round(teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY
|
||||
|| Math.round(teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ
|
||||
|| teleportUser.getPlayer().getHealth() < health))
|
||||
{ // user moved, cancel teleport
|
||||
cancel(true);
|
||||
return;
|
||||
}
|
||||
|
||||
health = user.getPlayer().getHealth(); // in case user healed, then later gets injured
|
||||
health = teleportUser.getPlayer().getHealth(); // in case user healed, then later gets injured
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if (now > started + delay)
|
||||
if (now > started + tpDelay)
|
||||
{
|
||||
try
|
||||
{
|
||||
cooldown(false);
|
||||
user.sendMessage(_("teleportationCommencing"));
|
||||
teleportUser.sendMessage(_("teleportationCommencing"));
|
||||
try
|
||||
{
|
||||
|
||||
now(teleportTarget, cause);
|
||||
teleportUser.getTeleport().now(teleportTarget, cause);
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.charge(user);
|
||||
@@ -123,6 +112,10 @@ public class Teleport implements Runnable, ITeleport
|
||||
catch (Exception ex)
|
||||
{
|
||||
user.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||
if (user != teleportUser)
|
||||
{
|
||||
teleportUser.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,21 +126,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
this.ess = ess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Location bed = user.getBedSpawnLocation();
|
||||
final Location respawnLoc = ess.getPlugin().callRespawnEvent(user.getPlayer(), bed == null ? user.getPlayer().getWorld().getSpawnLocation() : bed, bed != null);
|
||||
teleport(new Target(respawnLoc), chargeFor, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Location loc = ess.getWarps().getWarp(warp);
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
user.sendMessage(_("warpingTo", warp));
|
||||
}
|
||||
|
||||
public void cooldown(boolean check) throws Exception
|
||||
{
|
||||
@@ -162,6 +141,7 @@ public class Teleport implements Runnable, ITeleport
|
||||
}
|
||||
}
|
||||
|
||||
//If we need to cancel a pending teleport call this method
|
||||
public void cancel(boolean notifyUser)
|
||||
{
|
||||
if (teleTimer == -1)
|
||||
@@ -174,6 +154,10 @@ public class Teleport implements Runnable, ITeleport
|
||||
if (notifyUser)
|
||||
{
|
||||
user.sendMessage(_("pendingTeleportCancelled"));
|
||||
if (teleportUser != user)
|
||||
{
|
||||
teleportUser.sendMessage(_("pendingTeleportCancelled"));
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -187,17 +171,13 @@ public class Teleport implements Runnable, ITeleport
|
||||
cancel(false);
|
||||
}
|
||||
|
||||
public void teleport(Location loc, Trade chargeFor) throws Exception
|
||||
{
|
||||
teleport(new Target(loc), chargeFor, TeleportCause.PLUGIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
teleport(new Target(entity), chargeFor, cause);
|
||||
@@ -205,14 +185,14 @@ public class Teleport implements Runnable, ITeleport
|
||||
|
||||
private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
double tDelay = ess.getRanks().getTeleportDelay(user);
|
||||
double delay = ess.getRanks().getTeleportDelay(user);
|
||||
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.isAffordableFor(user);
|
||||
}
|
||||
cooldown(true);
|
||||
if (tDelay <= 0 || Permissions.TELEPORT_TIMER_BYPASS.isAuthorized(user))
|
||||
if (delay <= 0 || Permissions.TELEPORT_TIMER_BYPASS.isAuthorized(user))
|
||||
{
|
||||
cooldown(false);
|
||||
now(target, cause);
|
||||
@@ -224,16 +204,14 @@ public class Teleport implements Runnable, ITeleport
|
||||
}
|
||||
|
||||
cancel();
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, (int)tDelay);
|
||||
c.add(Calendar.MILLISECOND, (int)((tDelay * 1000.0) % 1000.0));
|
||||
user.sendMessage(_("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis())));
|
||||
initTimer((long)(tDelay * 1000.0), target, chargeFor, cause);
|
||||
warnUser(user, delay);
|
||||
initTimer((long)(delay * 1000.0), target, chargeFor, cause);
|
||||
|
||||
teleTimer = ess.getPlugin().scheduleSyncRepeatingTask(this, 10, 10);
|
||||
}
|
||||
|
||||
private void now(final Target target, final TeleportCause cause) throws Exception
|
||||
@Override
|
||||
public void now(final Target target, final TeleportCause cause) throws Exception
|
||||
{
|
||||
cancel();
|
||||
user.setLastLocation();
|
||||
@@ -258,13 +236,9 @@ public class Teleport implements Runnable, ITeleport
|
||||
now(new Target(loc), cause);
|
||||
}
|
||||
|
||||
public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
cooldown(false);
|
||||
chargeFor.charge(user);
|
||||
now(new Target(loc), cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
//The now function is used when you want to skip tp delay when teleporting someone to a location or player.
|
||||
public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception
|
||||
{
|
||||
if (cooldown)
|
||||
@@ -274,6 +248,66 @@ public class Teleport implements Runnable, ITeleport
|
||||
now(new Target(entity), cause);
|
||||
}
|
||||
|
||||
public void now(Location loc, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
cooldown(false);
|
||||
chargeFor.charge(user);
|
||||
now(new Target(loc), cause);
|
||||
}
|
||||
|
||||
//The teleportToMe function is a wrapper used to handle teleporting players to them, like /tphere
|
||||
public void teleportToMe(IUser otherUser, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
Target target = new Target(user.getPlayer());
|
||||
|
||||
double delay = ess.getRanks().getTeleportDelay(user);
|
||||
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.isAffordableFor(user);
|
||||
}
|
||||
cooldown(true);
|
||||
if (delay <= 0 || Permissions.TELEPORT_TIMER_BYPASS.isAuthorized(user))
|
||||
{
|
||||
cooldown(false);
|
||||
otherUser.getTeleport().now(target, cause);
|
||||
if (chargeFor != null)
|
||||
{
|
||||
chargeFor.charge(user);
|
||||
}
|
||||
return; }
|
||||
|
||||
cancel(false);
|
||||
warnUser(otherUser, delay);
|
||||
initTimer((long)(delay * 1000.0), otherUser, target, chargeFor, cause);
|
||||
|
||||
teleTimer = ess.getPlugin().scheduleSyncRepeatingTask(this, 10, 10);
|
||||
}
|
||||
|
||||
private void warnUser(final IUser user, final double delay)
|
||||
{
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.add(Calendar.SECOND, (int)delay);
|
||||
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||
user.sendMessage(_("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Location bed = user.getBedSpawnLocation();
|
||||
final Location respawnLoc = ess.getPlugin().callRespawnEvent(user.getPlayer(), bed == null ? user.getPlayer().getWorld().getSpawnLocation() : bed, bed != null);
|
||||
teleport(new Target(respawnLoc), chargeFor, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception
|
||||
{
|
||||
final Location loc = ess.getWarps().getWarp(warp);
|
||||
user.sendMessage(_("warpingTo", warp));
|
||||
teleport(new Target(loc), chargeFor, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void back(Trade chargeFor) throws Exception
|
||||
{
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.ess3.api;
|
||||
|
||||
import net.ess3.economy.Trade;
|
||||
import net.ess3.utils.Target;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
@@ -12,12 +13,16 @@ public interface ITeleport
|
||||
|
||||
void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception;
|
||||
|
||||
void now(final Target target, final TeleportCause cause) throws Exception;
|
||||
|
||||
void back(Trade chargeFor) throws Exception;
|
||||
|
||||
void teleport(Location bed, Trade charge, TeleportCause teleportCause) throws Exception;
|
||||
|
||||
void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception;
|
||||
|
||||
void teleportToMe(IUser otherUser, Trade chargeFor, TeleportCause cause) throws Exception;
|
||||
|
||||
void home(Location loc, Trade chargeFor) throws Exception;
|
||||
|
||||
void respawn(Trade charge, TeleportCause teleportCause) throws Exception;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
@@ -9,6 +10,8 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
public class Commanddelhome extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern colon = Pattern.compile(":");
|
||||
|
||||
@Override
|
||||
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -22,7 +25,7 @@ public class Commanddelhome extends EssentialsCommand
|
||||
String[] expandedArg;
|
||||
|
||||
//Allowing both formats /sethome khobbits house | /sethome khobbits:house
|
||||
final String[] nameParts = args[0].split(":");
|
||||
final String[] nameParts = colon.split(args[0]);
|
||||
if (nameParts[0].length() != args[0].length())
|
||||
{
|
||||
expandedArg = nameParts;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
@@ -13,6 +14,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Commandgive extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern data = Pattern.compile("[:+',;.]");
|
||||
|
||||
@Override
|
||||
protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -45,7 +48,7 @@ public class Commandgive extends EssentialsCommand
|
||||
{
|
||||
for (int i = Util.isInt(args[3]) ? 4 : 3; i < args.length; i++)
|
||||
{
|
||||
final String[] split = args[i].split("[:+',;.]", 2);
|
||||
final String[] split = data.split(args[i], 2);
|
||||
if (split.length < 1)
|
||||
{
|
||||
continue;
|
||||
|
@@ -2,6 +2,7 @@ package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.economy.Trade;
|
||||
@@ -14,6 +15,8 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
||||
public class Commandhome extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern colon = Pattern.compile(":");
|
||||
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -24,7 +27,7 @@ public class Commandhome extends EssentialsCommand
|
||||
String[] nameParts;
|
||||
if (args.length > 0)
|
||||
{
|
||||
nameParts = args[0].split(":");
|
||||
nameParts = colon.split(args[0]);
|
||||
if (nameParts[0].length() == args[0].length() || !Permissions.HOME_OTHERS.isAuthorized(user))
|
||||
{
|
||||
homeName = nameParts[0];
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
@@ -10,6 +11,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Commanditem extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern data = Pattern.compile("[:+',;.]");
|
||||
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -41,7 +44,7 @@ public class Commanditem extends EssentialsCommand
|
||||
{
|
||||
for (int i = 2; i < args.length; i++)
|
||||
{
|
||||
final String[] split = args[i].split("[:+',;.]", 2);
|
||||
final String[] split = data.split(args[i], 2);
|
||||
if (split.length < 1)
|
||||
{
|
||||
continue;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.permissions.Permissions;
|
||||
@@ -8,13 +9,15 @@ import net.ess3.permissions.Permissions;
|
||||
|
||||
public class Commandsethome extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern colon = Pattern.compile(":");
|
||||
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, String[] args) throws Exception
|
||||
{
|
||||
if (args.length > 0)
|
||||
{
|
||||
//Allowing both formats /sethome khobbits house | /sethome khobbits:house
|
||||
final String[] nameParts = args[0].split(":");
|
||||
final String[] nameParts = colon.split(args[0]);
|
||||
if (nameParts[0].length() != args[0].length())
|
||||
{
|
||||
args = nameParts;
|
||||
|
@@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
@@ -22,6 +23,8 @@ import org.bukkit.material.Colorable;
|
||||
|
||||
public class Commandspawnmob extends EssentialsCommand
|
||||
{
|
||||
private final transient Pattern colon = Pattern.compile(":");
|
||||
|
||||
@Override
|
||||
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
@@ -45,7 +48,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
|
||||
|
||||
final String[] mountparts = args[0].split(",");
|
||||
String[] parts = mountparts[0].split(":");
|
||||
String[] parts = colon.split(mountparts[0]);
|
||||
String mobType = parts[0];
|
||||
String mobData = null;
|
||||
if (parts.length == 2)
|
||||
@@ -56,7 +59,7 @@ public class Commandspawnmob extends EssentialsCommand
|
||||
String mountData = null;
|
||||
if (mountparts.length > 1)
|
||||
{
|
||||
parts = mountparts[1].split(":");
|
||||
parts = colon.split(mountparts[1]);
|
||||
mountType = parts[0];
|
||||
if (parts.length == 2)
|
||||
{
|
||||
|
@@ -56,12 +56,13 @@ public class Commandtpaccept extends EssentialsCommand
|
||||
|
||||
if (user.isTpRequestHere())
|
||||
{
|
||||
user.getTeleport().teleport(target.getPlayer(), charge, TeleportCause.COMMAND);
|
||||
target.getTeleport().teleportToMe(user, charge, TeleportCause.COMMAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
target.getTeleport().teleport(user.getPlayer(), charge, TeleportCause.COMMAND);
|
||||
}
|
||||
user.requestTeleport(null, false);
|
||||
throw new NoChargeException();
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,8 @@ public class Commandtphere extends EssentialsCommand
|
||||
{
|
||||
throw new Exception(_("teleportDisabled", player.getPlayer().getDisplayName()));
|
||||
}
|
||||
player.getTeleport().teleport(user.getPlayer(), new Trade(commandName, ess), TeleportCause.COMMAND);
|
||||
|
||||
user.getTeleport().teleportToMe(player, new Trade(commandName, ess), TeleportCause.COMMAND);
|
||||
user.sendMessage(_("teleporting"));
|
||||
player.sendMessage(_("teleporting"));
|
||||
throw new NoChargeException();
|
||||
|
@@ -7,20 +7,6 @@ import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
|
||||
public class MoneyHolder extends AsyncStorageObjectHolder<Money>
|
||||
{
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public MoneyHolder(IEssentials ess)
|
||||
{
|
||||
super(ess, Money.class, new File(ess.getPlugin().getDataFolder(), "economy_npcs.yml"));
|
||||
|
@@ -14,16 +14,6 @@ import org.bukkit.material.MaterialData;
|
||||
|
||||
public class WorthHolder extends AsyncStorageObjectHolder<net.ess3.economy.Worth> implements IWorth
|
||||
{
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
public WorthHolder(final IEssentials ess)
|
||||
{
|
||||
super(ess, net.ess3.economy.Worth.class, new File(ess.getPlugin().getDataFolder(), "worth.yml"));
|
||||
|
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
@@ -318,12 +319,13 @@ public class EssentialsPlayerListener implements Listener
|
||||
});
|
||||
}
|
||||
}
|
||||
private final Pattern spaceSplit = Pattern.compile(" ");
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(final PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
final IUser user = ess.getUserMap().getUser(event.getPlayer());
|
||||
final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
|
||||
final String cmd = spaceSplit.split(event.getMessage().toLowerCase(Locale.ENGLISH))[0].replace("/", "").toLowerCase(Locale.ENGLISH);
|
||||
if (ess.getSettings().getData().getCommands().getSocalspy().getSocialspyCommands().contains(cmd))
|
||||
{
|
||||
for (Player player : ess.getServer().getOnlinePlayers())
|
||||
|
@@ -96,6 +96,7 @@ public enum Permissions implements IPermission
|
||||
TELEPORT_HIDDEN,
|
||||
TELEPORT_OTHERS,
|
||||
TELEPORT_TIMER_BYPASS,
|
||||
TELEPORT_TIMER_MOVE,
|
||||
TEMPBAN_EXEMPT,
|
||||
TEMPBAN_OFFLINE,
|
||||
TIME_SET,
|
||||
|
@@ -26,16 +26,6 @@ public class RanksStorage extends AsyncStorageObjectHolder<Ranks> implements IRa
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
public RanksStorage(final IEssentials ess)
|
||||
{
|
||||
super(ess, Ranks.class, new File(ess.getPlugin().getDataFolder(), "ranks.yml"));
|
||||
|
@@ -77,7 +77,7 @@ public class General implements StorageObject
|
||||
{
|
||||
return loginAttackDelay * 1000;
|
||||
}
|
||||
public Boolean metricsEnabled = null;
|
||||
private Boolean metricsEnabled = null;
|
||||
|
||||
@Comment("The join message when players join the server")
|
||||
private String joinMessage = "&e{PLAYER} has joined the game";
|
||||
|
@@ -8,15 +8,6 @@ import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
|
||||
public class SettingsHolder extends AsyncStorageObjectHolder<Settings> implements ISettings
|
||||
{
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
private transient volatile boolean debug = false;
|
||||
|
||||
public SettingsHolder(final IEssentials ess)
|
||||
|
@@ -28,16 +28,6 @@ import org.bukkit.plugin.EventExecutor;
|
||||
|
||||
public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IEssentialsModule
|
||||
{
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
public SpawnsHolder(final IEssentials ess)
|
||||
{
|
||||
super(ess, Spawns.class, new File(ess.getPlugin().getDataFolder(), "spawn.yml"));
|
||||
|
@@ -8,15 +8,6 @@ import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
|
||||
public class WarpHolder extends AsyncStorageObjectHolder<Warp> implements IWarp
|
||||
{
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
private final String name;
|
||||
|
||||
public WarpHolder(String name, IEssentials ess) throws InvalidNameException
|
||||
|
@@ -22,53 +22,59 @@ public class Alert implements StorageObject
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> alertOnPlacement = null;
|
||||
private Set<Material> alertOnPlacement = new HashSet<Material>();
|
||||
@Comment("For which block types would you like to be alerted when used?")
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> alertOnUse = null;
|
||||
private Set<Material> alertOnUse = new HashSet<Material>();
|
||||
@Comment("For which block types would you like to be alerted when broken?")
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> alertOnBreak = null;
|
||||
private Set<Material> alertOnBreak = new HashSet<Material>();
|
||||
|
||||
public Alert()
|
||||
{
|
||||
if (alertOnPlacement == null)
|
||||
if (alertOnPlacement.isEmpty())
|
||||
{
|
||||
Material[] mat =
|
||||
{
|
||||
Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET
|
||||
};
|
||||
alertOnPlacement = new HashSet<Material>();
|
||||
alertOnPlacement.addAll(Arrays.asList(mat));
|
||||
}
|
||||
|
||||
if (alertOnUse == null)
|
||||
if (alertOnUse.isEmpty())
|
||||
{
|
||||
alertOnUse = new HashSet<Material>();
|
||||
alertOnUse.add(Material.LAVA_BUCKET);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getAlertOnPlacement(Material mat)
|
||||
{
|
||||
if (alertOnPlacement == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return alertOnPlacement.contains(mat);
|
||||
}
|
||||
|
||||
public boolean getAlertOnUse(Material mat)
|
||||
{
|
||||
if (alertOnUse == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return alertOnUse.contains(mat);
|
||||
}
|
||||
|
||||
public boolean getAlertOnBreak(Material mat)
|
||||
{
|
||||
if (alertOnBreak == null)
|
||||
{
|
||||
alertOnBreak = new HashSet<Material>();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Set<Material> getAlertOnPlacement()
|
||||
{
|
||||
return alertOnPlacement;
|
||||
}
|
||||
|
||||
public Set<Material> getAlertOnUse()
|
||||
{
|
||||
return alertOnUse;
|
||||
}
|
||||
|
||||
public Set<Material> getAlertOnBreak()
|
||||
{
|
||||
return alertOnBreak;
|
||||
return alertOnBreak.contains(mat);
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ public class BlackList implements StorageObject
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> placement;
|
||||
private Set<Material> placement = new HashSet<Material>();
|
||||
@Comment(
|
||||
{
|
||||
"Which items should people be prevented from using"
|
||||
@@ -33,7 +33,7 @@ public class BlackList implements StorageObject
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> usage;
|
||||
private Set<Material> usage = new HashSet<Material>();
|
||||
@Comment(
|
||||
{
|
||||
"Which blocks should people be prevented from breaking"
|
||||
@@ -41,7 +41,7 @@ public class BlackList implements StorageObject
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> breaking;
|
||||
private Set<Material> breaking = new HashSet<Material>();
|
||||
@Comment(
|
||||
{
|
||||
"Which blocks should not be pushed by pistons"
|
||||
@@ -49,56 +49,60 @@ public class BlackList implements StorageObject
|
||||
@ListType(Material.class)
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private Set<Material> piston;
|
||||
private Set<Material> piston = new HashSet<Material>();
|
||||
|
||||
public BlackList()
|
||||
{
|
||||
if (placement == null)
|
||||
if(placement.isEmpty())
|
||||
{
|
||||
Material[] mat =
|
||||
{
|
||||
Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET
|
||||
};
|
||||
placement = new HashSet<Material>();
|
||||
|
||||
placement.addAll(Arrays.asList(mat));
|
||||
}
|
||||
|
||||
if (usage == null)
|
||||
|
||||
if (usage.isEmpty())
|
||||
{
|
||||
usage = new HashSet<Material>();
|
||||
usage.add(Material.LAVA_BUCKET);
|
||||
}
|
||||
|
||||
if (breaking == null)
|
||||
{
|
||||
breaking = new HashSet<Material>();
|
||||
}
|
||||
|
||||
if (piston == null)
|
||||
public boolean getPlacement(Material mat)
|
||||
{
|
||||
piston = new HashSet<Material>();
|
||||
if(placement == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return placement.contains(mat);
|
||||
}
|
||||
|
||||
|
||||
public boolean getUsage(Material mat)
|
||||
{
|
||||
if(usage == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return usage.contains(mat);
|
||||
}
|
||||
|
||||
public Set<Material> getPlacement()
|
||||
public boolean getBreaking(Material mat)
|
||||
{
|
||||
return placement;
|
||||
if(breaking == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return breaking.contains(mat);
|
||||
}
|
||||
|
||||
public Set<Material> getUsage()
|
||||
public boolean getPiston(Material mat)
|
||||
{
|
||||
return usage;
|
||||
if(piston == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<Material> getBreaking()
|
||||
{
|
||||
return breaking;
|
||||
}
|
||||
|
||||
public Set<Material> getPiston()
|
||||
{
|
||||
return piston;
|
||||
return piston.contains(mat);
|
||||
}
|
||||
}
|
||||
|
@@ -2,10 +2,7 @@ package net.ess3.storage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -78,9 +75,17 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
public abstract void finishRead();
|
||||
protected void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void finishWrite();
|
||||
protected void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
protected void fillWithDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
public StorageQueue.RequestState getRequestState(long timestamp)
|
||||
{
|
||||
@@ -108,6 +113,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
||||
return writer;
|
||||
}
|
||||
|
||||
|
||||
private class StorageObjectDataWriter extends AbstractDelayedYamlFileWriter
|
||||
{
|
||||
public StorageObjectDataWriter()
|
||||
@@ -176,6 +182,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen
|
||||
loaded.set(true);
|
||||
if (exception instanceof FileNotFoundException)
|
||||
{
|
||||
fillWithDefaults();
|
||||
writer.schedule();
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,8 @@ import org.yaml.snakeyaml.nodes.*;
|
||||
public class BukkitConstructor extends Constructor
|
||||
{
|
||||
private final transient Pattern NUMPATTERN = Pattern.compile("\\d+");
|
||||
private final transient Pattern DATAPATTERN = Pattern.compile("[:+',;.]");
|
||||
private final transient Pattern WORD = Pattern.compile("\\W");
|
||||
private final transient IPlugin plugin;
|
||||
|
||||
public BukkitConstructor(final Class clazz, final IPlugin plugin)
|
||||
@@ -59,7 +61,7 @@ public class BukkitConstructor extends Constructor
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final String[] split = val.split("[:+',;.]", 2);
|
||||
final String[] split = DATAPATTERN.split(val, 2);
|
||||
if (split.length == 0)
|
||||
{
|
||||
return null;
|
||||
@@ -92,12 +94,12 @@ public class BukkitConstructor extends Constructor
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final String[] split1 = val.split("\\W");
|
||||
final String[] split1 = WORD.split(val);
|
||||
if (split1.length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final String[] split2 = split1[0].split("[:+',;.]", 2);
|
||||
final String[] split2 = DATAPATTERN.split(split1[0], 2);
|
||||
if (split2.length == 0)
|
||||
{
|
||||
return null;
|
||||
@@ -131,7 +133,7 @@ public class BukkitConstructor extends Constructor
|
||||
{
|
||||
for (int i = 2; i < split1.length; i++)
|
||||
{
|
||||
final String[] split3 = split1[0].split("[:+',;.]", 2);
|
||||
final String[] split3 = DATAPATTERN.split(split1[0], 2);
|
||||
if (split3.length < 1)
|
||||
{
|
||||
continue;
|
||||
@@ -175,7 +177,7 @@ public class BukkitConstructor extends Constructor
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final String[] split = val.split("[:+',;.]", 2);
|
||||
final String[] split = DATAPATTERN.split(val, 2);
|
||||
if (split.length == 0)
|
||||
{
|
||||
return null;
|
||||
|
@@ -78,16 +78,6 @@ public class User extends UserBase implements IUser
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCooldown(final UserData.TimestampType cooldownType, final double cooldown, final boolean set, final IPermission bypassPermission) throws CooldownException
|
||||
{
|
||||
|
@@ -7,6 +7,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.api.IUserMap;
|
||||
@@ -144,11 +145,12 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap
|
||||
{
|
||||
return matchUsers(name, false, false, requester);
|
||||
}
|
||||
private final Pattern comma = Pattern.compile(",");
|
||||
|
||||
public Set<IUser> matchUsers(final String name, final boolean includeHidden, final boolean includeOffline, final Player requester)
|
||||
{
|
||||
final String colorlessName = FormatUtil.stripColor(name);
|
||||
final String[] search = colorlessName.split(",");
|
||||
final String[] search = comma.split(colorlessName);
|
||||
final boolean multisearch = search.length > 1;
|
||||
final Set<IUser> result = new LinkedHashSet<IUser>();
|
||||
final String nicknamePrefix = FormatUtil.stripColor(getNickNamePrefix());
|
||||
|
32
Essentials/src/net/ess3/utils/Target.java
Normal file
32
Essentials/src/net/ess3/utils/Target.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package net.ess3.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class Target
|
||||
{
|
||||
private final Location location;
|
||||
private final Entity entity;
|
||||
|
||||
public Target(Location location)
|
||||
{
|
||||
this.location = location;
|
||||
this.entity = null;
|
||||
}
|
||||
|
||||
public Target(Entity entity)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.location = null;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
if (this.entity != null)
|
||||
{
|
||||
return this.entity.getLocation();
|
||||
}
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import net.ess3.api.IEssentials;
|
||||
import net.ess3.settings.antibuild.AntiBuild;
|
||||
import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
|
||||
|
||||
public class AntiBuildHolder extends AsyncStorageObjectHolder<AntiBuild>
|
||||
{
|
||||
public AntiBuildHolder(final IEssentials ess)
|
||||
@@ -12,14 +13,4 @@ public class AntiBuildHolder extends AsyncStorageObjectHolder<AntiBuild>
|
||||
super(ess, AntiBuild.class, new File(ess.getPlugin().getDataFolder(), "antibuild.yml"));
|
||||
onReload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (antib.getSettings().getData().getBlacklist().getPlacement().contains(type) && !Permissions.BLACKLIST_ALLOWPLACEMENT.isAuthorized(user))
|
||||
if (antib.getSettings().getData().getBlacklist().getPlacement(type) && !Permissions.BLACKLIST_ALLOWPLACEMENT.isAuthorized(user))
|
||||
{
|
||||
if (antib.getSettings().getData().isWarnOnBuildDisallow())
|
||||
{
|
||||
@@ -61,7 +61,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnPlacement().contains(type)
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnPlacement(type)
|
||||
&& !Permissions.ALERTS_NOTRIGGER.isAuthorized(user))
|
||||
{
|
||||
antib.getEssentialsConnect().alert(user, type.toString(), _("alertPlaced"));
|
||||
@@ -88,7 +88,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (antib.getSettings().getData().getBlacklist().getBreaking().contains(type) && !Permissions.BLACKLIST_ALLOWBREAK.isAuthorized(user))
|
||||
if (antib.getSettings().getData().getBlacklist().getBreaking(type) && !Permissions.BLACKLIST_ALLOWBREAK.isAuthorized(user))
|
||||
{
|
||||
if (antib.getSettings().getData().isWarnOnBuildDisallow())
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnBreak().contains(type)
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnBreak(type)
|
||||
&& !Permissions.ALERTS_NOTRIGGER.isAuthorized(user))
|
||||
{
|
||||
antib.getEssentialsConnect().alert(user, type.toString(), _("alertBroke"));
|
||||
@@ -130,7 +130,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
{
|
||||
for (Block block : event.getBlocks())
|
||||
{
|
||||
if (antib.getSettings().getData().getBlacklist().getPiston().contains(block.getType()))
|
||||
if (antib.getSettings().getData().getBlacklist().getPiston(block.getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
@@ -146,7 +146,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
final Block block = event.getRetractLocation().getBlock();
|
||||
if (antib.getSettings().getData().getBlacklist().getPiston().contains(block.getType()))
|
||||
if (antib.getSettings().getData().getBlacklist().getPiston(block.getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
final ItemStack item = event.getItem();
|
||||
|
||||
if (item != null
|
||||
&& antib.getSettings().getData().getBlacklist().getUsage().contains(item.getType())
|
||||
&& antib.getSettings().getData().getBlacklist().getUsage(item.getType())
|
||||
&& !Permissions.BLACKLIST_ALLOWUSAGE.isAuthorized(user))
|
||||
{
|
||||
if (antib.getSettings().getData().isWarnOnBuildDisallow())
|
||||
@@ -172,7 +172,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
}
|
||||
|
||||
if (item != null
|
||||
&& antib.getSettings().getData().getAlert().getAlertOnUse().contains(item.getType())
|
||||
&& antib.getSettings().getData().getAlert().getAlertOnUse(item.getType())
|
||||
&& !Permissions.ALERTS_NOTRIGGER.isAuthorized(user))
|
||||
{
|
||||
antib.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed"));
|
||||
|
@@ -17,14 +17,4 @@ public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
|
||||
this.geoip = geoip;
|
||||
onReload(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -12,14 +12,4 @@ public class ProtectHolder extends AsyncStorageObjectHolder<Protect>
|
||||
{
|
||||
super(ess, Protect.class, new File(ess.getPlugin().getDataFolder(), "protect.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -52,14 +52,4 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignConfig>
|
||||
{
|
||||
return !signsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user