Anther fix.

This commit is contained in:
Brianna O'Keefe 2018-11-23 21:34:22 -05:00
parent aed58781e5
commit a518bfaf82
4 changed files with 13 additions and 6 deletions

View File

@ -22,9 +22,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
import java.util.List;
public final class UltimateRepairing extends JavaPlugin implements Listener { public final class UltimateRepairing extends JavaPlugin implements Listener {
private static CommandSender console = Bukkit.getConsoleSender(); private static CommandSender console = Bukkit.getConsoleSender();

View File

@ -26,7 +26,7 @@ public class Editor {
} }
public void open(Player player, Block block) { public void open(Player player, Block block) {
UAnvil anvil = editing.put(player.getUniqueId(), instance.getAnvilManager().getAnvil(block)); UAnvil anvil = instance.getAnvilManager().getAnvil(block);
open(player, anvil); open(player, anvil);
} }
@ -62,7 +62,7 @@ public class Editor {
inventory.setItem(15, Methods.createButton(Material.FIREWORK_ROCKET, "&9&lToggle Particles", anvil.isParticles() ? "&7Currently: &aEnabled&7." : "&7Currently &cDisabled&7.")); inventory.setItem(15, Methods.createButton(Material.FIREWORK_ROCKET, "&9&lToggle Particles", anvil.isParticles() ? "&7Currently: &aEnabled&7." : "&7Currently &cDisabled&7."));
player.openInventory(inventory); player.openInventory(inventory);
editing.put(player.getUniqueId(), anvil);
} }
public void toggleHologram(Player player) { public void toggleHologram(Player player) {
@ -87,4 +87,8 @@ public class Editor {
return editing.containsKey(player.getUniqueId()); return editing.containsKey(player.getUniqueId());
} }
public void removeEditing(Player player) {
editing.remove(player.getUniqueId());
}
} }

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.inventory.InventoryPickupItemEvent;
/** /**
@ -72,4 +73,9 @@ public class InventoryListeners implements Listener {
Debugger.runReport(ex); Debugger.runReport(ex);
} }
} }
@EventHandler
public void onClose(InventoryCloseEvent event) {
instance.getEditor().removeEditing((Player)event.getPlayer());
}
} }

View File

@ -21,7 +21,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* Created by songo on 6/4/2017. * Created by songoda on 6/4/2017.
*/ */
public class SettingsManager implements Listener { public class SettingsManager implements Listener {