Use a field for editor used requirements. Check source object for editor NoChange. Remove unused imports. Fix indentation.
This commit is contained in:
parent
422ceed9ad
commit
54f1c3ea4f
@ -13,6 +13,7 @@ import com.massivecraft.massivecore.command.requirement.RequirementEditorUse;
|
|||||||
import com.massivecraft.massivecore.command.type.Type;
|
import com.massivecraft.massivecore.command.type.Type;
|
||||||
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
import com.massivecraft.massivecore.event.EventMassiveCoreEditorEdit;
|
||||||
import com.massivecraft.massivecore.mson.Mson;
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.util.Txt;
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
|
||||||
public class CommandEditAbstract<O, V> extends MassiveCommand
|
public class CommandEditAbstract<O, V> extends MassiveCommand
|
||||||
@ -110,11 +111,13 @@ public class CommandEditAbstract<O, V> extends MassiveCommand
|
|||||||
|
|
||||||
// NoChange
|
// NoChange
|
||||||
// We check, inform and cancel on equality.
|
// 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());
|
message(this.attemptSetNochangeMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.attemptSetPerform(after);
|
this.attemptSetPerform(after);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.massivecraft.massivecore.command.editor;
|
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.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -43,6 +45,13 @@ public class EditSettings<O>
|
|||||||
return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get()));
|
return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The requirements to edit used object.
|
||||||
|
private List<Requirement> usedRequirements = new ArrayList<Requirement>();
|
||||||
|
public List<Requirement> getUsedRequirements() { return this.usedRequirements; }
|
||||||
|
public void setUsedRequirements(List<Requirement> requirements) { this.usedRequirements = requirements; }
|
||||||
|
public void addUsedRequirements(Collection<Requirement> requirements) { this.usedRequirements.addAll(requirements); }
|
||||||
|
public void addUsedRequirements(Requirement... requirements) { this.addUsedRequirements(Arrays.asList(requirements)); }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -81,15 +90,6 @@ public class EditSettings<O>
|
|||||||
return new CommandEditUsed<O>(this);
|
return new CommandEditUsed<O>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
|
||||||
// PERMISSONS
|
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
public List<Requirement> getUsedRequirements()
|
|
||||||
{
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// TYPE READ UTILITY
|
// TYPE READ UTILITY
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -13,7 +13,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import com.massivecraft.massivecore.Named;
|
import com.massivecraft.massivecore.Named;
|
||||||
import com.massivecraft.massivecore.collections.MassiveList;
|
import com.massivecraft.massivecore.collections.MassiveList;
|
||||||
import com.massivecraft.massivecore.command.requirement.Requirement;
|
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.command.type.Type;
|
||||||
import com.massivecraft.massivecore.mson.Mson;
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
import com.massivecraft.massivecore.store.Entity;
|
import com.massivecraft.massivecore.store.Entity;
|
||||||
|
@ -21,13 +21,11 @@ public class TypeSenderId extends TypeSenderIdAbstract<String>
|
|||||||
super(source, presence);
|
super(source, presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TypeSenderId(SenderIdSource source, SenderType type)
|
private TypeSenderId(SenderIdSource source, SenderType type)
|
||||||
{
|
{
|
||||||
super(source, type);
|
super(source, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TypeSenderId(SenderIdSource source)
|
private TypeSenderId(SenderIdSource source)
|
||||||
{
|
{
|
||||||
super(source);
|
super(source);
|
||||||
|
@ -22,13 +22,11 @@ public class TypeSenderName extends TypeSenderIdAbstract<String>
|
|||||||
super(source, presence);
|
super(source, presence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TypeSenderName(SenderIdSource source, SenderType type)
|
private TypeSenderName(SenderIdSource source, SenderType type)
|
||||||
{
|
{
|
||||||
super(source, type);
|
super(source, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TypeSenderName(SenderIdSource source)
|
private TypeSenderName(SenderIdSource source)
|
||||||
{
|
{
|
||||||
super(source);
|
super(source);
|
||||||
|
Loading…
Reference in New Issue
Block a user