mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2024-11-14 10:45:23 +01:00
Add option for better compatibility with BungeeCord setups
This commit is contained in:
parent
9c4d9ef4ba
commit
b0eb919803
6
pom.xml
6
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>at.pcgamingfreaks</groupId>
|
||||
<artifactId>MinePacks</artifactId>
|
||||
<version>1.17.4</version>
|
||||
<version>1.17.5-SNAPSHOT</version>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:GeorgH93/Bukkit_Minepacks.git</connection>
|
||||
@ -121,11 +121,11 @@
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>releases</id>
|
||||
<url>http://repo.pcgamingfreaks.at/repository/releases/</url>
|
||||
<url>http://repo.pcgamingfreaks.at/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>snapshots</id>
|
||||
<url>http://repo.pcgamingfreaks.at/repository/snapshots/</url>
|
||||
<url>http://repo.pcgamingfreaks.at/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
@ -38,6 +38,9 @@ full_inventory:
|
||||
# Radius in which items get collected, in meter/blocks, allow decimals
|
||||
collect_radius: 1.5
|
||||
|
||||
# Enable this option if you are running a bungeecord setup!
|
||||
BungeeCordMode: false
|
||||
|
||||
|
||||
# Database settings
|
||||
Database:
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
public class Config extends Configuration
|
||||
{
|
||||
private static final int CONFIG_VERSION = 15;
|
||||
private static final int CONFIG_VERSION = 16;
|
||||
|
||||
public Config(JavaPlugin plugin)
|
||||
{
|
||||
@ -245,6 +245,11 @@ public double getFullInvRadius()
|
||||
|
||||
public boolean isV2InfoDisabled()
|
||||
{
|
||||
return config.getBoolean("Misc.DisableV2Info", false);
|
||||
return config.getBoolean("DisableV2Info", false);
|
||||
}
|
||||
|
||||
public boolean isBungeeCordModeEnabled()
|
||||
{
|
||||
return config.getBoolean("BungeeCordMode", false);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2016 GeorgH93
|
||||
* Copyright (C) 2014-2017 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,7 +29,7 @@ public class Database
|
||||
{
|
||||
protected MinePacks plugin;
|
||||
|
||||
protected boolean useUUIDs, useUUIDSeparators;
|
||||
protected boolean useUUIDs, useUUIDSeparators, bungeeMode;
|
||||
protected long maxAge;
|
||||
|
||||
private HashMap<OfflinePlayer, Backpack> backpacks = new HashMap<>();
|
||||
@ -41,6 +41,7 @@ public Database(MinePacks mp)
|
||||
useUUIDSeparators = plugin.config.getUseUUIDSeparators();
|
||||
useUUIDs = plugin.config.getUseUUIDs();
|
||||
maxAge = plugin.config.getAutoCleanupMaxInactiveDays();
|
||||
bungeeMode = plugin.config.isBungeeCordModeEnabled();
|
||||
}
|
||||
|
||||
public static Database getDatabase(MinePacks Plugin)
|
||||
@ -170,7 +171,7 @@ public void close() { }
|
||||
public void updatePlayerAndLoadBackpack(Player player)
|
||||
{
|
||||
updatePlayer(player);
|
||||
asyncLoadBackpack(player);
|
||||
if(!bungeeMode) asyncLoadBackpack(player);
|
||||
}
|
||||
|
||||
public void updatePlayer(Player player) {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2015 GeorgH93
|
||||
* Copyright (C) 2014-2017 GeorgH93
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -73,10 +73,7 @@ public void onResult(Backpack backpack)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail()
|
||||
{
|
||||
|
||||
}
|
||||
public void onFail() {}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -144,10 +141,10 @@ public void onPlayerLoginEvent(PlayerJoinEvent event)
|
||||
public void onPlayerLeaveEvent(PlayerQuitEvent event)
|
||||
{
|
||||
Backpack backpack = plugin.DB.getBackpack(event.getPlayer());
|
||||
if(backpack != null && !backpack.isOpen())
|
||||
if(backpack != null)
|
||||
{
|
||||
backpack.save();
|
||||
plugin.DB.unloadBackpack(backpack);
|
||||
if(!backpack.isOpen()) plugin.DB.unloadBackpack(backpack);
|
||||
}
|
||||
if(plugin.cooldowns.containsKey(event.getPlayer()))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user