mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 02:55:45 +01:00
Fix /npc text pages, add via version backcompat
This commit is contained in:
parent
f90b1f747b
commit
249074c7bc
@ -223,7 +223,7 @@ public class Text extends Trait implements Runnable, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean sendPage(CommandSender player, int page) {
|
boolean sendPage(CommandSender player, int page) {
|
||||||
Paginator paginator = new Paginator().header("Current Texts").enablePageSwitcher();
|
Paginator paginator = new Paginator().header("Current Texts").enablePageSwitcher("/npc text page $page");
|
||||||
for (int i = 0; i < text.size(); i++) {
|
for (int i = 0; i < text.size(); i++) {
|
||||||
paginator.addLine(text.get(i) + " <green>(<click:suggest_command:edit " + i
|
paginator.addLine(text.get(i) + " <green>(<click:suggest_command:edit " + i
|
||||||
+ " ><yellow>edit</click>) (<hover:show_text:Remove this text><click:run_command:/npc text remove "
|
+ " ><yellow>edit</click>) (<hover:show_text:Remove this text><click:run_command:/npc text remove "
|
||||||
|
@ -351,7 +351,7 @@ citizens.editors.text.range-set=[[Range]] set to [[{0}]].
|
|||||||
citizens.editors.text.delay-set=[[Delay]] set to [[{0}]] seconds.
|
citizens.editors.text.delay-set=[[Delay]] set to [[{0}]] seconds.
|
||||||
citizens.editors.text.realistic-looking-set=[[Realistic looking]] set to [[{0}]].
|
citizens.editors.text.realistic-looking-set=[[Realistic looking]] set to [[{0}]].
|
||||||
citizens.editors.text.speech-bubbles-set=[[Speech bubbles]] set to [[{0}]].
|
citizens.editors.text.speech-bubbles-set=[[Speech bubbles]] set to [[{0}]].
|
||||||
citizens.editors.text.start-prompt=<click:suggest_command:add ><yellow>Add text</click> | <click:suggest_command:item ><hover:show_text:"Set the talk item in hand pattern (set to <yellow>default</yellow> to clear)"><yellow>item</hover></click> | <click:suggest_command:range ><hover:show_text:Set the talking range in blocks><yellow>range</hover></click> | <click:suggest_command:delay ><hover:show_text:Set the talking delay in seconds><yellow>delay</hover></click><br><click:run_command:/npc text close><hover:show_text:Toggle sending messages when players get close>{0}talk close</hover></click> | <click:run_command:/npc text random><hover:show_text:Toggle random talking>{1}random</hover></click> | <click:run_command:/npc text speech bubbles><hover:show_text:Toggle showing text as holograms instead of chat messages>{2}speech bubbles</hover></click> | <click:run_command:/npc text realistic looking><hover:show_text:Toggle requiring line of sight before speaking>{3}realistic</hover></click>
|
citizens.editors.text.start-prompt=<click:suggest_command:add ><yellow>Add text</click> | <click:suggest_command:item ><hover:show_text:"Set the talk item in hand pattern (set to <yellow>default</yellow> to clear)"><yellow>item</hover></click> | <click:suggest_command:range ><hover:show_text:Set the talking range in blocks><yellow>range</hover></click> | <click:suggest_command:delay ><hover:show_text:Set the talking delay in seconds><yellow>delay</yellow></hover></click><br><click:run_command:/npc text close><hover:show_text:Toggle sending messages when players get close>{0}talk close</hover></click> | <click:run_command:/npc text random><hover:show_text:Toggle random talking>{1}random</hover></click> | <click:run_command:/npc text speech bubbles><hover:show_text:Toggle showing text as holograms instead of chat messages>{2}speech bubbles</hover></click> | <click:run_command:/npc text realistic looking><hover:show_text:Toggle requiring line of sight before speaking>{3}realistic</hover></click>
|
||||||
citizens.editors.text.talk-item-set=[[Talk item pattern]] set to [[{0}]].
|
citizens.editors.text.talk-item-set=[[Talk item pattern]] set to [[{0}]].
|
||||||
citizens.editors.text.text-list-header=Current text:
|
citizens.editors.text.text-list-header=Current text:
|
||||||
citizens.editors.waypoints.wander.editing-regions-stop=Exited the region editor.
|
citizens.editors.waypoints.wander.editing-regions-stop=Exited the region editor.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<artifactId>citizens-parent</artifactId>
|
<artifactId>citizens-parent</artifactId>
|
||||||
<version>2.0.30-SNAPSHOT</version>
|
<version>2.0.30-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>citizens-v1_19_R2</artifactId>
|
<artifactId>citizens-v1_19_R2</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -13,6 +14,13 @@
|
|||||||
<craftbukkit.version>1.19.3-R0.1-SNAPSHOT</craftbukkit.version>
|
<craftbukkit.version>1.19.3-R0.1-SNAPSHOT</craftbukkit.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>viaversion-repo</id>
|
||||||
|
<url>https://repo.viaversion.com</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
@ -27,12 +35,17 @@
|
|||||||
<classifier>remapped-mojang</classifier>
|
<classifier>remapped-mojang</classifier>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.viaversion</groupId>
|
||||||
|
<artifactId>viaversion-api</artifactId>
|
||||||
|
<version>4.5.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>clean package install</defaultGoal>
|
<defaultGoal>clean package install</defaultGoal>
|
||||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -43,7 +56,6 @@
|
|||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
@ -55,7 +67,6 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>net.md-5</groupId>
|
||||||
<artifactId>specialsource-maven-plugin</artifactId>
|
<artifactId>specialsource-maven-plugin</artifactId>
|
||||||
@ -89,13 +100,11 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>3.2.2</version>
|
<version>3.2.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
@ -5,6 +5,9 @@ import java.lang.invoke.MethodHandle;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.viaversion.viaversion.api.Via;
|
||||||
|
|
||||||
|
import net.citizensnpcs.Settings.Setting;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.nms.v1_19_R2.entity.EntityHumanNPC;
|
import net.citizensnpcs.nms.v1_19_R2.entity.EntityHumanNPC;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
@ -22,6 +25,15 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
|||||||
public PlayerlistTracker(ChunkMap map, Entity entity, int i, int j, boolean flag) {
|
public PlayerlistTracker(ChunkMap map, Entity entity, int i, int j, boolean flag) {
|
||||||
map.super(entity, i, j, flag);
|
map.super(entity, i, j, flag);
|
||||||
this.tracker = entity;
|
this.tracker = entity;
|
||||||
|
|
||||||
|
if (VIA_ENABLED == null) {
|
||||||
|
try {
|
||||||
|
Via.getAPI();
|
||||||
|
VIA_ENABLED = true;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
VIA_ENABLED = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerlistTracker(ChunkMap map, TrackedEntity entry) {
|
public PlayerlistTracker(ChunkMap map, TrackedEntity entry) {
|
||||||
@ -41,6 +53,21 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
|||||||
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new ClientboundAnimatePacket(tracker, 0));
|
NMSImpl.sendPacket(entityplayer.getBukkitEntity(), new ClientboundAnimatePacket(tracker, 0));
|
||||||
}
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
if (VIA_ENABLED == false || !Setting.DISABLE_TABLIST.asBoolean())
|
||||||
|
return;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
int version = Via.getAPI().getPlayerVersion(entityplayer.getBukkitEntity());
|
||||||
|
if (version >= 761 /* 1.19.3 */)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
NMS.sendTabListRemove(entityplayer.getBukkitEntity(), (Player) tracker.getBukkitEntity());
|
||||||
|
}
|
||||||
|
}, Setting.TABLIST_REMOVE_PACKET_DELAY.asInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,4 +119,5 @@ public class PlayerlistTracker extends ChunkMap.TrackedEntity {
|
|||||||
private static final MethodHandle TRACKER = NMS.getFirstGetter(TrackedEntity.class, Entity.class);
|
private static final MethodHandle TRACKER = NMS.getFirstGetter(TrackedEntity.class, Entity.class);
|
||||||
private static final MethodHandle TRACKER_ENTRY = NMS.getFirstGetter(TrackedEntity.class, ServerEntity.class);
|
private static final MethodHandle TRACKER_ENTRY = NMS.getFirstGetter(TrackedEntity.class, ServerEntity.class);
|
||||||
private static final MethodHandle TRACKING_DISTANCE = NMS.getFirstGetter(TrackedEntity.class, int.class);
|
private static final MethodHandle TRACKING_DISTANCE = NMS.getFirstGetter(TrackedEntity.class, int.class);
|
||||||
|
private static Boolean VIA_ENABLED = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user