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

Datei anzeigen

@ -19,11 +19,14 @@
package de.steamwar.command;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.types.ListenerLink;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@Linked(ListenerLink.class)
public class CaseInsensitiveCommandsListener implements Listener {
@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.PlayerJoinedEvent;
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.network.NetworkReceiver;
import de.steamwar.sql.Statement;
@ -115,22 +119,13 @@ public class Core extends JavaPlugin{
}
});
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().registerOutgoingPluginChannel(this, "sw:bridge");
if(Core.getVersion() < 19)
AuthlibInjector.inject();
LinkageUtils.run(ListenerLink.class, EnableLink.class);
TinyProtocol.init();
if(Core.getVersion() < 17 && Bukkit.getPluginManager().getPlugin("ViaVersion") != null)
new PartialChunkFixer();
if(Core.getVersion() >= 19)
//new ServerDataHandler();
LinkageUtils.run(Plain.class);
try {
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.mojang.authlib.GameProfileRepository;
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 {
private AuthlibInjector() {}
@Linked(EnableLink.class)
@MaxVersion(19)
public class AuthlibInjector implements Enable {
public static void inject() {
@Override
public void enable() {
Class<?> minecraftServerClass = Reflection.getClass("{nms.server}.MinecraftServer");
Reflection.FieldAccessor<GameProfileRepository> gameProfile = Reflection.getField(minecraftServerClass, GameProfileRepository.class, 0);
Object minecraftServer = Reflection.getTypedMethod(minecraftServerClass, "getServer", minecraftServerClass).invoke(null);

Datei anzeigen

@ -20,15 +20,18 @@
package de.steamwar.core.events;
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.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
@Linked(ListenerLink.class)
public class ChattingEvent implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onChat(AsyncPlayerChatEvent event) {
public void onChat(AsyncPlayerChatEvent event) {
event.setCancelled(true);
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 de.steamwar.core.Core;
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.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.
* 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 {
private static final int PROTOCOL1_17 = 755;

Datei anzeigen

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

Datei anzeigen

@ -19,10 +19,13 @@
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.Listener;
import org.bukkit.event.world.WorldInitEvent;
@Linked(ListenerLink.class)
public class WorldLoadEvent implements Listener {
@EventHandler

Datei anzeigen

@ -4,8 +4,13 @@ import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.core.ChatWrapper;
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;
// @Linked(Plain.class)
@MinVersion(19)
public class ServerDataHandler {
private Class<?> serverDataPacket = Reflection.getClass("{nms.network.protocol.game}.ClientboundServerDataPacket");