appearance updates

This commit is contained in:
Brianna O'Keefe 2018-12-22 11:04:16 -05:00
parent 6795293766
commit fc03496d5d
18 changed files with 81 additions and 76 deletions

View File

@ -82,7 +82,6 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
private static final Set<Biome> BIOMES = EnumSet.allOf(Biome.class);
private static EpicSpawnersPlugin INSTANCE;
private References references;
private ChatListeners chatListeners;
@ -166,7 +165,6 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
this.hooksFile.createNewFile("Loading Hooks File", "EpicSpawners Hooks File");
this.references = new References();
this.boostManager = new BoostManager();
this.spawnManager = new SpawnManager();
this.spawnerManager = new ESpawnerManager();
@ -680,7 +678,6 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
this.locale.reloadMessages();
this.spawnerFile.createNewFile("Loading Spawners File", "EpicSpawners Spawners File");
this.hooksFile.createNewFile("Loading hookHandler File", "EpicSpawners Hooks File");
this.references = new References();
this.blacklistHandler.reload();
this.loadSpawnersFromFile();
this.setupConfig();
@ -734,10 +731,6 @@ public class EpicSpawnersPlugin extends JavaPlugin implements EpicSpawners {
return heads;
}
public References getReferences() {
return references;
}
public ChatListeners getChatListeners() {
return chatListeners;
}

View File

