mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-06 22:56:41 +02:00
2.9 -> 3.0 merge
This commit is contained in:
@@ -120,6 +120,8 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload,
|
|||||||
|
|
||||||
void setInvSee(boolean invsee);
|
void setInvSee(boolean invsee);
|
||||||
|
|
||||||
|
boolean hasInvulnerabilityAfterTeleport();
|
||||||
|
|
||||||
void update(final Player base);
|
void update(final Player base);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -90,16 +90,10 @@ public class Commandkit extends EssentialsCommand
|
|||||||
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
|
throw new Exception(_("noKitPermission", "essentials.kit." + kitName));
|
||||||
}
|
}
|
||||||
final Kit kit = ess.getKits().getKit(kitName);
|
final Kit kit = ess.getKits().getKit(kitName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ess.getKits().checkTime(userFrom, kit);
|
ess.getKits().checkTime(userFrom, kit);
|
||||||
|
|
||||||
final Trade charge = new Trade("kit-" + kitName, ess);
|
final Trade charge = new Trade("kit-" + kitName, ess);
|
||||||
charge.isAffordableFor(userFrom);
|
charge.isAffordableFor(userFrom);
|
||||||
|
|
||||||
ess.getKits().sendKit(userTo, kit);
|
ess.getKits().sendKit(userTo, kit);
|
||||||
|
|
||||||
charge.charge(userFrom);
|
charge.charge(userFrom);
|
||||||
userTo.sendMessage(_("kitGive", kitName));
|
userTo.sendMessage(_("kitGive", kitName));
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String itemName = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replaceAll("_", " ");
|
final String itemName = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replaceAll("_", " ");
|
||||||
|
user.acquireReadLock();
|
||||||
List<String> powertools = user.getData().getPowertool(itemStack.getType());
|
List<String> powertools = user.getData().getPowertool(itemStack.getType());
|
||||||
if (command != null && !command.isEmpty())
|
if (command != null && !command.isEmpty())
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
package com.earth2me.essentials.craftbukkit;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import net.minecraft.server.ChunkPosition;
|
||||||
|
import net.minecraft.server.Packet60Explosion;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
|
||||||
|
|
||||||
|
public class FakeExplosion
|
||||||
|
{
|
||||||
|
public static void createExplosion(final EntityExplodeEvent event, final Server server, final Player[] players)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size());
|
||||||
|
final List<ChunkPosition> blocksUnderPlayers = new ArrayList<ChunkPosition>(players.length);
|
||||||
|
final Location loc = event.getLocation();
|
||||||
|
for (Player player : players)
|
||||||
|
{
|
||||||
|
if (player.getWorld().equals(loc.getWorld()))
|
||||||
|
{
|
||||||
|
blocksUnderPlayers.add(new ChunkPosition(player.getLocation().getBlockX(), player.getLocation().getBlockY() - 1, player.getLocation().getBlockZ()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (Block block : event.blockList())
|
||||||
|
{
|
||||||
|
final ChunkPosition cp = new ChunkPosition(block.getX(), block.getY(), block.getZ());
|
||||||
|
if (!blocksUnderPlayers.contains(cp))
|
||||||
|
{
|
||||||
|
set.add(cp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
((CraftServer)server).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0F, set));
|
||||||
|
}
|
||||||
|
catch (Throwable ex)
|
||||||
|
{
|
||||||
|
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -5,9 +5,11 @@ import com.earth2me.essentials.api.IEssentials;
|
|||||||
import com.earth2me.essentials.api.ISettings;
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import com.earth2me.essentials.api.IUser;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.permissions.Permissions;
|
import com.earth2me.essentials.permissions.Permissions;
|
||||||
|
import com.earth2me.essentials.user.UserData.TimestampType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.Cleanup;
|
import lombok.Cleanup;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -33,34 +35,59 @@ public class EssentialsEntityListener implements Listener
|
|||||||
{
|
{
|
||||||
final Entity eAttack = event.getDamager();
|
final Entity eAttack = event.getDamager();
|
||||||
final Entity eDefend = event.getEntity();
|
final Entity eDefend = event.getEntity();
|
||||||
|
|
||||||
if (eDefend instanceof Player && eAttack instanceof Player)
|
if (eDefend instanceof Player && eAttack instanceof Player)
|
||||||
{
|
{
|
||||||
@Cleanup
|
@Cleanup
|
||||||
final IUser attacker = ess.getUser((Player)eAttack);
|
final IUser attacker = ess.getUser((Player)eAttack);
|
||||||
|
@Cleanup
|
||||||
|
final IUser defender = ess.getUser((Player)eDefend);
|
||||||
|
@Cleanup
|
||||||
|
ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
attacker.acquireReadLock();
|
attacker.acquireReadLock();
|
||||||
|
defender.acquireReadLock();
|
||||||
|
|
||||||
attacker.updateActivity(true);
|
attacker.updateActivity(true);
|
||||||
|
if (settings.getData().getGeneral().getLoginAttackDelay() > 0 && !Permissions.PVPDELAY_EXEMPT.isAuthorized(attacker)
|
||||||
|
&& (System.currentTimeMillis() < (attacker.getTimestamp(TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay())))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
final ItemStack itemstack = attacker.getItemInHand();
|
final ItemStack itemstack = attacker.getItemInHand();
|
||||||
final List<String> commandList = attacker.getData().getPowertool(itemstack.getType());
|
final List<String> commandList = attacker.getData().getPowertool(itemstack.getType());
|
||||||
if (commandList != null && !commandList.isEmpty())
|
if (commandList != null && !commandList.isEmpty())
|
||||||
{
|
{
|
||||||
for (String command : commandList)
|
for (final String command : commandList)
|
||||||
{
|
{
|
||||||
if (command != null && !command.isEmpty())
|
if (command != null && !command.isEmpty())
|
||||||
{
|
{
|
||||||
attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", ((Player)eDefend).getName()));
|
ess.scheduleSyncDelayedTask(
|
||||||
|
new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
attacker.getServer().dispatchCommand(attacker.getBase(), command.replaceAll("\\{player\\}", defender.getName()));
|
||||||
|
}
|
||||||
|
});
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eDefend instanceof Animals && eAttack instanceof Player)
|
else if (eDefend instanceof Ageable && eAttack instanceof Player)
|
||||||
{
|
{
|
||||||
final Player player = (Player)eAttack;
|
final Player player = (Player)eAttack;
|
||||||
final ItemStack hand = player.getItemInHand();
|
final ItemStack hand = player.getItemInHand();
|
||||||
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
if (hand != null && hand.getType() == Material.MILK_BUCKET)
|
||||||
{
|
{
|
||||||
((Animals)eDefend).setBaby();
|
((Ageable)eDefend).setBaby();
|
||||||
hand.setType(Material.BUCKET);
|
hand.setType(Material.BUCKET);
|
||||||
player.setItemInHand(hand);
|
player.setItemInHand(hand);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
|
@@ -59,6 +59,7 @@ public enum Permissions implements IPermission
|
|||||||
OVERSIZEDSTACKS(PermissionDefault.FALSE),
|
OVERSIZEDSTACKS(PermissionDefault.FALSE),
|
||||||
POWERTOOL_APPEND,
|
POWERTOOL_APPEND,
|
||||||
PTIME_OTHERS,
|
PTIME_OTHERS,
|
||||||
|
PVPDELAY_EXEMPT,
|
||||||
REPAIR_ARMOR,
|
REPAIR_ARMOR,
|
||||||
REPAIR_ENCHANTED,
|
REPAIR_ENCHANTED,
|
||||||
SEEN_BANREASON,
|
SEEN_BANREASON,
|
||||||
|
@@ -80,9 +80,9 @@ public class General implements StorageObject
|
|||||||
"This applies to /world, /back, /tp[a|o][here|all], but not warps.",
|
"This applies to /world, /back, /tp[a|o][here|all], but not warps.",
|
||||||
"Give someone permission to teleport to a world with essentials.world.<worldname>"
|
"Give someone permission to teleport to a world with essentials.world.<worldname>"
|
||||||
})
|
})
|
||||||
private boolean worldTeleportPermissions = false;
|
private boolean worldTeleportPermissions = false;
|
||||||
|
|
||||||
private boolean worldHomePermissions = false;
|
private boolean worldHomePermissions = false;
|
||||||
|
|
||||||
|
|
||||||
@Comment("Prevent creatures spawning")
|
@Comment("Prevent creatures spawning")
|
||||||
private Map<String, Boolean> creatureSpawn = new HashMap<String, Boolean>();
|
private Map<String, Boolean> creatureSpawn = new HashMap<String, Boolean>();
|
||||||
@@ -95,4 +95,12 @@ public class General implements StorageObject
|
|||||||
}
|
}
|
||||||
return creatureSpawn.get(creatureName);
|
return creatureSpawn.get(creatureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Comment("Delay to wait before people can cause attack damage after logging in ")
|
||||||
|
private long loginAttackDelay = 0;
|
||||||
|
|
||||||
|
public long getLoginAttackDelay()
|
||||||
|
{
|
||||||
|
return loginAttackDelay * 1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -739,6 +739,10 @@ public class User extends UserBase implements IUser
|
|||||||
teleportInvulnerabilityTimestamp = 0;
|
teleportInvulnerabilityTimestamp = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public boolean hasInvulnerabilityAfterTeleport()
|
||||||
|
{
|
||||||
|
return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void toggleVanished()
|
public void toggleVanished()
|
||||||
|
@@ -113,14 +113,7 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem
|
|||||||
@Override
|
@Override
|
||||||
public Location getBedSpawnLocation()
|
public Location getBedSpawnLocation()
|
||||||
{
|
{
|
||||||
if (isOnlineUser())
|
return base.getBedSpawnLocation();
|
||||||
{
|
|
||||||
return base.getBedSpawnLocation();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return offlinePlayer.getBedSpawnLocation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -696,7 +696,8 @@ public class EssentialsUpgrade
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ess.getSettings().setMetricsEnabled(false);
|
//todo - metrics
|
||||||
|
// ess.getSettings().setMetricsEnabled(false);
|
||||||
doneFile.setProperty("warnMetrics", true);
|
doneFile.setProperty("warnMetrics", true);
|
||||||
doneFile.save();
|
doneFile.save();
|
||||||
}
|
}
|
||||||
|
@@ -112,6 +112,7 @@ public abstract class EssentialsChatPlayer implements Listener
|
|||||||
|
|
||||||
protected void handleLocalChat(final PlayerChatEvent event, final ChatStore chatStore)
|
protected void handleLocalChat(final PlayerChatEvent event, final ChatStore chatStore)
|
||||||
{
|
{
|
||||||
|
|
||||||
long radius = 0;
|
long radius = 0;
|
||||||
ISettings settings = ess.getSettings();
|
ISettings settings = ess.getSettings();
|
||||||
settings.acquireReadLock();
|
settings.acquireReadLock();
|
||||||
@@ -143,26 +144,6 @@ public abstract class EssentialsChatPlayer implements Listener
|
|||||||
event.setFormat(_(format.toString(), event.getFormat()));
|
event.setFormat(_(format.toString(), event.getFormat()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!onlineUser.equals(sender))
|
|
||||||
{
|
|
||||||
if (onlineUser.isAuthorized("essentials.chat.spy"))
|
|
||||||
{
|
|
||||||
type = type.concat(_("chatTypeSpy"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
final Location playerLoc = onlineUser.getLocation();
|
|
||||||
if (playerLoc.getWorld() != world)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final double delta = playerLoc.distanceSquared(loc);
|
|
||||||
if (delta > chatStore.getRadius())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final StringBuilder errorMsg = new StringBuilder();
|
final StringBuilder errorMsg = new StringBuilder();
|
||||||
errorMsg.append("notAllowedTo").append(chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatStore.getType().substring(1));
|
errorMsg.append("notAllowedTo").append(chatStore.getType().substring(0, 1).toUpperCase(Locale.ENGLISH)).append(chatStore.getType().substring(1));
|
||||||
|
@@ -44,28 +44,29 @@ public class EssentialsLocalChatEventListener implements Listener
|
|||||||
}
|
}
|
||||||
if (!user.equals(sender))
|
if (!user.equals(sender))
|
||||||
{
|
{
|
||||||
final Location playerLoc = user.getLocation();
|
if (Permissions.CHAT_SPY.isAuthorized(user))
|
||||||
if (playerLoc.getWorld() != world)
|
|
||||||
{
|
{
|
||||||
continue;
|
type = type.concat(_("chatTypeSpy"));
|
||||||
}
|
}
|
||||||
final double delta = playerLoc.distanceSquared(loc);
|
else
|
||||||
|
|
||||||
if (delta > event.getRadius())
|
|
||||||
{
|
{
|
||||||
if (Permissions.CHAT_SPY.isAuthorized(user))
|
final Location playerLoc = user.getLocation();
|
||||||
|
if (playerLoc.getWorld() != world)
|
||||||
{
|
{
|
||||||
type = type.concat(_("chatTypeSpy"));
|
continue;
|
||||||
}
|
}
|
||||||
else
|
final double delta = playerLoc.distanceSquared(loc);
|
||||||
|
|
||||||
|
if (delta > event.getRadius())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final String message = type.concat(String.format(event.getFormat(), sender.getDisplayName(), event.getMessage()));
|
final String message = type.concat(String.format(event.getFormat(), sender.getDisplayName(), event.getMessage()));
|
||||||
user.sendMessage(message);
|
user.sendMessage(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -24,4 +24,16 @@ public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP>
|
|||||||
return new File(geoip.getDataFolder(), "config.yml");
|
return new File(geoip.getDataFolder(), "config.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRead()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishWrite()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials.protect;
|
package com.earth2me.essentials.protect;
|
||||||
|
|
||||||
import com.earth2me.essentials.api.IEssentials;
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.craftbukkit.FakeExplosion;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
@@ -3,7 +3,7 @@ package com.earth2me.essentials.signs;
|
|||||||
import static com.earth2me.essentials.I18n._;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.api.IEssentials;
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
import com.earth2me.essentials.api.IUser;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.utils.Util;
|
||||||
|
|
||||||
|
|
||||||
public class SignBalance extends EssentialsSign
|
public class SignBalance extends EssentialsSign
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
package com.earth2me.essentials.signs;
|
package com.earth2me.essentials.signs;
|
||||||
|
|
||||||
import com.earth2me.essentials.api.IEssentials;
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
|
import com.earth2me.essentials.api.ISettings;
|
||||||
import com.earth2me.essentials.api.IUser;
|
import com.earth2me.essentials.api.IUser;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.utils.Util;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -32,7 +33,9 @@ public class SignBlockListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockBreak(final BlockBreakEvent event)
|
public void onBlockBreak(final BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled())
|
ISettings settings = ess.getSettings();
|
||||||
|
settings.acquireReadLock();
|
||||||
|
if (plugin.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -65,15 +68,7 @@ public class SignBlockListener implements Listener
|
|||||||
LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign.");
|
LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : plugin.getSettings().getEnabledSigns())
|
||||||
{
|
|
||||||
if (sign.getBlocks().contains(block.getType())
|
|
||||||
&& !sign.onBlockBreak(block, player, ess))
|
|
||||||
{
|
|
||||||
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (EssentialsSign sign : plugin.getSettings().getEnabledSigns())
|
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockBreak(block, player, ess))
|
&& !sign.onBlockBreak(block, player, ess))
|
||||||
@@ -81,19 +76,18 @@ public class SignBlockListener implements Listener
|
|||||||
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onSignChange(final SignChangeEvent event)
|
public void onSignChange(final SignChangeEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled())
|
if (plugin.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
User user = ess.getUser(event.getPlayer());
|
IUser user = ess.getUser(event.getPlayer());
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@@ -120,7 +114,7 @@ public class SignBlockListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockPlace(final BlockPlaceEvent event)
|
public void onBlockPlace(final BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled())
|
if (plugin.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -154,7 +148,7 @@ public class SignBlockListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockBurn(final BlockBurnEvent event)
|
public void onBlockBurn(final BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled())
|
if (plugin.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -182,7 +176,7 @@ public class SignBlockListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onBlockIgnite(final BlockIgniteEvent event)
|
public void onBlockIgnite(final BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled())
|
if (plugin.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,7 @@ public class SignEntityListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
|
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled())
|
if (plugin.getSettings().areSignsDisabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.signs;
|
package com.earth2me.essentials.signs;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Kits;
|
||||||
import com.earth2me.essentials.api.ChargeException;
|
import com.earth2me.essentials.api.ChargeException;
|
||||||
import com.earth2me.essentials.economy.Trade;
|
import com.earth2me.essentials.economy.Trade;
|
||||||
import com.earth2me.essentials.api.IEssentials;
|
import com.earth2me.essentials.api.IEssentials;
|
||||||
@@ -58,11 +59,10 @@ public class SignKit extends EssentialsSign
|
|||||||
final Trade charge = getTrade(sign, 3, ess);
|
final Trade charge = getTrade(sign, 3, ess);
|
||||||
charge.isAffordableFor(player);
|
charge.isAffordableFor(player);
|
||||||
try
|
try
|
||||||
{
|
{;
|
||||||
final Kit kit = ess.getKits().getKit(kitName);
|
final Kit kit = ess.getKits().getKit(kitName);
|
||||||
Kit.checkTime(player, kitName, kit);
|
ess.getKits().checkTime(player, kit);
|
||||||
final List<String> items = Kit.getItems(player, kit);
|
ess.getKits().sendKit(player,kit);
|
||||||
Kit.expandItems(ess, player, items);
|
|
||||||
charge.charge(player);
|
charge.charge(player);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@@ -25,7 +25,7 @@ public class SignPlayerListener implements Listener
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(final PlayerInteractEvent event)
|
public void onPlayerInteract(final PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if (ess.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
if (plugin.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig>
|
|||||||
{
|
{
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>();
|
private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>();
|
||||||
|
private boolean signsEnabled = false;
|
||||||
|
|
||||||
public SignsConfigHolder(final IEssentials ess, final Plugin plugin)
|
public SignsConfigHolder(final IEssentials ess, final Plugin plugin)
|
||||||
{
|
{
|
||||||
@@ -24,6 +25,11 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig>
|
|||||||
Map<String, Boolean> signs = getData().getSigns();
|
Map<String, Boolean> signs = getData().getSigns();
|
||||||
for (Map.Entry<String, Boolean> entry : signs.entrySet())
|
for (Map.Entry<String, Boolean> entry : signs.entrySet())
|
||||||
{
|
{
|
||||||
|
if(entry.getKey().trim().toUpperCase(Locale.ENGLISH).equals("COLOR") || entry.getKey().trim().toUpperCase(Locale.ENGLISH).equals("COLOUR"))
|
||||||
|
{
|
||||||
|
signsEnabled = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Signs sign = Signs.valueOf(entry.getKey().toUpperCase(Locale.ENGLISH));
|
Signs sign = Signs.valueOf(entry.getKey().toUpperCase(Locale.ENGLISH));
|
||||||
if (sign != null && entry.getValue())
|
if (sign != null && entry.getValue())
|
||||||
{
|
{
|
||||||
@@ -61,4 +67,21 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig>
|
|||||||
{
|
{
|
||||||
return enabledSigns;
|
return enabledSigns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean areSignsDisabled()
|
||||||
|
{
|
||||||
|
return !signsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRead()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishWrite()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,11 +12,5 @@ public class InstallationFinishedEvent extends Event
|
|||||||
public HandlerList getHandlers()
|
public HandlerList getHandlers()
|
||||||
{
|
{
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers()
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user