Compare commits
No commits in common. "7825d92b2aac079a2394f4713a5819f413fb4e29" and "77093109971269c6bda770e0eacfde701a96534d" have entirely different histories.
7825d92b2a
...
7709310997
11 changed files with 5 additions and 149 deletions
|
@ -10,7 +10,7 @@ trigger:
|
||||||
steps:
|
steps:
|
||||||
- name: publish
|
- name: publish
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
image: openjdk:21-jdk
|
image: openjdk:8-jdk
|
||||||
environment:
|
environment:
|
||||||
PACKAGESKEY:
|
PACKAGESKEY:
|
||||||
from_secret: GITEA_PACKAGE_PUBLIC_RW
|
from_secret: GITEA_PACKAGE_PUBLIC_RW
|
||||||
|
|
|
@ -2,7 +2,6 @@ package lol.pyr.znpcsplus.api.interaction;
|
||||||
|
|
||||||
public interface ActionRegistry {
|
public interface ActionRegistry {
|
||||||
void register(InteractionActionType<?> type);
|
void register(InteractionActionType<?> type);
|
||||||
|
|
||||||
void unregister(Class<? extends InteractionAction> clazz);
|
void unregister(Class<? extends InteractionAction> clazz);
|
||||||
<T extends InteractionAction> T deserialize(String str);
|
|
||||||
<T extends InteractionAction> String serialize(T action);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ subprojects {
|
||||||
version "2.1.0-netherite-SNAPSHOT"
|
version "2.1.0-netherite-SNAPSHOT"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -21,9 +21,6 @@ subprojects {
|
||||||
maven {
|
maven {
|
||||||
url "https://repo.codemc.io/repository/maven-releases/"
|
url "https://repo.codemc.io/repository/maven-releases/"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
url "https://repo.codemc.io/repository/maven-snapshots/"
|
|
||||||
}
|
|
||||||
maven {
|
maven {
|
||||||
url "https://libraries.minecraft.net"
|
url "https://libraries.minecraft.net"
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ dependencies {
|
||||||
|
|
||||||
// Fancy text library
|
// Fancy text library
|
||||||
implementation "net.kyori:adventure-platform-bukkit:4.3.4"
|
implementation "net.kyori:adventure-platform-bukkit:4.3.4"
|
||||||
implementation "net.kyori:adventure-text-minimessage:4.18.0"
|
implementation "net.kyori:adventure-text-minimessage:4.17.0"
|
||||||
|
|
||||||
implementation project(":api")
|
implementation project(":api")
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,9 +335,7 @@ public class ZNpcsPlus {
|
||||||
.addSubcommand("set", new HoloSetCommand(npcRegistry))
|
.addSubcommand("set", new HoloSetCommand(npcRegistry))
|
||||||
.addSubcommand("setitem", new HoloSetItemCommand(npcRegistry))
|
.addSubcommand("setitem", new HoloSetItemCommand(npcRegistry))
|
||||||
.addSubcommand("offset", new HoloOffsetCommand(npcRegistry))
|
.addSubcommand("offset", new HoloOffsetCommand(npcRegistry))
|
||||||
.addSubcommand("refreshdelay", new HoloRefreshDelayCommand(npcRegistry))
|
.addSubcommand("refreshdelay", new HoloRefreshDelayCommand(npcRegistry)))
|
||||||
.addSubcommand("removeduplicate", new HoloRemoveDuplicateCommand(npcRegistry))
|
|
||||||
.addSubcommand("removeallduplicates", new holoRemoveAllDuplicatesCommand(npcRegistry)))
|
|
||||||
.addSubcommand("action", new MultiCommand(bootstrap.loadHelpMessage("action"))
|
.addSubcommand("action", new MultiCommand(bootstrap.loadHelpMessage("action"))
|
||||||
.addSubcommand("add", new ActionAddCommand(npcRegistry, actionRegistry))
|
.addSubcommand("add", new ActionAddCommand(npcRegistry, actionRegistry))
|
||||||
.addSubcommand("clear", new ActionClearCommand(npcRegistry))
|
.addSubcommand("clear", new ActionClearCommand(npcRegistry))
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
package lol.pyr.znpcsplus.commands.hologram;
|
|
||||||
|
|
||||||
import lol.pyr.director.adventure.command.CommandContext;
|
|
||||||
import lol.pyr.director.adventure.command.CommandHandler;
|
|
||||||
import lol.pyr.director.common.command.CommandExecutionException;
|
|
||||||
import lol.pyr.znpcsplus.hologram.HologramImpl;
|
|
||||||
import lol.pyr.znpcsplus.hologram.HologramLine;
|
|
||||||
import lol.pyr.znpcsplus.hologram.HologramText;
|
|
||||||
import lol.pyr.znpcsplus.npc.NpcEntryImpl;
|
|
||||||
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HoloRemoveDuplicateCommand implements CommandHandler {
|
|
||||||
private final NpcRegistryImpl registry;
|
|
||||||
|
|
||||||
public HoloRemoveDuplicateCommand(NpcRegistryImpl registry) {
|
|
||||||
this.registry = registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(CommandContext context) throws CommandExecutionException {
|
|
||||||
context.setUsage(context.getLabel() + " holo removeduplicates <id>");
|
|
||||||
HologramImpl hologram = context.parse(NpcEntryImpl.class).getNpc().getHologram();
|
|
||||||
List<HologramLine<?>> lines = new ArrayList<>(hologram.getLines());
|
|
||||||
List<HologramText> textLines = new ArrayList<>();
|
|
||||||
|
|
||||||
Iterator<HologramLine<?>> iterator = lines.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
HologramLine<?> line = iterator.next();
|
|
||||||
if (line instanceof HologramText textLine
|
|
||||||
&& !textLine.getValue().equals(Component.empty())
|
|
||||||
&& textLines.contains(textLine)) {
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line instanceof HologramText textLine) {
|
|
||||||
textLines.add(textLine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hologram.clearLines();
|
|
||||||
hologram.addLines(lines);
|
|
||||||
context.send(Component.text("NPC lines fixed!", NamedTextColor.GREEN));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> suggest(CommandContext context) throws CommandExecutionException {
|
|
||||||
if (context.argSize() == 1) return context.suggestCollection(registry.getModifiableIds());
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
package lol.pyr.znpcsplus.commands.hologram;
|
|
||||||
|
|
||||||
import lol.pyr.director.adventure.command.CommandContext;
|
|
||||||
import lol.pyr.director.adventure.command.CommandHandler;
|
|
||||||
import lol.pyr.director.common.command.CommandExecutionException;
|
|
||||||
import lol.pyr.znpcsplus.hologram.HologramImpl;
|
|
||||||
import lol.pyr.znpcsplus.hologram.HologramLine;
|
|
||||||
import lol.pyr.znpcsplus.hologram.HologramText;
|
|
||||||
import lol.pyr.znpcsplus.npc.NpcEntryImpl;
|
|
||||||
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.format.NamedTextColor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class holoRemoveAllDuplicatesCommand implements CommandHandler {
|
|
||||||
private final NpcRegistryImpl registry;
|
|
||||||
|
|
||||||
public holoRemoveAllDuplicatesCommand(NpcRegistryImpl registry) {
|
|
||||||
this.registry = registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(CommandContext context) throws CommandExecutionException {
|
|
||||||
context.setUsage(context.getLabel() + " holo removeallduplicates <id>");
|
|
||||||
|
|
||||||
for (NpcEntryImpl npcEntry : registry.getAll()) {
|
|
||||||
HologramImpl hologram = npcEntry.getNpc().getHologram();
|
|
||||||
List<HologramLine<?>> lines = new ArrayList<>(hologram.getLines());
|
|
||||||
List<HologramText> textLines = new ArrayList<>();
|
|
||||||
|
|
||||||
Iterator<HologramLine<?>> iterator = lines.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
HologramLine<?> line = iterator.next();
|
|
||||||
if (line instanceof HologramText textLine
|
|
||||||
&& !textLine.getValue().equals(Component.empty())
|
|
||||||
&& textLines.contains(textLine)) {
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line instanceof HologramText textLine) {
|
|
||||||
textLines.add(textLine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hologram.clearLines();
|
|
||||||
hologram.addLines(lines);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.send(Component.text("NPCs fixed!", NamedTextColor.GREEN));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> suggest(CommandContext context) throws CommandExecutionException {
|
|
||||||
if (context.argSize() == 1) return context.suggestCollection(registry.getModifiableIds());
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -101,12 +101,6 @@ public class HologramImpl extends Viewable implements Hologram {
|
||||||
lines.clear();
|
lines.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLines(List<HologramLine<?>> lines) {
|
|
||||||
this.lines.addAll(lines);
|
|
||||||
relocateLines();
|
|
||||||
for (Player viewer : getViewers()) for (HologramLine<?> line : lines) line.show(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void insertTextLineComponent(int index, Component line) {
|
public void insertTextLineComponent(int index, Component line) {
|
||||||
HologramText newLine = new HologramText(this, propertyRegistry, packetFactory, null, line);
|
HologramText newLine = new HologramText(this, propertyRegistry, packetFactory, null, line);
|
||||||
lines.add(index, newLine);
|
lines.add(index, newLine);
|
||||||
|
|
|
@ -39,12 +39,4 @@ public class HologramText extends HologramLine<Component> {
|
||||||
public boolean hasProperty(EntityProperty<?> key) {
|
public boolean hasProperty(EntityProperty<?> key) {
|
||||||
return key.getName().equalsIgnoreCase("name") || key.getName().equalsIgnoreCase("invisible");
|
return key.getName().equalsIgnoreCase("name") || key.getName().equalsIgnoreCase("invisible");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) return true;
|
|
||||||
if (obj == null || getClass() != obj.getClass()) return false;
|
|
||||||
HologramText that = (HologramText) obj;
|
|
||||||
return getValue().equals(that.getValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,6 @@ public class NpcTypeRegistryImpl implements NpcTypeRegistry {
|
||||||
.setHologramOffset(0.4)
|
.setHologramOffset(0.4)
|
||||||
.addProperties("bashing", "camel_sitting"));
|
.addProperties("bashing", "camel_sitting"));
|
||||||
|
|
||||||
|
|
||||||
if (!version.isNewerThanOrEquals(ServerVersion.V_1_20_5)) return;
|
if (!version.isNewerThanOrEquals(ServerVersion.V_1_20_5)) return;
|
||||||
|
|
||||||
register(builder(p, "armadillo", EntityTypes.ARMADILLO)
|
register(builder(p, "armadillo", EntityTypes.ARMADILLO)
|
||||||
|
|
|
@ -11,9 +11,6 @@ api-version: 1.13
|
||||||
|
|
||||||
folia-supported: true
|
folia-supported: true
|
||||||
|
|
||||||
depend:
|
|
||||||
- packetevents
|
|
||||||
|
|
||||||
softdepend:
|
softdepend:
|
||||||
- PlaceholderAPI
|
- PlaceholderAPI
|
||||||
- ServersNPC
|
- ServersNPC
|
||||||
|
|
Loading…
Reference in a new issue