mirror of
https://github.com/tomasff/BeesPlus.git
synced 2025-01-09 01:07:54 +01:00
Update to v1.5
Update to version 1.5
This commit is contained in:
commit
870b2dbe2d
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tomff.beesplus</groupId>
|
||||
<artifactId>BeesPlus</artifactId>
|
||||
<version>1.4.5-SNAPSHOT</version>
|
||||
<version>1.5</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -1,15 +1,16 @@
|
||||
package com.tomff.beesplus;
|
||||
|
||||
import com.tomff.beesplus.handlers.DamageHandler;
|
||||
import com.tomff.beesplus.handlers.RightClickHandler;
|
||||
import com.tomff.beesplus.items.BeeProtectionBoots;
|
||||
import com.tomff.beesplus.items.BeeProtectionChestplate;
|
||||
import com.tomff.beesplus.items.BeeProtectionHelmet;
|
||||
import com.tomff.beesplus.items.BeeProtectionLeggings;
|
||||
import com.tomff.beesplus.core.UpdateChecker;
|
||||
import com.tomff.beesplus.core.gui.GuiHandler;
|
||||
import com.tomff.beesplus.core.gui.GuiManager;
|
||||
import com.tomff.beesplus.core.gui.GuiViewTracker;
|
||||
import com.tomff.beesplus.core.items.CustomItemManager;
|
||||
import com.tomff.beesplus.core.migrations.AddFields;
|
||||
import com.tomff.beesplus.core.migrations.Field;
|
||||
import com.tomff.beesplus.core.migrations.MigrationsExecutor;
|
||||
import com.tomff.beesplus.handlers.BeehiveHandler;
|
||||
import com.tomff.beesplus.handlers.DamageHandler;
|
||||
import com.tomff.beesplus.handlers.RightClickHandler;
|
||||
import com.tomff.beesplus.items.*;
|
||||
import com.tomff.beesplus.localization.Localization;
|
||||
import com.tomff.beesplus.localization.LocalizationWrapper;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
@ -22,63 +23,28 @@ import java.util.Locale;
|
||||
|
||||
public class BeesPlus extends JavaPlugin {
|
||||
|
||||
private GuiManager guiManager;
|
||||
private GuiViewTracker guiViewTracker;
|
||||
private CustomItemManager customItemManager;
|
||||
|
||||
private LocalizationWrapper localizationWrapper;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
performMigrations();
|
||||
saveDefaultConfig();
|
||||
|
||||
String locale = getConfig().getString("locale", Locale.ENGLISH.toLanguageTag());
|
||||
|
||||
localizationWrapper = new LocalizationWrapper(this, "locale");
|
||||
|
||||
try {
|
||||
YamlConfiguration localeYamlFile = localizationWrapper.getLocale(locale);
|
||||
Localization.load(localeYamlFile);
|
||||
} catch (IOException e) {
|
||||
getLogger().severe("Invalid locale! Please choose a valid locale.");
|
||||
disablePlugin();
|
||||
|
||||
return;
|
||||
} catch (InvalidConfigurationException e) {
|
||||
getLogger().severe(e.getMessage());
|
||||
getLogger().severe("Locale file corrupted or malformed! Please check your locale file.");
|
||||
disablePlugin();
|
||||
|
||||
return;
|
||||
} catch (IllegalArgumentException e) {
|
||||
getLogger().severe(e.getMessage());
|
||||
getLogger().severe("Error in the locale file! Please check your locale file.");
|
||||
getLogger().severe("Maybe caused by a typo");
|
||||
disablePlugin();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
guiManager = new GuiManager();
|
||||
guiViewTracker = new GuiViewTracker();
|
||||
customItemManager = new CustomItemManager(this);
|
||||
|
||||
getServer().getPluginManager().registerEvents(new GuiHandler(this), this);
|
||||
getServer().getPluginManager().registerEvents(new BeehiveHandler(), this);
|
||||
getServer().getPluginManager().registerEvents(new RightClickHandler(this), this);
|
||||
|
||||
boolean isProtectionSuitEnabled = getConfig().getBoolean("beeprotectionsuit.enabled", true);
|
||||
|
||||
if (isProtectionSuitEnabled) {
|
||||
customItemManager = new CustomItemManager(this);
|
||||
|
||||
customItemManager.registerCustomItem("protection_boots", new BeeProtectionBoots());
|
||||
customItemManager.registerCustomItem("protection_leggings", new BeeProtectionLeggings());
|
||||
customItemManager.registerCustomItem("protection_chestplate", new BeeProtectionChestplate());
|
||||
customItemManager.registerCustomItem("protection_helmet", new BeeProtectionHelmet());
|
||||
|
||||
customItemManager.registerRecipes();
|
||||
|
||||
getServer().getPluginManager().registerEvents(new DamageHandler(this), this);
|
||||
if (!loadLocale()) {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
Metrics metrics = new Metrics(this, 7065);
|
||||
registerItems();
|
||||
setupMetrics();
|
||||
|
||||
new UpdateChecker(this, 77224).getVersion(version -> {
|
||||
if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
|
||||
@ -87,15 +53,91 @@ public class BeesPlus extends JavaPlugin {
|
||||
});
|
||||
}
|
||||
|
||||
private void disablePlugin() {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
private void setupMetrics() {
|
||||
Metrics metrics = new Metrics(this, 7065);
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("language_used",
|
||||
() -> getConfig().getString("locale", Locale.ENGLISH.toLanguageTag())));
|
||||
}
|
||||
|
||||
public GuiManager getGuiManager() {
|
||||
return guiManager;
|
||||
@Override
|
||||
public void onDisable() {
|
||||
guiViewTracker.clearViews();
|
||||
}
|
||||
|
||||
private boolean loadLocale() {
|
||||
String locale = getConfig().getString("locale", Locale.ENGLISH.toLanguageTag());
|
||||
LocalizationWrapper localizationWrapper = new LocalizationWrapper(this, "locale");
|
||||
|
||||
try {
|
||||
YamlConfiguration localeYamlFile = localizationWrapper.getLocale(locale);
|
||||
Localization.load(localeYamlFile);
|
||||
} catch (IOException e) {
|
||||
getLogger().severe("Invalid locale! Please choose a valid locale.");
|
||||
|
||||
return false;
|
||||
} catch (InvalidConfigurationException | IllegalArgumentException e) {
|
||||
getLogger().severe(e.getMessage());
|
||||
|
||||
getLogger().severe("Locale file corrupted or malformed! Please check your locale file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void performMigrations() {
|
||||
MigrationsExecutor migrationsExecutor = new MigrationsExecutor(this);
|
||||
|
||||
Field[] beehiveUpgradeTranslation = new Field[] {
|
||||
new Field("beehive_upgrade_item_name", "&6Beehive Upgrade"),
|
||||
new Field("beehive_upgrade_item_lore", "&7Bee capacity: &a+3||&8(Right click to use)"),
|
||||
new Field("beehive_upgrade_success", "&aBeehive upgraded! New population: &7%beesno%&a bees"),
|
||||
new Field("beehive_upgrade_max", "&cError: This beehive has reached the maximum population allowed!")
|
||||
};
|
||||
|
||||
migrationsExecutor.addMigration(1,
|
||||
new AddFields("config.yml", new Field[] {
|
||||
new Field("beehiveupgrade.maximumpopulation", 9)
|
||||
}),
|
||||
new AddFields("locale/en.yml", beehiveUpgradeTranslation),
|
||||
new AddFields("locale/fr.yml", beehiveUpgradeTranslation),
|
||||
new AddFields("locale/hu.yml", beehiveUpgradeTranslation),
|
||||
new AddFields("locale/zh_cn.yml", beehiveUpgradeTranslation),
|
||||
new AddFields("locale/pt.yml", new Field[] {
|
||||
new Field("beehive_upgrade_item_name", "&6Melhorar Colmeia"),
|
||||
new Field("beehive_upgrade_item_lore", "&7População de abelhas: &a+3||&8(Clique direito para usar)"),
|
||||
new Field("beehive_upgrade_success", "&aColmeia melhorada! Nova população: &7%beesno%&a abelhas"),
|
||||
new Field("beehive_upgrade_max", "&cErro: Esta colmeia atingiu a população máxima permitida!")
|
||||
})
|
||||
);
|
||||
|
||||
migrationsExecutor.migrate();
|
||||
}
|
||||
|
||||
private void registerItems() {
|
||||
BeeHiveUpgrade beeHiveUpgrade = new BeeHiveUpgrade(this);
|
||||
|
||||
customItemManager.registerCustomItem("honey_upgrade", beeHiveUpgrade);
|
||||
getServer().getPluginManager().registerEvents(beeHiveUpgrade, this);
|
||||
|
||||
boolean isProtectionSuitEnabled = getConfig().getBoolean("beeprotectionsuit.enabled", true);
|
||||
|
||||
if(isProtectionSuitEnabled) {
|
||||
customItemManager.registerCustomItem("protection_boots", new BeeProtectionBoots());
|
||||
customItemManager.registerCustomItem("protection_leggings", new BeeProtectionLeggings());
|
||||
customItemManager.registerCustomItem("protection_chestplate", new BeeProtectionChestplate());
|
||||
customItemManager.registerCustomItem("protection_helmet", new BeeProtectionHelmet());
|
||||
|
||||
getServer().getPluginManager().registerEvents(new DamageHandler(this), this);
|
||||
}
|
||||
}
|
||||
|
||||
public GuiViewTracker getGuiViewTracker() {
|
||||
return guiViewTracker;
|
||||
}
|
||||
|
||||
public CustomItemManager getCustomItemManager() {
|
||||
return customItemManager;
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,10 @@ public abstract class Gui {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasIcon(int slot) {
|
||||
return icons.containsKey(slot);
|
||||
}
|
||||
|
||||
public Icon getIcon(int slot) {
|
||||
return icons.get(slot);
|
||||
}
|
||||
|
@ -6,51 +6,76 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class GuiHandler implements Listener {
|
||||
|
||||
private final BeesPlus beesPlus;
|
||||
private final GuiManager guiManager;
|
||||
private final GuiViewTracker guiViewTracker;
|
||||
|
||||
public GuiHandler(BeesPlus beesPlus) {
|
||||
this.beesPlus = beesPlus;
|
||||
this.guiManager = beesPlus.getGuiManager();
|
||||
this.guiViewTracker = beesPlus.getGuiViewTracker();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (!(event.getWhoClicked() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (!(event.getWhoClicked() instanceof Player)) return;
|
||||
|
||||
Inventory clickedInventory = event.getInventory();
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
if (guiManager.getOpenedGuis().containsKey(uuid) &&
|
||||
guiManager.getOpenedGuis().get(uuid).getInventory().equals(clickedInventory)) {
|
||||
if (!guiViewTracker.isViewingGui(uuid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
if (guiViewTracker.getView(uuid).getInventoryView() != event.getView()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack clickedItem = event.getCurrentItem();
|
||||
event.setCancelled(true);
|
||||
|
||||
if (clickedItem == null || clickedItem.getType() == Material.AIR) return;
|
||||
ItemStack clickedItem = event.getCurrentItem();
|
||||
|
||||
Gui gui = guiManager.getOpenedGuis().get(uuid);
|
||||
if (clickedItem == null) return;
|
||||
if (clickedItem.getType() == Material.AIR) return;
|
||||
|
||||
Icon icon = gui.getIcon(event.getRawSlot());
|
||||
if (icon == null) return;
|
||||
int slot = event.getRawSlot();
|
||||
|
||||
Consumer<Player> callback = icon.getCallback();
|
||||
if(callback == null) return;
|
||||
View view = guiViewTracker.getView(uuid);
|
||||
Gui gui = view.getGui();
|
||||
|
||||
icon.getCallback().accept(player);
|
||||
if (!gui.hasIcon(slot)) return;
|
||||
|
||||
Icon icon = gui.getIcon(event.getRawSlot());
|
||||
Consumer<Player> callback = icon.getCallback();
|
||||
|
||||
if(callback == null) return;
|
||||
|
||||
icon.getCallback().accept(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
if (!(event.getPlayer() instanceof Player)) return;
|
||||
|
||||
Player player = (Player) event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
if (!guiViewTracker.isViewingGui(uuid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (guiViewTracker.getView(uuid).getInventoryView() == event.getView()) {
|
||||
guiViewTracker.removeView(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent event) {
|
||||
guiViewTracker.removeView(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
package com.tomff.beesplus.core.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GuiManager {
|
||||
|
||||
private HashMap<UUID, Gui> openedGuis;
|
||||
|
||||
public GuiManager() {
|
||||
openedGuis = new HashMap<>();
|
||||
}
|
||||
|
||||
public void openGui(Player player, Gui gui) {
|
||||
openedGuis.put(player.getUniqueId(), gui);
|
||||
|
||||
gui.buildIcons();
|
||||
player.openInventory(gui.getInventory());
|
||||
}
|
||||
|
||||
public HashMap<UUID, Gui> getOpenedGuis() {
|
||||
return openedGuis;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.tomff.beesplus.core.gui;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GuiViewTracker {
|
||||
|
||||
private HashMap<UUID, View> views;
|
||||
|
||||
public GuiViewTracker() {
|
||||
views = new HashMap<>();
|
||||
}
|
||||
|
||||
public boolean isViewingGui(UUID uuid) {
|
||||
return views.containsKey(uuid);
|
||||
}
|
||||
|
||||
public View getView(UUID uuid) {
|
||||
return views.get(uuid);
|
||||
}
|
||||
|
||||
public void removeView(UUID uuid) {
|
||||
views.remove(uuid);
|
||||
}
|
||||
|
||||
public void clearViews() {
|
||||
views.forEach((uuid, view) -> view.getInventoryView().close());
|
||||
}
|
||||
|
||||
public void openGui(Player player, Gui gui) {
|
||||
gui.buildIcons();
|
||||
InventoryView view = player.openInventory(gui.getInventory());
|
||||
|
||||
views.put(player.getUniqueId(), new View(view, gui));
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class Icon {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public Consumer<Player> getCallback() {
|
||||
public Consumer<Player> getCallback() {
|
||||
return callback;
|
||||
}
|
||||
|
||||
|
22
src/main/java/com/tomff/beesplus/core/gui/View.java
Normal file
22
src/main/java/com/tomff/beesplus/core/gui/View.java
Normal file
@ -0,0 +1,22 @@
|
||||
package com.tomff.beesplus.core.gui;
|
||||
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
|
||||
public class View {
|
||||
|
||||
private final InventoryView inventoryView;
|
||||
private final Gui gui;
|
||||
|
||||
public View(InventoryView inventoryView, Gui gui) {
|
||||
this.inventoryView = inventoryView;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public InventoryView getInventoryView() {
|
||||
return inventoryView;
|
||||
}
|
||||
|
||||
public Gui getGui() {
|
||||
return gui;
|
||||
}
|
||||
}
|
@ -9,13 +9,6 @@ public abstract class CustomItem {
|
||||
|
||||
public abstract String[] getRecipe();
|
||||
public abstract Map<Character, Material> getIngredients();
|
||||
public abstract String getName();
|
||||
public abstract Material getMaterial();
|
||||
|
||||
public ItemStack getItem() {
|
||||
return new ItemBuilder(getMaterial())
|
||||
.setName(getName())
|
||||
.build();
|
||||
}
|
||||
public abstract ItemStack getResult();
|
||||
|
||||
}
|
||||
|
@ -24,16 +24,12 @@ public class CustomItemManager {
|
||||
|
||||
public void registerCustomItem(String id, CustomItem customItem) {
|
||||
customItems.put(id, customItem);
|
||||
}
|
||||
|
||||
public void registerRecipes() {
|
||||
customItems.forEach((id, customItem) -> {
|
||||
NamespacedKey namespacedKey = new NamespacedKey(beesPlus, id);
|
||||
ShapedRecipe recipe = new ShapedRecipe(namespacedKey, customItem.getItem());
|
||||
recipe.shape(customItem.getRecipe());
|
||||
customItem.getIngredients().forEach(recipe::setIngredient);
|
||||
NamespacedKey namespacedKey = new NamespacedKey(beesPlus, id);
|
||||
ShapedRecipe recipe = new ShapedRecipe(namespacedKey, customItem.getResult());
|
||||
recipe.shape(customItem.getRecipe());
|
||||
customItem.getIngredients().forEach(recipe::setIngredient);
|
||||
|
||||
Bukkit.addRecipe(recipe);
|
||||
});
|
||||
Bukkit.addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package com.tomff.beesplus.core.items;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -33,6 +37,30 @@ public class ItemBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemBuilder enchant(Enchantment enchantment, int level) {
|
||||
item.addUnsafeEnchantment(enchantment, level);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemBuilder hideEnchantments() {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public <T, Z> ItemBuilder setPersistentData(NamespacedKey key, PersistentDataType<T, Z> type, Z value) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.getPersistentDataContainer().set(key, type, value);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack build() {
|
||||
return item;
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.tomff.beesplus.core.migrations;
|
||||
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class AddFields implements Operation {
|
||||
private File file;
|
||||
private Field[] fields;
|
||||
|
||||
public AddFields(String filePath, Field[] fields) {
|
||||
file = new File(BASE_PATH, filePath);
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws IOException {
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
|
||||
try {
|
||||
config.load(file);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for (Field field : fields) {
|
||||
config.set(field.getPath(), field.getValue());
|
||||
}
|
||||
|
||||
config.save(file);
|
||||
}
|
||||
}
|
19
src/main/java/com/tomff/beesplus/core/migrations/Field.java
Normal file
19
src/main/java/com/tomff/beesplus/core/migrations/Field.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.tomff.beesplus.core.migrations;
|
||||
|
||||
public class Field {
|
||||
private final String path;
|
||||
private final Object value;
|
||||
|
||||
public Field(String path, Object value) {
|
||||
this.path = path;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package com.tomff.beesplus.core.migrations;
|
||||
|
||||
import com.tomff.beesplus.BeesPlus;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class MigrationsExecutor {
|
||||
private int latestVersion;
|
||||
|
||||
private Map<Integer, Operation[]> migrations;
|
||||
private File migrationFileRegistry;
|
||||
private YamlConfiguration yaml;
|
||||
|
||||
private BeesPlus beesPlus;
|
||||
|
||||
public MigrationsExecutor(BeesPlus beesPlus) {
|
||||
this.beesPlus = beesPlus;
|
||||
this.migrations = new HashMap<>();
|
||||
this.yaml = new YamlConfiguration();
|
||||
this.migrationFileRegistry = new File(beesPlus.getDataFolder(), "migration.yml");
|
||||
this.latestVersion = 0;
|
||||
}
|
||||
|
||||
public void addMigration(int version, Operation... operations) {
|
||||
migrations.put(version, operations);
|
||||
|
||||
if (version > latestVersion) {
|
||||
this.latestVersion = version;
|
||||
}
|
||||
}
|
||||
|
||||
public void migrate() {
|
||||
if (hasConfig() && !hasMigrationRegistry()) {
|
||||
loadRegistry();
|
||||
|
||||
migrateFrom(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!loadRegistry()) return;
|
||||
|
||||
int version = yaml.getInt("migration", 0);
|
||||
if (version == latestVersion) return;
|
||||
|
||||
migrateFrom(version);
|
||||
}
|
||||
|
||||
private void migrateFrom(int version) {
|
||||
beesPlus.getLogger().info("Old files detected. Migrating files to migration v" + latestVersion);
|
||||
|
||||
for (int nextVersion = version + 1; nextVersion <= latestVersion; nextVersion++) {
|
||||
performMigration(migrations.get(nextVersion));
|
||||
}
|
||||
|
||||
setCurrentMigration(latestVersion);
|
||||
}
|
||||
|
||||
public void setCurrentMigration(int version) {
|
||||
yaml.set("migration", version);
|
||||
|
||||
try {
|
||||
yaml.save(migrationFileRegistry);
|
||||
} catch (IOException e) {
|
||||
beesPlus.getLogger().severe("An error occurred while trying to update the migration version");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createIfNotExist() {
|
||||
if (!hasMigrationRegistry()) {
|
||||
yaml.set("migration", latestVersion);
|
||||
|
||||
try {
|
||||
yaml.save(migrationFileRegistry);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
beesPlus.getLogger().severe("An error occurred while trying to create the migration registry file!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean loadRegistry() {
|
||||
createIfNotExist();
|
||||
|
||||
try {
|
||||
yaml.load(migrationFileRegistry);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
beesPlus.getLogger().severe("An error occurred while opening the migration registry file.");
|
||||
beesPlus.getLogger().severe("Suggested action: please delete the BeesPlus plugin folder and restart.");
|
||||
e.printStackTrace();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void performMigration(Operation[] operations) {
|
||||
for(Operation operation : operations) {
|
||||
try {
|
||||
operation.execute();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
beesPlus.getLogger().severe("An error occurred while migrating a file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasMigrationRegistry() {
|
||||
return migrationFileRegistry.exists();
|
||||
}
|
||||
|
||||
private boolean hasConfig() {
|
||||
return new File(beesPlus.getDataFolder(), "config.yml").exists();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.tomff.beesplus.core.migrations;
|
||||
|
||||
import com.tomff.beesplus.BeesPlus;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface Operation {
|
||||
File BASE_PATH = JavaPlugin.getPlugin(BeesPlus.class).getDataFolder();
|
||||
|
||||
void execute() throws IOException;
|
||||
}
|
@ -8,8 +8,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Beehive;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Campfire;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class BeeHiveInfo extends Gui {
|
||||
@ -54,26 +52,6 @@ public class BeeHiveInfo extends Gui {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSedated(Location location) {
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
Block block = location.subtract(0, 1, 0).getBlock();
|
||||
|
||||
if (block.getType() == Material.CAMPFIRE && ((Campfire) block.getBlockData()).isLit()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getBeehivePopulation(Beehive beehive) {
|
||||
return beehive.getEntityCount();
|
||||
}
|
||||
|
||||
private int getBeehiveMaxPopulation(Beehive beehive) {
|
||||
return beehive.getMaxEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildIcons() {
|
||||
org.bukkit.block.data.type.Beehive beehiveData = (org.bukkit.block.data.type.Beehive) beehive.getBlockData();
|
||||
@ -87,12 +65,12 @@ public class BeeHiveInfo extends Gui {
|
||||
Icon honeyLevelIcon = new Icon(honeyLevel, null);
|
||||
setIcon(honeyLevelIcon, 10);
|
||||
|
||||
String isSedated = isSedated(beehive.getLocation()) ? Localization.get(Localization.BEEHIVE_INFO_GUI_SEDATED) :
|
||||
String isSedated = beehive.isSedated() ? Localization.get(Localization.BEEHIVE_INFO_GUI_SEDATED) :
|
||||
Localization.get(Localization.BEEHIVE_INFO_GUI_NOT_SEDATED);
|
||||
|
||||
ItemStack beeCapacity = new ItemBuilder(Material.BEE_NEST)
|
||||
.setName(Localization.get(Localization.BEEHIVE_INFO_GUI_BEE_CAPACITY))
|
||||
.setLore(Localization.get(Localization.BEEHIVE_INFO_GUI_BEE_CAPACITY_DESC, getBeehivePopulation(beehive), getBeehiveMaxPopulation(beehive)),
|
||||
.setLore(Localization.get(Localization.BEEHIVE_INFO_GUI_BEE_CAPACITY_DESC, beehive.getEntityCount(), beehive.getMaxEntities()),
|
||||
isSedated)
|
||||
.build();
|
||||
|
||||
@ -114,7 +92,8 @@ public class BeeHiveInfo extends Gui {
|
||||
Icon flowerIcon = new Icon(flower, null);
|
||||
setIcon(flowerIcon, 37);
|
||||
|
||||
HoneyLevelIndicators honeyLevelIndicator = HoneyLevelIndicators.getFromLevel(beehiveData.getHoneyLevel());
|
||||
HoneyLevelIndicators honeyLevelIndicator = HoneyLevelIndicators.getFromLevel(beehiveData.getHoneyLevel(),
|
||||
beehiveData.getMaximumHoneyLevel());
|
||||
setHoneyLevelSlots(honeyLevelIndicator);
|
||||
|
||||
ItemStack filler = new ItemBuilder(Material.WHITE_STAINED_GLASS_PANE)
|
||||
|
@ -4,8 +4,6 @@ import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum HoneyLevelIndicators {
|
||||
|
||||
EMPTY(0, Material.AIR, null, null, 0),
|
||||
@ -28,15 +26,16 @@ public enum HoneyLevelIndicators {
|
||||
this.slots = slots;
|
||||
}
|
||||
|
||||
public static HoneyLevelIndicators getFromLevel(int level) {
|
||||
return Arrays.stream(values())
|
||||
.filter((levelIndicator) -> levelIndicator.level == level)
|
||||
.findFirst()
|
||||
.orElse(VERY_HIGH);
|
||||
}
|
||||
public static HoneyLevelIndicators getFromLevel(int currentHoneyLvl, int maxHoneyLvl) {
|
||||
float ratio = (float) currentHoneyLvl / (float) maxHoneyLvl;
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
if (ratio == 0) return EMPTY;
|
||||
if (ratio <= 0.25) return LOW;
|
||||
if (ratio <= 0.50) return MEDIUM;
|
||||
if (ratio <= 0.75) return HIGH;
|
||||
if (ratio <= 1) return VERY_HIGH;
|
||||
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public ChatColor getColor() {
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.tomff.beesplus.handlers;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockDropItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
public class BeehiveHandler implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBeeHiveBreak(BlockDropItemEvent event) {
|
||||
BlockState blockState = event.getBlockState();
|
||||
Material blockType = blockState.getType();
|
||||
|
||||
if (blockType != Material.BEEHIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItems().size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.getItems()
|
||||
.stream()
|
||||
.filter(this::validBeehive)
|
||||
.findFirst()
|
||||
.ifPresent(item -> saveState(blockState, item));
|
||||
}
|
||||
|
||||
private boolean validBeehive(Item item) {
|
||||
ItemStack itemStack = item.getItemStack();
|
||||
|
||||
return (!itemStack.hasItemMeta() && itemStack.getType() == Material.BEEHIVE);
|
||||
}
|
||||
|
||||
private void saveState(BlockState state, Item item) {
|
||||
ItemStack itemStack = item.getItemStack();
|
||||
BlockStateMeta itemMeta = (BlockStateMeta) itemStack.getItemMeta();
|
||||
|
||||
itemMeta.setBlockState(state);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
item.setItemStack(itemStack);
|
||||
}
|
||||
}
|
@ -41,14 +41,16 @@ public class DamageHandler implements Listener {
|
||||
Player player = (Player) event.getEntity();
|
||||
PlayerInventory playerInventory = player.getInventory();
|
||||
|
||||
if (Stream.of(playerInventory.getArmorContents()).allMatch(Objects::nonNull)) {
|
||||
if (playerInventory.getHelmet().isSimilar(helmet.getItem()) &&
|
||||
playerInventory.getChestplate().isSimilar(chestplate.getItem()) &&
|
||||
playerInventory.getLeggings().isSimilar(leggings.getItem()) &&
|
||||
playerInventory.getBoots().isSimilar(boots.getItem())) {
|
||||
if (!Stream.of(playerInventory.getArmorContents()).allMatch(Objects::nonNull)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setDamage(reduction * event.getDamage());
|
||||
}
|
||||
if (playerInventory.getHelmet().isSimilar(helmet.getResult()) &&
|
||||
playerInventory.getChestplate().isSimilar(chestplate.getResult()) &&
|
||||
playerInventory.getLeggings().isSimilar(leggings.getResult()) &&
|
||||
playerInventory.getBoots().isSimilar(boots.getResult())) {
|
||||
|
||||
event.setDamage(reduction * event.getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package com.tomff.beesplus.handlers;
|
||||
import com.tomff.beesplus.BeesPlus;
|
||||
import com.tomff.beesplus.gui.BeeHiveInfo;
|
||||
import com.tomff.beesplus.gui.BeeInfo;
|
||||
import com.tomff.beesplus.core.gui.GuiManager;
|
||||
import com.tomff.beesplus.core.gui.GuiViewTracker;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Beehive;
|
||||
@ -24,7 +24,7 @@ import java.util.Arrays;
|
||||
public class RightClickHandler implements Listener {
|
||||
|
||||
private final BeesPlus beesPlus;
|
||||
private final GuiManager guiManager;
|
||||
private final GuiViewTracker guiViewTracker;
|
||||
|
||||
private final boolean removeAnger;
|
||||
|
||||
@ -40,7 +40,7 @@ public class RightClickHandler implements Listener {
|
||||
|
||||
public RightClickHandler(BeesPlus beesPlus) {
|
||||
this.beesPlus = beesPlus;
|
||||
this.guiManager = beesPlus.getGuiManager();
|
||||
this.guiViewTracker = beesPlus.getGuiViewTracker();
|
||||
|
||||
removeAnger = beesPlus.getConfig().getBoolean("healing.removeanger", true);
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class RightClickHandler implements Listener {
|
||||
if (player.isSneaking() && player.hasPermission("beesplus.bee.view")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
guiManager.openGui(player, new BeeInfo(bee));
|
||||
guiViewTracker.openGui(player, new BeeInfo(bee));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class RightClickHandler implements Listener {
|
||||
event.setCancelled(true);
|
||||
|
||||
Beehive beehive = (Beehive) clickedBlock.getState();
|
||||
guiManager.openGui(player, new BeeHiveInfo(beehive));
|
||||
guiViewTracker.openGui(player, new BeeHiveInfo(beehive));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
130
src/main/java/com/tomff/beesplus/items/BeeHiveUpgrade.java
Normal file
130
src/main/java/com/tomff/beesplus/items/BeeHiveUpgrade.java
Normal file
@ -0,0 +1,130 @@
|
||||
package com.tomff.beesplus.items;
|
||||
|
||||
import com.tomff.beesplus.BeesPlus;
|
||||
import com.tomff.beesplus.core.items.CustomItem;
|
||||
import com.tomff.beesplus.core.items.ItemBuilder;
|
||||
import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Beehive;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeeHiveUpgrade extends CustomItem implements Listener {
|
||||
|
||||
private NamespacedKey upgradeKey;
|
||||
private int maxPopulation;
|
||||
|
||||
public BeeHiveUpgrade(BeesPlus beesPlus) {
|
||||
upgradeKey = new NamespacedKey(beesPlus, "upgrade");
|
||||
maxPopulation = beesPlus.getConfig().getInt("beehiveupgrade.maximumpopulation", 9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getRecipe() {
|
||||
return new String[] {
|
||||
"CCC",
|
||||
"CHC",
|
||||
"CCC"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Character, Material> getIngredients() {
|
||||
Map<Character, Material> ingredients = new HashMap<>();
|
||||
|
||||
ingredients.put('C', Material.HONEYCOMB);
|
||||
ingredients.put('H', Material.BEEHIVE);
|
||||
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
return new ItemBuilder(Material.HONEYCOMB)
|
||||
.setName(Localization.get(Localization.BEEHIVE_UPGRADE_ITEM_NAME))
|
||||
.setLore(Localization.get(Localization.BEEHIVE_UPGRADE_ITEM_LORE).split("\\|\\|"))
|
||||
.setPersistentData(upgradeKey, PersistentDataType.STRING, "beehive")
|
||||
.enchant(Enchantment.DURABILITY, 1)
|
||||
.hideEnchantments()
|
||||
.build();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHiveClick(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Action action = event.getAction();
|
||||
Block clickedBlock = event.getClickedBlock();
|
||||
|
||||
if (event.getHand() != EquipmentSlot.HAND) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (clickedBlock == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getItem() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (action == Action.RIGHT_CLICK_BLOCK && clickedBlock.getType().equals(Material.BEEHIVE)) {
|
||||
ItemStack handItem = event.getItem();
|
||||
ItemMeta handItemMeta = handItem.getItemMeta();
|
||||
|
||||
if (handItemMeta == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
PersistentDataContainer container = handItemMeta.getPersistentDataContainer();
|
||||
|
||||
if (!container.has(upgradeKey, PersistentDataType.STRING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String upgradeType = container.get(upgradeKey, PersistentDataType.STRING);
|
||||
|
||||
if (upgradeType.equals("beehive")) {
|
||||
event.setCancelled(true);
|
||||
|
||||
Beehive beehive = (Beehive) clickedBlock.getState();
|
||||
|
||||
if (!player.hasPermission("beesplus.beehive.upgrade")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (beehive.getMaxEntities() >= maxPopulation) {
|
||||
Localization.sendMessage(player, Localization.BEEHIVE_UPGRADE_MAX);
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
beehive.setMaxEntities(beehive.getMaxEntities() + 3);
|
||||
beehive.update();
|
||||
|
||||
Localization.sendMessage(player, Localization.BEEHIVE_UPGRADE_SUCCESS, beehive.getMaxEntities());
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 2, 2);
|
||||
|
||||
ItemStack upgradeAmountRemove = handItem.clone();
|
||||
upgradeAmountRemove.setAmount(1);
|
||||
|
||||
player.getInventory().removeItem(upgradeAmountRemove);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
package com.tomff.beesplus.items;
|
||||
|
||||
import com.tomff.beesplus.core.items.CustomItem;
|
||||
import com.tomff.beesplus.core.items.ItemBuilder;
|
||||
import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -28,12 +30,9 @@ public class BeeProtectionBoots extends CustomItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Localization.get(Localization.BEE_PROTECTION_BOOTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
return Material.CHAINMAIL_BOOTS;
|
||||
public ItemStack getResult() {
|
||||
return new ItemBuilder(Material.CHAINMAIL_BOOTS)
|
||||
.setName(Localization.get(Localization.BEE_PROTECTION_BOOTS))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.tomff.beesplus.items;
|
||||
|
||||
import com.tomff.beesplus.core.items.CustomItem;
|
||||
import com.tomff.beesplus.core.items.ItemBuilder;
|
||||
import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -28,12 +30,9 @@ public class BeeProtectionChestplate extends CustomItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Localization.get(Localization.BEE_PROTECTION_CHESTPLATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
return Material.CHAINMAIL_CHESTPLATE;
|
||||
public ItemStack getResult() {
|
||||
return new ItemBuilder(Material.CHAINMAIL_CHESTPLATE)
|
||||
.setName(Localization.get(Localization.BEE_PROTECTION_CHESTPLATE))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.tomff.beesplus.items;
|
||||
|
||||
import com.tomff.beesplus.core.items.CustomItem;
|
||||
import com.tomff.beesplus.core.items.ItemBuilder;
|
||||
import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -28,12 +30,9 @@ public class BeeProtectionHelmet extends CustomItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Localization.get(Localization.BEE_PROTECTION_HELMET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
return Material.CHAINMAIL_HELMET;
|
||||
public ItemStack getResult() {
|
||||
return new ItemBuilder(Material.CHAINMAIL_HELMET)
|
||||
.setName(Localization.get(Localization.BEE_PROTECTION_HELMET))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.tomff.beesplus.items;
|
||||
|
||||
import com.tomff.beesplus.core.items.CustomItem;
|
||||
import com.tomff.beesplus.core.items.ItemBuilder;
|
||||
import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -28,12 +30,9 @@ public class BeeProtectionLeggings extends CustomItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Localization.get(Localization.BEE_PROTECTION_LEGGINGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial() {
|
||||
return Material.CHAINMAIL_LEGGINGS;
|
||||
public ItemStack getResult() {
|
||||
return new ItemBuilder(Material.CHAINMAIL_LEGGINGS)
|
||||
.setName(Localization.get(Localization.BEE_PROTECTION_LEGGINGS))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,10 @@ public enum Localization {
|
||||
BEE_PROTECTION_CHESTPLATE,
|
||||
BEE_PROTECTION_LEGGINGS,
|
||||
BEE_PROTECTION_BOOTS,
|
||||
BEEHIVE_UPGRADE_ITEM_NAME,
|
||||
BEEHIVE_UPGRADE_ITEM_LORE,
|
||||
BEEHIVE_UPGRADE_SUCCESS("beesno"),
|
||||
BEEHIVE_UPGRADE_MAX,
|
||||
HONEY_LOW,
|
||||
HONEY_MEDIUM,
|
||||
HONEY_HIGH,
|
||||
|
@ -23,4 +23,11 @@ beeprotectionsuit:
|
||||
# removeanger: remove anger from bees when they are healed?
|
||||
#
|
||||
healing:
|
||||
removeanger: true
|
||||
removeanger: true
|
||||
|
||||
# Beehive upgrade settings
|
||||
#
|
||||
# maximumSize: maximum number of bees a beehive can be upgraded to
|
||||
#
|
||||
beehiveupgrade:
|
||||
maximumpopulation: 9
|
@ -76,4 +76,15 @@ ride_bee_subtitle: "&6a bee &8%name%&6!"
|
||||
bee_protection_helmet: "&6Bee Protection Helmet"
|
||||
bee_protection_chestplate: "&6Bee Protection Chestplate"
|
||||
bee_protection_leggings: "&6Bee Protection Leggings"
|
||||
bee_protection_boots: "&6Bee Protection Boots"
|
||||
bee_protection_boots: "&6Bee Protection Boots"
|
||||
|
||||
###################
|
||||
# Beehive upgrade item
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6Beehive Upgrade"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7Bee capacity: &a+3||&8(Right click to use)"
|
||||
|
||||
beehive_upgrade_success: "&aBeehive upgraded! New population: &7%beesno%&a bees"
|
||||
beehive_upgrade_max: "&cError: This beehive has reached the maximum population allowed!"
|
@ -82,4 +82,15 @@ ride_bee_subtitle: "&6a abeille &8%name%&6!"
|
||||
bee_protection_helmet: "&6Casque de Protection des Abeilles"
|
||||
bee_protection_chestplate: "&6Plastron de Protection des Abeilles"
|
||||
bee_protection_leggings: "&6Leggings de Protection des Abeilles"
|
||||
bee_protection_boots: "&6Bottes de protection des abeilles"
|
||||
bee_protection_boots: "&6Bottes de protection des abeilles"
|
||||
|
||||
###################
|
||||
# Beehive upgrade item
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6Beehive Upgrade"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7Bee capacity: &a+3||&8(Right click to use)"
|
||||
|
||||
beehive_upgrade_success: "&aBeehive upgraded! New population: &7%beesno%&a bees"
|
||||
beehive_upgrade_max: "&cError: This beehive has reached the maximum population allowed!"
|
@ -82,4 +82,15 @@ ride_bee_subtitle: "&6méhecskén &8%name%&6!"
|
||||
bee_protection_helmet: "&6Méh Védelmi Sisak"
|
||||
bee_protection_chestplate: "&6Méh Védelmi Mellvért"
|
||||
bee_protection_leggings: "&6Méh Védelmi Lábszárvédő"
|
||||
bee_protection_boots: "&6Méh Védelmi Csizma"
|
||||
bee_protection_boots: "&6Méh Védelmi Csizma"
|
||||
|
||||
###################
|
||||
# Méhkas fejlesztő eszköz
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6Méhkas fejlesztés"
|
||||
|
||||
# Használd a || jelzést, hogy elkészíts egy új sort.
|
||||
beehive_upgrade_item_lore: "&7Méh kapacitás: &a+3||&8(Jobb klikk, hogy használd)"
|
||||
|
||||
beehive_upgrade_success: "&aMéhkas felfejlesztve! Új populáció: &7%beesno%&a méh"
|
||||
beehive_upgrade_max: "&cHiba: Ez a méhkas elérte a megengedett maximum populációt!"
|
@ -76,4 +76,15 @@ ride_bee_subtitle: "&6uma abelha &8%name%&6!"
|
||||
bee_protection_helmet: "&6Proteção contra abelhas"
|
||||
bee_protection_chestplate: "&6Proteção contra abelhas"
|
||||
bee_protection_leggings: "&6Proteção contra abelhas"
|
||||
bee_protection_boots: "&6Proteção contra abelhas"
|
||||
bee_protection_boots: "&6Proteção contra abelhas"
|
||||
|
||||
###################
|
||||
# Beehive upgrade item
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6Melhorar Colmeia"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7População de abelhas: &a+3||&8(Clique direito para usar)"
|
||||
|
||||
beehive_upgrade_success: "&aColmeia melhorada! Nova população: &7%beesno%&a abelhas"
|
||||
beehive_upgrade_max: "&cErro: Esta colmeia atingiu a população máxima permitida!"
|
@ -82,4 +82,15 @@ ride_bee_subtitle: "&6一只蜜蜂 &8%name%&6!"
|
||||
bee_protection_helmet: "&6防蜂头盔"
|
||||
bee_protection_chestplate: "&6蜜蜂保护胸甲"
|
||||
bee_protection_leggings: "&6蜜蜂护腿"
|
||||
bee_protection_boots: "&6蜜蜂保护靴"
|
||||
bee_protection_boots: "&6蜜蜂保护靴"
|
||||
|
||||
###################
|
||||
# Beehive upgrade item
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6Beehive Upgrade"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7Bee capacity: &a+3||&8(Right click to use)"
|
||||
|
||||
beehive_upgrade_success: "&aBeehive upgraded! New population: &7%beesno%&a bees"
|
||||
beehive_upgrade_max: "&cError: This beehive has reached the maximum population allowed!"
|
@ -12,4 +12,6 @@ permissions:
|
||||
default: op
|
||||
beesplus.beehive.view:
|
||||
default: op
|
||||
beesplus.beehive.upgrade:
|
||||
default: op
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user