mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-26 04:25:30 +01:00
fix: issues with tab menu capitalisation
This commit is contained in:
parent
9ccf7b1d13
commit
81e8876079
@ -15,6 +15,7 @@ import com.sekwah.advancedportals.core.services.DestinationServices;
|
|||||||
import com.sekwah.advancedportals.core.services.PortalServices;
|
import com.sekwah.advancedportals.core.services.PortalServices;
|
||||||
import com.sekwah.advancedportals.core.tags.activation.DestiTag;
|
import com.sekwah.advancedportals.core.tags.activation.DestiTag;
|
||||||
import com.sekwah.advancedportals.core.tags.activation.NameTag;
|
import com.sekwah.advancedportals.core.tags.activation.NameTag;
|
||||||
|
import com.sekwah.advancedportals.core.tags.activation.TriggerBlockTag;
|
||||||
import com.sekwah.advancedportals.core.util.GameScheduler;
|
import com.sekwah.advancedportals.core.util.GameScheduler;
|
||||||
import com.sekwah.advancedportals.core.util.InfoLogger;
|
import com.sekwah.advancedportals.core.util.InfoLogger;
|
||||||
import com.sekwah.advancedportals.core.util.Lang;
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
@ -109,6 +110,7 @@ public class AdvancedPortalsCore {
|
|||||||
private void registerTags() {
|
private void registerTags() {
|
||||||
this.tagRegistry.registerTag(new NameTag());
|
this.tagRegistry.registerTag(new NameTag());
|
||||||
this.tagRegistry.registerTag(new DestiTag());
|
this.tagRegistry.registerTag(new DestiTag());
|
||||||
|
this.tagRegistry.registerTag(new TriggerBlockTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,11 +171,7 @@ public class CommandWithSubCommands implements CommandTemplate {
|
|||||||
if(tabList == null) {
|
if(tabList == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for(String arg : tabList.toArray(new String[0])) {
|
tabList.removeIf(arg -> !arg.startsWith(lastArg));
|
||||||
if(!arg.startsWith(lastArg.toLowerCase())) {
|
|
||||||
tabList.remove(arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tabList;
|
return tabList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.sekwah.advancedportals.core.commands.subcommands.common;
|
package com.sekwah.advancedportals.core.commands.subcommands.common;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
import com.sekwah.advancedportals.core.commands.SubCommand;
|
import com.sekwah.advancedportals.core.commands.SubCommand;
|
||||||
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer;
|
import com.sekwah.advancedportals.core.connector.containers.CommandSenderContainer;
|
||||||
import com.sekwah.advancedportals.core.serializeddata.DataTag;
|
import com.sekwah.advancedportals.core.serializeddata.DataTag;
|
||||||
|
import com.sekwah.advancedportals.core.util.InfoLogger;
|
||||||
import com.sekwah.advancedportals.core.util.TagReader;
|
import com.sekwah.advancedportals.core.util.TagReader;
|
||||||
import com.sekwah.advancedportals.core.warphandler.Tag;
|
import com.sekwah.advancedportals.core.warphandler.Tag;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sekwah.advancedportals.core.connector.containers;
|
package com.sekwah.advancedportals.core.connector.containers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface ServerContainer {
|
public interface ServerContainer {
|
||||||
@ -10,6 +11,8 @@ public interface ServerContainer {
|
|||||||
|
|
||||||
PlayerContainer getPlayer(UUID name);
|
PlayerContainer getPlayer(UUID name);
|
||||||
|
|
||||||
|
List<String> getTriggerBlocks();
|
||||||
|
|
||||||
PlayerContainer[] getPlayers();
|
PlayerContainer[] getPlayers();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.sekwah.advancedportals.core.tags.activation;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
|
||||||
|
import com.sekwah.advancedportals.core.connector.containers.ServerContainer;
|
||||||
|
import com.sekwah.advancedportals.core.registry.TagTarget;
|
||||||
|
import com.sekwah.advancedportals.core.services.DestinationServices;
|
||||||
|
import com.sekwah.advancedportals.core.util.Lang;
|
||||||
|
import com.sekwah.advancedportals.core.warphandler.ActivationData;
|
||||||
|
import com.sekwah.advancedportals.core.warphandler.Tag;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class TriggerBlockTag implements Tag.AutoComplete {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ServerContainer serverContainer;
|
||||||
|
|
||||||
|
public static String TAG_NAME = "triggerblock";
|
||||||
|
|
||||||
|
private final TagType[] tagTypes = new TagType[]{ TagType.PORTAL };
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagType[] getTagTypes() {
|
||||||
|
return tagTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return TAG_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getAliases() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String description() {
|
||||||
|
return Lang.translate("tag.triggerblock.description");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> autoComplete(String argData) {
|
||||||
|
return serverContainer.getTriggerBlocks().stream()
|
||||||
|
.filter(s -> s.startsWith(argData))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
@ -149,3 +149,4 @@ items.interact.right=Right Click
|
|||||||
|
|
||||||
tag.desti.description=Sets the destination of the portal
|
tag.desti.description=Sets the destination of the portal
|
||||||
tag.name.error.nospaces= The name cannot contain spaces.
|
tag.name.error.nospaces= The name cannot contain spaces.
|
||||||
|
tag.triggerblock.description=Sets the trigger block/s of the portal. Comma seperated or multi tag.
|
||||||
|
@ -3,13 +3,18 @@ package com.sekwah.advancedportals.spigot.connector.container;
|
|||||||
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
|
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
|
||||||
import com.sekwah.advancedportals.core.connector.containers.ServerContainer;
|
import com.sekwah.advancedportals.core.connector.containers.ServerContainer;
|
||||||
import com.sekwah.advancedportals.core.connector.containers.WorldContainer;
|
import com.sekwah.advancedportals.core.connector.containers.WorldContainer;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SpigotServerContainer implements ServerContainer {
|
public class SpigotServerContainer implements ServerContainer {
|
||||||
|
|
||||||
private final Server server;
|
private final Server server;
|
||||||
|
private final List<String> triggerBlockList = Arrays.stream(Material.values()).filter(Material::isBlock).map(Enum::name)
|
||||||
|
.toList();
|
||||||
|
|
||||||
public SpigotServerContainer(Server server) {
|
public SpigotServerContainer(Server server) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
@ -45,6 +50,11 @@ public class SpigotServerContainer implements ServerContainer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTriggerBlocks() {
|
||||||
|
return this.triggerBlockList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerContainer[] getPlayers() {
|
public PlayerContainer[] getPlayers() {
|
||||||
return server.getOnlinePlayers().stream()
|
return server.getOnlinePlayers().stream()
|
||||||
|
Loading…
Reference in New Issue
Block a user