use of net.ess3.api.IEssentials in project Essentials by drtshock.
the class EssentialsSign method getItemMeta.
protected final ItemStack getItemMeta(final ItemStack item, final String meta, final IEssentials ess) throws SignException {
ItemStack stack = item;
try {
if (!meta.isEmpty()) {
MetaItemStack metaStack = new MetaItemStack(stack);
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
metaStack.addStringMeta(null, allowUnsafe, meta, ess);
stack = metaStack.getItemStack();
}
} catch (Exception ex) {
throw new SignException(ex.getMessage(), ex);
}
return stack;
}
use of net.ess3.api.IEssentials in project Essentials by drtshock.
the class EssentialsSign method onSignBreak.
protected final boolean onSignBreak(final Block block, final Player player, final IEssentials ess) throws MaxMoneyException {
final ISign sign = new BlockSign(block);
final User user = ess.getUser(player);
try {
if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".break") || user.isAuthorized("essentials.signs.break." + signName.toLowerCase(Locale.ENGLISH)))) {
return false;
}
final SignBreakEvent signEvent = new SignBreakEvent(sign, this, user);
ess.getServer().getPluginManager().callEvent(signEvent);
if (signEvent.isCancelled()) {
return false;
}
return onSignBreak(sign, user, getUsername(user), ess);
} catch (SignException ex) {
showError(ess, user.getSource(), ex, signName);
return false;
}
}
use of net.ess3.api.IEssentials in project Essentials by drtshock.
the class EssentialsChat method onEnable.
@Override
public void onEnable() {
final PluginManager pluginManager = getServer().getPluginManager();
final IEssentials ess = (IEssentials) pluginManager.getPlugin("Essentials");
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) {
LOGGER.log(Level.WARNING, tl("versionMismatchAll"));
}
if (!ess.isEnabled()) {
this.setEnabled(false);
return;
}
final Map<AsyncPlayerChatEvent, ChatStore> chatStore = Collections.synchronizedMap(new HashMap<AsyncPlayerChatEvent, ChatStore>());
final EssentialsChatPlayerListenerLowest playerListenerLowest = new EssentialsChatPlayerListenerLowest(getServer(), ess, chatStore);
final EssentialsChatPlayerListenerNormal playerListenerNormal = new EssentialsChatPlayerListenerNormal(getServer(), ess, chatStore);
final EssentialsChatPlayerListenerHighest playerListenerHighest = new EssentialsChatPlayerListenerHighest(getServer(), ess, chatStore);
pluginManager.registerEvents(playerListenerLowest, this);
pluginManager.registerEvents(playerListenerNormal, this);
pluginManager.registerEvents(playerListenerHighest, this);
}
use of net.ess3.api.IEssentials in project Essentials by EssentialsX.
the class EssentialsSign method getItemStack.
protected final ItemStack getItemStack(final String itemName, final int quantity, final IEssentials ess) throws SignException {
try {
final ItemStack item = ess.getItemDb().get(itemName);
item.setAmount(quantity);
return item;
} catch (Exception ex) {
throw new SignException(ex.getMessage(), ex);
}
}
use of net.ess3.api.IEssentials in project Essentials by EssentialsX.
the class EssentialsSign method getItemMeta.
protected final ItemStack getItemMeta(final ItemStack item, final String meta, final IEssentials ess) throws SignException {
ItemStack stack = item;
try {
if (!meta.isEmpty()) {
MetaItemStack metaStack = new MetaItemStack(stack);
final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments();
metaStack.addStringMeta(null, allowUnsafe, meta, ess);
stack = metaStack.getItemStack();
}
} catch (Exception ex) {
throw new SignException(ex.getMessage(), ex);
}
return stack;
}
Aggregations