mirror of https://github.com/tomasff/BeesPlus.git
Compare commits
56 Commits
Author | SHA1 | Date |
---|---|---|
Tomás F | c9c5d78a38 | |
Tomás F | 9a94cea232 | |
Tomás F | e7ae6ae440 | |
Tomás F | 1e0c51f607 | |
Tomás F | f224810f45 | |
Tomás F | 8d0f7f3498 | |
Ai Tanabe | 85e8bb3271 | |
Tomás F | bd982cdbe2 | |
Tomás F | 3882d3e21b | |
Tomás F | 0fb9f945f4 | |
Tomás F | 1abf7570bf | |
ErdbeerbaerLP | f29ba54069 | |
Tomás F | 82855f4f86 | |
Tomás F | 5140310b87 | |
Tomás F | 93a01271fe | |
Tomás F | 5f3c97cdcd | |
Tomás F | 65901852d2 | |
Tomás F | 80674bef7a | |
Tomás F | 9f38ec8b19 | |
Tomás F | 0c865fc87f | |
Tomás F | 171e3bcb41 | |
Tomás F | 5e36087c4a | |
Tomás F | 3453aea187 | |
Tomás F | fd39a81542 | |
Tomás F | a65214c24a | |
Tomás F | c965dccdac | |
Tomás F | 559234f0dd | |
Tomás F | c24786020e | |
Tomás F | 2f20b90968 | |
Tomás F | e5ff947996 | |
Tomás F | ea99c15c3d | |
Choi YunJun | c25713f375 | |
Tomás F | 870b2dbe2d | |
Tomás F | a8199f4164 | |
Tomás F | 8e78219e2d | |
Tomás F | 635d4bed77 | |
Tomás F | edc0b47982 | |
Tomás F | 791f69a19d | |
Tomás F | 4c3906f773 | |
Tomás F | f89db04f71 | |
Tomás F | f0facfee7c | |
Tomás F | 17312c4fc4 | |
Tomás F | 3d7562061f | |
Tomás F | 3e74124af2 | |
Tomás F | 7b349d4bc3 | |
Tomás F | 416167e5c1 | |
Tomás F | 5e9f3bc791 | |
Tomás F | 84ab5daf40 | |
Tomás F | 3ba2c17c6a | |
Tomás F | c73fcba252 | |
Tomás F | 1f079051fa | |
Tomás F | b85876c8b3 | |
Tomás F | 512b5c71e8 | |
Tomás F | b71ea15609 | |
Tomás F | cd053c749e | |
Tomás F | a3276feaaf |
|
@ -0,0 +1,2 @@
|
|||
# These are supported funding model platforms
|
||||
ko_fi: tomasff
|
|
@ -0,0 +1,35 @@
|
|||
name: Java CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '17'
|
||||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1.1.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
- name: Upload release artifact
|
||||
id: upload_release_artifact
|
||||
uses: actions/upload-artifact@v2.0.1
|
||||
with:
|
||||
path: ${{ github.workspace }}/target/BeesPlus-*.jar
|
|
@ -2,13 +2,14 @@
|
|||
<img src="static/header.png" alt="Bees+"/>
|
||||
</p>
|
||||
|
||||
![](https://github.com/tomasff/BeesPlus/workflows/Java%20CI/badge.svg)
|
||||
![Java](https://img.shields.io/badge/Java-8%2B-blue)
|
||||
![Spigot Downloads](https://img.shields.io/spiget/downloads/77224)
|
||||
[![CodeFactor](https://www.codefactor.io/repository/github/tomasff/beesplus/badge)](https://www.codefactor.io/repository/github/tomasff/beesplus)
|
||||
|
||||
A Spigot (Minecraft server software) plugin that displays useful bee-related information.
|
||||
|
||||
## Compatibiliy
|
||||
## Compatibility
|
||||
This plugin is only compatible with Minecraft 1.15+ currently.
|
||||
|
||||
## Demo
|
||||
|
@ -21,8 +22,7 @@ This plugin is only compatible with Minecraft 1.15+ currently.
|
|||
|
||||
## Builds
|
||||
The latest plugin builds can be found in it's SpigotMC Forum's page [here](https://www.spigotmc.org/resources/beesplus.77224/).
|
||||
You can also clone this repository and build the plugin with Maven.
|
||||
Please note that this projects depends on `spigot` and not `spigot-api`
|
||||
You can also clone this repository and build the plugin with Maven.
|
||||
|
||||
## Metrics
|
||||
<p align="center">
|
||||
|
|
30
pom.xml
30
pom.xml
|
@ -6,16 +6,21 @@
|
|||
|
||||
<groupId>com.tomff.beesplus</groupId>
|
||||
<artifactId>BeesPlus</artifactId>
|
||||
<version>1.4.5-SNAPSHOT</version>
|
||||
<version>1.6.1</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<junit.jupiter.version>5.6.2</junit.jupiter.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>CodeMC</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
|
@ -25,16 +30,22 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.7</version>
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>${junit.jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -54,7 +65,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
|
@ -80,6 +91,11 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,20 +1,23 @@
|
|||
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 com.tomff.beesplus.localization.LocalizationLoader;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bstats.charts.SimplePie;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -22,80 +25,141 @@ import java.util.Locale;
|
|||
|
||||
public class BeesPlus extends JavaPlugin {
|
||||
|
||||
private GuiManager guiManager;
|
||||
private CustomItemManager customItemManager;
|
||||
private static final int RESOURCE_ID = 77224;
|
||||
private static final int PLUGIN_ID = 7065;
|
||||
|
||||
private LocalizationWrapper localizationWrapper;
|
||||
private static final String LANGUAGE_CHART_ID = "language_used";
|
||||
|
||||
private GuiViewTracker guiViewTracker;
|
||||
private CustomItemManager customItemManager;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
performMigrations();
|
||||
saveDefaultConfig();
|
||||
|
||||
String locale = getConfig().getString("locale", Locale.ENGLISH.toLanguageTag());
|
||||
guiViewTracker = new GuiViewTracker();
|
||||
customItemManager = new CustomItemManager(this);
|
||||
|
||||
localizationWrapper = new LocalizationWrapper(this, "locale");
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
|
||||
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();
|
||||
pluginManager.registerEvents(new GuiHandler(this), this);
|
||||
pluginManager.registerEvents(new BeehiveHandler(), this);
|
||||
pluginManager.registerEvents(new RightClickHandler(this), this);
|
||||
|
||||
if (!loadLocale()) {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
guiManager = new GuiManager();
|
||||
registerItems();
|
||||
setupMetrics();
|
||||
setupUpdateChecker();
|
||||
}
|
||||
|
||||
getServer().getPluginManager().registerEvents(new GuiHandler(this), 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);
|
||||
}
|
||||
|
||||
Metrics metrics = new Metrics(this, 7065);
|
||||
|
||||
new UpdateChecker(this, 77224).getVersion(version -> {
|
||||
private void setupUpdateChecker() {
|
||||
new UpdateChecker(this, RESOURCE_ID).getVersion(version -> {
|
||||
if (!this.getDescription().getVersion().equalsIgnoreCase(version)) {
|
||||
getLogger().info("A new update is available: BeesPlus " + version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void disablePlugin() {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
private void setupMetrics() {
|
||||
Metrics metrics = new Metrics(this, PLUGIN_ID);
|
||||
|
||||
metrics.addCustomChart(new SimplePie(LANGUAGE_CHART_ID,
|
||||
() -> 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());
|
||||
LocalizationLoader localizationLoader = new LocalizationLoader(this, "locale");
|
||||
|
||||
try {
|
||||
YamlConfiguration localeYamlFile = localizationLoader.load(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", new Field[] {
|
||||
new Field("beehive_upgrade_item_name", "&6Méhkas fejlesztés"),
|
||||
new Field("beehive_upgrade_item_lore", "&7Méh kapacitás: &a+3||&8(Jobb klikk, hogy használd)"),
|
||||
new Field("beehive_upgrade_success", "&aMéhkas felfejlesztve! Új populáció: &7%beesno%&a méh"),
|
||||
new Field("beehive_upgrade_max", "&cHiba: Ez a méhkas elérte a megengedett maximum populációt!")
|
||||
}),
|
||||
new AddFields("locale/zh_cn.yml", new Field[] {
|
||||
new Field("beehive_upgrade_item_name", "&6蜂巢升级"),
|
||||
new Field("beehive_upgrade_item_lore", "&7蜜蜂容量: &a+3||&8(右键单击查看)"),
|
||||
new Field("beehive_upgrade_success", "&a蜂巢升级! 新移入: &7%beesno%&a 蜜蜂"),
|
||||
new Field("beehive_upgrade_max", "&c错误:此蜂箱已达到允许的最大数量!")
|
||||
}),
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,7 +21,8 @@ public class UpdateChecker {
|
|||
|
||||
public void getVersion(final Consumer<String> consumer) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(beesPlus, () -> {
|
||||
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream(); Scanner scanner = new Scanner(inputStream)) {
|
||||
try (InputStream inputStream = new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId).openStream();
|
||||
Scanner scanner = new Scanner(inputStream)) {
|
||||
if (scanner.hasNext()) {
|
||||
consumer.accept(scanner.next());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -5,17 +5,10 @@ import org.bukkit.inventory.ItemStack;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class CustomItem {
|
||||
public interface 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();
|
||||
}
|
||||
String[] getRecipe();
|
||||
Map<Character, Material> getIngredients();
|
||||
ItemStack getResult();
|
||||
|
||||
}
|
||||
|
|
|
@ -24,16 +24,13 @@ 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());
|
||||
|
||||
Bukkit.addRecipe(recipe);
|
||||
});
|
||||
recipe.shape(customItem.getRecipe());
|
||||
customItem.getIngredients().forEach(recipe::setIngredient);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.tomff.beesplus.core.items.ItemBuilder;
|
|||
import com.tomff.beesplus.localization.Localization;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class BeeInfo extends Gui {
|
||||
|
@ -26,6 +27,44 @@ public class BeeInfo extends Gui {
|
|||
return Localization.get(Localization.BEE_INFO_GUI_TITLE);
|
||||
}
|
||||
|
||||
public void rideBee(Player player) {
|
||||
double distance = player.getLocation().distance(bee.getLocation());
|
||||
|
||||
if (!player.hasPermission("beesplus.bee.ride")) {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_NO_PERMISSION);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (bee.getAnger() > 0) {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_ANGRY);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (distance <= 6) {
|
||||
if (bee.getPassengers().size() >= 1) {
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_ALREADY);
|
||||
return;
|
||||
}
|
||||
|
||||
player.closeInventory();
|
||||
|
||||
bee.addPassenger(player);
|
||||
|
||||
String title = Localization.get(Localization.RIDE_BEE_TITLE, player.getName());
|
||||
String subtitle = Localization.get(Localization.RIDE_BEE_SUBTITLE, player.getName());
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_FLAP, 10, 1);
|
||||
player.sendTitle(title, subtitle, 10, 25, 10);
|
||||
} else {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_TOO_FAR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildIcons() {
|
||||
ItemStack age = new ItemBuilder(Material.OAK_SIGN)
|
||||
|
@ -64,44 +103,7 @@ public class BeeInfo extends Gui {
|
|||
.setName(Localization.get(Localization.BEE_INFO_GUI_RIDE))
|
||||
.build();
|
||||
|
||||
Icon mountIcon = new Icon(mount, (player) -> {
|
||||
double distance = player.getLocation().distance(bee.getLocation());
|
||||
|
||||
if (!player.hasPermission("beesplus.bee.ride")) {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_NO_PERMISSION);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (bee.getAnger() > 0) {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_ANGRY);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (distance <= 6) {
|
||||
|
||||
if (bee.getPassengers().size() >= 1) {
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_ALREADY);
|
||||
return;
|
||||
}
|
||||
|
||||
player.closeInventory();
|
||||
|
||||
bee.addPassenger(player);
|
||||
|
||||
String title = Localization.get(Localization.RIDE_BEE_TITLE, player.getName());
|
||||
String subtitle = Localization.get(Localization.RIDE_BEE_SUBTITLE, player.getName());
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_FLAP, 10, 1);
|
||||
player.sendTitle(title, subtitle, 10, 25, 10);
|
||||
} else {
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 2, 2);
|
||||
Localization.sendMessage(player, Localization.BEE_INFO_GUI_RIDE_TOO_FAR);
|
||||
}
|
||||
});
|
||||
Icon mountIcon = new Icon(mount, this::rideBee);
|
||||
setIcon(mountIcon, 15);
|
||||
|
||||
ItemStack stung = new ItemBuilder(Material.IRON_SWORD)
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 implements CustomItem, Listener {
|
||||
private NamespacedKey upgradeKey;
|
||||
private int maxPopulation;
|
||||
|
||||
public BeeHiveUpgrade(BeesPlus beesPlus) {
|
||||
upgradeKey = new NamespacedKey(beesPlus, "upgrade");
|
||||
maxPopulation = beesPlus.getConfig().getInt("beehiveupgrade.maximumpopulation", 9);
|
||||
}
|
||||
|
||||
public String[] getRecipe() {
|
||||
return new String[] {
|
||||
"CCC",
|
||||
"CHC",
|
||||
"CCC"
|
||||
};
|
||||
}
|
||||
|
||||
public Map<Character, Material> getIngredients() {
|
||||
Map<Character, Material> ingredients = new HashMap<>();
|
||||
|
||||
ingredients.put('C', Material.HONEYCOMB);
|
||||
ingredients.put('H', Material.BEEHIVE);
|
||||
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
upgradeBeehive(player, beehive, handItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void upgradeBeehive(Player player, Beehive beehive, ItemStack handItem) {
|
||||
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,14 +1,15 @@
|
|||
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;
|
||||
|
||||
public class BeeProtectionBoots extends CustomItem {
|
||||
@Override
|
||||
public class BeeProtectionBoots implements CustomItem {
|
||||
public String[] getRecipe() {
|
||||
return new String[] {
|
||||
"SSS",
|
||||
|
@ -17,7 +18,6 @@ public class BeeProtectionBoots extends CustomItem {
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Character, Material> getIngredients() {
|
||||
Map<Character, Material> ingredients = new HashMap<>();
|
||||
|
||||
|
@ -27,13 +27,9 @@ public class BeeProtectionBoots extends CustomItem {
|
|||
return ingredients;
|
||||
}
|
||||
|
||||
@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,14 +1,15 @@
|
|||
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;
|
||||
|
||||
public class BeeProtectionChestplate extends CustomItem {
|
||||
@Override
|
||||
public class BeeProtectionChestplate implements CustomItem {
|
||||
public String[] getRecipe() {
|
||||
return new String[] {
|
||||
"SSS",
|
||||
|
@ -17,7 +18,6 @@ public class BeeProtectionChestplate extends CustomItem {
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Character, Material> getIngredients() {
|
||||
Map<Character, Material> ingredients = new HashMap<>();
|
||||
|
||||
|
@ -27,13 +27,9 @@ public class BeeProtectionChestplate extends CustomItem {
|
|||
return ingredients;
|
||||
}
|
||||
|
||||
@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,14 +1,15 @@
|
|||
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;
|
||||
|
||||
public class BeeProtectionHelmet extends CustomItem {
|
||||
@Override
|
||||
public class BeeProtectionHelmet implements CustomItem {
|
||||
public String[] getRecipe() {
|
||||
return new String[] {
|
||||
"SSS",
|
||||
|
@ -17,7 +18,6 @@ public class BeeProtectionHelmet extends CustomItem {
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Character, Material> getIngredients() {
|
||||
Map<Character, Material> ingredients = new HashMap<>();
|
||||
|
||||
|
@ -27,13 +27,9 @@ public class BeeProtectionHelmet extends CustomItem {
|
|||
return ingredients;
|
||||
}
|
||||
|
||||
@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,14 +1,15 @@
|
|||
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;
|
||||
|
||||
public class BeeProtectionLeggings extends CustomItem {
|
||||
@Override
|
||||
public class BeeProtectionLeggings implements CustomItem {
|
||||
public String[] getRecipe() {
|
||||
return new String[] {
|
||||
"SSS",
|
||||
|
@ -17,7 +18,6 @@ public class BeeProtectionLeggings extends CustomItem {
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Character, Material> getIngredients() {
|
||||
Map<Character, Material> ingredients = new HashMap<>();
|
||||
|
||||
|
@ -27,13 +27,9 @@ public class BeeProtectionLeggings extends CustomItem {
|
|||
return ingredients;
|
||||
}
|
||||
|
||||
@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,
|
||||
|
|
|
@ -8,17 +8,17 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class LocalizationWrapper {
|
||||
public class LocalizationLoader {
|
||||
|
||||
private final BeesPlus beesPlus;
|
||||
private final String basePath;
|
||||
|
||||
public LocalizationWrapper(BeesPlus beesPlus, String path) {
|
||||
public LocalizationLoader(BeesPlus beesPlus, String path) {
|
||||
this.beesPlus = beesPlus;
|
||||
this.basePath = path;
|
||||
}
|
||||
|
||||
public YamlConfiguration getLocale(String locale) throws IOException, InvalidConfigurationException {
|
||||
public YamlConfiguration load(String locale) throws IOException, InvalidConfigurationException {
|
||||
String path = Paths.get(basePath, locale + ".yml").toString();
|
||||
File localeFile = new File(beesPlus.getDataFolder(), path);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# Language Settings
|
||||
#
|
||||
# Available locale: en, fr, pt, zh_cn, hu
|
||||
# Available locale: en, fr, pt, zh_cn, hu, de
|
||||
#
|
||||
# If you want to create your own, the file name must match the locale name.
|
||||
# Example:
|
||||
|
@ -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
|
|
@ -0,0 +1,90 @@
|
|||
####################
|
||||
# Yes or no
|
||||
####################
|
||||
text_yes: "&aJa"
|
||||
text_no: "&cNein"
|
||||
|
||||
###################
|
||||
# Beehive GUI
|
||||
###################
|
||||
beehive_info_gui_title: "&8Bienenstockinformationen"
|
||||
|
||||
beehive_info_gui_honey_capacity: "&fHonig-Lager"
|
||||
|
||||
beehive_info_gui_honey_capacity_desc: "&aKapazität: &7%current%/%maximum%"
|
||||
|
||||
beehive_info_gui_bee_capacity: "&fBienenwohnraum"
|
||||
|
||||
beehive_info_gui_bee_capacity_desc: "&aKapazität: &7%current%/%maximum% Bienen"
|
||||
|
||||
beehive_info_gui_sedated: "&aSediert"
|
||||
beehive_info_gui_not_sedated: "&cNicht sediert"
|
||||
|
||||
beehive_info_gui_flower: "&fBlume"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_info_gui_no_target_flower_desc: "&aDieser Bienenstock hat||&anoch keine Zielblume!"
|
||||
|
||||
honey_low: "Wenig"
|
||||
honey_medium: "Mittel"
|
||||
honey_high: "Viel"
|
||||
honey_very_high: "Sehr Viel"
|
||||
|
||||
###################
|
||||
# Bee GUI
|
||||
###################
|
||||
bee_info_gui_title: "&8Bienen-Info"
|
||||
|
||||
bee_info_gui_age: "&fAlter"
|
||||
bee_info_gui_age_adult: "&aErwachsen"
|
||||
bee_info_gui_age_baby: "&aBaby"
|
||||
|
||||
bee_info_gui_anger: "&fWut"
|
||||
|
||||
# Use %level% as a placeholder for the bee's anger level
|
||||
bee_info_gui_anger_level_desc: "&aWut-level: &7%level%"
|
||||
|
||||
bee_info_gui_hive_location: "&fBienenstock-Ort"
|
||||
|
||||
# Use || to a create a new line
|
||||
bee_info_gui_no_hive_desc: "&aDiese Biene hat||&anoch keinen Stock!"
|
||||
|
||||
bee_info_gui_ride: "&fReiten"
|
||||
bee_info_gui_ride_no_permission: "&cDu hast nicht die Erlaubnis auf Bienen zu reiten!"
|
||||
bee_info_gui_ride_angry: "&cDu kannst keine wütenden Bienen reiten!"
|
||||
bee_info_gui_ride_already: "&cDiese Biene ist bereits besetzt!"
|
||||
bee_info_gui_ride_too_far: "&cDu bist zu weit von der Biene entfernt!"
|
||||
|
||||
bee_info_gui_has_stung: "&fHat gestochen?"
|
||||
bee_info_gui_has_nectar: "&fHat Nektar?"
|
||||
|
||||
bee_info_gui_health: "&fGesundheit"
|
||||
|
||||
# Use %health% to represent the bee's health
|
||||
bee_info_gui_health_desc: "&a&7%health% ❤"
|
||||
|
||||
###################
|
||||
# Riding a bee title
|
||||
# Use %name% as a placeholder for the player's name
|
||||
###################
|
||||
ride_bee_title: "&6Du reitest nun"
|
||||
ride_bee_subtitle: "&6eine Biene, &8%name%&6!"
|
||||
|
||||
###################
|
||||
# Protection suit name
|
||||
###################
|
||||
bee_protection_helmet: "&6Bienenschutzhelm"
|
||||
bee_protection_chestplate: "&6Bienenschutzhemd"
|
||||
bee_protection_leggings: "&6Bienenschutzhose"
|
||||
bee_protection_boots: "&6Bienenschutzschuhe"
|
||||
|
||||
###################
|
||||
# Beehive upgrade item
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6Bienenstock Upgrade"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7Bienenwohnraum: &a+3||&8(Zum verwenden rechtsklicken)"
|
||||
|
||||
beehive_upgrade_success: "&aBienenstock verbessert! Neuer Wohnraum: &7%beesno%&a Bienen"
|
||||
beehive_upgrade_max: "&cFehler: Dieser Bienenstock hat bereits den maximalen Wohnraum erreicht!"
|
|
@ -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: "&6Amélioration de la ruche"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7Capacité d'abeilles: &a+3||&8(Cliquez à droite pour l'utiliser)"
|
||||
|
||||
beehive_upgrade_success: "&aLa ruche a été améliorée ! Nouvelle population de: &7%beesno%&a abeilles"
|
||||
beehive_upgrade_max: "&cErreur : Cette ruche a atteint sa capacité maximale !"
|
||||
|
|
|
@ -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!"
|
|
@ -0,0 +1,90 @@
|
|||
####################
|
||||
# Yes or no
|
||||
####################
|
||||
text_yes: "&a네"
|
||||
text_no: "&c아니요"
|
||||
|
||||
###################
|
||||
# Beehive GUI
|
||||
###################
|
||||
beehive_info_gui_title: "&8벌집 정보"
|
||||
|
||||
beehive_info_gui_honey_capacity: "&f꿀 용량"
|
||||
|
||||
beehive_info_gui_honey_capacity_desc: "&a용량: &7%current%/%maximum%"
|
||||
|
||||
beehive_info_gui_bee_capacity: "&f벌 용량"
|
||||
|
||||
beehive_info_gui_bee_capacity_desc: "&a용량: &7%current%/%maximum% 벌"
|
||||
|
||||
beehive_info_gui_sedated: "&a진정제"
|
||||
beehive_info_gui_not_sedated: "&c진정제 없음"
|
||||
|
||||
beehive_info_gui_flower: "&f꽃"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_info_gui_no_target_flower_desc: "&a이 벌집은 ||&a설정된 꽃이 없습니다!"
|
||||
|
||||
honey_low: "적음"
|
||||
honey_medium: "중간"
|
||||
honey_high: "많음"
|
||||
honey_very_high: "매우 많음"
|
||||
|
||||
###################
|
||||
# Bee GUI
|
||||
###################
|
||||
bee_info_gui_title: "&8벌 정보"
|
||||
|
||||
bee_info_gui_age: "&f나이"
|
||||
bee_info_gui_age_adult: "&a어른"
|
||||
bee_info_gui_age_baby: "&a아기"
|
||||
|
||||
bee_info_gui_anger: "&f화남"
|
||||
|
||||
# Use %level% as a placeholder for the bee's anger level
|
||||
bee_info_gui_anger_level_desc: "&a화남 레벨: &7%level%"
|
||||
|
||||
bee_info_gui_hive_location: "&f벌집 위치"
|
||||
|
||||
# Use || to a create a new line
|
||||
bee_info_gui_no_hive_desc: "&a이 벌은 ||&a벌집을 가지고 있지 않습니다!"
|
||||
|
||||
bee_info_gui_ride: "&f탑승"
|
||||
bee_info_gui_ride_no_permission: "&c벌을 탈 수 있는 권한이 없습니다!"
|
||||
bee_info_gui_ride_angry: "&c화난 벌을 탈 수 없습니다!"
|
||||
bee_info_gui_ride_already: "&c누군가 이미 이 벌을 타고 있습니다!"
|
||||
bee_info_gui_ride_too_far: "&c벌을 타기에는 거리가 너무 멉니다!"
|
||||
|
||||
bee_info_gui_has_stung: "&f찌르기?"
|
||||
bee_info_gui_has_nectar: "&f꿀?"
|
||||
|
||||
bee_info_gui_health: "&f체력"
|
||||
|
||||
# Use %health% to represent the bee's health
|
||||
bee_info_gui_health_desc: "&a체력: &7%health% ❤"
|
||||
|
||||
###################
|
||||
# Riding a bee title
|
||||
# Use %name% as a placeholder for the player's name
|
||||
###################
|
||||
ride_bee_title: "&6벌에 탑승하였습니다."
|
||||
ride_bee_subtitle: "&6이 벌의 이름은 &8%name%&6!"
|
||||
|
||||
###################
|
||||
# Protection suit name
|
||||
###################
|
||||
bee_protection_helmet: "&6벌 보호 투구"
|
||||
bee_protection_chestplate: "&6벌 보호 흉갑"
|
||||
bee_protection_leggings: "&6벌 보호 바지"
|
||||
bee_protection_boots: "&6벌 보호 부츠"
|
||||
|
||||
###################
|
||||
# Beehive upgrade item
|
||||
###################
|
||||
beehive_upgrade_item_name: "&6벌집 업그레이드"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7벌 용량: &a+3||&8(우클릭으로 사용)"
|
||||
|
||||
beehive_upgrade_success: "&a벌집이 업그레이드 되었습니다! 새로운 벌 수용량: &7%beesno%&a 마리"
|
||||
beehive_upgrade_max: "&c에러: 이 벌집은 수용량 최고치에 도달하였습니다!"
|
|
@ -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: "&6蜂巢升级"
|
||||
|
||||
# Use || to a create a new line
|
||||
beehive_upgrade_item_lore: "&7蜜蜂容量: &a+3||&8(右键单击查看)"
|
||||
|
||||
beehive_upgrade_success: "&a蜂巢升级! 新移入: &7%beesno%&a 蜜蜂"
|
||||
beehive_upgrade_max: "&c错误:此蜂箱已达到允许的最大数量!"
|
|
@ -2,7 +2,7 @@ name: BeesPlus
|
|||
author: Attlantiz
|
||||
version: ${project.version}
|
||||
main: com.tomff.beesplus.BeesPlus
|
||||
api-version: 1.15
|
||||
api-version: 1.18
|
||||
permissions:
|
||||
beesplus.bee.view:
|
||||
default: op
|
||||
|
@ -12,4 +12,5 @@ permissions:
|
|||
default: op
|
||||
beesplus.beehive.view:
|
||||
default: op
|
||||
|
||||
beesplus.beehive.upgrade:
|
||||
default: op
|
||||
|
|
Loading…
Reference in New Issue