mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-03 18:47:43 +01:00
improve stability
This commit is contained in:
parent
5c442369e8
commit
462ab1b680
@ -57,12 +57,12 @@ public Backpack(OfflinePlayer owner, int size)
|
|||||||
this(owner, size, -1);
|
this(owner, size, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Backpack(OfflinePlayer owner, int Size, int ID)
|
public Backpack(OfflinePlayer owner, int size, int ID)
|
||||||
{
|
{
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
titleOther = StringUtils.limitLength(String.format(Minepacks.getInstance().backpackTitleOther, owner.getName()), 32);
|
titleOther = StringUtils.limitLength(String.format(Minepacks.getInstance().backpackTitleOther, owner.getName()), 32);
|
||||||
bp = Bukkit.createInventory(this, Size, titleOther);
|
bp = Bukkit.createInventory(this, size, titleOther);
|
||||||
size = Size;
|
this.size = size;
|
||||||
ownerID = ID;
|
ownerID = ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ public long getUnCacheDelay()
|
|||||||
|
|
||||||
public String getBPTitleOther()
|
public String getBPTitleOther()
|
||||||
{
|
{
|
||||||
return ChatColor.translateAlternateColorCodes('&', config.getString("BackpackTitleOther", "{OwnerName} Backpack").replaceAll("%", "%%").replaceAll("\\{OwnerName\\}", "%s"));
|
return ChatColor.translateAlternateColorCodes('&', config.getString("BackpackTitleOther", "{OwnerName} Backpack").replaceAll("%", "%%").replaceAll("\\{OwnerName}", "%s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBPTitle()
|
public String getBPTitle()
|
||||||
|
@ -60,7 +60,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin
|
|||||||
|
|
||||||
public final Map<UUID, Long> cooldowns = new HashMap<>();
|
public final Map<UUID, Long> cooldowns = new HashMap<>();
|
||||||
|
|
||||||
public String backpackTitleOther, backpackTitle;
|
public String backpackTitleOther = "%s Backpack", backpackTitle = "Backpack";
|
||||||
public Message messageNoPermission, messageInvalidBackpack;
|
public Message messageNoPermission, messageInvalidBackpack;
|
||||||
|
|
||||||
private int maxSize;
|
private int maxSize;
|
||||||
@ -96,8 +96,14 @@ public void onEnable()
|
|||||||
lang = new Language(this);
|
lang = new Language(this);
|
||||||
lang.load(config.getLanguage(), config.getLanguageUpdateMode());
|
lang.load(config.getLanguage(), config.getLanguageUpdateMode());
|
||||||
database = Database.getDatabase(this);
|
database = Database.getDatabase(this);
|
||||||
getCommand("backpack").setExecutor(new OnCommand(this));
|
maxSize = config.getBackpackMaxSize();
|
||||||
|
backpackTitleOther = config.getBPTitleOther();
|
||||||
|
backpackTitle = StringUtils.limitLength(config.getBPTitle(), 32);
|
||||||
|
messageNoPermission = lang.getMessage("Ingame.NoPermission");
|
||||||
|
messageInvalidBackpack = lang.getMessage("Ingame.InvalidBackpack");
|
||||||
|
getServer().getServicesManager().register(Minepacks.class, this, this, ServicePriority.Normal);
|
||||||
|
|
||||||
|
getCommand("backpack").setExecutor(new OnCommand(this));
|
||||||
//region register events
|
//region register events
|
||||||
PluginManager pluginManager = getServer().getPluginManager();
|
PluginManager pluginManager = getServer().getPluginManager();
|
||||||
pluginManager.registerEvents(new EventListener(this), this);
|
pluginManager.registerEvents(new EventListener(this), this);
|
||||||
@ -105,19 +111,11 @@ public void onEnable()
|
|||||||
if(config.isItemFilterEnabled()) pluginManager.registerEvents(new ItemFilter(this), this);
|
if(config.isItemFilterEnabled()) pluginManager.registerEvents(new ItemFilter(this), this);
|
||||||
if(config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this);
|
if(config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this);
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
if(config.getFullInvCollect())
|
if(config.getFullInvCollect())
|
||||||
{
|
{
|
||||||
(new ItemsCollector(this)).runTaskTimer(this, config.getFullInvCheckInterval(), config.getFullInvCheckInterval());
|
(new ItemsCollector(this)).runTaskTimer(this, config.getFullInvCheckInterval(), config.getFullInvCheckInterval());
|
||||||
}
|
}
|
||||||
|
|
||||||
maxSize = config.getBackpackMaxSize();
|
|
||||||
backpackTitleOther = config.getBPTitleOther();
|
|
||||||
backpackTitle = StringUtils.limitLength(config.getBPTitle(), 32);
|
|
||||||
messageNoPermission = lang.getMessage("Ingame.NoPermission");
|
|
||||||
messageInvalidBackpack = lang.getMessage("Ingame.InvalidBackpack");
|
|
||||||
getServer().getServicesManager().register(Minepacks.class, this, this, ServicePriority.Normal);
|
|
||||||
|
|
||||||
if(config.getAutoUpdate()) // Lets check for updates
|
if(config.getAutoUpdate()) // Lets check for updates
|
||||||
{
|
{
|
||||||
getLogger().info("Checking for updates ...");
|
getLogger().info("Checking for updates ...");
|
||||||
|
Loading…
Reference in New Issue
Block a user