@ -2,13 +2,7 @@ package com.songoda.epicspawners;
public class References {
private String prefix;
public References() {
prefix = EpicSpawnersPlugin.getInstance().getLocale().getMessage("general.nametag.prefix") + " ";
}
public String getPrefix() {
return this.prefix;
public static String getPrefix() {
return EpicSpawnersPlugin.getInstance().getLocale().getMessage("general.nametag.prefix") + " ";
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.command;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.command.commands.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -58,7 +59,7 @@ public class CommandManager implements CommandExecutor {
}
}
}
commandSender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7The command you entered does not exist or is spelt incorrectly."));
commandSender.sendMessage(References.getPrefix() + TextComponent.formatText("&7The command you entered does not exist or is spelt incorrectly."));
return true;
}
@ -70,12 +71,12 @@ public class CommandManager implements CommandExecutor {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
AbstractCommand.ReturnType returnType = command.runCommand(instance, sender, strings);
if (returnType == AbstractCommand.ReturnType.SYNTAX_ERROR) {
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&cInvalid Syntax!"));
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
sender.sendMessage(References.getPrefix() + TextComponent.formatText("&cInvalid Syntax!"));
sender.sendMessage(References.getPrefix() + TextComponent.formatText("&7The valid syntax is: &6" + command.getSyntax() + "&7."));
}
return;
}
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
sender.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
}
public List<AbstractCommand> getCommands() {

View File

@ -3,6 +3,7 @@ package com.songoda.epicspawners.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.math.AMath;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.boost.BoostData;
import com.songoda.epicspawners.boost.BoostType;
import com.songoda.epicspawners.command.AbstractCommand;
@ -21,19 +22,19 @@ public class CommandBoost extends AbstractCommand {
@Override
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
if (args.length < 3) {
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText("&7Syntax error..."));
sender.sendMessage(References.getPrefix() + TextComponent.formatText("&7Syntax error..."));
return ReturnType.SYNTAX_ERROR;
}
if (!args[1].contains("p:") && !args[1].contains("player:") &&
!args[1].contains("f:") && !args[1].contains("faction:") &&
!args[1].contains("t:") && !args[1].contains("town:") &&
!args[1].contains("i:") && !args[1].contains("island:")) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[1] + " &7this is incorrect"));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&6" + args[1] + " &7this is incorrect"));
return ReturnType.SYNTAX_ERROR;
}
String[] arr = (args[1]).split(":");
if (!AMath.isInt(args[2])) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[2] + " &7is not a number..."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&6" + args[2] + " &7is not a number..."));
return ReturnType.SYNTAX_ERROR;
}
@ -61,7 +62,7 @@ public class CommandBoost extends AbstractCommand {
c.add(Calendar.YEAR, Integer.parseInt(arr2[1]));
response += " &7for &6" + arr2[1] + " years&7.";
} else {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7" + args[3] + " &7is invalid."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&7" + args[3] + " &7is invalid."));
return ReturnType.SYNTAX_ERROR;
}
} else {
@ -77,7 +78,7 @@ public class CommandBoost extends AbstractCommand {
if (arr[0].equalsIgnoreCase("p") || arr[0].equalsIgnoreCase("player")) {
if (Bukkit.getOfflinePlayer(arr[1]) == null) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat player does not exist..."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&cThat player does not exist..."));
} else {
start += "The player";
boostType = BoostType.PLAYER;
@ -85,7 +86,7 @@ public class CommandBoost extends AbstractCommand {
}
} else if (arr[0].equalsIgnoreCase("f") || arr[0].equalsIgnoreCase("faction")) {
if (instance.getFactionId(arr[1]) == null) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat faction does not exist..."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&cThat faction does not exist..."));
return ReturnType.FAILURE;
}
@ -94,7 +95,7 @@ public class CommandBoost extends AbstractCommand {
boostObject = instance.getFactionId(arr[1]);
} else if (arr[0].equalsIgnoreCase("t") || arr[0].equalsIgnoreCase("town")) {
if (instance.getTownId(arr[1]) == null) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat town does not exist..."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&cThat town does not exist..."));
return ReturnType.FAILURE;
}
@ -103,7 +104,7 @@ public class CommandBoost extends AbstractCommand {
boostObject = instance.getTownId(arr[1]);
} else if (arr[0].equalsIgnoreCase("i") || arr[0].equalsIgnoreCase("island")) {
if (instance.getIslandId(arr[1]) == null) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat island does not exist..."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&cThat island does not exist..."));
return ReturnType.FAILURE;
}
@ -118,7 +119,7 @@ public class CommandBoost extends AbstractCommand {
BoostData boostData = new BoostData(boostType, Integer.parseInt(args[2]), c.getTime().getTime(), boostObject);
instance.getBoostManager().addBoostToSpawner(boostData);
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + start + response));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + start + response));
return ReturnType.SUCCESS;
}

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.Spawner;
import com.songoda.epicspawners.api.spawner.SpawnerData;
import com.songoda.epicspawners.api.spawner.SpawnerStack;
@ -23,14 +24,14 @@ public class CommandChange extends AbstractCommand {
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
if (args.length != 2) return ReturnType.SYNTAX_ERROR;
if (!sender.hasPermission("epicspawners.admin") && !sender.hasPermission("epicspawners.change.*") && !sender.hasPermission("epicspawners.change." + args[1].toUpperCase())) {
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
sender.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.general.nopermission"));
return ReturnType.FAILURE;
}
Player player = (Player) sender;
Block block = player.getTargetBlock(null, 200);
if (block.getType() != Material.SPAWNER) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThis is not a spawner."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&cThis is not a spawner."));
return ReturnType.FAILURE;
}
@ -61,10 +62,10 @@ public class CommandChange extends AbstractCommand {
}
spawner.getCreatureSpawner().update();
instance.getHologramHandler().processChange(block);
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Successfully changed this spawner to &6" + args[1] + "&7."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&7Successfully changed this spawner to &6" + args[1] + "&7."));
return ReturnType.SUCCESS;
} catch (Exception ee) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7That entity does not exist."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&7That entity does not exist."));
return ReturnType.FAILURE;
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.command.AbstractCommand;
import org.bukkit.command.CommandSender;
@ -14,7 +15,7 @@ public class CommandEpicSpawners extends AbstractCommand {
@Override
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
sender.sendMessage("");
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
for (AbstractCommand command : instance.getCommandManager().getCommands()) {
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {

View File

@ -4,6 +4,7 @@ import com.google.common.collect.Iterables;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.math.AMath;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.SpawnerData;
import com.songoda.epicspawners.command.AbstractCommand;
import com.songoda.epicspawners.utils.Methods;
@ -27,7 +28,7 @@ public class CommandGive extends AbstractCommand {
return ReturnType.SYNTAX_ERROR;
}
if (Bukkit.getPlayerExact(args[1]) == null && !args[1].toLowerCase().equals("all")) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&cThat username does not exist, or the user is not online!"));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&cThat username does not exist, or the user is not online!"));
return ReturnType.FAILURE;
}
int multi = 1;
@ -41,7 +42,7 @@ public class CommandGive extends AbstractCommand {
}
if (data == null && !args[2].equalsIgnoreCase("random")) {
sender.sendMessage(instance.getReferences().getPrefix() + TextComponent.formatText(instance.getReferences().getPrefix() + "&7The entity Type &6" + args[2] + " &7does not exist. Try one of these:"));
sender.sendMessage(References.getPrefix() + TextComponent.formatText(References.getPrefix() + "&7The entity Type &6" + args[2] + " &7does not exist. Try one of these:"));
StringBuilder list = new StringBuilder();
for (SpawnerData spawnerData : instance.getSpawnerManager().getAllSpawnerData()) {
@ -56,7 +57,7 @@ public class CommandGive extends AbstractCommand {
}
if (args.length == 4) {
if (!AMath.isInt(args[3])) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[3] + "&7 is not a number."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&6" + args[3] + "&7 is not a number."));
return ReturnType.SYNTAX_ERROR;
}
int amt = Integer.parseInt(args[3]);
@ -64,21 +65,21 @@ public class CommandGive extends AbstractCommand {
if (args[1].toLowerCase().equals("all")) {
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.getInventory().addItem(spawnerItem);
pl.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
pl.sendMessage(TextComponent.formatText(References.getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
}
} else {
Player pl = Bukkit.getPlayerExact(args[1]);
pl.getInventory().addItem(spawnerItem);
pl.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
pl.sendMessage(TextComponent.formatText(References.getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
}
} else {
if (!AMath.isInt(args[3])) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[3] + "&7 is not a number."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&6" + args[3] + "&7 is not a number."));
return ReturnType.FAILURE;
}
if (!AMath.isInt(args[4])) {
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&6" + args[4] + "&7 is not a number."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&6" + args[4] + "&7 is not a number."));
return ReturnType.FAILURE;
}
int amt = Integer.parseInt(args[3]);
@ -87,12 +88,12 @@ public class CommandGive extends AbstractCommand {
if (args[1].toLowerCase().equals("all")) {
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.getInventory().addItem(spawnerItem);
pl.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
pl.sendMessage(TextComponent.formatText(References.getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
}
} else {
Player pl = Bukkit.getPlayerExact(args[1]);
pl.getInventory().addItem(spawnerItem);
pl.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
pl.sendMessage(TextComponent.formatText(References.getPrefix() + instance.getLocale().getMessage("command.give.success", amt, Methods.compileName(data, multi, false))));
}
}

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.command.AbstractCommand;
import org.bukkit.command.CommandSender;
@ -14,7 +15,7 @@ public class CommandReload extends AbstractCommand {
@Override
protected ReturnType runCommand(EpicSpawnersPlugin instance, CommandSender sender, String... args) {
instance.reload();
sender.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Configuration and Language files reloaded."));
sender.sendMessage(TextComponent.formatText(References.getPrefix() + "&7Configuration and Language files reloaded."));
return ReturnType.SUCCESS;
}

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.command.commands;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.SpawnerData;
import com.songoda.epicspawners.command.AbstractCommand;
import com.songoda.epicspawners.gui.GUISpawnerStats;
@ -29,7 +30,7 @@ public class CommandSpawnerStats extends AbstractCommand {
Player player = (Player) sender;
if (instance.getPlayerActionManager().getPlayerAction(player).getEntityKills().size() == 0) {
player.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("interface.spawnerstats.nokills"));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("interface.spawnerstats.nokills"));
return AbstractCommand.ReturnType.SUCCESS;
}

View File

@ -3,6 +3,7 @@ package com.songoda.epicspawners.gui;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.Spawner;
import com.songoda.epicspawners.boost.BoostData;
import com.songoda.epicspawners.boost.BoostType;
@ -181,7 +182,7 @@ public class GUISpawnerBoost extends AbstractGUI {
stack.setAmount(cost);
Arconix.pl().getApi().getGUI().removeFromInventory(player.getInventory(), stack);
} else {
player.sendMessage(plugin.getReferences().getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
return;
}
} else if (type.equals("ECO")) {
@ -191,7 +192,7 @@ public class GUISpawnerBoost extends AbstractGUI {
if (econ.has(player, cost)) {
econ.withdrawPlayer(player, cost);
} else {
player.sendMessage(plugin.getReferences().getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
return;
}
} else {
@ -204,7 +205,7 @@ public class GUISpawnerBoost extends AbstractGUI {
player.setLevel(player.getLevel() - cost);
}
} else {
player.sendMessage(plugin.getReferences().getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
return;
}
}
@ -216,7 +217,7 @@ public class GUISpawnerBoost extends AbstractGUI {
BoostData boostData = new BoostData(BoostType.LOCATION, amt, c.getTime().getTime(), location);
instance.getBoostManager().addBoostToSpawner(boostData);
player.sendMessage(plugin.getReferences().getPrefix() + plugin.getLocale().getMessage("event.boost.applied"));
player.sendMessage(References.getPrefix() + plugin.getLocale().getMessage("event.boost.applied"));
player.playSound(location, Sound.ENTITY_VILLAGER_YES, 1,1);
} catch (Exception e) {
Debugger.runReport(e);

View File

@ -1,6 +1,7 @@
package com.songoda.epicspawners.listeners;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.events.SpawnerBreakEvent;
import com.songoda.epicspawners.api.events.SpawnerPlaceEvent;
import com.songoda.epicspawners.api.spawner.Spawner;
@ -14,6 +15,7 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
@ -90,9 +92,9 @@ public class BlockListeners implements Listener {
}
if (instance.getConfig().getBoolean("Main.Deny Place On Force Combine"))
player.sendMessage(instance.getLocale().getMessage("event.block.forcedeny"));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.block.forcedeny"));
else if (spawner.stack(player, placedSpawner.getFirstStack().getSpawnerData(), placedSpawner.getSpawnerDataCount()))
player.sendMessage(instance.getLocale().getMessage("event.block.mergedistance"));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.block.mergedistance"));
return true;
}
return false;
@ -137,6 +139,8 @@ public class BlockListeners implements Listener {
return;
}
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_STEP, 1L, 1L);
if (doForceCombine(player, spawner)) {
event.setCancelled(true);
return;
@ -167,7 +171,7 @@ public class BlockListeners implements Listener {
instance.getSpawnerManager().addSpawnerToWorld(location, spawner);
if (instance.getConfig().getBoolean("Main.Alerts On Place And Break"))
player.sendMessage(instance.getLocale().getMessage("event.block.place", Methods.compileName(spawnerData, spawner.getFirstStack().getStackSize(), false)));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.block.place", Methods.compileName(spawnerData, spawner.getFirstStack().getStackSize(), false)));
try {
spawner.getCreatureSpawner().setSpawnedType(EntityType.valueOf(spawnerData.getIdentifyingName().toUpperCase().replace(" ", "_")));
@ -240,7 +244,7 @@ public class BlockListeners implements Listener {
if (spawner.getFirstStack().getSpawnerData().getPickupCost() != 0 && (!naturalOnly || spawner.getPlacedBy() == null)) {
if (!((ESpawnerManager) instance.getSpawnerManager()).hasCooldown(spawner)) {
player.sendMessage(instance.getLocale().getMessage("event.block.chargebreak", spawner.getFirstStack().getSpawnerData().getPickupCost()));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.block.chargebreak", spawner.getFirstStack().getSpawnerData().getPickupCost()));
((ESpawnerManager) instance.getSpawnerManager()).addCooldown(spawner);
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(instance, () -> ((ESpawnerManager) instance.getSpawnerManager()).removeCooldown(spawner), 300L);
event.setCancelled(true);
@ -255,7 +259,7 @@ public class BlockListeners implements Listener {
if (econ.has(player, cost)) {
econ.withdrawPlayer(player, cost);
} else {
player.sendMessage(instance.getLocale().getMessage("event.block.cannotbreak"));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.block.cannotbreak"));
event.setCancelled(true);
return;
}
@ -266,9 +270,9 @@ public class BlockListeners implements Listener {
if (spawner.unstack(event.getPlayer())) {
if (instance.getConfig().getBoolean("Main.Alerts On Place And Break")) {
if (spawner.getSpawnerStacks().size() != 0) {
player.sendMessage(instance.getLocale().getMessage("event.downgrade.success", Integer.toString(spawner.getSpawnerDataCount())));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.downgrade.success", Integer.toString(spawner.getSpawnerDataCount())));
} else {
player.sendMessage(instance.getLocale().getMessage("event.block.break", Methods.compileName(firstData, currentStackSize, true)));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.block.break", Methods.compileName(firstData, currentStackSize, true)));
}
}
}

View File

@ -3,6 +3,7 @@ package com.songoda.epicspawners.listeners;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.api.methods.math.AMath;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.SpawnerData;
import com.songoda.epicspawners.spawners.editor.EditingMenu;
import com.songoda.epicspawners.utils.Debugger;
@ -80,7 +81,7 @@ public class ChatListeners implements Listener {
break;
case COMMAND:
String msg = e.getMessage();
player.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&8Command &5" + msg + "&8 saved to your inventory."));
player.sendMessage(TextComponent.formatText(References.getPrefix() + "&8Command &5" + msg + "&8 saved to your inventory."));
instance.getSpawnerEditor().addCommand(player, e.getMessage());
break;
case CUSTOM_GOAL:

View File

@ -172,7 +172,7 @@ public class InteractListeners implements Listener {
}
}
} else if (event.getClickedBlock().getType() == Material.SPAWNER && !EpicSpawnersPlugin.getInstance().getBlacklistHandler().isBlacklisted(player, false)) {
if (!player.isSneaking()) {
if (!player.isSneaking() || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Spawner spawner = EpicSpawnersPlugin.getInstance().getSpawnerManager().getSpawnerFromWorld(location);
((ESpawner) spawner).overview(player);

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.listeners;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.particles.ParticleDensity;
import com.songoda.epicspawners.api.particles.ParticleEffect;
import com.songoda.epicspawners.api.particles.ParticleType;
@ -94,7 +95,7 @@ public class InventoryListeners implements Listener {
if (!event.getClick().isLeftClick() && !event.getClick().isRightClick()) {
SpawnerData spawnerData = editingData.getSpawnerEditing();
spawnerData.setDisplayItem(Material.valueOf(player.getInventory().getItemInHand().getType().toString()));
player.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Display Item for &6" + spawnerData.getIdentifyingName() + " &7set to &6" + player.getInventory().getItemInHand().getType().toString() + "&7."));
player.sendMessage(TextComponent.formatText(References.getPrefix() + "&7Display Item for &6" + spawnerData.getIdentifyingName() + " &7set to &6" + player.getInventory().getItemInHand().getType().toString() + "&7."));
instance.getSpawnerEditor().overview(player, editingData.getSpawnerEditing());
} else if (event.getClick().isLeftClick()) {
instance.getSpawnerEditor().editSpawnerName(player);

View File

@ -2,6 +2,7 @@ package com.songoda.epicspawners.listeners;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.utils.Debugger;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -26,7 +27,7 @@ public class PlayerJoinListeners implements Listener {
if (player.isOp() && instance.getConfig().getBoolean("Main.Display Helpful Tips For Operators")) {
if (instance.getServer().getPluginManager().getPlugin("Factions") != null && instance.getServer().getPluginManager().getPlugin("FactionsFramework") == null) {
player.sendMessage("");
player.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Here's the deal,"));
player.sendMessage(TextComponent.formatText(References.getPrefix() + "&7Here's the deal,"));
player.sendMessage(TextComponent.formatText("&7I cannot give you full support for Factions out of the box."));
player.sendMessage(TextComponent.formatText("&7Things will work without it but if you wan't a flawless"));
player.sendMessage(TextComponent.formatText("&7experience you need to download"));

View File

@ -3,6 +3,7 @@ package com.songoda.epicspawners.spawners.editor;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.SpawnerData;
import com.songoda.epicspawners.listeners.ChatListeners;
import com.songoda.epicspawners.player.PlayerData;
@ -634,7 +635,7 @@ public class SpawnerEditor {
}
spawnerData.setCommands(list);
}
p.sendMessage(TextComponent.formatText(instance.getReferences().getPrefix() + "&7Spawner Saved."));
p.sendMessage(TextComponent.formatText(References.getPrefix() + "&7Spawner Saved."));
spawnerData.reloadSpawnMethods();
} catch (Exception e) {
Debugger.runReport(e);

View File

@ -3,6 +3,7 @@ package com.songoda.epicspawners.spawners.shop;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.spawner.SpawnerData;
import com.songoda.epicspawners.player.MenuType;
import com.songoda.epicspawners.player.PlayerData;
@ -314,7 +315,7 @@ public class Shop {
net.milkbowl.vault.economy.Economy econ = rsp.getProvider();
double price = spawnerData.getShopPrice() * amount;
if (!player.isOp() && !econ.has(player, price)) {
player.sendMessage(EpicSpawnersPlugin.getInstance().getReferences().getPrefix() + instance.getLocale().getMessage("event.shop.cannotafford"));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.shop.cannotafford"));
return;
}
ItemStack item = spawnerData.toItemStack(amount);
@ -322,7 +323,7 @@ public class Shop {
player.getInventory().addItem(item);
player.sendMessage(EpicSpawnersPlugin.getInstance().getReferences().getPrefix() + instance.getLocale().getMessage("event.shop.purchasesuccess"));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.shop.purchasesuccess"));
if (!player.isOp()) {

View File

@ -3,7 +3,9 @@ package com.songoda.epicspawners.spawners.spawner;
import com.songoda.arconix.api.methods.formatting.TextComponent;
import com.songoda.arconix.plugin.Arconix;
import com.songoda.epicspawners.EpicSpawnersPlugin;
import com.songoda.epicspawners.References;
import com.songoda.epicspawners.api.CostType;
import com.songoda.epicspawners.api.EpicSpawners;
import com.songoda.epicspawners.api.EpicSpawnersAPI;
import com.songoda.epicspawners.api.events.SpawnerChangeEvent;
import com.songoda.epicspawners.api.particles.ParticleType;
@ -177,7 +179,7 @@ public class ESpawner implements Spawner {
double price = type.getConvertPrice() * getSpawnerDataCount();
if (!(econ.has(p, price) || p.isOp())) {
p.sendMessage(EpicSpawnersPlugin.getInstance().getReferences().getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
p.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
return;
}
SpawnerChangeEvent event = new SpawnerChangeEvent(p, this, getFirstStack().getSpawnerData(), type);
@ -194,7 +196,7 @@ public class ESpawner implements Spawner {
}
this.creatureSpawner.update();
p.sendMessage(EpicSpawnersPlugin.getInstance().getReferences().getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.convert.success"));
p.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.convert.success"));
instance.getHologramHandler().updateHologram(this);
p.closeInventory();
@ -248,7 +250,10 @@ public class ESpawner implements Spawner {
}
if (instance.getConfig().getBoolean("Main.Sounds Enabled")) {
player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.6F, 15.0F);
if (stackSize == stack.getStackSize() && spawnerStacks.size() == 1)
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_STEP, 1L, 1L);
else
player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.6F, 15.0F);
}
ItemStack item = stack.getSpawnerData().toItemStack(1, stackSize);
@ -313,7 +318,7 @@ public class ESpawner implements Spawner {
int currentStackSize = getSpawnerDataCount();
if (getSpawnerDataCount() == max) {
player.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("event.upgrade.maxed", max));
player.sendMessage(References.getPrefix() + instance.getLocale().getMessage("event.upgrade.maxed", max));
return false;
}
@ -356,9 +361,9 @@ public class ESpawner implements Spawner {
int currentStackSize = getSpawnerDataCount();
if (getSpawnerDataCount() != SettingsManager.Setting.SPAWNERS_MAX.getInt())
player.sendMessage(EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.success", currentStackSize));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.success", currentStackSize));
else
player.sendMessage(EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.successmaxed", currentStackSize));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.successmaxed", currentStackSize));
SpawnerChangeEvent event = new SpawnerChangeEvent(player, this, currentStackSize, oldStackSize);
Bukkit.getPluginManager().callEvent(event);
@ -370,7 +375,6 @@ public class ESpawner implements Spawner {
loc.setZ(loc.getZ() + .5);
player.getWorld().spawnParticle(org.bukkit.Particle.valueOf(EpicSpawnersPlugin.getInstance().getConfig().getString("Main.Upgrade Particle Type")), loc, 100, .5, .5, .5);
if (!SettingsManager.Setting.SOUNDS_ENABLED.getBoolean()) {
return;
}
@ -392,13 +396,10 @@ public class ESpawner implements Spawner {
try {
int cost = getUpgradeCost(type);
boolean maxed = false;
boolean maxed = getSpawnerDataCount() == SettingsManager.Setting.SPAWNERS_MAX.getInt();
if (getSpawnerDataCount() == EpicSpawnersPlugin.getInstance().getConfig().getInt("Main.Spawner Max Upgrade")) {
maxed = true;
}
if (maxed) {
player.sendMessage(EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.maxed"));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.maxed"));
} else {
if (type == CostType.ECONOMY) {
if (EpicSpawnersPlugin.getInstance().getServer().getPluginManager().getPlugin("Vault") != null) {
@ -410,7 +411,7 @@ public class ESpawner implements Spawner {
spawnerStacks.getFirst().setStackSize(spawnerStacks.getFirst().getStackSize() + 1);
upgradeFinal(player, oldMultiplier);
} else {
player.sendMessage(EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
}
} else {
player.sendMessage("Vault is not installed.");
@ -424,7 +425,7 @@ public class ESpawner implements Spawner {
spawnerStacks.getFirst().setStackSize(spawnerStacks.getFirst().getStackSize() + 1);
upgradeFinal(player, oldMultiplier);
} else {
player.sendMessage(EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
player.sendMessage(References.getPrefix() + EpicSpawnersPlugin.getInstance().getLocale().getMessage("event.upgrade.cannotafford"));
}
}
}