Attempt to fix Jenkins build
Oddly enough it builds with no errors on my computer
Dieser Commit ist enthalten in:
Ursprung
390c21f6d5
Commit
501244cb3c
@ -1,21 +1,19 @@
|
|||||||
package com.comphenix.protocol;
|
package com.comphenix.protocol;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import com.comphenix.protocol.utility.Constants;
|
||||||
import static org.mockito.Mockito.when;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_12_R1.DispenserRegistry;
|
import net.minecraft.server.v1_12_R1.DispenserRegistry;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemFactory;
|
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemFactory;
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.util.Versioning;
|
import org.bukkit.craftbukkit.v1_12_R1.util.Versioning;
|
||||||
|
|
||||||
import com.comphenix.protocol.utility.Constants;
|
import static org.mockito.Mockito.*;
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
|
||||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to ensure that ProtocolLib and Bukkit is prepared to be tested.
|
* Used to ensure that ProtocolLib and Bukkit is prepared to be tested.
|
||||||
@ -37,12 +35,18 @@ public class BukkitInitialization {
|
|||||||
|
|
||||||
initializePackage();
|
initializePackage();
|
||||||
|
|
||||||
|
try {
|
||||||
|
LogManager.getLogger();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
DispenserRegistry.c(); // Basically registers everything
|
DispenserRegistry.c(); // Basically registers everything
|
||||||
|
|
||||||
// Mock the server object
|
// Mock the server object
|
||||||
Server mockedServer = mock(Server.class);
|
Server mockedServer = mock(Server.class);
|
||||||
|
|
||||||
when(mockedServer.getLogger()).thenReturn(Logger.getLogger("Minecraft"));
|
when(mockedServer.getLogger()).thenReturn(java.util.logging.Logger.getLogger("Minecraft"));
|
||||||
when(mockedServer.getName()).thenReturn("Mock Server");
|
when(mockedServer.getName()).thenReturn("Mock Server");
|
||||||
when(mockedServer.getVersion()).thenReturn(CraftServer.class.getPackage().getImplementationVersion());
|
when(mockedServer.getVersion()).thenReturn(CraftServer.class.getPackage().getImplementationVersion());
|
||||||
when(mockedServer.getBukkitVersion()).thenReturn(Versioning.getBukkitVersion());
|
when(mockedServer.getBukkitVersion()).thenReturn(Versioning.getBukkitVersion());
|
||||||
@ -62,6 +66,12 @@ public class BukkitInitialization {
|
|||||||
if (!packaged) {
|
if (!packaged) {
|
||||||
packaged = true;
|
packaged = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
LogManager.getLogger();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
MinecraftReflection.setMinecraftPackage(Constants.NMS, Constants.OBC);
|
MinecraftReflection.setMinecraftPackage(Constants.NMS, Constants.OBC);
|
||||||
MinecraftVersion.setCurrentVersion(MinecraftVersion.COLOR_UPDATE);
|
MinecraftVersion.setCurrentVersion(MinecraftVersion.COLOR_UPDATE);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren