EventMassiveCoreEditorEdit
This commit is contained in:
parent
c37feb469e
commit
2d4bfdcbf8
@ -11,6 +11,7 @@ import com.massivecraft.massivecore.command.MassiveCommand;
|
|||||||
import com.massivecraft.massivecore.command.requirement.RequirementEditorUse;
|
import com.massivecraft.massivecore.command.requirement.RequirementEditorUse;
|
||||||
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
|
||||||
import com.massivecraft.massivecore.command.type.Type;
|
import com.massivecraft.massivecore.command.type.Type;
|
||||||
|
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.util.PermUtil;
|
import com.massivecraft.massivecore.util.PermUtil;
|
||||||
|
|
||||||
@ -95,6 +96,12 @@ public class CommandEditAbstract<O, V> extends MassiveCommand
|
|||||||
O source = inherited.getKey();
|
O source = inherited.getKey();
|
||||||
V before = inherited.getValue();
|
V before = inherited.getValue();
|
||||||
|
|
||||||
|
// Event
|
||||||
|
EventMassiveCoreEditorEdit<O, V> event = new EventMassiveCoreEditorEdit<O, V>(this, source, before, after);
|
||||||
|
event.run();
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
after = event.getAfter();
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
String descProperty = this.getProperty().getDisplayName();
|
String descProperty = this.getProperty().getDisplayName();
|
||||||
String descObject = this.getObjectVisual();
|
String descObject = this.getObjectVisual();
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.massivecraft.massivecore.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;
|
||||||
|
|
||||||
|
public class EventMassiveCoreEditorEdit<O, V> extends EventMassiveCore
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// REQUIRED EVENT CODE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
@Override public HandlerList getHandlers() { return handlers; }
|
||||||
|
public static HandlerList getHandlerList() { return handlers; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// FIELD
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
protected final CommandEditAbstract<O, V> command;
|
||||||
|
public CommandEditAbstract<O, V> getCommand() { return this.command; }
|
||||||
|
|
||||||
|
protected final O source;
|
||||||
|
public O getSource() { return this.source; }
|
||||||
|
|
||||||
|
protected final V before;
|
||||||
|
public V getBefore() { return this.before; }
|
||||||
|
|
||||||
|
protected V after;
|
||||||
|
public V getAfter() { return this.after; }
|
||||||
|
public void setAfter(V after) { this.after = after; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public EventMassiveCoreEditorEdit(CommandEditAbstract<O, V> command, O source, V before, V after)
|
||||||
|
{
|
||||||
|
this.command = command;
|
||||||
|
this.source = source;
|
||||||
|
this.before = before;
|
||||||
|
this.after = after;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user