mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-23 19:16:14 +01:00
Ignore log files generated by Log4J, fix an error with MCPC
This commit is contained in:
parent
b32d0d5fcd
commit
47632e1fb1
9
.gitignore
vendored
9
.gitignore
vendored
@ -161,11 +161,14 @@ pip-log.txt
|
|||||||
.coverage
|
.coverage
|
||||||
.tox
|
.tox
|
||||||
|
|
||||||
#Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
|
||||||
#Mr Developer
|
# Mr Developer
|
||||||
.mr.developer.cfg
|
.mr.developer.cfg
|
||||||
|
|
||||||
# Mac crap
|
# Mac crap
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Log4J files
|
||||||
|
logs/
|
@ -63,7 +63,7 @@ class RemappedClassSource extends ClassSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String version = server.getVersion();
|
String version = server.getVersion();
|
||||||
if (!server.getVersion().contains("MCPC-Plus") && !version.contains("Cauldron")) {
|
if (!version.contains("MCPC") && !version.contains("Cauldron")) {
|
||||||
throw new RemapperUnavaibleException(Reason.MCPC_NOT_PRESENT);
|
throw new RemapperUnavaibleException(Reason.MCPC_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import net.minecraft.server.v1_8_R3.DispenserRegistry;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||||
import org.bukkit.inventory.ItemFactory;
|
import org.bukkit.inventory.ItemFactory;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@ -32,8 +33,6 @@ public class BukkitInitialization {
|
|||||||
// Denote that we're done
|
// Denote that we're done
|
||||||
initialized = true;
|
initialized = true;
|
||||||
|
|
||||||
initializePackage();
|
|
||||||
|
|
||||||
DispenserRegistry.c(); // Basically registers everything
|
DispenserRegistry.c(); // Basically registers everything
|
||||||
|
|
||||||
// Mock the server object
|
// Mock the server object
|
||||||
@ -41,20 +40,14 @@ public class BukkitInitialization {
|
|||||||
ItemMeta mockedMeta = mock(ItemMeta.class);
|
ItemMeta mockedMeta = mock(ItemMeta.class);
|
||||||
ItemFactory mockedFactory = new ItemFactoryDelegate(mockedMeta);
|
ItemFactory mockedFactory = new ItemFactoryDelegate(mockedMeta);
|
||||||
|
|
||||||
|
when(mockedServer.getVersion()).thenReturn(CraftServer.class.getPackage().getImplementationVersion());
|
||||||
when(mockedServer.getItemFactory()).thenReturn(mockedFactory);
|
when(mockedServer.getItemFactory()).thenReturn(mockedFactory);
|
||||||
when(mockedServer.isPrimaryThread()).thenReturn(true);
|
when(mockedServer.isPrimaryThread()).thenReturn(true);
|
||||||
// when(mockedFactory.getItemMeta(any(Material.class))).thenReturn(mockedMeta);
|
|
||||||
|
|
||||||
// Inject this fake server
|
// Inject this fake server
|
||||||
FieldUtils.writeStaticField(Bukkit.class, "server", mockedServer, true);
|
FieldUtils.writeStaticField(Bukkit.class, "server", mockedServer, true);
|
||||||
|
|
||||||
// TODO Figure this out
|
initializePackage();
|
||||||
/* try {
|
|
||||||
FieldUtils.writeStaticFinalField(CraftItemFactory.class, "instance", mockedFactory, true);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
System.err.println("Failed to inject fake item factory: ");
|
|
||||||
ex.printStackTrace();
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user