diff --git a/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java b/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java index d4898ff4..77534cd3 100644 --- a/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java +++ b/src/com/massivecraft/massivecore/command/editor/CommandEditAbstract.java @@ -13,6 +13,7 @@ import com.massivecraft.massivecore.command.requirement.RequirementEditorUse; import com.massivecraft.massivecore.command.type.Type; import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit; import com.massivecraft.massivecore.mson.Mson; +import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.Txt; public class CommandEditAbstract extends MassiveCommand @@ -110,11 +111,13 @@ public class CommandEditAbstract extends MassiveCommand // NoChange // We check, inform and cancel on equality. - if (this.getValueType().equals(before, after)) + // For this to count the source must be the object itself. + if (MUtil.equals(this.getObject(), source) && this.getValueType().equals(before, after)) { message(this.attemptSetNochangeMessage()); return; } + this.attemptSetPerform(after); } @@ -126,7 +129,7 @@ public class CommandEditAbstract extends MassiveCommand this.getObjectVisual(), " already: ", this.getInheritedVisual() - ).color(ChatColor.GRAY); + ).color(ChatColor.GRAY); } protected void attemptSetPerform(V after) @@ -143,7 +146,7 @@ public class CommandEditAbstract extends MassiveCommand messages.add(mson( mson("Before: ").color(ChatColor.AQUA), descValue - )); + )); // Apply // We set the new property value. @@ -155,7 +158,7 @@ public class CommandEditAbstract extends MassiveCommand messages.add(mson( mson("After: ").color(ChatColor.AQUA), descValue - )); + )); // Startup // We inform what property and object the edit is taking place on. @@ -166,7 +169,7 @@ public class CommandEditAbstract extends MassiveCommand " for ", descObject, " edited:" - ).color(ChatColor.GRAY)); + ).color(ChatColor.GRAY)); message(messages); } diff --git a/src/com/massivecraft/massivecore/command/editor/EditSettings.java b/src/com/massivecraft/massivecore/command/editor/EditSettings.java index fc694d07..e7613e36 100644 --- a/src/com/massivecraft/massivecore/command/editor/EditSettings.java +++ b/src/com/massivecraft/massivecore/command/editor/EditSettings.java @@ -1,6 +1,8 @@ package com.massivecraft.massivecore.command.editor; -import java.util.Collections; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.List; import java.util.Set; @@ -43,6 +45,13 @@ public class EditSettings return new EditSettings(TypeSender.get(), new PropertyThis(TypeSender.get())); } + // The requirements to edit used object. + private List usedRequirements = new ArrayList(); + public List getUsedRequirements() { return this.usedRequirements; } + public void setUsedRequirements(List requirements) { this.usedRequirements = requirements; } + public void addUsedRequirements(Collection requirements) { this.usedRequirements.addAll(requirements); } + public void addUsedRequirements(Requirement... requirements) { this.addUsedRequirements(Arrays.asList(requirements)); } + // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // @@ -81,15 +90,6 @@ public class EditSettings return new CommandEditUsed(this); } - // -------------------------------------------- // - // PERMISSONS - // -------------------------------------------- // - - public List getUsedRequirements() - { - return Collections.emptyList(); - } - // -------------------------------------------- // // TYPE READ UTILITY // -------------------------------------------- // diff --git a/src/com/massivecraft/massivecore/command/editor/Property.java b/src/com/massivecraft/massivecore/command/editor/Property.java index 48edb076..7f7237c6 100644 --- a/src/com/massivecraft/massivecore/command/editor/Property.java +++ b/src/com/massivecraft/massivecore/command/editor/Property.java @@ -13,7 +13,6 @@ import org.bukkit.command.CommandSender; import com.massivecraft.massivecore.Named; import com.massivecraft.massivecore.collections.MassiveList; import com.massivecraft.massivecore.command.requirement.Requirement; -import com.massivecraft.massivecore.command.requirement.RequirementAbstract; import com.massivecraft.massivecore.command.type.Type; import com.massivecraft.massivecore.mson.Mson; import com.massivecraft.massivecore.store.Entity; diff --git a/src/com/massivecraft/massivecore/command/type/sender/TypeSenderId.java b/src/com/massivecraft/massivecore/command/type/sender/TypeSenderId.java index 63c1be47..92a552c3 100644 --- a/src/com/massivecraft/massivecore/command/type/sender/TypeSenderId.java +++ b/src/com/massivecraft/massivecore/command/type/sender/TypeSenderId.java @@ -21,13 +21,11 @@ public class TypeSenderId extends TypeSenderIdAbstract super(source, presence); } - private TypeSenderId(SenderIdSource source, SenderType type) { super(source, type); } - private TypeSenderId(SenderIdSource source) { super(source); diff --git a/src/com/massivecraft/massivecore/command/type/sender/TypeSenderName.java b/src/com/massivecraft/massivecore/command/type/sender/TypeSenderName.java index 0de9c7ce..756bdb98 100644 --- a/src/com/massivecraft/massivecore/command/type/sender/TypeSenderName.java +++ b/src/com/massivecraft/massivecore/command/type/sender/TypeSenderName.java @@ -22,13 +22,11 @@ public class TypeSenderName extends TypeSenderIdAbstract super(source, presence); } - private TypeSenderName(SenderIdSource source, SenderType type) { super(source, type); } - private TypeSenderName(SenderIdSource source) { super(source);