Change some custom event to let them be async
This commit is contained in:
@@ -13,6 +13,14 @@ public class CustomEvent extends Event implements Cancellable {
|
||||
private boolean isCancelled;
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public CustomEvent() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
public CustomEvent(boolean b) {
|
||||
super(b);
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public class FirstSpawnTeleportEvent extends CustomEvent {
|
||||
private Location from;
|
||||
|
||||
public FirstSpawnTeleportEvent(Player player, Location from, Location to) {
|
||||
super(true);
|
||||
this.player = player;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
|
||||
@@ -22,6 +22,7 @@ public class PasswordEncryptionEvent extends Event {
|
||||
private String playerName = "";
|
||||
|
||||
public PasswordEncryptionEvent(EncryptionMethod method, String playerName) {
|
||||
super(true);
|
||||
this.method = method;
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ public class ProtectInventoryEvent extends CustomEvent {
|
||||
|
||||
public ProtectInventoryEvent(Player player, ItemStack[] storedinventory,
|
||||
ItemStack[] storedarmor) {
|
||||
super(true);
|
||||
this.player = player;
|
||||
this.storedinventory = storedinventory;
|
||||
this.storedarmor = storedarmor;
|
||||
|
||||
@@ -13,6 +13,7 @@ public class ResetInventoryEvent extends CustomEvent {
|
||||
private Player player;
|
||||
|
||||
public ResetInventoryEvent(Player player) {
|
||||
super(true);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,14 @@ public class RestoreInventoryEvent extends CustomEvent {
|
||||
this.armor = armor;
|
||||
}
|
||||
|
||||
public RestoreInventoryEvent(Player player, ItemStack[] inventory,
|
||||
ItemStack[] armor, boolean b) {
|
||||
super(b);
|
||||
this.player = player;
|
||||
this.inventory = inventory;
|
||||
this.armor = armor;
|
||||
}
|
||||
|
||||
public ItemStack[] getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ public class StoreInventoryEvent extends CustomEvent {
|
||||
try {
|
||||
this.inventory = fileCache.readCache(player).getInventory();
|
||||
this.armor = fileCache.readCache(player).getArmour();
|
||||
} catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
this.inventory = player.getInventory().getContents();
|
||||
this.armor = player.getInventory().getArmorContents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user