summaryrefslogtreecommitdiff
path: root/loginsecurity.py
diff options
context:
space:
mode:
authorDico <Dico200@users.noreply.github.com>2016-06-23 05:21:24 +0200
committerGitHub <noreply@github.com>2016-06-23 05:21:24 +0200
commitfd368a8aac7e7eb0a0220476c9d68681dc6ae3d3 (patch)
tree6df54f34882564e6da79c0597e6925f8e78f97ba /loginsecurity.py
parentbfcb22f650fe432d8f9d4e72d16283eece4c2dce (diff)
Patch buggy movement blocking when logging inloginsecurity-patch-1
Added a separate event handler for PlayerMoveEvent which instead of cancelling the event, sets the new position to the old one. This should fix the buggy, flashy screen you get when you move your cursor while not yet logged in.
Diffstat (limited to 'loginsecurity.py')
-rw-r--r--loginsecurity.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/loginsecurity.py b/loginsecurity.py
index 4fbb307..d1607ef 100644
--- a/loginsecurity.py
+++ b/loginsecurity.py
@@ -12,7 +12,7 @@ from player import get_py_player, py_players
wait_time = 30 #seconds
admin_perm = "utils.loginsecurity.admin"
min_pass_length = 8
-blocked_events = ["block.BlockBreakEvent", "block.BlockPlaceEvent", "player.PlayerMoveEvent","player.AsyncPlayerChatEvent"]
+blocked_events = ["block.BlockBreakEvent", "block.BlockPlaceEvent", "player.AsyncPlayerChatEvent"]
@@ -273,4 +273,10 @@ def pre_command_proccess(event):
args = event.getMessage().split(" ")
if not args[0].lower() == "/login":
msg(player.player, "&4You need to login before you do that!")
- event.setCancelled(True) \ No newline at end of file
+ event.setCancelled(True)
+
+@hook.event("player.PlayerMoveEvent","normal")
+def player_move(event):
+ user = get_py_player(event.getPlayer())
+ if user.logging_in:
+ event.setTo(event.getFrom())