Better tab completion for internal entities
This commit is contained in:
parent
442e90759d
commit
216dd14bf8
@ -59,6 +59,7 @@ import com.massivecraft.factions.entity.migrator.MigratorMConf002CleanInactivity
|
|||||||
import com.massivecraft.factions.entity.migrator.MigratorMConf003CleanInactivity;
|
import com.massivecraft.factions.entity.migrator.MigratorMConf003CleanInactivity;
|
||||||
import com.massivecraft.factions.entity.migrator.MigratorMConf004Rank;
|
import com.massivecraft.factions.entity.migrator.MigratorMConf004Rank;
|
||||||
import com.massivecraft.factions.entity.migrator.MigratorMConf005Warps;
|
import com.massivecraft.factions.entity.migrator.MigratorMConf005Warps;
|
||||||
|
import com.massivecraft.factions.entity.migrator.MigratorMPerm001Warps;
|
||||||
import com.massivecraft.factions.entity.migrator.MigratorMPlayer001Ranks;
|
import com.massivecraft.factions.entity.migrator.MigratorMPlayer001Ranks;
|
||||||
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
||||||
import com.massivecraft.factions.integration.V18.IntegrationV18;
|
import com.massivecraft.factions.integration.V18.IntegrationV18;
|
||||||
@ -147,6 +148,7 @@ public class Factions extends MassivePlugin
|
|||||||
MigratorMConf003CleanInactivity.class,
|
MigratorMConf003CleanInactivity.class,
|
||||||
MigratorMConf004Rank.class,
|
MigratorMConf004Rank.class,
|
||||||
MigratorMConf005Warps.class,
|
MigratorMConf005Warps.class,
|
||||||
|
MigratorMPerm001Warps.class,
|
||||||
MigratorMPlayer001Ranks.class
|
MigratorMPlayer001Ranks.class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package com.massivecraft.factions.cmd.type;
|
package com.massivecraft.factions.cmd.type;
|
||||||
|
|
||||||
import com.massivecraft.factions.entity.Faction;
|
import com.massivecraft.factions.entity.Faction;
|
||||||
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
|
import com.massivecraft.massivecore.command.type.TypeAbstractChoice;
|
||||||
import com.massivecraft.massivecore.store.EntityInternal;
|
import com.massivecraft.massivecore.store.EntityInternal;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class TypeEntityInternalFaction<E extends EntityInternal<E>> extends TypeAbstractChoice<E>
|
public abstract class TypeEntityInternalFaction<E extends EntityInternal<E>> extends TypeAbstractChoice<E>
|
||||||
{
|
{
|
||||||
@ -53,4 +56,25 @@ public abstract class TypeEntityInternalFaction<E extends EntityInternal<E>> ext
|
|||||||
else return super.isValid(arg, sender);
|
else return super.isValid(arg, sender);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<String> getTabList(CommandSender sender, String arg)
|
||||||
|
{
|
||||||
|
if (this.getFaction() != null) return super.getTabList(sender, arg);
|
||||||
|
|
||||||
|
// Default to tab list for the sender
|
||||||
|
Faction faction = MPlayer.get(sender).getFaction();
|
||||||
|
|
||||||
|
// Create
|
||||||
|
Set<String> ret = new MassiveSet<>();
|
||||||
|
|
||||||
|
// Fill
|
||||||
|
for (E value : this.getAll(faction))
|
||||||
|
{
|
||||||
|
ret.addAll(this.createTabs(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user