Merge branch 'development'

This commit is contained in:
Christian Koop 2024-10-02 15:32:57 +02:00
commit eaf203ad68
No known key found for this signature in database
GPG Key ID: 6A4A09E8ED946113
23 changed files with 116 additions and 101 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<version>5.0.3</version>
<version>5.3.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>EpicHoppers-API</artifactId>
@ -18,7 +18,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.10.0</version>
<executions>
<execution>
@ -38,7 +38,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
@ -63,7 +63,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -31,17 +31,17 @@ public class Level {
this.description.clear();
this.description.add(getPlugin().getLocale().getMessage("interface.hopper.range")
.processPlaceholder("range", this.range).getMessage());
.processPlaceholder("range", this.range).toText());
this.description.add(getPlugin().getLocale().getMessage("interface.hopper.amount")
.processPlaceholder("amount", this.amount).getMessage());
.processPlaceholder("amount", this.amount).toText());
if (this.linkAmount != 1) {
this.description.add(getPlugin().getLocale().getMessage("interface.hopper.linkamount")
.processPlaceholder("amount", this.linkAmount).getMessage());
.processPlaceholder("amount", this.linkAmount).toText());
}
if (this.filter) {
this.description.add(getPlugin().getLocale().getMessage("interface.hopper.filter")
.processPlaceholder("enabled", getPlugin().getLocale()
.getMessage("general.word.enabled").getMessage()).getMessage());
.getMessage("general.word.enabled").toText()).toText());
}
if (this.teleport) {
this.description.add(getPlugin()
@ -52,8 +52,8 @@ public class Level {
getPlugin()
.getLocale()
.getMessage("general.word.enabled")
.getMessage())
.getMessage());
.toText())
.toText());
}
for (Module module : this.registeredModules) {

View File

@ -80,7 +80,7 @@ public class Methods {
String name = getPlugin().getLocale()
.getMessage("general.nametag.nameformat")
.processPlaceholder("level", level)
.getMessage();
.toText();
return TextUtils.formatText(name);

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<version>5.0.3</version>
<version>5.3.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>EpicHoppers-Plugin</artifactId>
@ -17,7 +17,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version>
<version>3.6.0</version>
<executions>
<execution>
@ -56,10 +56,10 @@
<excludeDefaults>false</excludeDefaults>
<includes>
<include>**/nms/v*/**</include>
<include>**/third_party/net/kyori/**</include>
</includes>
<excludes>
<exclude>**/third_party/org/apache/**</exclude>
<exclude>**/third_party/net/kyori/**</exclude>
<exclude>**/third_party/com/zaxxer/**</exclude>
<exclude>**/third_party/org/jooq/**</exclude>
<exclude>**/third_party/org/mariadb/**</exclude>
@ -95,6 +95,16 @@
<url>https://repo.songoda.com/repository/public/</url>
</repository>
<repository>
<id>bg-repo</id>
<url>https://repo.bg-software.com/repository/api/</url>
</repository>
<repository>
<id>songoda-public</id>
<url>https://repo.songoda.com/repository/minecraft-plugins/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io/</url>
@ -119,21 +129,21 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>FabledSkyBlock</artifactId>
<version>3.0.4</version>
<version>3.0.8-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>EpicFarming</artifactId>
<version>4.1.1</version>
<version>4.2.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
@ -147,7 +157,7 @@
<dependency>
<groupId>com.github.Gypopo</groupId>
<artifactId>EconomyShopGUI-API</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
@ -160,15 +170,15 @@
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>wildstacker</artifactId>
<version>3.5.1</version>
<artifactId>WildStackerAPI</artifactId>
<version>2024.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.rosewood</groupId>
<artifactId>rosestacker</artifactId>
<version>1.5.17</version>
<version>1.5.23</version>
<scope>provided</scope>
</dependency>

View File

@ -235,7 +235,7 @@ public class EpicHoppers extends SongodaPlugin {
ItemStack item = XMaterial.HOPPER.parseItem();
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(TextUtils.formatText(Methods.formatName(level.getLevel())));
String line = getLocale().getMessage("general.nametag.lore").getMessage();
String line = getLocale().getMessage("general.nametag.lore").toText();
if (!line.isEmpty()) {
itemmeta.setLore(Arrays.asList(line.split("\n")));
}

View File

@ -72,7 +72,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
// Whitelist
ItemStack indicatorItem = XMaterial.WHITE_STAINED_GLASS_PANE.parseItem();
ItemMeta indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.whitelist").getMessage());
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.whitelist").toText());
indicatorItem.setItemMeta(indicatorMeta);
int[] whiteSlots = {0, 1, 2, 45, 46, 47};
@ -92,7 +92,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
// Blacklist
indicatorItem = XMaterial.BLACK_STAINED_GLASS_PANE.parseItem();
indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.blacklist").getMessage());
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.blacklist").toText());
indicatorItem.setItemMeta(indicatorMeta);
int[] blackSlots = {3, 4, 5, 48, 49, 50};
@ -113,12 +113,12 @@ public class GUIAutoSellFilter extends CustomizableGui {
indicatorItem = XMaterial.PAPER.parseItem();
indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.infotitle").getMessage());
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.infotitle").toText());
ArrayList<String> loreInfo = new ArrayList<>();
String[] parts = plugin
.getLocale()
.getMessage("interface.autosell-filter.infolore")
.getMessage()
.toText()
.split("\\|");
for (String line : parts) {

View File

@ -64,7 +64,7 @@ public class GUIFilter extends CustomizableGui {
ItemStack it = XMaterial.WHITE_STAINED_GLASS_PANE.parseItem();
ItemMeta itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.whitelist").getMessage());
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.whitelist").toText());
it.setItemMeta(itm);
setButton("back", 8, GuiUtils.createButtonItem(XMaterial.ARROW.parseItem(),
@ -93,7 +93,7 @@ public class GUIFilter extends CustomizableGui {
it = XMaterial.BLACK_STAINED_GLASS_PANE.parseItem();
itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.blacklist").getMessage());
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.blacklist").toText());
it.setItemMeta(itm);
int[] blackSlots = {2, 3, 47, 48};
@ -114,7 +114,7 @@ public class GUIFilter extends CustomizableGui {
it = XMaterial.BARRIER.parseItem();
itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.void").getMessage());
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.void").toText());
it.setItemMeta(itm);
int[] avoid = {4, 5, 49, 50};
@ -134,9 +134,9 @@ public class GUIFilter extends CustomizableGui {
ItemStack itemInfo = XMaterial.PAPER.parseItem();
ItemMeta itemMetaInfo = itemInfo.getItemMeta();
itemMetaInfo.setDisplayName(plugin.getLocale().getMessage("interface.filter.infotitle").getMessage());
itemMetaInfo.setDisplayName(plugin.getLocale().getMessage("interface.filter.infotitle").toText());
ArrayList<String> loreInfo = new ArrayList<>();
String[] parts = plugin.getLocale().getMessage("interface.filter.infolore").getMessage().split("\\|");
String[] parts = plugin.getLocale().getMessage("interface.filter.infolore").toText().split("\\|");
for (String line : parts) {
loreInfo.add(TextUtils.formatText(line));
}
@ -148,11 +148,11 @@ public class GUIFilter extends CustomizableGui {
ItemStack hook = XMaterial.TRIPWIRE_HOOK.parseItem();
ItemMeta hookMeta = hook.getItemMeta();
hookMeta.setDisplayName(plugin.getLocale().getMessage("interface.hopper.rejectsync").getMessage());
hookMeta.setDisplayName(plugin.getLocale().getMessage("interface.hopper.rejectsync").toText());
ArrayList<String> loreHook = new ArrayList<>();
parts = plugin.getLocale().getMessage("interface.hopper.synclore")
.processPlaceholder("amount", filter.getEndPoint() != null ? 1 : 0)
.getMessage().split("\\|");
.toText().split("\\|");
for (String line : parts) {
loreHook.add(TextUtils.formatText(line));
}

View File

@ -79,16 +79,16 @@ public class GUIOverview extends CustomizableGui {
ItemStack pearl = new ItemStack(Material.ENDER_PEARL, 1);
ItemMeta pearlMeta = pearl.getItemMeta();
pearlMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.perltitle").getMessage());
pearlMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.perltitle").toText());
ArrayList<String> lorePearl = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.perllore2")
.processPlaceholder(
"type",
this.hopper.getTeleportTrigger() == TeleportTrigger.DISABLED
? this.plugin.getLocale().getMessage("general.word.disabled").getMessage()
? this.plugin.getLocale().getMessage("general.word.disabled").toText()
: this.hopper.getTeleportTrigger().name()
)
.getMessage()
.toText()
.split("\\|");
for (String line : parts) {
lorePearl.add(TextUtils.formatText(line));
@ -98,9 +98,9 @@ public class GUIOverview extends CustomizableGui {
ItemStack filter = new ItemStack(ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13) ? Material.COMPARATOR : Material.valueOf("REDSTONE_COMPARATOR"), 1);
ItemMeta filterMeta = filter.getItemMeta();
filterMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.filtertitle").getMessage());
filterMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.filtertitle").toText());
ArrayList<String> loreFilter = new ArrayList<>();
parts = this.plugin.getLocale().getMessage("interface.hopper.filterlore").getMessage().split("\\|");
parts = this.plugin.getLocale().getMessage("interface.hopper.filterlore").toText().split("\\|");
for (String line : parts) {
loreFilter.add(TextUtils.formatText(line));
}
@ -110,14 +110,14 @@ public class GUIOverview extends CustomizableGui {
ItemStack item = new ItemStack(Material.HOPPER, 1);
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.currentlevel").processPlaceholder("level", level.getLevel()).getMessage());
itemmeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.currentlevel").processPlaceholder("level", level.getLevel()).toText());
List<String> lore = level.getDescription();
if (this.plugin.getConfig().getBoolean("Main.Allow hopper Upgrading")) {
lore.add("");
if (nextLevel == null) {
lore.add(this.plugin.getLocale().getMessage("interface.hopper.alreadymaxed").getMessage());
lore.add(this.plugin.getLocale().getMessage("interface.hopper.alreadymaxed").toText());
} else {
lore.add(this.plugin.getLocale().getMessage("interface.hopper.nextlevel").processPlaceholder("level", nextLevel.getLevel()).getMessage());
lore.add(this.plugin.getLocale().getMessage("interface.hopper.nextlevel").processPlaceholder("level", nextLevel.getLevel()).toText());
lore.addAll(nextLevel.getDescription());
}
}
@ -127,7 +127,7 @@ public class GUIOverview extends CustomizableGui {
parts = this.plugin.getLocale().getMessage("interface.hopper.boostedstats")
.processPlaceholder("amount", Integer.toString(boostData.getMultiplier()))
.processPlaceholder("time", TimeUtils.makeReadable(boostData.getEndTime() - System.currentTimeMillis()))
.getMessage().split("\\|");
.toText().split("\\|");
lore.add("");
for (String line : parts) {
lore.add(TextUtils.formatText(line));
@ -139,11 +139,11 @@ public class GUIOverview extends CustomizableGui {
ItemStack hook = new ItemStack(Material.TRIPWIRE_HOOK, 1);
ItemMeta hookMeta = hook.getItemMeta();
hookMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.synchopper").getMessage());
hookMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.synchopper").toText());
ArrayList<String> loreHook = new ArrayList<>();
parts = this.plugin.getLocale().getMessage("interface.hopper.synclore")
.processPlaceholder("amount", this.hopper.getLinkedBlocks().stream().distinct().count())
.getMessage().split("\\|");
.toText().split("\\|");
for (String line : parts) {
loreHook.add(TextUtils.formatText(line));
}

View File

@ -117,7 +117,7 @@ public class GUISmeltable extends CustomizableGui {
meta.setLore(Arrays.asList(TextUtils.formatText(" &7-> &e" + CompatibleMaterial.getFurnaceResult(material).getType().name()),
TextUtils.formatText("&7Enabled: &6" + String.valueOf(enabled).toLowerCase() + "&7."),
"",
this.plugin.getLocale().getMessage("interface.hopper.toggle").getMessage()));
this.plugin.getLocale().getMessage("interface.hopper.toggle").toText()));
item.setItemMeta(meta);
return item;

View File

@ -93,6 +93,7 @@ public class HopperImpl implements Hopper {
this.level = getLevelManager().getLevel((int) map.get("level"));
this.placedBy = UUID.fromString((String) map.get("placed_by"));
this.lastPlayerOpened = map.get("last_opened_by") != null ? UUID.fromString((String) map.get("last_opened_by")) : null;
this.teleportTrigger = TeleportTrigger.valueOf((String) map.get("teleport_trigger"));
DataManager dataManager = EpicHoppers.getPlugin(EpicHoppers.class).getDataManager();
dataManager.getDatabaseConnector().connectDSL(dslContext -> {

View File

@ -1,7 +1,6 @@
package com.craftaro.epichoppers.hopper.levels;
import com.craftaro.core.nms.NmsManager;
import com.craftaro.core.nms.nbt.NBTCore;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBT;
import com.craftaro.core.third_party.de.tr7zw.nbtapi.NBTItem;
import com.craftaro.epichoppers.hopper.levels.modules.Module;
import org.bukkit.ChatColor;
@ -45,9 +44,7 @@ public class LevelManagerImpl implements LevelManager {
@Override
public boolean isEpicHopper(ItemStack item) {
NBTCore nbt = NmsManager.getNbt();
if (nbt.of(item).has("level")) {
if (NBT.readNbt(item).hasTag("level")) {
return true;
}

View File

@ -192,10 +192,10 @@ public class ModuleAutoCrafting extends Module {
ItemStack crafting = XMaterial.CRAFTING_TABLE.parseItem();
ItemMeta craftingMeta = crafting.getItemMeta();
craftingMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.craftingtitle")
.getMessage());
.toText());
ArrayList<String> lorecrafting = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.craftinglore")
.getMessage().split("\\|");
.toText().split("\\|");
for (String line : parts) {
lorecrafting.add(TextUtils.formatText(line));
}
@ -223,8 +223,8 @@ public class ModuleAutoCrafting extends Module {
public String getDescription() {
return this.plugin.getLocale()
.getMessage("interface.hopper.crafting")
.processPlaceholder("enabled", this.plugin.getLocale().getMessage("general.word.enabled").getMessage())
.getMessage();
.processPlaceholder("enabled", this.plugin.getLocale().getMessage("general.word.enabled").toText())
.toText();
}
@Override

View File

@ -147,13 +147,13 @@ public class ModuleAutoSell extends Module {
ItemStack sellItem = XMaterial.SUNFLOWER.parseItem();
ItemMeta sellMeta = sellItem.getItemMeta();
sellMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.selltitle").getMessage());
sellMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.selltitle").toText());
ArrayList<String> loreSell = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.selllore")
.processPlaceholder("timeleft", getTime(hopper) == -9999 ? "" : (int) Math.floor(getTime(hopper) / 20))
.processPlaceholder("state", isNotifying(hopper))
.getMessage()
.processPlaceholder("timeleft", String.valueOf(getTime(hopper) == -9999 ? "" : (int) Math.floor(getTime(hopper) / 20)))
.processPlaceholder("state", String.valueOf(isNotifying(hopper)))
.toText()
.split("\\|");
for (String line : parts) {
@ -192,7 +192,7 @@ public class ModuleAutoSell extends Module {
return this.plugin.getLocale()
.getMessage("interface.hopper.autosell")
.processPlaceholder("seconds", (int) Math.floor(this.timeOut / 20))
.getMessage();
.toText();
}
@Override

View File

@ -92,15 +92,15 @@ public class ModuleAutoSmelter extends Module {
public ItemStack getGUIButton(Hopper hopper) {
ItemStack block = XMaterial.IRON_INGOT.parseItem();
ItemMeta blockMeta = block.getItemMeta();
blockMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.smelttitle").getMessage());
blockMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.smelttitle").toText());
ArrayList<String> loreBlock = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.smeltlore")
.processPlaceholder("timeleft", getTime(hopper) == -9999 ? "" : (int) Math.floor(getTime(hopper) / 20.0))
.processPlaceholder("timeleft", String.valueOf(getTime(hopper) == -9999 ? "" : (int) Math.floor(getTime(hopper) / 20.0)))
.processPlaceholder("enabled", isEnabled(hopper) ?
this.plugin.getLocale().getMessage("general.word.enabled").getMessage() :
this.plugin.getLocale().getMessage("general.word.disabled").getMessage()
this.plugin.getLocale().getMessage("general.word.enabled").toText() :
this.plugin.getLocale().getMessage("general.word.disabled").toText()
)
.getMessage()
.toText()
.split("\\|");
for (String line : parts) {
loreBlock.add(TextUtils.formatText(line));
@ -138,7 +138,7 @@ public class ModuleAutoSmelter extends Module {
@Override
public String getDescription() {
return this.plugin.getLocale().getMessage("interface.hopper.autosmelt")
.processPlaceholder("ticks", (int) Math.floor(this.timeOut / 20.0)).getMessage();
.processPlaceholder("ticks", (int) Math.floor(this.timeOut / 20.0)).toText();
}
private int getTime(Hopper hopper) {

View File

@ -1,6 +1,7 @@
package com.craftaro.epichoppers.hopper.levels.modules;
import com.craftaro.core.SongodaPlugin;
import com.craftaro.core.chat.AdventureUtils;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.utils.TextUtils;
@ -127,22 +128,20 @@ public class ModuleBlockBreak extends Module {
@Override
public ItemStack getGUIButton(Hopper hopper) {
ItemStack block = new ItemStack(Material.IRON_ORE, 1);
ItemMeta blockMeta = block.getItemMeta();
blockMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.blocktitle").getMessage());
AdventureUtils.formatItemName(block, this.plugin.getLocale().getMessage("interface.hopper.blocktitle").getMessage());
ArrayList<String> loreBlock = new ArrayList<>();
String[] parts = this.plugin.getLocale()
.getMessage("interface.hopper.blocklore")
.processPlaceholder("enabled", isEnabled(hopper)
? this.plugin.getLocale().getMessage("general.word.enabled").getMessage()
: this.plugin.getLocale().getMessage("general.word.disabled").getMessage()
? this.plugin.getLocale().getMessage("general.word.enabled").toText()
: this.plugin.getLocale().getMessage("general.word.disabled").toText()
)
.getMessage()
.toText()
.split("\\|");
for (String line : parts) {
loreBlock.add(TextUtils.formatText(line));
}
blockMeta.setLore(loreBlock);
block.setItemMeta(blockMeta);
AdventureUtils.formatItemLore(block, loreBlock);
return block;
}
@ -159,7 +158,7 @@ public class ModuleBlockBreak extends Module {
@Override
public String getDescription() {
return this.plugin.getLocale().getMessage("interface.hopper.blockbreak")
.processPlaceholder("ticks", this.ticksPerBreak).getMessage();
.processPlaceholder("ticks", this.ticksPerBreak).toText();
}
@Override

View File

@ -1,6 +1,7 @@
package com.craftaro.epichoppers.hopper.levels.modules;
import com.craftaro.core.SongodaPlugin;
import com.craftaro.core.chat.AdventureUtils;
import com.craftaro.core.gui.GuiManager;
import com.craftaro.core.utils.TextUtils;
import com.craftaro.epichoppers.hopper.Hopper;
@ -67,17 +68,15 @@ public class ModuleMobHopper extends Module {
@Override
public ItemStack getGUIButton(Hopper hopper) {
ItemStack block = new ItemStack(Material.ROTTEN_FLESH, 1);
ItemMeta blockMeta = block.getItemMeta();
blockMeta.setDisplayName(this.plugin.getLocale().getMessage("interface.hopper.mobtitle").getMessage());
AdventureUtils.formatItemName(block, this.plugin.getLocale().getMessage("interface.hopper.mobtitle").getMessage());
ArrayList<String> loreBlock = new ArrayList<>();
String[] parts = this.plugin.getLocale().getMessage("interface.hopper.moblore").processPlaceholder("enabled",
isEnabled(hopper) ? this.plugin.getLocale().getMessage("general.word.enabled").getMessage()
: this.plugin.getLocale().getMessage("general.word.disabled").getMessage()).getMessage().split("\\|");
isEnabled(hopper) ? this.plugin.getLocale().getMessage("general.word.enabled").toText()
: this.plugin.getLocale().getMessage("general.word.disabled").toText()).toText().split("\\|");
for (String line : parts) {
loreBlock.add(TextUtils.formatText(line));
}
blockMeta.setLore(loreBlock);
block.setItemMeta(blockMeta);
AdventureUtils.formatItemLore(block, loreBlock);
return block;
}
@ -96,7 +95,7 @@ public class ModuleMobHopper extends Module {
return this.plugin.getLocale()
.getMessage("interface.hopper.mobhopper")
.processPlaceholder("ticks", this.amount)
.getMessage();
.toText();
}
public boolean isEnabled(Hopper hopper) {

View File

@ -8,7 +8,6 @@ import com.craftaro.core.locale.Locale;
import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial;
import com.craftaro.core.utils.TextUtils;
import com.craftaro.epichoppers.hopper.Hopper;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.settings.Settings;
import com.craftaro.epichoppers.utils.Methods;
import com.craftaro.epichoppers.utils.StorageContainerCache;
@ -192,11 +191,11 @@ public class ModuleSuction extends Module {
Locale locale = this.plugin.getLocale();
ItemStack item = XMaterial.CAULDRON.parseItem();
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(locale.getMessage("interface.hopper.suctiontitle").getMessage());
meta.setDisplayName(locale.getMessage("interface.hopper.suctiontitle").toText());
List<String> lore = new ArrayList<>();
String[] parts = locale.getMessage("interface.hopper.suctionlore")
.processPlaceholder("status", isEnabled(hopper) ? locale.getMessage("general.word.enabled").getMessage() : locale.getMessage("general.word.disabled").getMessage())
.processPlaceholder("radius", getRadius(hopper)).getMessage().split("\\|");
.processPlaceholder("status", isEnabled(hopper) ? locale.getMessage("general.word.enabled").toText() : locale.getMessage("general.word.disabled").toText())
.processPlaceholder("radius", getRadius(hopper)).toText().split("\\|");
for (String line : parts) {
lore.add(TextUtils.formatText(line));
}
@ -248,6 +247,6 @@ public class ModuleSuction extends Module {
return this.plugin.getLocale()
.getMessage("interface.hopper.suction")
.processPlaceholder("suction", this.maxSearchRadius)
.getMessage();
.toText();
}
}

View File

@ -52,7 +52,7 @@ public class BlockListeners implements Listener {
int max = maxHoppers(player);
if (max != -1 && amt > max) {
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.toomany").processPlaceholder("amount", max).getMessage());
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.toomany").processPlaceholder("amount", max).toText());
e.setCancelled(true);
return;
}
@ -64,7 +64,7 @@ public class BlockListeners implements Listener {
}
if (!this.plugin.getHopperManager().isReady()) {
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.notready").getMessage());
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.notready").toText());
e.setCancelled(true);
return;
}
@ -121,7 +121,7 @@ public class BlockListeners implements Listener {
}
if (!this.plugin.getHopperManager().isReady()) {
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.notready").getMessage());
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.notready").toText());
event.setCancelled(true);
return;
}

View File

@ -1,7 +1,7 @@
package com.craftaro.epichoppers.listeners;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.core.nms.NmsManager;
import com.craftaro.core.nms.Nms;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.settings.Settings;
import com.craftaro.epichoppers.EpicHoppers;
@ -140,12 +140,12 @@ public class HopperListeners implements Listener {
// we need to instead cancel and manually remove the item to move
source.removeItem(moveInstead);
if (sourceLocation != null) {
NmsManager.getWorld().updateAdjacentComparators(sourceLocation.getBlock());
Nms.getImplementations().getWorld().updateAdjacentComparators(sourceLocation.getBlock());
}
// now add it to the hopper
destination.addItem(moveInstead);
if (destinationLocation != null) {
NmsManager.getWorld().updateAdjacentComparators(destinationLocation.getBlock());
Nms.getImplementations().getWorld().updateAdjacentComparators(destinationLocation.getBlock());
}
}
return;

View File

@ -1,5 +1,6 @@
package com.craftaro.epichoppers.listeners;
import com.craftaro.core.chat.AdventureUtils;
import com.craftaro.core.hooks.ProtectionManager;
import com.craftaro.core.hooks.WorldGuardHook;
import com.craftaro.epichoppers.hopper.Hopper;
@ -63,7 +64,7 @@ public class InteractListeners implements Listener {
}
if (Settings.USE_PROTECTION_PLUGINS.getBoolean() && ProtectionManager.canInteract(player, event.getClickedBlock().getLocation()) && WorldGuardHook.isInteractAllowed(event.getClickedBlock().getLocation())) {
player.sendMessage(this.plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage());
AdventureUtils.sendMessage(this.plugin, this.plugin.getLocale().getMessage("event.general.protected").getPrefixedMessage());
return;
}
@ -81,7 +82,7 @@ public class InteractListeners implements Listener {
if (playerData.getSyncType() == null) {
if (event.getClickedBlock().getType() == Material.HOPPER) {
if (!this.plugin.getHopperManager().isReady()) {
player.sendMessage(this.plugin.getLocale().getMessage("event.hopper.notready").getMessage());
AdventureUtils.sendMessage(this.plugin, this.plugin.getLocale().getMessage("event.hopper.notready").getPrefixedMessage());
event.setCancelled(true);
return;
}

View File

@ -1,7 +1,7 @@
package com.craftaro.epichoppers.tasks;
import com.craftaro.core.compatibility.ServerVersion;
import com.craftaro.epichoppers.boost.BoostData;
import com.craftaro.epichoppers.boost.BoostDataImpl;
import com.craftaro.epichoppers.containers.CustomContainer;
import com.craftaro.epichoppers.hopper.HopperImpl;
import com.craftaro.epichoppers.hopper.levels.modules.ModuleAutoCrafting;
@ -18,6 +18,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Hopper;
import org.bukkit.block.data.Directional;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Minecart;
@ -81,11 +82,19 @@ public class HopTask extends BukkitRunnable {
int maxToMove = hopper.getLevel().getAmount() * (boostData == null ? 1 : boostData.getMultiplier());
// Get hopper state data.
HopperDirection hopperDirection;
Location pointingLocation;
if (ServerVersion.isServerVersionBelow(ServerVersion.V1_20)){
Hopper hopperState = (Hopper) block.getState();
HopperDirection hopperDirection = HopperDirection.getDirection(hopperState.getRawData());
Location pointingLocation = hopperDirection.getLocation(location);
hopperDirection = HopperDirection.getDirection(hopperState.getRawData());
pointingLocation = hopperDirection.getLocation(location);
}
else{
hopperDirection = HopperDirection.valueOf(((Directional) block.getBlockData()).getFacing().name());
BlockFace blockFace = hopperDirection.getDirectionFacing();
pointingLocation = block.getLocation().getBlock().getRelative(blockFace).getLocation();
}
final StorageContainerCache.Cache hopperCache = StorageContainerCache.getCachedInventory(block);
// Create list to hold blocked materials.
List<Material> blockedMaterials = new ArrayList<>();

View File

@ -39,7 +39,7 @@ public enum HopperDirection {
return location.clone().add(getX(), getY(), getZ());
}
public BlockFace getDirection() {
public BlockFace getDirectionFacing() {
switch (this) {
case NORTH:
return BlockFace.NORTH;

View File

@ -7,7 +7,7 @@
<groupId>com.craftaro</groupId>
<artifactId>EpicHoppers-Parent</artifactId>
<packaging>pom</packaging>
<version>5.0.3</version>
<version>5.3.0</version>
<!-- Run 'mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.Y.Z-DEV' to update version recursively -->
<modules>
@ -20,7 +20,7 @@
<url>https://craftaro.com/marketplace/product/15</url>
<properties>
<craftaro.coreVersion>3.0.0-SNAPSHOT</craftaro.coreVersion>
<craftaro.coreVersion>3.5.0-SNAPSHOT</craftaro.coreVersion>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.target>1.8</maven.compiler.target>