mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Formatting fix
This commit is contained in:
parent
9ded6d1ac4
commit
cd8603a6d8
@ -13,19 +13,9 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
public class PreCanUnlockResearchEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
|
||||
private final Player player;
|
||||
private final Research research;
|
||||
private final PlayerProfile profile;
|
||||
private final SlimefunItem slimefunItem;
|
||||
private final Category category;
|
||||
|
||||
/**
|
||||
/**
|
||||
* This {@link Event} is called whenever a {@link Player} click to unlock a research.
|
||||
* This is called called before {@link Research#canUnlock(Player)}
|
||||
* The event is not called for the cheat sheet
|
||||
@ -36,41 +26,42 @@ public class PreCanUnlockResearchEvent extends Event implements Cancellable {
|
||||
* @see BookSlimefunGuide
|
||||
*
|
||||
*/
|
||||
public PreCanUnlockResearchEvent(@Nonnull Player p, @Nonnull Research research, @Nonnull PlayerProfile profile, @Nonnull SlimefunItem slimefunItem, @Nonnull Category category) {
|
||||
public class PreCanUnlockResearchEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final Player player;
|
||||
private final Research research;
|
||||
private final SlimefunItem slimefunItem;
|
||||
|
||||
private boolean cancelled;
|
||||
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public PreCanUnlockResearchEvent(Player p, Research research, SlimefunItem slimefunItem) {
|
||||
Validate.notNull(p, "The Player cannot be null");
|
||||
Validate.notNull(research, "Research cannot be null");
|
||||
Validate.notNull(profile, "PlayerProfile cannot be null");
|
||||
Validate.notNull(slimefunItem, "SlimefunItem cannot be null");
|
||||
Validate.notNull(category, "Category cannot be null");
|
||||
|
||||
this.player = p;
|
||||
this.research = research;
|
||||
this.profile = profile;
|
||||
this.slimefunItem = slimefunItem;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Player getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
@Nonnull
|
||||
public Research getResearch() {
|
||||
return this.research;
|
||||
}
|
||||
@Nonnull
|
||||
public PlayerProfile getProfile() {
|
||||
return this.profile;
|
||||
}
|
||||
@Nonnull
|
||||
public SlimefunItem getSlimefunItem() {
|
||||
return this.slimefunItem;
|
||||
}
|
||||
@Nonnull
|
||||
public Category getCategory() {
|
||||
return this.category;
|
||||
return player;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Research getResearch() {
|
||||
return research;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public SlimefunItem getSlimefunItem() {
|
||||
return slimefunItem;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static HandlerList getHandlerList() {
|
||||
|
@ -242,9 +242,10 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
if (profile.hasUnlocked(research)) {
|
||||
openCategory(profile, category, page);
|
||||
} else {
|
||||
PreCanUnlockResearchEvent event = new PreCanUnlockResearchEvent(p,research,profile,item,category);
|
||||
PreCanUnlockResearchEvent event = new PreCanUnlockResearchEvent(p, research, item);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (research.canUnlock(p)) {
|
||||
unlockItem(p, item, pl -> openCategory(profile, category, page));
|
||||
} else {
|
||||
@ -252,7 +253,6 @@ public class BookSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -289,9 +289,10 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
if (profile.hasUnlocked(research)) {
|
||||
openCategory(profile, category, page);
|
||||
} else {
|
||||
PreCanUnlockResearchEvent event = new PreCanUnlockResearchEvent(p,research,profile,sfitem,category);
|
||||
PreCanUnlockResearchEvent event = new PreCanUnlockResearchEvent(p, research, sfitem);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(!event.isCancelled()) {
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (research.canUnlock(pl)) {
|
||||
unlockItem(pl, sfitem, player -> openCategory(profile, category, page));
|
||||
} else {
|
||||
@ -301,7 +302,6 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user