4 days of work and I'm still not done ;_;

This commit is contained in:
nossr50
2019-01-08 19:52:52 -08:00
parent ee765a0d30
commit 362d036b16
95 changed files with 2781 additions and 908 deletions

View File

@ -0,0 +1,79 @@
package com.gmail.nossr50.events.skills;
import com.gmail.nossr50.datatypes.interactions.NotificationType;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
/**
* This event is sent for when mcMMO informs a player about various important information
*/
public class McMMOPlayerNotificationEvent extends PlayerEvent implements Cancellable {
private boolean isCancelled;
private static final HandlerList handlers = new HandlerList();
protected String notificationMessage;
protected final NotificationType notificationType;
public McMMOPlayerNotificationEvent(Player who, NotificationType notificationType, String notificationMessage) {
super(who);
this.notificationType = notificationType;
this.notificationMessage = notificationMessage;
isCancelled = false;
}
/*
* Getters & Setters
*/
/**
* The notification type for this event
* @return this event's notification type
*/
public NotificationType getEventNotificationType() {
return notificationType;
}
/**
* The message delivered to players by this notification
* @return the message that will be delivered to the player
*/
public String getNotificationMessage() {
return notificationMessage;
}
/**
* Change the notification message
* @param newMessage the new replacement message
*/
public void setNotificationMessage(String newMessage) {
notificationMessage = newMessage;
}
/*
* Custom Event Boilerplate
*/
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
/*
* Cancellable Interface Boilerplate
*/
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean b) {
isCancelled = b;
}
}

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.events.skills.secondaryabilities;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.SubSkill;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@ -8,21 +10,31 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkill;
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable {
private SubSkill subSkill;
private boolean cancelled;
private SubSkillType subSkillType;
private boolean cancelled = false;
public SubSkillEvent(Player player, SubSkill subSkill) {
super(player, PrimarySkill.bySecondaryAbility(subSkill));
this.subSkill = subSkill;
cancelled = false;
/**
* Only skills using the old system will fire this event
* @param player target player
* @param subSkillType target subskill
*/
@Deprecated
public SubSkillEvent(Player player, SubSkillType subSkillType) {
super(player, PrimarySkill.bySecondaryAbility(subSkillType));
this.subSkillType = subSkillType;
}
public SubSkillEvent(Player player, AbstractSubSkill abstractSubSkill)
{
super(player, abstractSubSkill.getPrimarySkill());
}
/**
* Gets the SubSkill involved in the event
* @return the SubSkill
* Gets the SubSkillType involved in the event
* @return the SubSkillType
*/
public SubSkill getSubSkill() {
return subSkill;
public SubSkillType getSubSkillType() {
return subSkillType;
}
public boolean isCancelled() {

View File

@ -1,16 +1,23 @@
package com.gmail.nossr50.events.skills.secondaryabilities;
import com.gmail.nossr50.datatypes.skills.SubSkill;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import org.bukkit.entity.Player;
public class SubSkillWeightedActivationCheckEvent extends SubSkillEvent {
private double chance;
public SubSkillWeightedActivationCheckEvent(Player player, SubSkill ability, double chance) {
public SubSkillWeightedActivationCheckEvent(Player player, SubSkillType ability, double chance) {
super(player, ability);
this.chance = chance;
}
public SubSkillWeightedActivationCheckEvent(Player player, AbstractSubSkill abstractSubSkill, double chance)
{
super(player, abstractSubSkill);
this.chance = chance;
}
/**
* Gets the activation chance of the ability 0D being no chance, 1.0D being 100% chance
*