mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Trial using runtime maven dependencies to reduce jar size
This commit is contained in:
parent
06b1568e07
commit
7d2a222143
33
main/pom.xml
33
main/pom.xml
@ -42,6 +42,10 @@
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>AlessioDP</id>
|
||||
<url>https://repo.alessiodp.com/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -52,12 +56,6 @@
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-module-junit4</artifactId>
|
||||
@ -74,7 +72,19 @@
|
||||
<groupId>net.sf.trove4j</groupId>
|
||||
<artifactId>trove4j</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<scope>compile</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.ethz.globis.phtree</groupId>
|
||||
<artifactId>phtree</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
@ -101,6 +111,11 @@
|
||||
<version>${worldguard.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.byteflux</groupId>
|
||||
<artifactId>libby-bukkit</artifactId> <!-- Replace bukkit if you're using another platform -->
|
||||
<version>1.1.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<url>http://www.citizensnpcs.co</url>
|
||||
@ -192,6 +207,10 @@
|
||||
<pattern>net.kyori</pattern>
|
||||
<shadedPattern>clib.net.kyori</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>net.byteflux.libby</pattern>
|
||||
<shadedPattern>clib.net.byteflux.libby</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>net.citizensnpcs.util.metrics</shadedPattern>
|
||||
|
@ -27,6 +27,8 @@ import com.google.common.collect.Maps;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
|
||||
import net.byteflux.libby.BukkitLibraryManager;
|
||||
import net.byteflux.libby.Library;
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.CitizensPlugin;
|
||||
@ -281,6 +283,45 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
return traitFactory;
|
||||
}
|
||||
|
||||
private void loadMavenLibraries() {
|
||||
BukkitLibraryManager lib = new BukkitLibraryManager(this);
|
||||
lib.addMavenCentral();
|
||||
// Unfortunately, transitive dependency management is not supported in this library.
|
||||
// TODO: consider using eclipse aether to resolve dependencies
|
||||
lib.loadLibrary(Library.builder().groupId("ch{}ethz{}globis{}phtree").artifactId("phtree").version("2.5.0")
|
||||
.relocate("ch{}ethz{}globis{}phtree", "clib{}phtree").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}sf{}trove4j").artifactId("trove4j").version("3.0.3")
|
||||
.relocate("gnu{}trove", "clib{}trove").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-minimessage")
|
||||
.version("4.11.0").relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-bukkit").version("4.1.2")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-api").version("4.1.2")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-facet").version("4.1.2")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-viaversion")
|
||||
.version("4.1.2").relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-api").version("4.11.0")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-bungeecord")
|
||||
.version("4.1.2").relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-legacy")
|
||||
.version("4.11.0").relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-gson")
|
||||
.version("4.11.0").relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-gson-legacy-impl")
|
||||
.version("4.11.0").relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-nbt").version("4.11.0")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-key").version("4.11.0")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("examination-api").version("1.3.0")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("examination-string").version("1.3.0")
|
||||
.relocate("net{}kyori", "clib{}net{}kyori").build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String cmdName, String[] args) {
|
||||
// TODO: use injector?
|
||||
@ -311,6 +352,8 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
loadMavenLibraries();
|
||||
|
||||
CitizensAPI.setImplementation(this);
|
||||
config = new Settings(getDataFolder());
|
||||
setupTranslator();
|
||||
|
@ -36,6 +36,7 @@ public class SleepTrait extends Trait {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (at == null)
|
||||
return;
|
||||
|
||||
|
@ -47,7 +47,8 @@ public class SlimeSize extends Trait {
|
||||
*/
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
if (slime)
|
||||
if (slime) {
|
||||
((Slime) npc.getEntity()).setSize(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,9 @@ package net.citizensnpcs.nms.v1_8_R3.entity;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -15,7 +17,6 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.event.NPCEnderTeleportEvent;
|
||||
@ -61,7 +62,7 @@ import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||
public class EntityHumanNPC extends EntityPlayer implements NPCHolder, SkinnableEntity {
|
||||
private PlayerControllerJump controllerJump;
|
||||
private PlayerControllerMove controllerMove;
|
||||
private final TIntObjectHashMap<ItemStack> equipmentCache = new TIntObjectHashMap<ItemStack>();
|
||||
private final Map<Integer, ItemStack> equipmentCache = new HashMap<Integer, ItemStack>();
|
||||
private int jumpTicks = 0;
|
||||
private PlayerNavigation navigation;
|
||||
private final CitizensNPC npc;
|
||||
|
Loading…
Reference in New Issue
Block a user