-
Notifications
You must be signed in to change notification settings - Fork 20
/
slim-jar.py
30 lines (23 loc) · 976 Bytes
/
slim-jar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
# Generate minecraft-server.jar (internally-renamed server jar)
# without any of the NMS classes included in the CB project
# This can help avoid PSI errors
# To use:
# 1. edit CraftBukkit/pom.xml , change:
# <artifactId>minecraft-server</artifactId>
# to:
# <artifactId>slim-minecraft-server</artifactId>
# 2. run:
# mvn install:install-file -Dfile=slim-minecraft-server-1.5.jar -DgroupId=org.bukkit -DartifactId=slim-minecraft-server -Dversion=1.5 -Dpackaging=jar
# Project should build as normal
import zipfile, os, sys
srcDir = "../CraftBukkit/src/main/java/net/minecraft/server"
inFile = "minecraft-server-1.5.jar"
outFile = "slim-minecraft-server-1.5.jar"
skipFiles = ["net/minecraft/server/" + x.replace(".java", ".class") for x in os.listdir(srcDir)]
z = zipfile.ZipFile(inFile)
z2 = zipfile.ZipFile(outFile, "w")
for zi in z.infolist():
if zi.filename not in skipFiles:
z2.writestr(zi, z.read(zi.filename))
z2.close()