Initial release
This commit is contained in:
1 parent
8ebc156b5b
commit
c0b182ea01
17 files changed
+325
-286
No files matched your search
@@ -1,12 +1,6 @@
|
||||
[submodule "libs/Utilities-OG"]
|
||||
path = libs/Utilities-OG
|
||||
url = https://github.com/true-og/Utilities-OG
|
||||
[submodule "libs/GxUI-OG"]
|
||||
path = libs/GxUI-OG
|
||||
url = https://github.com/true-og/GxUI-OG
|
||||
[submodule "libs/DiamondBank-OG"]
|
||||
path = libs/DiamondBank-OG
|
||||
url = https://github.com/true-og/DiamondBank-OG
|
||||
[submodule "libs/Chat-OG"]
|
||||
path = libs/Chat-OG
|
||||
url = https://github.com/true-og/Chat-OG
|
||||
@@ -1,6 +1,6 @@
|
||||
# Template-OG
|
||||
# MiniPlaceholders-DiamondBank-OG
|
||||
|
||||
TrueOG Network's standard Java plugin template.
|
||||
Adds the MiniPlaceholder \<diamondbankog\_balance\> to servers running [DiamondBank-OG](https://github.com/true-og/DiamondBank-OG).
|
||||
|
||||
Gradle Version: 8.14.3
|
||||
|
||||
@@ -10,4 +10,4 @@ Minecraft API: 1.19
|
||||
|
||||
API Jar: 1.19.4 Purpur
|
||||
|
||||
Template-OG is public domain software released under the terms of [The Unlicense](https://github.com/true-og/Template-OG/blob/main/LICENSE).
|
||||
MiniPlaceholders-DiamondBank-OG is public domain software released under the terms of [The Unlicense](https://github.com/true-og/Template-OG/blob/main/LICENSE).
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/bash
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
|
||||
# Fetch all submodule content.
|
||||
git submodule update --force --recursive --init
|
||||
+1
-16
@@ -29,7 +29,7 @@ java {
|
||||
kotlin { jvmToolchain(17) }
|
||||
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "net.trueog.template-og" // Declare bundle identifier.
|
||||
group = "net.trueog.miniplaceholders-diamondbank-og" // Declare bundle identifier.
|
||||
|
||||
version = "1.0" // Declare plugin version (will be in .jar).
|
||||
|
||||
@@ -48,17 +48,6 @@ repositories {
|
||||
mavenCentral() // Import the Maven Central Maven Repository.
|
||||
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
|
||||
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
|
||||
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let { // TrueOG Bootstrap mavenLocal().
|
||||
val dir = file(it)
|
||||
if (dir.isDirectory) {
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
|
||||
maven { url = uri("file://${dir.absolutePath}") }
|
||||
} else {
|
||||
logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
mavenLocal()
|
||||
}
|
||||
} ?: logger.error("TrueOG Bootstrap not found, defaulting to ~/.m2 for mavenLocal()")
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
@@ -66,10 +55,6 @@ dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
|
||||
compileOnly("io.github.miniplaceholders:miniplaceholders-api:2.2.3") // Import MiniPlaceholders API.
|
||||
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
|
||||
compileOnlyApi(project(":libs:GxUI-OG")) // Import TrueOG Network GxUI-OG Java API (from source).
|
||||
compileOnlyApi(project(":libs:Chat-OG")) {
|
||||
attributes { attribute(kotlinAttribute, true) }
|
||||
} // Import TrueOG Network Chat-OG Kotlin API (from source).
|
||||
compileOnlyApi(project(":libs:DiamondBank-OG")) {
|
||||
attributes { attribute(kotlinAttribute, true) }
|
||||
} // Import TrueOG network DiamondBank-OG Kotlin API (from source).
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ configurations.creating {
|
||||
|
||||
configure<EclipseModel> {
|
||||
project {
|
||||
name = "Template-OG-Plugin"
|
||||
name = "MiniPlaceholders-OG-Plugin"
|
||||
}
|
||||
classpath {
|
||||
plusConfigurations.add(ideLibs)
|
||||
|
||||
-1
Submodule libs/Chat-OG deleted from 4a64b47f41.
+1
-1
Submodule libs/DiamondBank-OG updated: 02cfbab97d...71f99bc83e.
-1
Submodule libs/GxUI-OG deleted from d2c5221291.
+1
-1
@@ -1,4 +1,4 @@
|
||||
rootProject.name = "Template-OG"
|
||||
rootProject.name = "MiniPlaceholders-DiamondBank-OG"
|
||||
|
||||
ProcessBuilder("sh", "bootstrap.sh").directory(rootDir).inheritIO().start().let {
|
||||
if (it.waitFor() != 0) throw GradleException("bootstrap.sh failed")
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// Author: NotAlexNoyle.
|
||||
package plugin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import net.trueog.diamondbankog.DiamondBankException;
|
||||
import net.trueog.diamondbankog.PlayerBalanceChangedEvent;
|
||||
import net.trueog.diamondbankog.PlayerBalanceChangedListener;
|
||||
|
||||
// Fetches the balance for the MiniPlaceholder upon balance changes.
|
||||
public class BalanceChangeListener implements PlayerBalanceChangedListener {
|
||||
|
||||
// Hook into DiamondBank-OG's balance change event.
|
||||
@Override
|
||||
public void onUpdate(PlayerBalanceChangedEvent event) {
|
||||
|
||||
// Get the UUID of the player whose balance changed.
|
||||
final UUID playerUUID = event.getUuid();
|
||||
|
||||
// Fetch diamond shard balance asynchronously.
|
||||
Bukkit.getScheduler().runTaskAsynchronously(DiamondBankMiniPlaceholdersOG.getPlugin(), () -> {
|
||||
|
||||
try {
|
||||
|
||||
// Ask DiamondBank-OG for the player's total shard count.
|
||||
final long totalShards = DiamondBankMiniPlaceholdersOG.diamondBankAPI().getTotalShards(playerUUID);
|
||||
|
||||
// Cache the new balance for reference by the MiniPlaceholder.
|
||||
DiamondBankMiniPlaceholdersOG.cacheShardTotal(playerUUID, totalShards);
|
||||
|
||||
}
|
||||
// If the DiamondBank-OG economy is disabled, do this...
|
||||
catch (DiamondBankException.EconomyDisabledException error) {
|
||||
|
||||
// Commit sudoku, inform console of the DiamondBank-OG economy being disabled.
|
||||
DiamondBankMiniPlaceholdersOG.disableSelf("The DiamondBank-OG economy is disabled — disabling "
|
||||
+ DiamondBankMiniPlaceholdersOG.getPlugin().getName() + "!");
|
||||
|
||||
}
|
||||
// If the DiamondBank-OG database is having problems, do this...
|
||||
catch (DiamondBankException.DatabaseException error) {
|
||||
|
||||
// Commit sudoku, inform console of the DiamondBank-OG database error.
|
||||
DiamondBankMiniPlaceholdersOG.disableSelf("DiamondBank-OG database error — disabling "
|
||||
+ DiamondBankMiniPlaceholdersOG.getPlugin().getName() + ". Cause: " + error.getMessage());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// Author: NotAlexNoyle.
|
||||
package plugin;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.trueog.diamondbankog.DiamondBankAPIJava;
|
||||
import net.trueog.diamondbankog.DiamondBankException;
|
||||
import net.trueog.utilitiesog.UtilitiesOG;
|
||||
|
||||
// Main plugin class.
|
||||
public class DiamondBankMiniPlaceholdersOG extends JavaPlugin {
|
||||
|
||||
// Declare internal fields.
|
||||
private static DiamondBankMiniPlaceholdersOG plugin;
|
||||
private static DiamondBankAPIJava diamondBankAPI;
|
||||
private static String pluginPrefix;
|
||||
private static FileConfiguration config;
|
||||
// Cache for total shards for each player.
|
||||
private static final Map<UUID, Long> SHARD_CACHE = new ConcurrentHashMap<>();
|
||||
// Helps prevent duplicate fetches.
|
||||
private static final Set<UUID> IN_FLIGHT = ConcurrentHashMap.newKeySet();
|
||||
|
||||
// When the server loads the plugin, do this...
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
// Populate the plugin instance with the real live instance.
|
||||
plugin = this;
|
||||
|
||||
// Get the plugin name and format it into a prefix.
|
||||
pluginPrefix = ("[" + getPlugin().getName() + "]");
|
||||
|
||||
// Copy the config file from the jar to the server's filesystem.
|
||||
saveDefaultConfig();
|
||||
|
||||
// Get the config file from the server's filesystem.
|
||||
config = getConfig();
|
||||
|
||||
// Initialize the DiamondBank-OG API.
|
||||
final RegisteredServiceProvider<DiamondBankAPIJava> provider = getServer().getServicesManager()
|
||||
.getRegistration(DiamondBankAPIJava.class);
|
||||
|
||||
// If the DiamondBank-OG API failed to initialize, do this...
|
||||
if (provider == null) {
|
||||
|
||||
// Tell Bukkit to disable this plugin, and inform the console.
|
||||
disableSelf("DiamondBank-OG API is null – disabling " + getPlugin().getName() + "!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Assign the active instance of DiamondBank-OG to the API handler.
|
||||
diamondBankAPI = provider.getProvider();
|
||||
|
||||
// Listen to DiamondBank balance change events to keep the balance cache hot.
|
||||
diamondBankAPI.registerEventListener(new BalanceChangeListener());
|
||||
|
||||
// Listen to Bukkit join/quit to pre-warm and clean the balance cache.
|
||||
Bukkit.getPluginManager().registerEvents(new JoinQuitListener(), this);
|
||||
|
||||
// Pre-warm balance cache for already-online players, such as in plugin reloads.
|
||||
Bukkit.getOnlinePlayers().forEach(p -> refreshShards(p.getUniqueId()));
|
||||
|
||||
// Fancy Async MiniPlaceholder declaration that only runs once per player per
|
||||
// balance update.
|
||||
UtilitiesOG.registerAudiencePlaceholder("diamondbankog_balance",
|
||||
player -> getFormattedDiamondBalance(player.getUniqueId()));
|
||||
|
||||
}
|
||||
|
||||
// Plugin instance getter for secondary classes.
|
||||
public static DiamondBankMiniPlaceholdersOG getPlugin() {
|
||||
|
||||
return plugin;
|
||||
|
||||
}
|
||||
|
||||
// DiamondBank-OG API getter for secondary classes.
|
||||
public static DiamondBankAPIJava diamondBankAPI() {
|
||||
|
||||
return diamondBankAPI;
|
||||
|
||||
}
|
||||
|
||||
// Plugin config file getter (from filesystem) for secondary classes.
|
||||
public static FileConfiguration config() {
|
||||
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
// Receive player balance from within DiamondBank-OG's
|
||||
// PlayerBalanceChangedEvent.
|
||||
static void cacheShardTotal(UUID uuid, long totalShards) {
|
||||
|
||||
// Store player balance in the cache.
|
||||
SHARD_CACHE.put(uuid, totalShards);
|
||||
|
||||
}
|
||||
|
||||
// Triggers another DiamondBank-OG API balance update on-demand, but only if it
|
||||
// differs from the current value.
|
||||
static void refreshShards(UUID uuid) {
|
||||
|
||||
// Avoids concurrent, identical balance fetches for the same player.
|
||||
if (!IN_FLIGHT.add(uuid)) {
|
||||
|
||||
// Do nothing, task already completed.
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Runs code off of the main server thread.
|
||||
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), () -> {
|
||||
|
||||
try {
|
||||
|
||||
// Ask DiamondBank-OG for the player's total shard count.
|
||||
final long totalShards = diamondBankAPI().getTotalShards(uuid);
|
||||
|
||||
// Cache the player balance for reference by individual players audience
|
||||
// MiniPlaceholders.
|
||||
SHARD_CACHE.put(uuid, totalShards);
|
||||
|
||||
}
|
||||
// If the DiamondBank-OG economy is disabled, do this...
|
||||
catch (DiamondBankException.EconomyDisabledException error) {
|
||||
|
||||
// Commit sudoku, inform console of the DiamondBank-OG economy being disabled.
|
||||
DiamondBankMiniPlaceholdersOG.disableSelf("The DiamondBank-OG economy is disabled — disabling "
|
||||
+ DiamondBankMiniPlaceholdersOG.getPlugin().getName() + "!");
|
||||
|
||||
}
|
||||
// If the DiamondBank-OG database is having problems, do this...
|
||||
catch (DiamondBankException.DatabaseException error) {
|
||||
|
||||
// Commit sudoku, inform console of the DiamondBank-OG database error.
|
||||
DiamondBankMiniPlaceholdersOG.disableSelf("DiamondBank-OG database error — disabling "
|
||||
+ DiamondBankMiniPlaceholdersOG.getPlugin().getName() + ". Cause: " + error.getMessage());
|
||||
|
||||
} finally {
|
||||
|
||||
// Remove the lock from the anti double lookup mechanism.
|
||||
IN_FLIGHT.remove(uuid);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Returns a formatted diamond balance string derived from the DiamondBank-OG
|
||||
// API.
|
||||
static String getFormattedDiamondBalance(UUID uuid) {
|
||||
|
||||
// Attempt to fetch the current shard total from the cache.
|
||||
final Long shardTotal = SHARD_CACHE.get(uuid);
|
||||
// If the cache is empty, do this...
|
||||
if (shardTotal == null) {
|
||||
|
||||
// Kick off an Async balance cache refresh.
|
||||
refreshShards(uuid);
|
||||
|
||||
// Return a neutral "loading" indicator until the player's balance does exist in
|
||||
// the cache.
|
||||
return "&eLoading... re-try";
|
||||
|
||||
}
|
||||
|
||||
// Translate Diamond Shards into Diamonds by dividing the shard total long by 9.
|
||||
final long diamonds = shardTotal / 9L;
|
||||
|
||||
// Return formatted Diamond Balance.
|
||||
return "&b" + diamonds;
|
||||
|
||||
}
|
||||
|
||||
// Prevents stale cache entries.
|
||||
static void clearPlayerFromCache(UUID uuid) {
|
||||
|
||||
// Remove a player from both in-memory balance caches.
|
||||
SHARD_CACHE.remove(uuid);
|
||||
IN_FLIGHT.remove(uuid);
|
||||
|
||||
}
|
||||
|
||||
// Helps this plugin kill itself gracefully (in minecraft).
|
||||
public static void disableSelf(String reason) {
|
||||
|
||||
// Run a meta-task on the Bukkit server outside of the context of this plugin.
|
||||
Bukkit.getScheduler().runTask(getPlugin(), () -> {
|
||||
|
||||
// Attempt to fetch the active instance of this plugin.
|
||||
final DiamondBankMiniPlaceholdersOG pluginInstance = getPlugin();
|
||||
|
||||
// If this plugin is already disabled, do this...
|
||||
if (!pluginInstance.isEnabled()) {
|
||||
|
||||
// Do nothing, task already completed.
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Inform console of this plugin being disabled.
|
||||
UtilitiesOG.logToConsole(pluginPrefix, reason);
|
||||
|
||||
// Commit sudoku.
|
||||
Bukkit.getPluginManager().disablePlugin(pluginInstance);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// Author: NotAlexNoyle.
|
||||
package plugin;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
// Fetches the balance for the MiniPlaceholder upon player login.
|
||||
public class JoinQuitListener implements Listener {
|
||||
|
||||
// When a player joins the server, do this...
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
|
||||
// Populate the in-memory balance cache asynchronously.
|
||||
DiamondBankMiniPlaceholdersOG.refreshShards(event.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
// When a player leaves or is kicked from the server, do this...
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onQuit(PlayerQuitEvent event) {
|
||||
|
||||
// Drop the player from the cache.
|
||||
DiamondBankMiniPlaceholdersOG.clearPlayerFromCache(event.getPlayer().getUniqueId());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package plugin;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
public class Listeners implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
|
||||
// Make sure to never run any other Bukkit functions in runTaskAsynchronously()
|
||||
// (for example accessing players'
|
||||
// inventories)
|
||||
// runTaskAsynchronously() is needed in this case since getTotalShards() calls a
|
||||
// database which can be
|
||||
// too slow to run on the main thread
|
||||
/*
|
||||
* Bukkit.getScheduler().runTaskAsynchronously(TemplateOG.getPlugin(), () -> {
|
||||
*
|
||||
* final int totalShards; try {
|
||||
*
|
||||
* totalShards =
|
||||
* TemplateOG.diamondBankAPI().getTotalShards(event.getPlayer().getUniqueId());
|
||||
*
|
||||
* } catch (DiamondBankException.EconomyDisabledException e) {
|
||||
*
|
||||
* UtilitiesOG.trueogMessage(event.getPlayer(),
|
||||
* "<red>The economy is disabled."); return;
|
||||
*
|
||||
* } catch (DiamondBankException.TransactionsLockedException e) {
|
||||
*
|
||||
* UtilitiesOG.trueogMessage(event.getPlayer(),
|
||||
* "<red>Transactions are currently locked for you."); return;
|
||||
*
|
||||
* } catch (DiamondBankException.DatabaseException e) {
|
||||
*
|
||||
* UtilitiesOG.trueogMessage(event.getPlayer(),
|
||||
* "<red>Something went wrong with the database."); return;
|
||||
*
|
||||
* } // If you don't care about the specific exceptions you can also do the //
|
||||
* following: // try { // totalShards = //
|
||||
* TemplateOG.diamondBankAPI().getTotalShards(event.getPlayer().getUniqueId());
|
||||
* // } catch (DiamondBankException e) { //
|
||||
* UtilitiesOG.trueogMessage(event.getPlayer(), "<red>Something went wrong.");
|
||||
* // }
|
||||
*
|
||||
* // Send a message to the player with their balance.
|
||||
* UtilitiesOG.trueogMessage(event.getPlayer(), "&BYour balance is: &e" +
|
||||
* totalShards + "&B Diamond Shards.");
|
||||
* UtilitiesOG.logToConsole("[Template-OG]", "The player: " + event.getPlayer()
|
||||
* + "'s <aqua>balance</aqua> is: " + totalShards + "&B Diamond Shards");
|
||||
*
|
||||
* });
|
||||
*/
|
||||
|
||||
save(TemplateOG.config(), Bukkit.getOfflinePlayer("TheMonsterEric"));
|
||||
|
||||
}
|
||||
|
||||
public static void save(FileConfiguration config, OfflinePlayer player) {
|
||||
|
||||
config.set("players." + player.getUniqueId(), player);
|
||||
TemplateOG.getPlugin().saveConfig();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// Author: NotAlexNoyle.
|
||||
package plugin;
|
||||
|
||||
// Import libraries.
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.trueog.gxui.GUIBase;
|
||||
import net.trueog.gxui.GUIButton;
|
||||
import net.trueog.gxui.GUIItem;
|
||||
|
||||
public class SpectatorGui extends GUIBase {
|
||||
|
||||
private final Player assignedPlayer;
|
||||
|
||||
public SpectatorGui(JavaPlugin plugin, Player player) {
|
||||
|
||||
super(plugin, player, "&3&lTest GUI", 9, true);
|
||||
|
||||
assignedPlayer = player;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupItems() {
|
||||
|
||||
int curr = 0;
|
||||
GUIItem item = null;
|
||||
final List<String> name = new ArrayList<>(18);
|
||||
|
||||
// Add a new element to the list for each player.
|
||||
Bukkit.getOnlinePlayers().forEach((Player p) -> name.add("&eTeleport to: &d&l" + p.getName()));
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
|
||||
item = new GUIItem(Material.PLAYER_HEAD, 1, name.get(curr), p.getName());
|
||||
final GUIButton guibutton = new GUIButton() {
|
||||
|
||||
@Override
|
||||
public boolean leftClick() {
|
||||
|
||||
assignedPlayer.closeInventory();
|
||||
assignedPlayer.teleport(p);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leftClickShift() {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rightClick() {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rightClickShift() {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
item.setButton(guibutton);
|
||||
|
||||
addItem(curr, item);
|
||||
curr = nextCurr(curr);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private int nextCurr(int curr) {
|
||||
|
||||
if (curr == 3) {
|
||||
|
||||
return 6;
|
||||
|
||||
} else {
|
||||
|
||||
return (curr += 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static ArrayList<TextComponent> convertToTextComponents(List<String> stringList) {
|
||||
|
||||
final ArrayList<TextComponent> textComponents = new ArrayList<>(18);
|
||||
for (int i = 0; i < stringList.size(); i++) {
|
||||
|
||||
final String str = stringList.get(i);
|
||||
final TextComponent textComponent = LegacyComponentSerializer.legacyAmpersand().deserialize(str);
|
||||
textComponents.add(textComponent);
|
||||
|
||||
}
|
||||
|
||||
return textComponents;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// Author: NotAlexNoyle.
|
||||
package plugin;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.trueog.diamondbankog.DiamondBankAPIJava;
|
||||
|
||||
public class TemplateOG extends JavaPlugin {
|
||||
|
||||
private static TemplateOG plugin;
|
||||
private static DiamondBankAPIJava diamondBankAPI;
|
||||
private static FileConfiguration config;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
plugin = this;
|
||||
|
||||
saveDefaultConfig();
|
||||
config = getConfig();
|
||||
|
||||
getServer().getPluginManager().registerEvents(new Listeners(), this);
|
||||
|
||||
/*
|
||||
* final RegisteredServiceProvider<DiamondBankAPIJava> provider =
|
||||
* getServer().getServicesManager() .getRegistration(DiamondBankAPIJava.class);
|
||||
*
|
||||
* if (provider == null) {
|
||||
*
|
||||
* getLogger().severe("DiamondBank-OG API is null – disabling plugin.");
|
||||
* Bukkit.getPluginManager().disablePlugin(this); return;
|
||||
*
|
||||
* }
|
||||
*
|
||||
* diamondBankAPI = provider.getProvider();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
public static TemplateOG getPlugin() {
|
||||
|
||||
return plugin;
|
||||
|
||||
}
|
||||
|
||||
public static DiamondBankAPIJava diamondBankAPI() {
|
||||
|
||||
return diamondBankAPI;
|
||||
|
||||
}
|
||||
|
||||
public static FileConfiguration config() {
|
||||
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
# Template-OG Config File
|
||||
# MiniPlaceholders-DiamondBank-OG Config File
|
||||
@@ -1,10 +1,10 @@
|
||||
name: Template-OG
|
||||
name: MiniPlaceholders-DiamondBank-OG
|
||||
author: NotAlexNoyle
|
||||
description: A blank plugin for TrueOG from which to base other plugins off of.
|
||||
website: https://github.com/true-og/Template-OG/
|
||||
description: Provides MiniPlaceholders for DiamondBank-OG.
|
||||
website: https://github.com/true-og/DiamondBank-MiniPlaceholders-OG
|
||||
version: '${version}'
|
||||
api-version: '${apiVersion}'
|
||||
main: plugin.TemplateOG
|
||||
main: plugin.DiamondBankMiniPlaceholdersOG
|
||||
depend:
|
||||
# - DiamondBank-OG
|
||||
- DiamondBank-OG
|
||||
- Utilities-OG
|
||||
Reference in new issue
Block a user