SteamWar/SpigotCore
Archiviert
13
0

Update to Linkage System
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2022-09-23 09:18:47 +02:00
Ursprung 4462c95607
Commit 8f544c3fd0
9 geänderte Dateien mit 45 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -33,7 +33,7 @@ targetCompatibility = 1.8
sourceSets { sourceSets {
main { main {
java { java {
srcDirs = ['src/'] srcDirs = ['src/', 'build/generated/sources/annotationProcessor/java/main/']
} }
resources { resources {
srcDirs = ['src/'] srcDirs = ['src/']
@ -65,10 +65,5 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation 'org.hamcrest:hamcrest:2.2'
implementation project(':CommonCore') implementation project(':CommonCore')
} annotationProcessor project(":CommonCore")
processResources {
from("build/classes/java/main/META-INF/annotations/") {
into("de.steamwar.bausystem")
}
} }

Datei anzeigen

@ -19,11 +19,14 @@
package de.steamwar.command; package de.steamwar.command;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.types.ListenerLink;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@Linked(ListenerLink.class)
public class CaseInsensitiveCommandsListener implements Listener { public class CaseInsensitiveCommandsListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)

Datei anzeigen

@ -26,6 +26,10 @@ import de.steamwar.core.events.ChattingEvent;
import de.steamwar.core.events.PartialChunkFixer; import de.steamwar.core.events.PartialChunkFixer;
import de.steamwar.core.events.PlayerJoinedEvent; import de.steamwar.core.events.PlayerJoinedEvent;
import de.steamwar.core.events.WorldLoadEvent; import de.steamwar.core.events.WorldLoadEvent;
import de.steamwar.linkage.types.EnableLink;
import de.steamwar.linkage.types.Plain;
import de.steamwar.spigotcore.linkage.LinkageUtils;
import de.steamwar.linkage.types.ListenerLink;
import de.steamwar.message.Message; import de.steamwar.message.Message;
import de.steamwar.network.NetworkReceiver; import de.steamwar.network.NetworkReceiver;
import de.steamwar.sql.Statement; import de.steamwar.sql.Statement;
@ -115,22 +119,13 @@ public class Core extends JavaPlugin{
} }
}); });
Bukkit.getScheduler().runTaskTimer(this, TabCompletionCache::invalidateOldEntries, 20, 20); Bukkit.getScheduler().runTaskTimer(this, TabCompletionCache::invalidateOldEntries, 20, 20);
Bukkit.getPluginManager().registerEvents(new CaseInsensitiveCommandsListener(), this);
Bukkit.getPluginManager().registerEvents(new PlayerJoinedEvent(), this);
Bukkit.getPluginManager().registerEvents(new ChattingEvent(), this);
Bukkit.getPluginManager().registerEvents(new WorldLoadEvent(), this);
getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new NetworkReceiver()); getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new NetworkReceiver());
getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge"); getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge");
if(Core.getVersion() < 19)
AuthlibInjector.inject(); LinkageUtils.run(ListenerLink.class, EnableLink.class);
TinyProtocol.init(); TinyProtocol.init();
LinkageUtils.run(Plain.class);
if(Core.getVersion() < 17 && Bukkit.getPluginManager().getPlugin("ViaVersion") != null)
new PartialChunkFixer();
if(Core.getVersion() >= 19)
//new ServerDataHandler();
try { try {
getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine()); getLogger().log(Level.INFO, "Running on: " + new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("hostname").getInputStream())).readLine());

Datei anzeigen

