Skip to content

Commit 6992dd9

Browse files
committed
use getServer().… instead of Bukkit.…
1 parent c4e52ac commit 6992dd9

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/main/java/pro/cloudnode/smp/bankaccounts/BankAccounts.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import com.google.gson.JsonParser;
55
import com.zaxxer.hikari.HikariConfig;
66
import com.zaxxer.hikari.HikariDataSource;
7-
import org.bukkit.Bukkit;
87
import org.bukkit.NamespacedKey;
98
import org.bukkit.OfflinePlayer;
109
import org.bukkit.command.CommandExecutor;
@@ -90,7 +89,7 @@ public void onEnable() {
9089
for (final @NotNull Listener event : events) getServer().getPluginManager().registerEvents(event, this);
9190

9291
// Setup PlaceholderAPI Integration
93-
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
92+
if(BankAccounts.getInstance().getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
9493
new PAPIIntegration().register();
9594
} else {
9695
getLogger().log(Level.INFO, "PlaceholderAPI not found. Skipping integration.");

src/main/java/pro/cloudnode/smp/bankaccounts/POS.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package pro.cloudnode.smp.bankaccounts;
22

3-
import org.bukkit.Bukkit;
43
import org.bukkit.Location;
54
import org.bukkit.World;
65
import org.bukkit.block.Block;
@@ -264,7 +263,7 @@ public static void openOwnerGui(final @NotNull Player player, final @NotNull Che
264263
final @NotNull ItemStack @NotNull [] items = Arrays.stream(chest.getInventory().getStorageContents()).filter(Objects::nonNull).toArray(ItemStack[]::new);
265264
final int extraRows = 1;
266265
final int size = extraRows * 9 + items.length + 9 - items.length % 9;
267-
final @NotNull Inventory gui = Bukkit.createInventory(null, size, BankAccounts.getInstance().config().posTitle(pos));
266+
final @NotNull Inventory gui = BankAccounts.getInstance().getServer().createInventory(null, size, BankAccounts.getInstance().config().posTitle(pos));
268267
gui.addItem(items);
269268

270269
final @NotNull ItemStack overview = new ItemStack(BankAccounts.getInstance().config().posInfoMaterial(), 1);
@@ -309,7 +308,7 @@ public static void openBuyGui(final @NotNull Player player, final @NotNull Chest
309308
final @NotNull ItemStack @NotNull [] items = Arrays.stream(chest.getInventory().getStorageContents()).filter(Objects::nonNull).toArray(ItemStack[]::new);
310309
final int extraRows = 1;
311310
final int size = extraRows * 9 + items.length + 9 - items.length % 9;
312-
final @NotNull Inventory gui = Bukkit.createInventory(null, size, BankAccounts.getInstance().config().posTitle(pos));
311+
final @NotNull Inventory gui = BankAccounts.getInstance().getServer().createInventory(null, size, BankAccounts.getInstance().config().posTitle(pos));
313312
gui.addItem(items);
314313

315314
final @NotNull ItemStack overview = new ItemStack(BankAccounts.getInstance().config().posInfoMaterial(), 1);

src/main/java/pro/cloudnode/smp/bankaccounts/events/BlockBreak.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package pro.cloudnode.smp.bankaccounts.events;
22

3-
import org.bukkit.Bukkit;
43
import org.bukkit.block.Block;
54
import org.bukkit.block.Chest;
65
import org.bukkit.event.EventHandler;
@@ -20,7 +19,7 @@ public void onBlockBreak(final @NotNull BlockBreakEvent event) {
2019
if (block.getState() instanceof final @NotNull Chest chest) {
2120
final @NotNull Inventory inventory = chest.getInventory();
2221
if (!inventory.isEmpty()) {
23-
Bukkit.getScheduler().runTaskAsynchronously(BankAccounts.getInstance(), () -> {
22+
BankAccounts.getInstance().getServer().getScheduler().runTaskAsynchronously(BankAccounts.getInstance(), () -> {
2423
final @NotNull Optional<POS> pos = POS.get(chest);
2524
if (pos.isPresent()) {
2625
pos.get().delete();

src/main/java/pro/cloudnode/smp/bankaccounts/events/Join.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package pro.cloudnode.smp.bankaccounts.events;
22

3-
import org.bukkit.Bukkit;
43
import org.bukkit.entity.Player;
54
import org.bukkit.event.EventHandler;
65
import org.bukkit.event.Listener;
@@ -19,7 +18,7 @@ public void onPlayerJoin(final @NotNull PlayerJoinEvent event) {
1918
final Player player = event.getPlayer();
2019
final @NotNull Optional<@NotNull Double> startingBalance = BankAccounts.getInstance().config()
2120
.startingBalance();
22-
startingBalance.ifPresent(aDouble -> Bukkit.getScheduler()
21+
startingBalance.ifPresent(aDouble -> BankAccounts.getInstance().getServer().getScheduler()
2322
.runTaskAsynchronously(BankAccounts.getInstance(), () -> {
2423
final @NotNull Account[] accounts = Account.get(player, Account.Type.PERSONAL);
2524
if (accounts.length == 0) {

0 commit comments

Comments
 (0)