NOT FINISHED!!! Current Progress on 1.13-pre7 update
This work is 100% unfinished. I am pushing it up so that we as a team can work on this update. Do not try to use this branch. You will fail.
This commit is contained in:
@@ -6,12 +6,15 @@ Subject: [PATCH] Paper config files
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
new file mode 100644
|
||||
index 00000000..ecd1c65a
|
||||
index 000000000..e8f7b7292
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package com.destroystokyo.paper;
|
||||
+
|
||||
+import com.google.common.base.Functions;
|
||||
+import com.google.common.collect.Iterables;
|
||||
+import com.google.common.collect.Lists;
|
||||
+import com.google.common.collect.Maps;
|
||||
+import net.minecraft.server.*;
|
||||
+import org.apache.commons.lang3.tuple.MutablePair;
|
||||
@@ -44,20 +47,61 @@ index 00000000..ecd1c65a
|
||||
+ @Override
|
||||
+ public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
|
||||
+ if (args.length <= 1)
|
||||
+ return CommandAbstract.getListMatchingLast(args, "heap", "entity", "reload", "version");
|
||||
+ return getListMatchingLast(args, "heap", "entity", "reload", "version");
|
||||
+
|
||||
+ switch (args[0].toLowerCase(Locale.ENGLISH))
|
||||
+ {
|
||||
+ case "entity":
|
||||
+ if (args.length == 2)
|
||||
+ return CommandAbstract.getListMatchingLast(args, "help", "list");
|
||||
+ return getListMatchingLast(args, "help", "list");
|
||||
+ if (args.length == 3)
|
||||
+ return CommandAbstract.getListMatchingLast(args, EntityTypes.getEntityNameList().stream().map(MinecraftKey::toString).sorted().toArray(String[]::new));
|
||||
+ return getListMatchingLast(args, EntityTypes.getEntityNameList().stream().map(MinecraftKey::toString).sorted().toArray(String[]::new));
|
||||
+ break;
|
||||
+ }
|
||||
+ return Collections.emptyList();
|
||||
+ }
|
||||
+
|
||||
+ // Code from Mojang - copyright them
|
||||
+ public static List<String> getListMatchingLast(String[] args, String... matches) {
|
||||
+ return getListMatchingLast(args, (Collection) Arrays.asList(matches));
|
||||
+ }
|
||||
+
|
||||
+ public static boolean matches(String s, String s1) {
|
||||
+ return s1.regionMatches(true, 0, s, 0, s.length());
|
||||
+ }
|
||||
+
|
||||
+ public static List<String> getListMatchingLast(String[] strings, Collection<?> collection) {
|
||||
+ String last = strings[strings.length - 1];
|
||||
+ ArrayList<String> results = Lists.newArrayList();
|
||||
+
|
||||
+ if (!collection.isEmpty()) {
|
||||
+ Iterator iterator = Iterables.transform(collection, Functions.toStringFunction()).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ String s1 = (String) iterator.next();
|
||||
+
|
||||
+ if (matches(last, s1)) {
|
||||
+ results.add(s1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (results.isEmpty()) {
|
||||
+ iterator = collection.iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Object object = iterator.next();
|
||||
+
|
||||
+ if (object instanceof MinecraftKey && matches(last, ((MinecraftKey) object).getKey())) {
|
||||
+ results.add(String.valueOf(object));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return results;
|
||||
+ }
|
||||
+ // end copy stuff
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
|
||||
+ if (!testPermission(sender)) return true;
|
||||
@@ -139,7 +183,7 @@ index 00000000..ecd1c65a
|
||||
+
|
||||
+ List<Entity> entities = world.entityList;
|
||||
+ entities.forEach(e -> {
|
||||
+ MinecraftKey key = EntityTypes.getKey(e);
|
||||
+ MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch
|
||||
+
|
||||
+ MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
|
||||
+ ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
|
||||
@@ -205,7 +249,7 @@ index 00000000..ecd1c65a
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
new file mode 100644
|
||||
index 00000000..3d8ee9ed
|
||||
index 000000000..3d8ee9ed3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -384,7 +428,7 @@ index 00000000..3d8ee9ed
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
new file mode 100644
|
||||
index 00000000..621bf705
|
||||
index 000000000..621bf7051
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -454,20 +498,8 @@ index 00000000..621bf705
|
||||
+ return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java
|
||||
index 76501e29..76bf04f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class CommandAbstract implements ICommand {
|
||||
return s1.regionMatches(true, 0, s, 0, s.length());
|
||||
}
|
||||
|
||||
+ public static List<String> getListMatchingLast(String[] args, String... matches) { return a(args, matches); } // Paper - OBFHELPER
|
||||
public static List<String> a(String[] astring, String... astring1) {
|
||||
return a(astring, (Collection) Arrays.asList(astring1));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index 8c5361d6..e1cb96a8 100644
|
||||
index 8563712d9..9155aa727 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
@@ -482,47 +514,51 @@ index 8c5361d6..e1cb96a8 100644
|
||||
DedicatedServer.LOGGER.info("Generating keypair");
|
||||
this.a(MinecraftEncryption.b());
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index b944be5c..40f06c5b 100644
|
||||
index 015959b9f..f3f8b65be 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener {
|
||||
private static final DataWatcherObject<Boolean> aD = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
private static final DataWatcherObject<Boolean> aE = DataWatcher.a(Entity.class, DataWatcherRegistry.h);
|
||||
public boolean aa;
|
||||
- public int ab;
|
||||
- public int ac;
|
||||
- public int ad;
|
||||
+ public int ab; public int getChunkX() { return ab; } // Paper - OBFHELPER
|
||||
+ public int ac; public int getChunkY() { return ac; } // Paper - OBFHELPER
|
||||
+ public int ad; public int getChunkZ() { return ad; } // Paper - OBFHELPER
|
||||
public boolean ah;
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||
private static final DataWatcherObject<Boolean> aG = DataWatcher.a(Entity.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Boolean> aH = DataWatcher.a(Entity.class, DataWatcherRegistry.i);
|
||||
public boolean inChunk;
|
||||
- public int ae;
|
||||
- public int af;
|
||||
- public int ag;
|
||||
+ public int ae; public int getChunkX() { return ae; } // Paper - OBFHELPER
|
||||
+ public int af; public int getChunkY() { return af; } // Paper - OBFHELPER
|
||||
+ public int ag; public int getChunkZ() { return ag; } // Paper - OBFHELPER
|
||||
public boolean ak;
|
||||
public boolean impulse;
|
||||
public int portalCooldown;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
|
||||
index eb6a955e..77b81a57 100644
|
||||
index a0c701f35..557a3f97f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTypes.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTypes {
|
||||
public static final Set<MinecraftKey> d = Sets.newHashSet();
|
||||
private static final List<String> g = Lists.newArrayList();
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
||||
+ @Nullable public static MinecraftKey getKey(Entity entity) { return a(entity); } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
public static MinecraftKey a(Entity entity) {
|
||||
return getName(entity.getClass());
|
||||
@@ -0,0 +0,0 @@ public class EntityTypes {
|
||||
return entity;
|
||||
}
|
||||
|
||||
+ public static Set<MinecraftKey> getEntityNameList() { return a(); } // Paper - OBFHELPER
|
||||
public static Set<MinecraftKey> a() {
|
||||
return EntityTypes.d;
|
||||
import com.mojang.datafixers.DataFixUtils;
|
||||
import com.mojang.datafixers.types.Type;
|
||||
+
|
||||
+import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> {
|
||||
return new EntityTypes(this.a, this.b, this.c, this.d, type);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public static Set<MinecraftKey> getEntityNameList() {
|
||||
+ return REGISTRY.keySet();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 740633d9..843320ff 100644
|
||||
index c7f5cba2d..330ea4e72 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
private int tickPosition;
|
||||
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
|
||||
|
||||
@@ -531,7 +567,7 @@ index 740633d9..843320ff 100644
|
||||
public final SpigotTimings.WorldTimingsHandler timings; // Spigot
|
||||
private boolean guardEntityList; // Spigot
|
||||
public static boolean haveWeSilencedAPhysicsCrash;
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
||||
|
||||
protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
|
||||
@@ -540,7 +576,7 @@ index 740633d9..843320ff 100644
|
||||
this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 0d320baa..b2bbccb5 100644
|
||||
index 8b118e81e..dad2dc959 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
@@ -565,8 +601,8 @@ index 0d320baa..b2bbccb5 100644
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
+ com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper
|
||||
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
int pollCount = 0;
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
{
|
||||
return spigot;
|
||||
@@ -595,7 +631,7 @@ index 0d320baa..b2bbccb5 100644
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index a151451d..0c5862a3 100644
|
||||
index c234b8749..5e49bca8a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -0,0 +0,0 @@ public class Main {
|
||||
@@ -614,7 +650,7 @@ index a151451d..0c5862a3 100644
|
||||
};
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 01e73eb8..0b66f5e3 100644
|
||||
index 9128f7754..7b1a9a8a0 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class SpigotWorldConfig
|
||||
|
||||
Reference in New Issue
Block a user