@ -22,11 +22,17 @@ package de.steamwar.core.authlib;
import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.Reflection;
import com.mojang.authlib.GameProfileRepository; import com.mojang.authlib.GameProfileRepository;
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MaxVersion;
import de.steamwar.linkage.api.Enable;
import de.steamwar.linkage.types.EnableLink;
public class AuthlibInjector { @Linked(EnableLink.class)
private AuthlibInjector() {} @MaxVersion(19)
public class AuthlibInjector implements Enable {
public static void inject() { @Override
public void enable() {
Class<?> minecraftServerClass = Reflection.getClass("{nms.server}.MinecraftServer"); Class<?> minecraftServerClass = Reflection.getClass("{nms.server}.MinecraftServer");
Reflection.FieldAccessor<GameProfileRepository> gameProfile = Reflection.getField(minecraftServerClass, GameProfileRepository.class, 0); Reflection.FieldAccessor<GameProfileRepository> gameProfile = Reflection.getField(minecraftServerClass, GameProfileRepository.class, 0);
Object minecraftServer = Reflection.getTypedMethod(minecraftServerClass, "getServer", minecraftServerClass).invoke(null); Object minecraftServer = Reflection.getTypedMethod(minecraftServerClass, "getServer", minecraftServerClass).invoke(null);

Datei anzeigen

@ -20,15 +20,18 @@
package de.steamwar.core.events; package de.steamwar.core.events;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.types.ListenerLink;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
@Linked(ListenerLink.class)
public class ChattingEvent implements Listener { public class ChattingEvent implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onChat(AsyncPlayerChatEvent event) { public void onChat(AsyncPlayerChatEvent event) {
event.setCancelled(true); event.setCancelled(true);
Core.MESSAGE.broadcastPrefixless("LOCAL_CHAT", event.getPlayer().getDisplayName(), event.getMessage()); Core.MESSAGE.broadcastPrefixless("LOCAL_CHAT", event.getPlayer().getDisplayName(), event.getMessage());
} }

Datei anzeigen

@ -25,6 +25,10 @@ import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.ViaAPI; import com.viaversion.viaversion.api.ViaAPI;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MaxVersion;
import de.steamwar.linkage.PluginCheck;
import de.steamwar.linkage.types.Plain;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -35,6 +39,9 @@ import java.util.List;
* TinyProtocol can't translate BlockEntities during 1.16 to 1.17 conversions du to removed partial chunk update support. This class cancels PartialChunkUpdates for this players and sends them a complete chunk instead. * TinyProtocol can't translate BlockEntities during 1.16 to 1.17 conversions du to removed partial chunk update support. This class cancels PartialChunkUpdates for this players and sends them a complete chunk instead.
* This class can only be loaded on 1.9 to 1.15 with active ViaVersion. * This class can only be loaded on 1.9 to 1.15 with active ViaVersion.
**/ **/
@Linked(Plain.class)
@MaxVersion(17)
@PluginCheck("ViaVersion")
public class PartialChunkFixer { public class PartialChunkFixer {
private static final int PROTOCOL1_17 = 755; private static final int PROTOCOL1_17 = 755;

Datei anzeigen

@ -19,6 +19,8 @@
package de.steamwar.core.events; package de.steamwar.core.events;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.types.ListenerLink;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserGroup;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -28,10 +30,11 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@Linked(ListenerLink.class)
public class PlayerJoinedEvent implements Listener{ public class PlayerJoinedEvent implements Listener{
@EventHandler @EventHandler
private void onJoin(PlayerJoinEvent event) { public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
@ -45,7 +48,7 @@ public class PlayerJoinedEvent implements Listener{
} }
@EventHandler @EventHandler
private void onQuit(PlayerQuitEvent event) { public void onQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
event.setQuitMessage("§c§l« §r" + player.getDisplayName()); event.setQuitMessage("§c§l« §r" + player.getDisplayName());

Datei anzeigen

@ -19,10 +19,13 @@
package de.steamwar.core.events; package de.steamwar.core.events;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.types.ListenerLink;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldInitEvent;
@Linked(ListenerLink.class)
public class WorldLoadEvent implements Listener { public class WorldLoadEvent implements Listener {
@EventHandler @EventHandler

Datei anzeigen

@ -4,8 +4,13 @@ import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol; import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.core.ChatWrapper; import de.steamwar.core.ChatWrapper;
import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.MinVersion;
import de.steamwar.linkage.types.Plain;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
// @Linked(Plain.class)
@MinVersion(19)
public class ServerDataHandler { public class ServerDataHandler {
private Class<?> serverDataPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket"); private Class<?> serverDataPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket");