Fix double and tripple click of REntityServer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
72e76d30ac
Commit
c4a294b186
@ -69,14 +69,22 @@ public class REntityServer implements Listener {
|
|||||||
private final HashMap<Player, Integer> viewDistance = new HashMap<>();
|
private final HashMap<Player, Integer> viewDistance = new HashMap<>();
|
||||||
|
|
||||||
private EntityActionListener callback = null;
|
private EntityActionListener callback = null;
|
||||||
|
private final Set<Player> playersThatClicked = new HashSet<>();
|
||||||
|
|
||||||
private final BiFunction<Player, Object, Object> filter = (player, packet) -> {
|
private final BiFunction<Player, Object, Object> filter = (player, packet) -> {
|
||||||
REntity entity = entityMap.get(useEntityTarget.get(packet));
|
REntity entity = entityMap.get(useEntityTarget.get(packet));
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
return packet;
|
return packet;
|
||||||
|
|
||||||
|
if (playersThatClicked.contains(player))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
playersThatClicked.add(player);
|
||||||
EntityAction action = getEntityAction.apply(useEntityAction.get(packet)) == 1 ? EntityAction.ATTACK : EntityAction.INTERACT;
|
EntityAction action = getEntityAction.apply(useEntityAction.get(packet)) == 1 ? EntityAction.ATTACK : EntityAction.INTERACT;
|
||||||
Bukkit.getScheduler().runTask(Core.getInstance(), () -> callback.onAction(player, entity, action));
|
Bukkit.getScheduler().runTask(Core.getInstance(), () -> {
|
||||||
|
playersThatClicked.remove(player);
|
||||||
|
callback.onAction(player, entity, action);
|
||||||
|
});
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren