mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-12-31 18:17:49 +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);
|
||||
}
|
||||
|
||||
public Backpack(OfflinePlayer owner, int Size, int ID)
|
||||
public Backpack(OfflinePlayer owner, int size, int ID)
|
||||
{
|
||||
this.owner = owner;
|
||||
titleOther = StringUtils.limitLength(String.format(Minepacks.getInstance().backpackTitleOther, owner.getName()), 32);
|
||||
bp = Bukkit.createInventory(this, Size, titleOther);
|
||||
size = Size;
|
||||
bp = Bukkit.createInventory(this, size, titleOther);
|
||||
this.size = size;
|
||||
ownerID = ID;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public long getUnCacheDelay()
|
||||
|
||||
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()
|
||||
|
@ -60,7 +60,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin
|
||||
|
||||
public final Map<UUID, Long> cooldowns = new HashMap<>();
|
||||
|
||||
public String backpackTitleOther, backpackTitle;
|
||||
public String backpackTitleOther = "%s Backpack", backpackTitle = "Backpack";
|
||||
public Message messageNoPermission, messageInvalidBackpack;
|
||||
|
||||
private int maxSize;
|
||||
@ -96,8 +96,14 @@ public void onEnable()
|
||||
lang = new Language(this);
|
||||
lang.load(config.getLanguage(), config.getLanguageUpdateMode());
|
||||
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
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
pluginManager.registerEvents(new EventListener(this), this);
|
||||
@ -105,19 +111,11 @@ public void onEnable()
|
||||
if(config.isItemFilterEnabled()) pluginManager.registerEvents(new ItemFilter(this), this);
|
||||
if(config.isShulkerboxesDisable()) pluginManager.registerEvents(new DisableShulkerboxes(this), this);
|
||||
//endregion
|
||||
|
||||
if(config.getFullInvCollect())
|
||||
{
|
||||
(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
|
||||
{
|
||||
getLogger().info("Checking for updates ...");
|
||||
|
Loading…
Reference in New Issue
Block a user