Skip to content

Commit

Permalink
Merge pull request DevotedMC#33 from Diet-Cola/anvil-fix
Browse files Browse the repository at this point in the history
Use pearlApi vs getInstance
  • Loading branch information
wingzero54 authored Jul 13, 2022
2 parents 4afc47d + be175c1 commit dac2f00
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.List;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.java.JavaPluginLoader;
Expand All @@ -20,8 +19,6 @@
*/
public final class ExilePearlPlugin extends JavaPlugin {

private static ExilePearlPlugin instance;

private static ExilePearlApi core;

public static ExilePearlApi getApi() {
Expand All @@ -38,10 +35,6 @@ protected ExilePearlPlugin(final JavaPluginLoader loader, final PluginDescriptio
core = CorePluginFactory.createCore(this);
}

public static Plugin getInstance() {
return instance;
}

@Override
public void onLoad() {
core.onLoad();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,9 @@ public boolean equals(final Object o) {
public void performBroadcast() {
Location l = getHolder().getLocation();
String name = getHolder().getName();
getPlayer().sendMessage(ChatUtils.parseColor(String.format(Lang.pearlPearlIsHeld, name, l.getBlockX(), l.getBlockY(), l.getBlockZ(), l.getWorld().getName())));
if (getPlayer() != null) {
getPlayer().sendMessage(ChatUtils.parseColor(String.format(Lang.pearlPearlIsHeld, name, l.getBlockX(), l.getBlockY(), l.getBlockZ(), l.getWorld().getName())));
}
for(BroadcastListener b : bcastListeners) {
b.broadcast(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.devotedmc.ExilePearl.ExilePearl;
import com.devotedmc.ExilePearl.ExilePearlApi;
import com.devotedmc.ExilePearl.ExilePearlPlugin;
import com.devotedmc.ExilePearl.ExileRule;
import com.devotedmc.ExilePearl.Lang;
import com.devotedmc.ExilePearl.PearlFreeReason;
Expand Down Expand Up @@ -140,7 +139,7 @@ public void disablePearlAnvil(final PrepareAnvilEvent event) {
}
event.setResult(null);
// This is needed because of client side shenanigans
Bukkit.getScheduler().runTaskLater(ExilePearlPlugin.getInstance(), () -> {
Bukkit.getScheduler().runTaskLater(pearlApi, () -> {
for (final Player viewer : InventoryUtils.getViewingPlayers(inventory)) {
viewer.updateInventory();
}
Expand Down

0 comments on commit dac2f00

Please sign in to comment.