Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressWarnings("rawtypes")
- LinkedList queue = new LinkedList();
- public void pluginListener(Plugin instance) {
- plugin = instance; // <-- ERROR HERE
- }
- toggleCanMove(player1);
- freeze(null);
- private void freeze(PlayerMoveEvent event) {
- event.setTo(event.getFrom());
- }
- @EventHandler
- public void onMove(PlayerMoveEvent e) {
- Player p = e.getPlayer();
- if (canMove.containsKey(p)) { //if not initialized, p hasn't something to do with the plugin
- if (!canMove.get(p)) {//since he "not canMove"
- e.setCancelled(true); //he won't move.
- }
- }
- }
- }, 0L, getConfig().getLong("Timers.check.queue"));
- }
- public void onDisable(){ //don't do anything on disable
- }
- final public Map<Player, Boolean> canMove = new HashMap<Player, Boolean>();
- //use a HashMap because you need to check more than one Var(Player)
- public void toggleCanMove(final Player p) {
- canMove.put(p, false);
- //first: deny the Movement of p
- plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { //<-- ERROR ON plugin ???
- public void run() {
- canMove.put(p, true);
- //second: after 200L(= 10 Seconds) p will be allowed to continue moving.
- }
- }, 200L);//1 Second is 20 Ticks, 1 Tick is written as "1L"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment