public static void teleblockPlayer(Player killer, Player target) { int teleblockDelay = 300000; if (target.getPrayers().getHeadIcon() == PrayerData.MAGIC) { teleblockDelay = 150000; } target.setTemporaryAttribute("teleblocked", true); target.setTeleblockTime(Environment.TickCount + teleblockDelay); Event removeTeleBlockEvent = new Event(teleblockDelay); removeTeleBlockEvent.setAction(() => { removeTeleBlockEvent.stop(); if (target != null) { target.removeTemporaryAttribute("teleblocked"); target.setTeleblockTime(0); } }); Server.registerEvent(removeTeleBlockEvent); }