mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 18:14:38 +02:00
2.9 -> 3.0 merge
This commit is contained in:
@@ -3,7 +3,7 @@ package com.earth2me.essentials.signs;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.IUser;
|
||||
import com.earth2me.essentials.Util;
|
||||
import com.earth2me.essentials.utils.Util;
|
||||
|
||||
|
||||
public class SignBalance extends EssentialsSign
|
||||
|
@@ -1,8 +1,9 @@
|
||||
package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
import com.earth2me.essentials.api.ISettings;
|
||||
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.Logger;
|
||||
import org.bukkit.Material;
|
||||
@@ -32,7 +33,9 @@ public class SignBlockListener implements Listener
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockBreak(final BlockBreakEvent event)
|
||||
{
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
ISettings settings = ess.getSettings();
|
||||
settings.acquireReadLock();
|
||||
if (plugin.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -65,15 +68,7 @@ public class SignBlockListener implements Listener
|
||||
LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign.");
|
||||
return true;
|
||||
}
|
||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||
{
|
||||
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())
|
||||
for (EssentialsSign sign : plugin.getSettings().getEnabledSigns())
|
||||
{
|
||||
if (sign.getBlocks().contains(block.getType())
|
||||
&& !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.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onSignChange(final SignChangeEvent event)
|
||||
{
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
if (plugin.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
User user = ess.getUser(event.getPlayer());
|
||||
IUser user = ess.getUser(event.getPlayer());
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -120,7 +114,7 @@ public class SignBlockListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onBlockPlace(final BlockPlaceEvent event)
|
||||
{
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
if (plugin.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -154,7 +148,7 @@ public class SignBlockListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onBlockBurn(final BlockBurnEvent event)
|
||||
{
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
if (plugin.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -182,7 +176,7 @@ public class SignBlockListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onBlockIgnite(final BlockIgniteEvent event)
|
||||
{
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
if (plugin.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ public class SignEntityListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onEntityChangeBlock(final EntityChangeBlockEvent event)
|
||||
{
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
if (plugin.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.signs;
|
||||
|
||||
import com.earth2me.essentials.Kits;
|
||||
import com.earth2me.essentials.api.ChargeException;
|
||||
import com.earth2me.essentials.economy.Trade;
|
||||
import com.earth2me.essentials.api.IEssentials;
|
||||
@@ -58,11 +59,10 @@ public class SignKit extends EssentialsSign
|
||||
final Trade charge = getTrade(sign, 3, ess);
|
||||
charge.isAffordableFor(player);
|
||||
try
|
||||
{
|
||||
final Kit kit = ess.getKits().getKit(kitName);
|
||||
Kit.checkTime(player, kitName, kit);
|
||||
final List<String> items = Kit.getItems(player, kit);
|
||||
Kit.expandItems(ess, player, items);
|
||||
{;
|
||||
final Kit kit = ess.getKits().getKit(kitName);
|
||||
ess.getKits().checkTime(player, kit);
|
||||
ess.getKits().sendKit(player,kit);
|
||||
charge.charge(player);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@@ -25,7 +25,7 @@ public class SignPlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
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;
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig>
|
||||
{
|
||||
private final Plugin plugin;
|
||||
private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>();
|
||||
private boolean signsEnabled = false;
|
||||
|
||||
public SignsConfigHolder(final IEssentials ess, final Plugin plugin)
|
||||
{
|
||||
@@ -24,6 +25,11 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig>
|
||||
Map<String, Boolean> signs = getData().getSigns();
|
||||
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));
|
||||
if (sign != null && entry.getValue())
|
||||
{
|
||||
@@ -61,4 +67,21 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig>
|
||||
{
|
||||
return enabledSigns;
|
||||
}
|
||||
|
||||
public boolean areSignsDisabled()
|
||||
{
|
||||
return !signsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishRead()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishWrite()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user