diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java
index 82aa14e..4ef8a31 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/ItemsCollector.java
@@ -64,7 +64,7 @@ public ItemsCollector(Minepacks plugin)
itemFilter = plugin.getItemFilter();
}
- private boolean canUseAutoPickup(Player player)
+ public boolean canUseAutoPickup(Player player)
{
// Check if player can use in world
if(plugin.isDisabled(player) != WorldBlacklistMode.None) return false;
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
index de8bd7b..cf7a62d 100644
--- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java
@@ -32,6 +32,7 @@
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Language;
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter;
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*;
+import at.pcgamingfreaks.Minepacks.Bukkit.Placeholder.PlaceholderManager;
import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker;
import at.pcgamingfreaks.Minepacks.MagicValues;
import at.pcgamingfreaks.Plugin.IPlugin;
@@ -79,6 +80,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin, IPlugin
private ItemFilter itemFilter = null;
private Sound openSound = null;
private ItemShortcut shortcut = null;
+ @Getter private PlaceholderManager placeholderManager = null;
public static Minepacks getInstance()
{
@@ -230,6 +232,8 @@ private void load()
if(config.getCommandCooldown() > 0) cooldownManager = new CooldownManager(this);
openSound = config.getOpenSound();
+
+ placeholderManager = new PlaceholderManager(this);
}
private void unload()
@@ -240,6 +244,7 @@ private void unload()
inventoryClearCommand.close();
inventoryClearCommand = null;
}
+ if (placeholderManager != null) { placeholderManager.close(); placeholderManager = null; }
if(collector != null) collector.close();
if(commandManager != null) commandManager.close();
if(collector != null) collector.cancel();
@@ -408,7 +413,8 @@ public boolean isBackpackItem(final @Nullable ItemStack itemStack)
return shortcut.isItemShortcut(itemStack);
}
- public ItemsCollector getItemsCollector() {
+ public ItemsCollector getItemsCollector()
+ {
return collector;
}
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Placeholder/PlaceholderManager.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Placeholder/PlaceholderManager.java
new file mode 100644
index 0000000..96b83eb
--- /dev/null
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Placeholder/PlaceholderManager.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2023 GeorgH93
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package at.pcgamingfreaks.Minepacks.Bukkit.Placeholder;
+
+import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
+import at.pcgamingfreaks.Minepacks.Bukkit.Placeholder.Replacer.AutoPickupEnabled;
+
+public final class PlaceholderManager extends at.pcgamingfreaks.Bukkit.Placeholder.PlaceholderManager
+{
+ public PlaceholderManager(Minepacks plugin)
+ {
+ super(plugin);
+ }
+
+ @Override
+ protected void generatePlaceholdersMap()
+ {
+ Minepacks plugin = (Minepacks) getPlugin();
+ registerPlaceholder(new AutoPickupEnabled(plugin));
+ }
+}
diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Placeholder/Replacer/AutoPickupEnabled.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Placeholder/Replacer/AutoPickupEnabled.java
new file mode 100644
index 0000000..f0122aa
--- /dev/null
+++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Placeholder/Replacer/AutoPickupEnabled.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2023 GeorgH93
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package at.pcgamingfreaks.Minepacks.Bukkit.Placeholder.Replacer;
+
+import at.pcgamingfreaks.Bukkit.Placeholder.PlaceholderName;
+import at.pcgamingfreaks.Bukkit.Placeholder.PlaceholderReplacerBase;
+import at.pcgamingfreaks.Minepacks.Bukkit.ItemsCollector;
+import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
+
+import org.bukkit.OfflinePlayer;
+import org.bukkit.entity.Player;
+import org.jetbrains.annotations.Nullable;
+
+@PlaceholderName(aliases = "IsAutoPickupEnabled")
+public class AutoPickupEnabled extends PlaceholderReplacerBase
+{
+ private final Minepacks plugin;
+
+ public AutoPickupEnabled(Minepacks mp)
+ {
+ this.plugin = mp;
+ }
+
+ @Override
+ public @Nullable String replace(OfflinePlayer player)
+ {
+ ItemsCollector collector = plugin.getItemsCollector();
+ if (collector != null)
+ {
+ if (player instanceof Player)
+ {
+ return collector.canUseAutoPickup((Player) player) ? "true" : "false";
+ }
+ return "offline";
+ }
+ return "disabled";
+ }
+}
diff --git a/pom.xml b/pom.xml
index 83b961f..600e44a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,13 +7,13 @@
pom
- 2.4.21.1
+ 2.4.22-SNAPSHOT
UTF-8
UTF-8
34
20
- 1.0.39-SNAPSHOT
+ 1.0.39.1-SNAPSHOT
1.15.2-R0.1-SNAPSHOT
3.4.1
@@ -37,7 +37,7 @@
Minepacks-Parent
- Minepacks is a backpack plugin with different backpack sizes, multi language support and SQLite and MySQL storage support.
+ Minepacks is a backpack plugin with different backpack sizes, multi-language support and SQLite and MySQL storage support.
https://www.spigotmc.org/resources/19286/
2014