In some versions of iHCF, if you enderpearl from the capzone when you're capping outside of the event's territory it will keep you capping.
I had a friend come to me and ask me to fix this after asking Notifyz to help him, and he then said he'd do this for $25. 25 fucking dollars for about 20 lines of code.
So I helped him, and here's the fix for free, for everyone so you don't have to deal with scummy people like him.
I had a friend come to me and ask me to fix this after asking Notifyz to help him, and he then said he'd do this for $25. 25 fucking dollars for about 20 lines of code.
So I helped him, and here's the fix for free, for everyone so you don't have to deal with scummy people like him.
Code:
@EventHandler
public void onTeleport(PlayerTeleportEvent event){
EventTimer eventTimer = plugin.getTimerManager().getEventTimer();
if(eventTimer.getRemaining() < 0L) return;
EventFaction eventFaction = eventTimer.getEventFaction();
if(event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL || plugin.getTimerManager().getEventTimer() == null || eventFaction == null || eventFaction.getCaptureZones() == null) {
return;
}
for(CaptureZone captureZone : eventFaction.getCaptureZones()) {
if(captureZone.getCappingPlayer() == event.getPlayer()) {
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, () -> {
if(!captureZone.getCuboid().contains(event.getPlayer().getLocation())) {
eventFaction.getEventType().getEventTracker().onControlLoss(event.getPlayer(), captureZone, eventFaction);
captureZone.setCappingPlayer(null);
}
}, 10L);
}
}
}
