ready to merge
This commit is contained in:
parent
87ede00cc3
commit
b30711ebcf
@ -1,50 +0,0 @@
|
|||||||
package com.massivecraft.factions.event;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.struct.Role;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents {@link Role} change of a factions player
|
|
||||||
* @see FPlayer#getRole()
|
|
||||||
*/
|
|
||||||
public class FPlayerRoleChangeEvent extends FactionPlayerEvent implements Cancellable {
|
|
||||||
|
|
||||||
private boolean cancelled;
|
|
||||||
private final Role from;
|
|
||||||
private Role to;
|
|
||||||
|
|
||||||
public FPlayerRoleChangeEvent(Faction faction, FPlayer fPlayer, Role from, Role to) {
|
|
||||||
super(faction, fPlayer);
|
|
||||||
this.from = from;
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FPlayerRoleChangeEvent(Faction faction, FPlayer fPlayer, Role to) {
|
|
||||||
this(faction, fPlayer, fPlayer.getRole(), to);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean cancelled) {
|
|
||||||
this.cancelled = cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Role getFrom() {
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Role getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTo(Role to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -241,17 +241,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
return this.role;
|
return this.role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRole(Role role) {
|
public void setRole(Role role) { this.role = role; }
|
||||||
if (this.role == role)
|
|
||||||
return;
|
|
||||||
|
|
||||||
FPlayerRoleChangeEvent event = new FPlayerRoleChangeEvent(getFaction(), this, role);
|
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
|
||||||
this.role = event.getTo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getPowerBoost() {
|
public double getPowerBoost() {
|
||||||
return this.powerBoost;
|
return this.powerBoost;
|
||||||
|
Loading…
Reference in New Issue
Block a user