mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Add SkillActivationPerkEvent
This commit is contained in:
parent
0466a28a5f
commit
556515eefd
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.166</version>
|
<version>2.1.167-SNAPSHOT</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.gmail.nossr50.events.skills;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class SkillActivationPerkEvent extends Event {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private final Player player;
|
||||||
|
private int ticks;
|
||||||
|
private final int maxTicks;
|
||||||
|
|
||||||
|
public SkillActivationPerkEvent(Player player, int ticks, int maxTicks) {
|
||||||
|
|
||||||
|
this.player = player;
|
||||||
|
this.ticks = ticks;
|
||||||
|
this.maxTicks = maxTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTicks() {
|
||||||
|
return ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicks(int ticks) {
|
||||||
|
this.ticks = ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxTicks() {
|
||||||
|
return maxTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,11 @@ package com.gmail.nossr50.util.skills;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.events.skills.SkillActivationPerkEvent;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -42,7 +45,9 @@ public final class PerksUtils {
|
|||||||
ticks += 4;
|
ticks += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ticks;
|
final SkillActivationPerkEvent skillActivationPerkEvent = new SkillActivationPerkEvent(player, ticks, maxTicks);
|
||||||
|
Bukkit.getPluginManager().callEvent(skillActivationPerkEvent);
|
||||||
|
return skillActivationPerkEvent.getTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float handleXpPerks(Player player, float xp, PrimarySkillType skill) {
|
public static float handleXpPerks(Player player, float xp, PrimarySkillType skill) {
|
||||||
|
Loading…
Reference in New Issue
Block a user