mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-09-28 14:37:32 +02:00
Automatically drop the username on leave
This commit is contained in:
parent
1bbf293379
commit
d1a79425ed
@ -1,6 +1,7 @@
|
||||
package com.Acrobot.ChestShop.Listeners.Player;
|
||||
|
||||
import com.Acrobot.ChestShop.Commands.Toggle;
|
||||
import com.Acrobot.ChestShop.UUIDs.NameManager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -15,6 +16,8 @@ public class PlayerLeave implements Listener {
|
||||
if (Toggle.isIgnoring(event.getPlayer())) {
|
||||
Toggle.setIgnoring(event.getPlayer(), false);
|
||||
}
|
||||
|
||||
NameManager.dropUsername(event.getPlayer());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -162,6 +162,20 @@ public class NameManager {
|
||||
});
|
||||
}
|
||||
|
||||
public static void dropUsername(final Player player) {
|
||||
final UUID uuid = player.getUniqueId();
|
||||
|
||||
if (usernameToUUID.containsValue(uuid)) {
|
||||
usernameToUUID.inverse().remove(uuid);
|
||||
}
|
||||
|
||||
String shortName = NameUtil.stripUsername(player.getName());
|
||||
|
||||
if (shortToLongName.containsKey(shortName)) {
|
||||
shortToLongName.remove(shortName);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean canUseName(Player player, String name) {
|
||||
String shortenedName = NameUtil.stripUsername(getUsername(player.getUniqueId()));
|
||||
|
||||
|
@ -505,7 +505,7 @@ public class Updater {
|
||||
* @return true if Updater should consider the remote version an update, false if not.
|
||||
*/
|
||||
public boolean shouldUpdate(String localVersion, String remoteVersion) {
|
||||
if (getLatestType() != ReleaseType.RELEASE) {
|
||||
if (localVersion.contains("DEV") || getLatestType() != ReleaseType.RELEASE) {
|
||||
return false; //Do not download alphas or betas
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user