mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-16 20:31:30 +01:00
Use strings instead of UUID keys
This commit is contained in:
parent
f345ef3f16
commit
46b1ba6e98
@ -2,7 +2,6 @@ package net.citizensnpcs.trait;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -30,7 +29,7 @@ public class CommandTrait extends Trait {
|
||||
private final Map<String, NPCCommand> commands = Maps.newHashMap();
|
||||
@Persist
|
||||
@DelegatePersistence(PlayerNPCCommandPersister.class)
|
||||
private final Map<UUID, PlayerNPCCommand> cooldowns = Maps.newHashMap();
|
||||
private final Map<String, PlayerNPCCommand> cooldowns = Maps.newHashMap();
|
||||
|
||||
public CommandTrait() {
|
||||
super("commandtrait");
|
||||
@ -92,13 +91,13 @@ public class CommandTrait extends Trait {
|
||||
for (NPCCommand command : commands.values()) {
|
||||
if (command.hand != hand && command.hand != Hand.BOTH)
|
||||
continue;
|
||||
PlayerNPCCommand info = cooldowns.get(player.getUniqueId());
|
||||
PlayerNPCCommand info = cooldowns.get(player.getUniqueId().toString());
|
||||
if (info != null && !info.canUse(player, command)) {
|
||||
continue;
|
||||
}
|
||||
command.run(npc, player);
|
||||
if (command.cooldown > 0 && info == null) {
|
||||
cooldowns.put(player.getUniqueId(), new PlayerNPCCommand(command));
|
||||
cooldowns.put(player.getUniqueId().toString(), new PlayerNPCCommand(command));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user