updated language system and rebranded

This commit is contained in:
Brianna O'Keefe 2018-10-25 02:11:32 -04:00
parent 99b19c041f
commit 76512e2e76
57 changed files with 1200 additions and 167 deletions

View File

@ -2,7 +2,6 @@ package com.songoda.epicbuckets;
import com.songoda.epicbuckets.commands.GenbucketAdminCommand;
import com.songoda.epicbuckets.commands.GenbucketCommand;
import com.songoda.epicbuckets.filehandler.files.MessageFile;
import com.songoda.epicbuckets.filehandler.files.ShopFile;
import com.songoda.epicbuckets.listeners.GenbucketPlaceListener;
import com.songoda.epicbuckets.listeners.InventoryClickListener;
@ -10,64 +9,71 @@ import com.songoda.epicbuckets.util.ChatUtil;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
public class EpicBuckets extends JavaPlugin {
private static CommandSender console = Bukkit.getConsoleSender();
public static EpicBuckets main;
private static EpicBuckets INSTANCE;
private static Permission permission = null;
private static Economy economy = null;
private static Chat chat = null;
public MessageFile messageFile;
public ShopFile shopFile;
private Locale locale;
public static EpicBuckets getInstance() {
return main;
return INSTANCE;
}
@Override
public void onEnable() {
main = this;
//new AntiPiracy().enable();
console.sendMessage(ChatUtil.colorString("&a============================="));
console.sendMessage(ChatUtil.colorString("&7EpicBuckets " + this.getDescription().getVersion() + " by &5Songoda <3!"));
console.sendMessage(ChatUtil.colorString("&7Action: &aEnabling&7..."));
INSTANCE = this;
if (!isEnabled())
return;
setUpFiles();
setupPermissions();
setupEconomy();
setupChat();
setUpCommands();
registerListeners();
// Locales
Locale.init(this);
Locale.saveDefaultLocale("en_US");
this.locale = Locale.getLocale(getConfig().getString("Locale", "en_US"));
this.setUpFiles();
this.setupPermissions();
this.setupEconomy();
this.setupChat();
this.setUpCommands();
this.registerListeners();
console.sendMessage(ChatUtil.colorString("&a============================="));
}
@Override
public void onDisable() {
main = null;
console.sendMessage(ChatUtil.colorString("&a============================="));
console.sendMessage(ChatUtil.colorString("&7EpicBuckets " + this.getDescription().getVersion() + " by &5Songoda <3!"));
console.sendMessage(ChatUtil.colorString("&7Action: &cDisabling&7..."));
console.sendMessage(ChatUtil.colorString("&a============================="));
}
private void setUpFiles() {
if (!getDataFolder().exists()) {
getDataFolder().mkdirs();
getLogger().warning("Folder not found, generating files!");
saveResource("messages.yml", false);
saveResource("shops.yml", false);
saveDefaultConfig();
}
messageFile = new MessageFile();
shopFile = new ShopFile();
@ -80,7 +86,7 @@ public class EpicBuckets extends JavaPlugin {
public void withdrawBalance(Player player, int amount, boolean sendMessage) {
if (sendMessage)
player.sendMessage(ChatUtil.colorPrefix(messageFile.config.getString("WITHDRAW-MESSAGE")).replace("{amount}", String.valueOf(amount)));
player.sendMessage(locale.getMessage("event.withdrawl.success").replace("{amount}", String.valueOf(amount)));
economy.withdrawPlayer(player, amount);
}
@ -102,8 +108,7 @@ public class EpicBuckets extends JavaPlugin {
public void reloadFiles() {
messageFile.load();
this.locale.reloadMessages();
shopFile.load();
reloadConfig();
@ -136,5 +141,8 @@ public class EpicBuckets extends JavaPlugin {
return (economy != null);
}
public Locale getLocale() {
return locale;
}
}

View File

@ -0,0 +1,364 @@
package com.songoda.epicbuckets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Assists in the creation of multiple localizations and languages,
* as well as the generation of default .lang files
*
* @author Parker Hawke - 2008Choco
*/
public class Locale {
private static JavaPlugin plugin;
private static final List<Locale> LOCALES = Lists.newArrayList();
private static final Pattern NODE_PATTERN = Pattern.compile("(\\w+(?:\\.{1}\\w+)*)\\s*=\\s*\"(.*)\"");
private static final String FILE_EXTENSION = ".lang";
private static File localeFolder;
private static String defaultLocale;
private final Map<String, String> nodes = new HashMap<>();
private final File file;
private final String name, region;
private Locale(String name, String region) {
if (plugin == null)
throw new IllegalStateException("Cannot generate locales without first initializing the class (Locale#init(JavaPlugin))");
this.name = name.toLowerCase();
this.region = region.toUpperCase();
String fileName = name + "_" + region + FILE_EXTENSION;
this.file = new File(localeFolder, fileName);
if (this.reloadMessages()) return;
plugin.getLogger().info("Loaded locale " + fileName);
}
/**
* Get the name of the language that this locale is based on.
* (i.e. "en" for English, or "fr" for French)
*
* @return the name of the language
*/
public String getName() {
return name;
}
/**
* Get the name of the region that this locale is from.
* (i.e. "US" for United States or "CA" for Canada)
*
* @return the name of the region
*/
public String getRegion() {
return region;
}
/**
* Return the entire locale tag (i.e. "en_US")
*
* @return the language tag
*/
public String getLanguageTag() {
return name + "_" + region;
}
/**
* Get the file that represents this locale
*
* @return the locale file (.lang)
*/
public File getFile() {
return file;
}
/**
* Get a message set for a specific node
*
* @param node the node to get
* @return the message for the specified node
*/
public String getMessage(String node) {
return ChatColor.translateAlternateColorCodes('&', this.getMessageOrDefault(node, node));
}
/**
* Get a message set for a specific node and replace its params with a supplied arguments.
*
* @param node the node to get
* @param args the replacement arguments
* @return the message for the specified node
*/
public String getMessage(String node, Object... args) {
String message = getMessage(node);
for (Object arg : args) {
message = message.replaceFirst("\\%.*?\\%", arg.toString());
}
return message;
}
/**
* Get a message set for a specific node
*
* @param node the node to get
* @param defaultValue the default value given that a value for the node was not found
* @return the message for the specified node. Default if none found
*/
public String getMessageOrDefault(String node, String defaultValue) {
return this.nodes.getOrDefault(node, defaultValue);
}
/**
* Get the key-value map of nodes to messages
*
* @return node-message map
*/
public Map<String, String> getMessageNodeMap() {
return ImmutableMap.copyOf(nodes);
}
/**
* Clear the previous message cache and load new messages directly from file
*
* @return reload messages from file
*/
public boolean reloadMessages() {
if (!this.file.exists()) {
plugin.getLogger().warning("Could not find file for locale " + this.name);
return false;
}
this.nodes.clear(); // Clear previous data (if any)
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
for (int lineNumber = 0; (line = reader.readLine()) != null; lineNumber++) {
if (line.isEmpty() || line.startsWith("#") /* Comment */) continue;
Matcher matcher = NODE_PATTERN.matcher(line);
if (!matcher.find()) {
System.err.println("Invalid locale syntax at (line=" + lineNumber + ")");
continue;
}
nodes.put(matcher.group(1), matcher.group(2));
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
/**
* Initialize the locale class to generate information and search for localizations.
* This must be called before any other methods in the Locale class can be invoked.
* Note that this will also call {@link #searchForLocales()}, so there is no need to
* invoke it for yourself after the initialization
*
* @param plugin the plugin instance
*/
public static void init(JavaPlugin plugin) {
Locale.plugin = plugin;
if (localeFolder == null) {
localeFolder = new File(plugin.getDataFolder(), "locales/");
}
localeFolder.mkdirs();
Locale.searchForLocales();
}
/**
* Find all .lang file locales under the "locales" folder
*/
public static void searchForLocales() {
if (!localeFolder.exists()) localeFolder.mkdirs();
for (File file : localeFolder.listFiles()) {
String name = file.getName();
if (!name.endsWith(".lang")) continue;
String fileName = name.substring(0, name.lastIndexOf('.'));
String[] localeValues = fileName.split("_");
if (localeValues.length != 2) continue;
if (localeExists(localeValues[0] + "_" + localeValues[1])) continue;
LOCALES.add(new Locale(localeValues[0], localeValues[1]));
plugin.getLogger().info("Found and loaded locale \"" + fileName + "\"");
}
}
/**
* Get a locale by its entire proper name (i.e. "en_US")
*
* @param name the full name of the locale
* @return locale of the specified name
*/
public static Locale getLocale(String name) {
for (Locale locale : LOCALES)
if (locale.getLanguageTag().equalsIgnoreCase(name)) return locale;
return null;
}
/**
* Get a locale from the cache by its name (i.e. "en" from "en_US")
*
* @param name the name of the language
* @return locale of the specified language. Null if not cached
*/
public static Locale getLocaleByName(String name) {
for (Locale locale : LOCALES)
if (locale.getName().equalsIgnoreCase(name)) return locale;
return null;
}
/**
* Get a locale from the cache by its region (i.e. "US" from "en_US")
*
* @param region the name of the region
* @return locale of the specified region. Null if not cached
*/
public static Locale getLocaleByRegion(String region) {
for (Locale locale : LOCALES)
if (locale.getRegion().equalsIgnoreCase(region)) return locale;
return null;
}
/**
* Check whether a locale exists and is registered or not
*
* @param name the whole language tag (i.e. "en_US")
* @return true if it exists
*/
public static boolean localeExists(String name) {
for (Locale locale : LOCALES)
if (locale.getLanguageTag().equals(name)) return true;
return false;
}
/**
* Get an immutable list of all currently loaded locales
*
* @return list of all locales
*/
public static List<Locale> getLocales() {
return ImmutableList.copyOf(LOCALES);
}
/**
* Save a default locale file from the project source directory, to the locale folder
*
* @param path the path to the file to save
* @param fileName the name of the file to save
* @return true if the operation was successful, false otherwise
*/
public static boolean saveDefaultLocale(String path, String fileName) {
if (!localeFolder.exists()) localeFolder.mkdirs();
if (!fileName.endsWith(FILE_EXTENSION))
fileName = (fileName.lastIndexOf(".") == -1 ? fileName : fileName.substring(0, fileName.lastIndexOf('.'))) + FILE_EXTENSION;
File destinationFile = new File(localeFolder, fileName);
if (destinationFile.exists()) {
return compareFiles(plugin.getResource(fileName), destinationFile);
}
try (OutputStream outputStream = new FileOutputStream(destinationFile)) {
IOUtils.copy(plugin.getResource(fileName), outputStream);
fileName = fileName.substring(0, fileName.lastIndexOf('.'));
String[] localeValues = fileName.split("_");
if (localeValues.length != 2) return false;
LOCALES.add(new Locale(localeValues[0], localeValues[1]));
if (defaultLocale == null) defaultLocale = fileName;
return true;
} catch (IOException e) {
return false;
}
}
/**
* Save a default locale file from the project source directory, to the locale folder
*
* @param fileName the name of the file to save
* @return true if the operation was successful, false otherwise
*/
public static boolean saveDefaultLocale(String fileName) {
return saveDefaultLocale("", fileName);
}
/**
* Clear all current locale data
*/
public static void clearLocaleData() {
for (Locale locale : LOCALES)
locale.nodes.clear();
LOCALES.clear();
}
// Write new changes to existing files, if any at all
private static boolean compareFiles(InputStream defaultFile, File existingFile) {
// Look for default
if (defaultFile == null) {
defaultFile = plugin.getResource(defaultLocale != null ? defaultLocale : "en_US");
if (defaultFile == null) return false; // No default at all
}
boolean changed = false;
List<String> defaultLines, existingLines;
try (BufferedReader defaultReader = new BufferedReader(new InputStreamReader(defaultFile));
BufferedReader existingReader = new BufferedReader(new FileReader(existingFile));
BufferedWriter writer = new BufferedWriter(new FileWriter(existingFile, true))) {
defaultLines = defaultReader.lines().collect(Collectors.toList());
existingLines = existingReader.lines().map(s -> s.split("\\s*=")[0]).collect(Collectors.toList());
for (String defaultValue : defaultLines) {
if (defaultValue.isEmpty() || defaultValue.startsWith("#")) continue;
String key = defaultValue.split("\\s*=")[0];
if (!existingLines.contains(key)) {
if (!changed) {
writer.newLine();
writer.newLine();
writer.write("# New messages for " + plugin.getName() + " v" + plugin.getDescription().getVersion());
}
writer.newLine();
writer.write(defaultValue);
changed = true;
}
}
} catch (IOException e) {
return false;
}
return changed;
}
}

View File

@ -7,6 +7,7 @@ import com.songoda.epicbuckets.inventories.InventoryManager;
import com.songoda.epicbuckets.util.ChatUtil;
import com.songoda.epicbuckets.util.Util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -28,22 +29,24 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args.length == 0) {
if (!sender.hasPermission("genbucketadmin.command.help")) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
sender.sendMessage("§a/genbucketadmin info §8- §fPlugin information");
sender.sendMessage("§a/genbucketadmin admin §8- §fToggle admin mode");
sender.sendMessage("§a/genbucketadmin reload §8- §fReload the configs");
sender.sendMessage("§a/genbucketadmin toggleStatus §8- §fEnable/Disable genbuckets");
sender.sendMessage("§a/genbucketadmin toggleSponge §8- §fEnable/Disable sponges");
sender.sendMessage("§a/genbucketadmin toggleEnchant §8- §fToggle glowing genbuckets");
sender.sendMessage("§a/genbucketadmin toggleInfinity §8- §fToggle infinite genbuckets");
sender.sendMessage("§a/genbucketadmin activepanel §8- §fOpens a GUI");
sender.sendMessage("§a/genbucketadmin setHeight <int> §8- §fModify vertical height");
sender.sendMessage("§a/genbucketadmin setLength <int> §8- §fModify horizontal length");
sender.sendMessage("§a/genbucketadmin give <player> <shop> <key> <amount>");
sender.sendMessage("");
sender.sendMessage(ChatUtil.colorString(ChatUtil.getPrefix() + "&7Version " + plugin.getDescription().getVersion() + " Created with <3 by &5&l&oBrianna"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin info&7 - Plugin information"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin admin&7 - Toggle admin mode"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin reload&7 - Reload the configs"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin toggleStatus&7 - Enable/Disable genbuckets"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin toggleSponge&7 - Enable/Disable sponges"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin toggleEnchant&7 - Toggle glowing genbuckets"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin toggleInfinity&7 - Toggle infinite genbuckets"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin activepanel&7 - Opens a GUI"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin setHeight <int>&7 - Modify vertical height"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin setLength <int>&7 - Modify horizontal length"));
sender.sendMessage(ChatUtil.colorString("&8 - &agenbucketadmin give <player> <shop> <key> <amount>"));
sender.sendMessage("");
return true;
}
@ -54,12 +57,12 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("admin")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("PLAYER-COMMAND")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.playercommand"));
return true;
}
@ -73,7 +76,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
GenbucketManager.adminList.remove(player.getUniqueId());
player.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("ADMIN-TOGGLE-OFF")));
player.sendMessage(plugin.getLocale().getMessage("event.admin.off"));
} else {
@ -81,7 +84,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
GenbucketManager.adminList.add(player.getUniqueId());
player.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("ADMIN-TOGGLE-ON")));
player.sendMessage(plugin.getLocale().getMessage("event.admin.on"));
}
@ -91,7 +94,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("reload")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -100,11 +103,11 @@ public class GenbucketAdminCommand implements CommandExecutor {
EpicBuckets.getInstance().reloadFiles();
} catch (Exception e) {
sender.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("ERROR-OCCURED")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.error"));
e.printStackTrace();
}
sender.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("RELOAD-CONFIG")));
sender.sendMessage(plugin.getLocale().getMessage("command.reload.success"));
return true;
}
@ -113,12 +116,12 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("activepanel")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
if (!(sender instanceof Player)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("PLAYER-COMMAND")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.playercommand"));
return true;
}
@ -134,7 +137,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("toggleStatus")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -151,7 +154,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("toggleInfinity")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -170,7 +173,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("toggleSponge")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -205,7 +208,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("toggleEnchant")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -231,7 +234,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("setheight")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -258,7 +261,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("setlength")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -292,7 +295,7 @@ public class GenbucketAdminCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("give")) {
if (!sender.hasPermission(permission)) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return true;
}
@ -347,10 +350,10 @@ public class GenbucketAdminCommand implements CommandExecutor {
private void toggleSetting(CommandSender sender, String setting, boolean oldValue) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("SETTING-MODIFY").replace("{setting}", setting.toUpperCase()).replace("{value}", String.valueOf(!oldValue))));
sender.sendMessage(plugin.getLocale().getMessage("event.settings.modify", setting.toUpperCase(), String.valueOf(!oldValue)));
}
private void toggleSetting(CommandSender sender, String setting, String oldValue) {
sender.sendMessage(ChatUtil.colorPrefix(plugin.messageFile.config.getString("SETTING-MODIFY").replace("{setting}", setting.toUpperCase()).replace("{value}", String.valueOf(oldValue))));
sender.sendMessage(plugin.getLocale().getMessage("event.settings.modify", setting.toUpperCase(), String.valueOf(oldValue)));
}
}

View File

@ -19,12 +19,12 @@ public class GenbucketCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("PLAYER-COMMAND")));
sender.sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.general.playercommand"));
return true;
}
if (!sender.hasPermission("genbucket.command")) {
sender.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("NO-PERMISSION")));
sender.sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.general.nopermission"));
return true;
}

View File

@ -1,16 +0,0 @@
package com.songoda.epicbuckets.filehandler.files;
import com.songoda.epicbuckets.filehandler.FileManager;
/**
* MessageFile created by: SoFocused
* Date Created: oktober 02 2018
* Time created: 22:57
*/
public class MessageFile extends FileManager {
public MessageFile() {
super("messages.yml");
}
}

View File

@ -21,7 +21,7 @@ import java.util.UUID;
*/
public abstract class Genbucket {
protected EpicBuckets main = EpicBuckets.getInstance();
protected EpicBuckets plugin = EpicBuckets.getInstance();
private GenbucketType genbucketType;
@ -34,7 +34,7 @@ public abstract class Genbucket {
public abstract void run();
public EpicBuckets getInstance() {
return main;
return plugin;
}
protected void genbucketFinished(Player player, UUID uuid) {
@ -65,7 +65,7 @@ public abstract class Genbucket {
//ChatUtil.debugMSG(player, factionsCheck, factionsUUIDCheck, griefPreventionCheck, worldGuardCheck, worldBorderCheck);
if (!factionsCheck || !factionsUUIDCheck || !griefPreventionCheck || !worldGuardCheck || worldBorderCheck) {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("YOU-CANNOT-PLACE-HERE")));
player.sendMessage(plugin.getLocale().getMessage("event.place.nothere"));
return false;
}
@ -84,7 +84,7 @@ public abstract class Genbucket {
if (!factionsCheck || !factionsUUIDCheck || !griefPreventionCheck || !worldGuardCheck || worldBorderCheck) {
if (sendMessage)
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("YOU-CANNOT-PLACE-HERE")));
player.sendMessage(plugin.getLocale().getMessage("event.place.nothere"));
return false;
@ -110,7 +110,7 @@ public abstract class Genbucket {
if (GenbucketManager.getActiveGenBuckets(player) >= maxActiveGenForPlayer(player) + 1) {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("YOU-MUST-WAIT")));
player.sendMessage(plugin.getLocale().getMessage("event.place.wait"));
return false;
}
@ -128,7 +128,7 @@ public abstract class Genbucket {
if (!offlinePlayer.isOnline())
continue;
offlinePlayer.getPlayer().sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("ADMIN-MESSAGE").replace("{player}", target.getName()).replace("{type}", genbucketType.toString().toLowerCase())));
offlinePlayer.getPlayer().sendMessage(plugin.getLocale().getMessage("event.admin.playerplaced", target.getName(), genbucketType.toString().toLowerCase()));
}
@ -136,24 +136,24 @@ public abstract class Genbucket {
protected boolean withdrawMoney(Player player, GenbucketItem item) {
boolean useInfinityGens = main.getConfig().getBoolean("INFINITE-USE");
boolean useInfinityGens = plugin.getConfig().getBoolean("INFINITE-USE");
if (!useInfinityGens) {
removeBucket(player, player.getInventory().getItem(player.getInventory().getHeldItemSlot()));
return true;
}
double playerBalance = main.getBalance(player);
double playerBalance = plugin.getBalance(player);
if (playerBalance >= item.getPrice()) {
main.withdrawBalance(player, item.getPrice(), true);
plugin.withdrawBalance(player, item.getPrice(), true);
return true;
} else {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("NOT-ENOUGH-MONEY").replace("{money}", String.valueOf((playerBalance - item.getPrice()) * -1))));
player.sendMessage(plugin.getLocale().getMessage("event.withdrawl.success", String.valueOf((playerBalance - item.getPrice()) * -1)));
return false;
}
@ -166,9 +166,9 @@ public abstract class Genbucket {
boolean foundValue = false;
for (String maxAmountString : main.getConfig().getConfigurationSection("CUSTOM-ACTIVE-GEN-PER-PLAY").getKeys(false)) {
for (String maxAmountString : plugin.getConfig().getConfigurationSection("CUSTOM-ACTIVE-GEN-PER-PLAY").getKeys(false)) {
String value[] = main.getConfig().getString("CUSTOM-ACTIVE-GEN-PER-PLAY." + maxAmountString).split(":");
String value[] = plugin.getConfig().getString("CUSTOM-ACTIVE-GEN-PER-PLAY." + maxAmountString).split(":");
if (!player.hasPermission(value[1]))
continue;
@ -180,7 +180,7 @@ public abstract class Genbucket {
}
if (!foundValue)
maxActiveGenForPlayer = main.getConfig().getInt("MAX-ACTIVE-GEN-PER-PLAYER");
maxActiveGenForPlayer = plugin.getConfig().getInt("MAX-ACTIVE-GEN-PER-PLAYER");
//ChatUtil.debugMSG(player, maxActiveGenForPlayer, foundValue);
@ -190,12 +190,12 @@ public abstract class Genbucket {
protected boolean foundSponge(Location loc) {
boolean useSponge = main.getConfig().getBoolean("USE-SPONGE-SUPPORT");
boolean useSponge = plugin.getConfig().getBoolean("USE-SPONGE-SUPPORT");
if (!useSponge)
return false;
int radius = main.getConfig().getInt("SPONGE-RADIUS");
int radius = plugin.getConfig().getInt("SPONGE-RADIUS");
if (radius < 0)
return false;

View File

@ -16,7 +16,7 @@ import java.util.List;
*/
public class GenbucketItem {
private EpicBuckets main = EpicBuckets.main;
private EpicBuckets main = EpicBuckets.getInstance();
private String itemName;
private List<String> itemLore;

View File

@ -54,7 +54,7 @@ public class GenbucketManager {
Inventory inventory = Bukkit.createInventory(player, size, inventoryName);
int mainItemSlot = config.getInt("BULK-SHOP-INVENTORY.main-item-slot");
int mainItemSlot = config.getInt("BULK-SHOP-INVENTORY.plugin-item-slot");
int itemAmount = getPlayerInteger(player);

View File

@ -48,7 +48,7 @@ public class Horizontal extends Genbucket {
public void run() {
if ("DOWN".equalsIgnoreCase(blockFace.name()) || "UP".equalsIgnoreCase(blockFace.name())) {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("GENBUCKET-PLACED-WRONG").replace("{direction}", main.messageFile.config.getString("TRANSLATE-DIRECTION-SIDE")).replace("{genbucket}", ChatUtil.stripColor(genbucketItem.getItemName()))));
player.sendMessage(ChatUtil.colorPrefix(plugin.getLocale().getMessage("event.genbucket.placedwrong", plugin.getLocale().getMessage("event.translate.directionside", ChatUtil.stripColor(genbucketItem.getItemName())))));
return;
}
@ -61,7 +61,7 @@ public class Horizontal extends Genbucket {
if (!withdrawMoney(player, genbucketItem))
return;
long delay = main.getConfig().getInt("DELAY");
long delay = plugin.getConfig().getInt("DELAY");
// Now we can start spawning the blocks
@ -119,7 +119,7 @@ public class Horizontal extends Genbucket {
return;
}
boolean run = main.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
boolean run = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
if (run) {
@ -136,7 +136,7 @@ public class Horizontal extends Genbucket {
}
}.runTaskTimer(main, 0L, delay);
}.runTaskTimer(plugin, 0L, delay);
}

View File

@ -56,7 +56,7 @@ public class Infused extends Genbucket {
public void run() {
if (!"UP".equalsIgnoreCase(blockFace.name())) {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("GENBUCKET-PLACED-WRONG").replace("{direction}", main.messageFile.config.getString("TRANSLATE-DIRECTION-UP")).replace("{genbucket}", ChatUtil.stripColor(genbucketItem.getItemName()))));
player.sendMessage(ChatUtil.colorPrefix(plugin.getLocale().getMessage("event.genbucket.placedwrong", plugin.getLocale().getMessage("event.translate.directionup", "{genbucket}", ChatUtil.stripColor(genbucketItem.getItemName())))));
return;
}
@ -74,7 +74,7 @@ public class Infused extends Genbucket {
if (!withdrawMoney(player, genbucketItem))
return;
long delay = main.getConfig().getInt("DELAY");
long delay = plugin.getConfig().getInt("DELAY");
// Now we can start spawning the blocks
@ -115,7 +115,7 @@ public class Infused extends Genbucket {
}
boolean runFirst = main.getConfig().getStringList("IGNORE-MATERIALS").contains(blockOne.getType().name());
boolean runFirst = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(blockOne.getType().name());
if (runPillarOne && runFirst && canPlace(player, blockOne.getLocation(), false)) {
@ -125,7 +125,7 @@ public class Infused extends Genbucket {
} else
runPillarOne = false;
boolean runSecond = main.getConfig().getStringList("IGNORE-MATERIALS").contains(blockTwo.getType().name());
boolean runSecond = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(blockTwo.getType().name());
if (runPillarTwo && runSecond && canPlace(player, blockTwo.getLocation(), false)) {
@ -148,8 +148,8 @@ public class Infused extends Genbucket {
Block nextBlockOne = blockOne.getLocation().clone().subtract(0, 1, 0).getBlock();
Block nextBlockTwo = blockTwo.getLocation().clone().subtract(0, 1, 0).getBlock();
boolean checkNextBlock = main.getConfig().getStringList("IGNORE-MATERIALS").contains(nextBlockOne.getType().name());
boolean checkNextBlock_ = main.getConfig().getStringList("IGNORE-MATERIALS").contains(nextBlockTwo.getType().name());
boolean checkNextBlock = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(nextBlockOne.getType().name());
boolean checkNextBlock_ = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(nextBlockTwo.getType().name());
if (!checkNextBlock && !checkNextBlock_ || !runPillarOne && !runPillarTwo) {
@ -162,7 +162,7 @@ public class Infused extends Genbucket {
}
}.runTaskTimer(main, 0L, delay);
}.runTaskTimer(plugin, 0L, delay);
}

View File

@ -61,7 +61,7 @@ public class PsuedoVertical extends Genbucket {
boolean validMaterial = false;
// This is a list of allowed material from the config
List<String> materialList = main.getConfig().getStringList("PSUEDO-MATERIALS");
List<String> materialList = plugin.getConfig().getStringList("PSUEDO-MATERIALS");
// In the for loop we simply check if the material is
// valid if it is then validMaterial is set to true
@ -73,7 +73,7 @@ public class PsuedoVertical extends Genbucket {
// If the material isn't valid we tell the player and stop the code
if (!validMaterial || !clickedMaterial.equals(genbucketItem.getType())) {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("WRONG-MATERIAL-PSUEDO")));
player.sendMessage(plugin.getLocale().getMessage("event.genbucket.wrongmaterialpsuedo"));
return;
}
@ -92,7 +92,7 @@ public class PsuedoVertical extends Genbucket {
return;
// Delay from config
long delay = main.getConfig().getInt("DELAY");
long delay = plugin.getConfig().getInt("DELAY");
// Now we can start spawning the blocks
@ -164,7 +164,7 @@ public class PsuedoVertical extends Genbucket {
} else {
List<String> materialList = main.getConfig().getStringList("PSUEDO-MATERIALS");
List<String> materialList = plugin.getConfig().getStringList("PSUEDO-MATERIALS");
boolean validMaterial = false;
@ -188,7 +188,7 @@ public class PsuedoVertical extends Genbucket {
}
}.runTaskTimer(main, 0L, delay);
}.runTaskTimer(plugin, 0L, delay);
}

View File

@ -28,7 +28,7 @@ public class Vertical extends Genbucket {
private BlockFace blockFace;
private GenbucketItem genbucketItem;
private UUID genbucketUUID;
private long delay = main.getConfig().getInt("DELAY");
private long delay = plugin.getConfig().getInt("DELAY");
/**
* Creating the class constructor for a Vertical genbucket
@ -147,7 +147,7 @@ public class Vertical extends Genbucket {
return;
}
boolean run = main.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
boolean run = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
if (!run && genbucketItem.getType().equals(Material.SAND) || !run && genbucketItem.getType().equals(Material.GRAVEL) || run) {
@ -161,7 +161,7 @@ public class Vertical extends Genbucket {
block_.setType(Material.COBBLESTONE);
Block blockUnderCobbleStone = block.getLocation().clone().subtract(0, 2, 0).getBlock();
boolean ignoreBlock = main.getConfig().getStringList("IGNORE-MATERIALS").contains(blockUnderCobbleStone.getType().name());
boolean ignoreBlock = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(blockUnderCobbleStone.getType().name());
if (!ignoreBlock) {
block_.setType(genbucketItem.getType());
@ -189,7 +189,7 @@ public class Vertical extends Genbucket {
}
}.runTaskTimer(main, 0L, delay);
}.runTaskTimer(plugin, 0L, delay);
}
@ -235,7 +235,7 @@ public class Vertical extends Genbucket {
return;
}
boolean run = main.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
boolean run = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
if (!run && genbucketItem.getType().equals(Material.SAND) || !run && genbucketItem.getType().equals(Material.GRAVEL) || run) {
@ -249,7 +249,7 @@ public class Vertical extends Genbucket {
block_.setType(Material.COBBLESTONE);
Block blockUnderCobbleStone = block.getLocation().clone().add(0, 2, 0).getBlock();
boolean ignoreBlock = main.getConfig().getStringList("IGNORE-MATERIALS").contains(blockUnderCobbleStone.getType().name());
boolean ignoreBlock = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(blockUnderCobbleStone.getType().name());
if (!ignoreBlock) {
block_.setType(genbucketItem.getType());
@ -277,7 +277,7 @@ public class Vertical extends Genbucket {
}
}.runTaskTimer(main, 0L, delay);
}.runTaskTimer(plugin, 0L, delay);
}
private void directionDown() {
@ -327,7 +327,7 @@ public class Vertical extends Genbucket {
return;
}
boolean run = main.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
boolean run = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(block.getType().name());
if (!run && genbucketItem.getType().equals(Material.SAND) || !run && genbucketItem.getType().equals(Material.GRAVEL) || run) {
@ -341,7 +341,7 @@ public class Vertical extends Genbucket {
block_.setType(Material.COBBLESTONE);
Block blockUnderCobbleStone = block.getLocation().clone().subtract(0, 2, 0).getBlock();
boolean ignoreBlock = main.getConfig().getStringList("IGNORE-MATERIALS").contains(blockUnderCobbleStone.getType().name());
boolean ignoreBlock = plugin.getConfig().getStringList("IGNORE-MATERIALS").contains(blockUnderCobbleStone.getType().name());
if (!ignoreBlock) {
block_.setType(genbucketItem.getType());
@ -369,7 +369,7 @@ public class Vertical extends Genbucket {
}
}.runTaskTimer(main, 0L, delay);
}.runTaskTimer(plugin, 0L, delay);
}

View File

@ -149,12 +149,12 @@ public class GenbucketPlaceListener implements Listener {
return;
if (!player.hasPermission("genbucket.place")) {
player.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("NO-PERMISSION")));
player.sendMessage(plugin.getLocale().getMessage("event.general.nopermission"));
return;
}
if (Util.disableGenbuckets()) {
player.sendMessage(ChatUtil.colorPrefix(EpicBuckets.getInstance().messageFile.config.getString("GENBUCKET-DISABLED")));
player.sendMessage(plugin.getLocale().getMessage("event.genbucket.disabled"));
player.updateInventory();
return;
}

View File

@ -28,7 +28,7 @@ import java.util.WeakHashMap;
*/
public class InventoryClickListener implements Listener {
private EpicBuckets main = EpicBuckets.main;
private EpicBuckets plugin = EpicBuckets.getInstance();
private Map<UUID, String> shopMap = new WeakHashMap<>();
@ -37,7 +37,7 @@ public class InventoryClickListener implements Listener {
@EventHandler
public void onClick(InventoryClickEvent event) {
String inventoryTitle = ChatUtil.stripColor(main.getConfig().getString("MENU-ITEMS.inventory-name"));
String inventoryTitle = ChatUtil.stripColor(plugin.getConfig().getString("MENU-ITEMS.inventory-name"));
String clickedInventoryTitle = ChatColor.stripColor(event.getInventory().getTitle());
if (!clickedInventoryTitle.equalsIgnoreCase(inventoryTitle))
@ -92,7 +92,7 @@ public class InventoryClickListener implements Listener {
@EventHandler
public void onClickSubInventory(InventoryClickEvent event) {
FileConfiguration config = main.shopFile.config;
FileConfiguration config = plugin.shopFile.config;
String clickedInventory = ChatUtil.stripColor(event.getInventory().getTitle());
@ -171,7 +171,7 @@ public class InventoryClickListener implements Listener {
// Open the multiple gui shop
final boolean infinite_gens = main.getConfig().getBoolean("INFINITE-USE");
final boolean infinite_gens = plugin.getConfig().getBoolean("INFINITE-USE");
if (infinite_gens) {
return;
@ -329,9 +329,9 @@ public class InventoryClickListener implements Listener {
}
FileConfiguration config = main.getConfig();
FileConfiguration config = plugin.getConfig();
int mainItemSlot = config.getInt("BULK-SHOP-INVENTORY.main-item-slot");
int mainItemSlot = config.getInt("BULK-SHOP-INVENTORY.plugin-item-slot");
inventory.getItem(mainItemSlot).setAmount(GenbucketManager.getPlayerInteger(player));
@ -341,7 +341,7 @@ public class InventoryClickListener implements Listener {
private int[] modifySlotList() {
FileConfiguration config = main.getConfig();
FileConfiguration config = plugin.getConfig();
int[] modifyValueSlots = new int[6];
@ -367,16 +367,16 @@ public class InventoryClickListener implements Listener {
if (player.getInventory().firstEmpty() == -1) {
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("INVENTORY-FULL")));
player.sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.purchase.inventoryfull"));
return;
}
int price = genbucketItem.getPrice() * amount;
double playerBalance = main.getBalance(player);
double playerBalance = plugin.getBalance(player);
final boolean infinite_gens = main.getConfig().getBoolean("INFINITE-USE");
final boolean infinite_gens = plugin.getConfig().getBoolean("INFINITE-USE");
if (infinite_gens) {
player.getInventory().addItem(genbucketItem.getGenbucketItem());
@ -387,7 +387,7 @@ public class InventoryClickListener implements Listener {
// they have enough money
main.withdrawBalance(player, price, true);
plugin.withdrawBalance(player, price, true);
genbucketItem.setAmount(amount);
@ -397,11 +397,11 @@ public class InventoryClickListener implements Listener {
// they have less money
player.sendMessage(ChatUtil.colorPrefix(main.messageFile.config.getString("NOT-ENOUGH-MONEY").replace("{money}", String.valueOf((playerBalance - price) * -1))));
player.sendMessage(plugin.getLocale().getMessage("event.withdrawl.success", String.valueOf((playerBalance - price) * -1)));
}
boolean closeGUI = main.getConfig().getBoolean("CLOSE-GUI-AFTER-PURCHASE");
boolean closeGUI = plugin.getConfig().getBoolean("CLOSE-GUI-AFTER-PURCHASE");
if (closeGUI)
player.getOpenInventory().close();

View File

@ -51,7 +51,7 @@ public class ChatUtil {
}
public static String getPrefix() {
return EpicBuckets.getInstance().messageFile.config.getString("PREFIX").equals("none") ? "" : EpicBuckets.getInstance().messageFile.config.getString("PREFIX") + " ";
return EpicBuckets.getInstance().getLocale().getMessage("general.nametag.prefix").equals("none") ? "" : EpicBuckets.getInstance().getLocale().getMessage("general.nametag.prefix") + " ";
}
public static void debugMSG(Player player, Object... args) {

View File

@ -0,0 +1,27 @@
#General Messages
general.nametag.prefix = "&8[&6EpicBuckets&8]"
#Command Messages
command.reload.success = "&7You've reloaded the config"
#Event Messages
event.general.nopermission = "&cYou do not have permission to do that."
event.general.playercommand = "&c&lOnly players can use this"
event.general.error = "&cAn error occurred, please contact an administrator"
event.withdrawl.success = "&e$%amount%&7 was taken from your &eaccount&7!"
event.purchase.notenoughmoney = "&7You need &e$%money% &7more to purchase this genbucket!"
event.purchase.inventoryfull = "&7Your inventory is &efull&7!"
event.place.nothere = "&7You're not &eallowed&7 to place a genbucket here!"
event.place.wait = "&7You must &ewait&7 before your other gen(s) finishes!"
event.admin.on = "&7You have toggled admin-mode &aon"
event.admin.off = "&7You have toggled admin-mode &coff"
event.admin.playerplaced = "&e%player% &7placed a &e%type% genbucket&7!"
event.settings.modify = "&7You've set &e%setting%&7 to &e%value%"
event.translate.directionup = "on top of blocks"
event.translate.directionside = "on the side of blocks"
event.genbucket.disabled = "&eGenbuckets &7are currently disabled!"
event.genbucket.placedwrong = "&e%genbucket% &7can be placed %direction%" # %side% equals to TRANSLATE-DIRECTION-X
event.genbucket.wrongmaterialpsuedo = "&7You cannot use this genbucket on this &eblock!"

View File

@ -1,31 +0,0 @@
PREFIX: "&e&lEZBUCKET>" # set to "none" if you don't want a prefix
NO-PERMISSION: "&7You do not have &epermission &7for this command"
PLAYER-COMMAND: "&c&lOnly players can use this"
ERROR-OCCURED: "&cAn error occurred, please contact an administrator"
RELOAD-CONFIG: "&7You've reloaded the config"
WITHDRAW-MESSAGE: "&e${amount}&7 was taken from your &eaccount&7!"
NOT-ENOUGH-MONEY: "&7You need &e${money} &7more to purchase this genbucket!"
INVENTORY-FULL: "&7Your inventory is &efull&7!"
YOU-CANNOT-PLACE-HERE: "&7You're not &eallowed&7 to place a genbucket here!"
YOU-MUST-WAIT: "&7You must &ewait&7 before your other gen(s) finishes!"
ADMIN-TOGGLE-ON: "&7You have toggled admin-mode &aon"
ADMIN-TOGGLE-OFF: "&7You have toggled admin-mode &coff"
ADMIN-MESSAGE: "&e{player} &7placed a &e{type} genbucket&7!"
WRONG-MATERIAL-PSUEDO: "&7You cannot use this genbucket on this &eblock!"
GENBUCKET-DISABLED: "&eGenbuckets &7are currently disabled!"
GENBUCKET-PLACED-WRONG: "&e{genbucket} &7can be placed {direction}" # {side} equals to TRANSLATE-DIRECTION-X
TRANSLATE-DIRECTION-UP: "on top of blocks"
TRANSLATE-DIRECTION-SIDE: "on the side of blocks"
SETTING-MODIFY: "&7You've set &e{setting}&7 to &e{value}"

View File

@ -2,13 +2,13 @@ name: EpicBuckets
version: 1
description: Generate walls fast and efficient with beautiful guis!
author: Songoda
main: club.sofocused.ezbucket.plugin.Plugin
main: com.songoda.epicbuckets.EpicBuckets
softdepend: [WorldGuard, WorldEdit, Factions, MassiveCore, FactionsUUID, GriefPrevention]
depend: [Vault]
commands:
genbucket:
description: Open genbucket shop
aliases: [gb, gen, genbuckets, ezbucket, genshop]
description: Open EpicBuckets shop
aliases: [gb, gen, genbuckets, ezbucket, epicbuckkets, genshop]
usage: "/gb"
genbucketadmin:
description: Admin commands

Binary file not shown.

Binary file not shown.

217
target/classes/config.yml Normal file
View File

@ -0,0 +1,217 @@
###############################################
# EpicBuckets #
# Made by Songoda #
###############################################
# All config files can be found on
# https://www.spigotmc.org/resources/ezbucket-1-7-1-12-region-support-gui-horizontal-vertical-and-infused-gens-genbucket.50944/
FACTIONS-SUPPORT: false # MassiveCore and Factions/FactionsUUID/SavageFactions is needed
WORLDGUARD-SUPPORT: false # WorldEdit and WorldGuard is needed
GRIEFPREVENTION-SUPPORT: false # GriefPrevention is needed
ENABLE-GENS-IN-WILDERNESS: true
ENCHANT: false # Enchant genbuckets in all guis
CLOSE-GUI-AFTER-PURCHASE: false # Close the inventory after purchase
INFINITE-USE: false # If enabled, you won't lose a genbucket when you place it down
USE-SPONGE-SUPPORT: false # If a sponge is found it will stop the genbucket
SPONGE-RADIUS: 3 # <- SPONGE-RADIUS 3 == 3x3. I do not recommending putting this higher than 3
MAX-ACTIVE-GEN-PER-PLAYER: 10 # Amount of gens a player can have active at time
PLACE-UNLIMTED-GENS: true # This will override MAX-ACTIVE-GEN-PER-PLAYER and let them place unlimted gens
MAX-VERTICAL-HEIGHT: 257 # Vertical gen height, the gen will stop if y > 256
MAX-HORIZONTAL-LENGTH: 50 # Horizontal height
DELAY: 10 # If delay is set to 20 it will place one block every second. 10 will place two blocks each second
DISABLE-GENBUCKETS: false # If enabled placing any genbuckets wont be placeable
CUSTOM-ACTIVE-GEN-PER-PLAY: # Put the highest first
# Everyone with the permission genbucket.limit.god
# will be able to place 30 instead of the default value (MAX-ACTIVE-GEN-PER-PLAYER)
GOD: "30:genbucket.limit.god"
VETERAN: "25:genbucket.limit.veteran"
VIP: "20:genbucket.limit.vip"
# All genbuckets will run over these materials
# except the psuedo.
# Make all words capital!
IGNORE-MATERIALS:
- "AIR" # <- Don't remove unless you know what you're doing
- "SNOW"
- "LONG_GRASS"
- "DEAD_BUSH"
- "YELLOW_FLOWER"
- "DOUBLE_PLANT"
- "RED_ROSE"
PSUEDO-MATERIALS: # Which materials should the psuedo genbucket work on?
- "cobblestone"
- "sand"
- "obsidian"
FILL-ITEM:
name: " "
material: stained_glass_pane
damage: 15
BACK-BUTTON:
name: " &c&lReturn back to categories"
material: barrier
damage: 0
BULK-SHOP-INVENTORY:
inventory-name: "Bulk shop for {player}"
size: 54 # Must be one of these: 9, 18, 27, 36, 45, 54
fill: false # recommended off
return-back-slot: 49
main-item-slot: 22
increase-item:
material: stained_glass_pane
damage: 5
slots: "24,25,26" # Put only three integers and separate with commas
decrease-item:
material: stained_glass_pane
damage: 14
slots: "18,19,20" # Put only three integers and separate with commas
purchase-item:
name: "&a&lConfirm"
material: stained_glass
damage: 13
slot: 40
# All material names can be found @ https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
MENU-ITEMS:
size: 27 # Must be one of these: 9, 18, 27, 36, 45, 54
fill: true # Fill inventory ?
inventory-name: "Select a category"
'1': # Must be unique
item: # Item configuration
material: WATER_BUCKET # material name
damage: 0 # also known as short
name: "&eVertical genbuckets" # Name of the item
lore: # Lore of the item
- ""
- "&7&o(( Click to open shop ))"
- ""
- "&7Use vertical genbuckets to create"
- "&7vertical walls fast and efficient"
- ""
shop: "vertical" # make a shop in shops.yml
slot: 10 # slot in the gui
'2':
item:
material: WATER_BUCKET
damage: 0
name: "&eHorizontal genbuckets"
lore:
- ""
- "&7&o(( Click to open shop ))"
- ""
- "&7Use horizontal genbuckets to create"
- "&7roofs & floors fast and efficient"
- ""
shop: "horizontal"
slot: 12 # slot in the gui
'3':
item:
material: WATER_BUCKET
damage: 0
name: "&eInfused genbuckets"
lore:
- ""
- "&7&o(( Click to open shop ))"
- ""
- "&7Use infused genbuckets to place"
- "&7vertical walls on each side of the"
- "&7block"
- ""
shop: "infused"
slot: 14 # slot in the gui
'4':
item:
material: WATER_BUCKET
damage: 0
name: "&ePsuedo genbuckets"
lore:
- ""
- "&7&o(( Click to open shop ))"
- ""
- "&7Use psuedo genbuckets to repair"
- "&7broken walls"
- ""
shop: "psuedo"
slot: 16 # slot in the gui

27
target/classes/en_US.lang Normal file
View File

@ -0,0 +1,27 @@
#General Messages
general.nametag.prefix = "&8[&6EpicBuckets8]"
#Command Messages
command.reload.success = "&7You've reloaded the config"
#Event Messages
event.general.nopermission = "&cYou do not have permission to do that."
event.general.playercommand = "&c&lOnly players can use this"
event.general.error = "&cAn error occurred, please contact an administrator"
event.withdrawl.success = "&e$%amount%&7 was taken from your &eaccount&7!"
event.purchase.notenoughmoney = "&7You need &e$%money% &7more to purchase this genbucket!"
event.purchase.inventoryfull = "&7Your inventory is &efull&7!"
event.place.nothere = "&7You're not &eallowed&7 to place a genbucket here!"
event.place.wait = "&7You must &ewait&7 before your other gen(s) finishes!"
event.admin.on = "&7You have toggled admin-mode &aon"
event.admin.off = "&7You have toggled admin-mode &coff"
event.admin.playerplaced = "&e%player% &7placed a &e%type% genbucket&7!"
event.settings.modify = "&7You've set &e%setting%&7 to &e%value%"
event.translate.directionup = "on top of blocks"
event.translate.directionside = "on the side of blocks"
event.genbucket.disabled = "&eGenbuckets &7are currently disabled!"
event.genbucket.placedwrong = "&e%genbucket% &7can be placed %direction%" # %side% equals to TRANSLATE-DIRECTION-X
event.genbucket.wrongmaterialpsuedo = "&7You cannot use this genbucket on this &eblock!"

16
target/classes/plugin.yml Normal file
View File

@ -0,0 +1,16 @@
name: EpicBuckets
version: 1
description: Generate walls fast and efficient with beautiful guis!
author: Songoda
main: com.songoda.epicbuckets.EpicBuckets
softdepend: [WorldGuard, WorldEdit, Factions, MassiveCore, FactionsUUID, GriefPrevention]
depend: [Vault]
commands:
genbucket:
description: Open EpicBuckets shop
aliases: [gb, gen, genbuckets, ezbucket, epicbuckkets, genshop]
usage: "/gb"
genbucketadmin:
description: Admin commands
aliases: [gbadmin, genadmin, genbucketadmin, ezbucketadmin]
usage: "/genbucketadmin"

418
target/classes/shops.yml Normal file
View File

@ -0,0 +1,418 @@
use-back-buttons: true
shops:
vertical:
goBackButton: 31 # back button will display if enabled in config.yml
trait: "VERTICAL" # Which genbucket type does this shop have?
size: 36 # Must be one of these: 9, 18, 27, 36, 45, 54
fill: true # Fill inventory ?
inventory-name: "Vertical genbuckets"
'0': # Must be unique
name: "&eVertical Cobble" # Genbucket item name
icon: "WATER_BUCKET" # This is the item placed in the GUI and the item you will get when purchased
type: "COBBLESTONE" # This is the material the bucket places
type-damage: 0 # Set a damage for the block the genbucket places
slot: 12 # This is the slot for the bucket in the GUI
price: 400 # This is the price for the bucket
damage: 0 # Material id if needed, for example if you want to spawn red wool in the guit
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'1':
name: "&eVertical Sand"
icon: "WATER_BUCKET"
type: "SAND"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 13
price: 400
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'2':
name: "&eVertical Obby"
icon: "WATER_BUCKET"
type: "OBSIDIAN"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 14
price: 700
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
infused:
goBackButton: 31
trait: "INFUSED"
size: 36
fill: true
inventory-name: "Infused genbuckets"
'0':
name: "&eInfused Cobble"
icon: "WATER_BUCKET"
type: "COBBLESTONE"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 12
price: 200
trait: "INFUSED"
material-id: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'1':
name: "&eInfused Obsidian"
icon: "WATER_BUCKET"
type: "OBSIDIAN"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 13
price: 700
trait: "INFUSED"
material-id: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'2':
name: "&eInfused Netherrack"
icon: "WATER_BUCKET"
type: "NETHERRACK"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 14
price: 31
trait: "INFUSED"
material-id: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
psuedo:
goBackButton: 31
trait: "PSUEDO"
size: 36
fill: true
inventory-name: "Psuedo genbuckets"
'0': # Must be unique
name: "&ePsuedo Cobble"
icon: "WATER_BUCKET"
type: "COBBLESTONE"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 12
price: 400
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'1':
name: "&ePsuedo Sand"
icon: "WATER_BUCKET"
type: "SAND"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 13
price: 400
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'2':
name: "&ePsuedo Obby"
icon: "WATER_BUCKET"
type: "OBSIDIAN"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 14
price: 700
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
horizontal:
goBackButton: 31
trait: "HORIZONTAL"
size: 36
fill: true
inventory-name: "Horizontal genbuckets"
'0': # Must be unique
name: "&eHorizontal Cobble"
icon: "WATER_BUCKET"
type: "COBBLESTONE"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 12
price: 400
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'1':
name: "&eHorizontal Sand"
icon: "WATER_BUCKET"
type: "SAND"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 13
price: 400
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""
'2':
name: "&eHorizontal Obby"
icon: "WATER_BUCKET"
type: "OBSIDIAN"
type-damage: 0 # Set a damage for the block the genbucket places
slot: 14
price: 700
damage: 0
description: # This is the lore of the bucket in the gui
- ""
- "&7&o((Left click to buy or right click to open bulk shop))"
- ""
- "&7Price for one &e${price}" # The {price} and {material} placeholders only works in description
- ""
- "&7Spawns &e{material} &7blocks"
- ""
item-lore: # New lore after the gen has been purchased
- ""
- "&7&oRight click a block to place"
- ""