Skip to content

Commit

Permalink
Fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Aug 6, 2023
1 parent 6a01864 commit cd6c392
Show file tree
Hide file tree
Showing 50 changed files with 216 additions and 205 deletions.
19 changes: 10 additions & 9 deletions src/main/java/com/mohistmc/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@

import com.mohistmc.api.ServerAPI;
import com.mohistmc.common.async.MohistThreadBox;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.plugin.Plugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.spigotmc.SpigotConfig;

import javax.net.ssl.HttpsURLConnection;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
Expand All @@ -36,15 +46,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.plugin.Plugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.spigotmc.SpigotConfig;

/**
* bStats collects some data for plugin authors.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/mohistmc/MohistConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/mohistmc/MohistProxySelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

import com.mohistmc.api.event.MohistNetworkEvent;
import com.mohistmc.util.IOUtil;
import org.bukkit.Bukkit;

import java.io.IOException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.util.List;
import org.bukkit.Bukkit;

public class MohistProxySelector extends ProxySelector {

Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/mohistmc/api/ItemAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@

package com.mohistmc.api;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.util.ResourceLocation;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ItemAPI {

public static Map<String, String> MODNAME_MAP = new ConcurrentHashMap();
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/mohistmc/api/PlayerAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
package com.mohistmc.api;

import com.mojang.authlib.GameProfile;
import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.server.MinecraftServer;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;

import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PlayerAPI {

public static Map<SocketAddress, Integer> mods = new ConcurrentHashMap<>();
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/com/mohistmc/api/ServerAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,21 @@
package com.mohistmc.api;

import io.netty.util.internal.ConcurrentSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import net.minecraft.entity.boss.dragon.phase.PhaseType;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.ModLoader;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.language.IModInfo;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.entity.EnderDragon;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class ServerAPI {

public static Map<String, Integer> mods = new ConcurrentHashMap();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/mohistmc/api/event/MohistNetworkEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

package com.mohistmc.api.event;

import java.net.URI;
import org.bukkit.Bukkit;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import java.net.URI;

public class MohistNetworkEvent extends Event implements Cancellable {

private static HandlerList handlers = new HandlerList();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/mohistmc/api/mc/ChunkMcAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
package com.mohistmc.api.mc;

import com.mojang.datafixers.util.Either;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ChunkHolder;
import net.minecraft.world.server.ChunkHolder.IChunkLoadingError;
import net.minecraft.world.server.ChunkHolder.LocationType;
import net.minecraft.world.server.ServerWorld;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;

/**
* Mohist API for Minecraft chunks.
* @author KR33PY
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/mohistmc/bukkit/ServerListPingEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

package com.mohistmc.bukkit;

import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.NoSuchElementException;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.NetworkManager;
import net.minecraft.server.MinecraftServer;
Expand All @@ -29,6 +26,10 @@
import org.bukkit.craftbukkit.v1_16_R3.util.CraftIconCache;
import org.bukkit.entity.Player;

import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.NoSuchElementException;

public class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {

public CraftIconCache icon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
package com.mohistmc.bukkit.nms.proxy;

import com.mohistmc.bukkit.nms.utils.RemapUtils;
import java.security.ProtectionDomain;
import net.md_5.specialsource.repo.RuntimeRepo;

import java.security.ProtectionDomain;

public class DelegateClassLoder extends ClassLoader{

public static final String desc = DelegateClassLoder.class.getName().replace('.', '/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

import com.mohistmc.bukkit.nms.utils.RemapUtils;
import com.mohistmc.util.MohistJDK9EnumHelper;
import net.md_5.specialsource.repo.RuntimeRepo;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;

import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URL;
Expand All @@ -34,9 +38,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import net.md_5.specialsource.repo.RuntimeRepo;
import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.ConfigurationSerialization;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.mohistmc.bukkit.nms.utils.ASMUtils;
import com.mohistmc.bukkit.nms.utils.ReflectionUtils;
import com.mohistmc.bukkit.nms.utils.RemapUtils;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.mohistmc.bukkit.nms.remappers.ReflectMethodRemapper;
import com.mohistmc.bukkit.nms.utils.RemapUtils;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

package com.mohistmc.bukkit.nms.proxy;

import org.bukkit.configuration.file.YamlConfiguration;
import org.yaml.snakeyaml.reader.ReaderException;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.bukkit.configuration.file.YamlConfiguration;
import org.yaml.snakeyaml.reader.ReaderException;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
package com.mohistmc.bukkit.nms.remappers;

import com.mohistmc.bukkit.nms.ClassLoaderContext;
import java.io.IOException;
import java.io.InputStream;
import net.md_5.specialsource.repo.CachingRepo;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.tree.ClassNode;

import java.io.IOException;
import java.io.InputStream;

/**
*
* @author pyz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
package com.mohistmc.bukkit.nms.remappers;

import com.mohistmc.bukkit.nms.utils.RemapUtils;
import net.md_5.specialsource.provider.InheritanceProvider;
import org.objectweb.asm.tree.ClassNode;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import net.md_5.specialsource.provider.InheritanceProvider;
import org.objectweb.asm.tree.ClassNode;

public class MohistInheritanceProvider implements InheritanceProvider {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@

import com.google.common.collect.BiMap;
import com.mohistmc.bukkit.nms.model.ClassMapping;
import net.md_5.specialsource.InheritanceMap;
import net.md_5.specialsource.NodeType;
import net.md_5.specialsource.provider.InheritanceProvider;
import net.md_5.specialsource.transformer.MappingTransformer;
import net.md_5.specialsource.transformer.MavenShade;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Remapper;

import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.Modifier;
Expand All @@ -30,13 +38,6 @@
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import net.md_5.specialsource.InheritanceMap;
import net.md_5.specialsource.NodeType;
import net.md_5.specialsource.provider.InheritanceProvider;
import net.md_5.specialsource.transformer.MappingTransformer;
import net.md_5.specialsource.transformer.MavenShade;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Remapper;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
package com.mohistmc.bukkit.nms.remappers;

import com.mohistmc.bukkit.nms.model.ClassMapping;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import net.md_5.specialsource.CustomRemapper;
import net.md_5.specialsource.NodeType;
import net.md_5.specialsource.RemapperProcessor;
Expand All @@ -32,6 +29,9 @@
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;

import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
import com.mohistmc.bukkit.nms.proxy.DelegateClassLoder;
import com.mohistmc.bukkit.nms.proxy.DelegateURLClassLoder;
import com.mohistmc.bukkit.nms.utils.ASMUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.ListIterator;
import java.util.Map;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TypeInsnNode;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
public class MohistSuperClassRemapper {
public static Map<String, Class<?>> defineClass = Maps.newHashMap();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
import com.mohistmc.bukkit.nms.proxy.ProxyYamlConfiguration;
import com.mohistmc.bukkit.nms.proxy.asm.ProxyClassWriter;
import com.mohistmc.bukkit.nms.utils.ASMUtils;
import net.minecraftforge.server.ServerMain;
import org.bukkit.configuration.file.YamlConfiguration;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.MethodRemapper;
import org.objectweb.asm.commons.Remapper;

import java.io.InputStream;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodType;
Expand All @@ -36,13 +44,6 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.minecraftforge.server.ServerMain;
import org.bukkit.configuration.file.YamlConfiguration;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.MethodRemapper;
import org.objectweb.asm.commons.Remapper;

/**
*
Expand Down
Loading

0 comments on commit cd6c392

Please sign in to comment.