Skip to content

Commit

Permalink
Use strings instead of UUID keys
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 7, 2020
1 parent f345ef3 commit 46b1ba6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main/src/main/java/net/citizensnpcs/trait/CommandTrait.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -92,13 +91,13 @@ public void dispatch(Player player, Hand hand) {
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));
}
}
}
Expand Down

0 comments on commit 46b1ba6

Please sign in to comment.