mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-15 10:55:20 +01:00
Refactor code to make it more readable
This commit is contained in:
parent
09cd1a0fb2
commit
f3ea7f3fee
@ -38,6 +38,7 @@ public ItemsCollector(Minepacks plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.radius = plugin.getConfiguration().getFullInvRadius();
|
||||
runTaskTimer(plugin, plugin.getConfiguration().getFullInvCheckInterval(), plugin.getConfiguration().getFullInvCheckInterval());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,11 +30,11 @@
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class EventListener extends MinepacksListener
|
||||
public class BackpackEventListener extends MinepacksListener
|
||||
{
|
||||
private final Message messageOwnBackpackClose, messageOtherBackpackClose;
|
||||
|
||||
public EventListener(Minepacks plugin)
|
||||
public BackpackEventListener(Minepacks plugin)
|
||||
{
|
||||
super(plugin);
|
||||
messageOwnBackpackClose = plugin.getLanguage().getMessage("Ingame.OwnBackpackClose");
|
||||
@ -82,10 +82,9 @@ public void onClick(InventoryClickEvent event)
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerLeaveEvent(PlayerQuitEvent event)
|
||||
{
|
||||
plugin.cooldowns.remove(event.getPlayer().getUniqueId());
|
||||
Backpack backpack = plugin.getDatabase().getBackpack(event.getPlayer());
|
||||
if(backpack != null) backpack.save();
|
||||
}
|
@ -33,7 +33,7 @@
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.DisableShulkerboxes;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Database;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.DropOnDeath;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.EventListener;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.BackpackEventListener;
|
||||
import at.pcgamingfreaks.Minepacks.Bukkit.Listener.ItemFilter;
|
||||
import at.pcgamingfreaks.PluginLib.Bukkit.PluginLib;
|
||||
import at.pcgamingfreaks.StringUtils;
|
||||
@ -169,16 +169,12 @@ private void load()
|
||||
|
||||
//region register events
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
pluginManager.registerEvents(new EventListener(this), this);
|
||||
pluginManager.registerEvents(new BackpackEventListener(this), this);
|
||||
if(config.getDropOnDeath()) pluginManager.registerEvents(new DropOnDeath(this), this);
|
||||
if(config.isItemFilterEnabled()) pluginManager.registerEvents(new ItemFilter(this), this);
|
||||
if(MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) && config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this);
|
||||
//endregion
|
||||
if(config.getFullInvCollect())
|
||||
{
|
||||
collector = new ItemsCollector(this);
|
||||
collector.runTaskTimer(this, config.getFullInvCheckInterval(), config.getFullInvCheckInterval());
|
||||
}
|
||||
if(config.getFullInvCollect()) collector = new ItemsCollector(this);
|
||||
worldBlacklist = config.getWorldBlacklist();
|
||||
if(worldBlacklist.size() == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user