fixing the things

This commit is contained in:
Shrek5InTheatres2019 2019-09-09 16:50:05 -07:00
parent 478d542981
commit 67bfb40dd5
3 changed files with 10 additions and 9 deletions

View File

@ -1,17 +1,19 @@
package com.gmail.nossr50.events.players; package com.gmail.nossr50.events.players;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent; import org.bukkit.event.player.PlayerEvent;
public class McMMOPlayerProfileLoadEvent extends PlayerEvent implements Cancellable { public class McMMOPlayerProfileLoadEvent extends Event implements Cancellable {
private boolean cancelled; private boolean cancelled;
private PlayerProfile profile; private PlayerProfile profile;
private Player player; private Player player;
public McMMOPlayerProfileLoadEvent(Player player, PlayerProfile profile){ public McMMOPlayerProfileLoadEvent(Player player, PlayerProfile profile){
super(player); super(!Bukkit.isPrimaryThread());
this.cancelled = false; this.cancelled = false;
this.profile = profile; this.profile = profile;
@ -19,12 +21,12 @@ public class McMMOPlayerProfileLoadEvent extends PlayerEvent implements Cancella
} }
@Override @Override
public boolean isCancelled() { public boolean isCancelled() {
return cancelled; return this.cancelled;
} }
@Override @Override
public void setCancelled(boolean b) { public void setCancelled(boolean cancelled) {
this.cancelled = b; this.cancelled = cancelled;
} }
public PlayerProfile getProfile(){return this.profile;} public PlayerProfile getProfile(){return this.profile;}
@ -38,4 +40,6 @@ public class McMMOPlayerProfileLoadEvent extends PlayerEvent implements Cancella
public static HandlerList getHandlerList() { public static HandlerList getHandlerList() {
return handlers; return handlers;
} }
public Player getPlayer() {return player;}
} }

View File

@ -68,7 +68,6 @@ public class PlayerListener implements Listener {
* *
* @param event The event to monitor * @param event The event to monitor
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerTeleport(PlayerTeleportEvent event) { public void onPlayerTeleport(PlayerTeleportEvent event) {
/* WORLD BLACKLIST CHECK */ /* WORLD BLACKLIST CHECK */

View File

@ -50,9 +50,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
// If successful, schedule the apply // If successful, schedule the apply
if (profile.isLoaded()) { if (profile.isLoaded()) {
new ApplySuccessfulProfile(new McMMOPlayer(player, profile)).runTask(mcMMO.p); new ApplySuccessfulProfile(new McMMOPlayer(player, profile)).runTask(mcMMO.p);
Bukkit.getScheduler().runTask(mcMMO.p, () -> { EventUtils.callPlayerProfileLoadEvent(player, profile);
EventUtils.callPlayerProfileLoadEvent(player, profile);
});
return; return;
} }