Fix various warnings and progress some javadoc
This commit is contained in:
parent
83e35f21bd
commit
045ca8b640
@ -70,11 +70,13 @@ import fr.pandacube.lib.util.Log;
|
||||
return permission.startsWith("-");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean playerAdd(String world, String player, String permission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean playerRemove(String world, String player, String permission) {
|
||||
return false;
|
||||
@ -114,11 +116,13 @@ import fr.pandacube.lib.util.Log;
|
||||
return Permissions.getPlayer(player.getUniqueId()).isInGroup(group);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean playerAddGroup(String world, String player, String group) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String world, String player, String group) {
|
||||
return false;
|
||||
@ -210,40 +214,50 @@ import fr.pandacube.lib.util.Log;
|
||||
return Permissions.getGroup(group).getSuffix();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setPlayerPrefix(String world, String player, String prefix) { /* unsupported */ }
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setPlayerSuffix(String world, String player, String suffix) { /* unsupported */ }
|
||||
@Override
|
||||
public void setGroupPrefix(String world, String group, String prefix) { /* unsupported */ }
|
||||
@Override
|
||||
public void setGroupSuffix(String world, String group, String suffix) { /* unsupported */ }
|
||||
@Deprecated
|
||||
@Override
|
||||
public int getPlayerInfoInteger(String world, String player, String node, int defaultValue) { return defaultValue; }
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setPlayerInfoInteger(String world, String player, String node, int value) { /* unsupported */ }
|
||||
@Override
|
||||
public int getGroupInfoInteger(String world, String group, String node, int defaultValue) { return defaultValue; }
|
||||
@Override
|
||||
public void setGroupInfoInteger(String world, String group, String node, int value) { /* unsupported */ }
|
||||
@Deprecated
|
||||
@Override
|
||||
public double getPlayerInfoDouble(String world, String player, String node, double defaultValue) { return defaultValue; }
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setPlayerInfoDouble(String world, String player, String node, double value) { /* unsupported */ }
|
||||
@Override
|
||||
public double getGroupInfoDouble(String world, String group, String node, double defaultValue) { return defaultValue; }
|
||||
@Override
|
||||
public void setGroupInfoDouble(String world, String group, String node, double value) { /* unsupported */ }
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue) { return defaultValue; }
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setPlayerInfoBoolean(String world, String player, String node, boolean value) { /* unsupported */ }
|
||||
@Override
|
||||
public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue) { return defaultValue; }
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String group, String node, boolean value) { /* unsupported */ }
|
||||
@Deprecated
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String player, String node, String defaultValue) { return defaultValue; }
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setPlayerInfoString(String world, String player, String node, String value) { /* unsupported */ }
|
||||
@Override
|
||||
|
@ -60,4 +60,16 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludePackageNames>fr.pandacube.lib.paper.reflect.wrapper.*</excludePackageNames>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -30,6 +30,10 @@ import net.fabricmc.mappingio.format.MappingFormat;
|
||||
import net.fabricmc.mappingio.tree.MappingTree;
|
||||
import net.fabricmc.mappingio.tree.MemoryMappingTree;
|
||||
|
||||
/**
|
||||
* Provides reflection tools related to Minecraft servers internals.
|
||||
* It automatically deals with the obfuscated classes and methods.
|
||||
*/
|
||||
public class NMSReflect {
|
||||
|
||||
|
||||
@ -43,6 +47,9 @@ public class NMSReflect {
|
||||
|
||||
private static boolean isInit = false;
|
||||
|
||||
/**
|
||||
* Initialize all the obfuscation mapping data.
|
||||
*/
|
||||
public static void init() {
|
||||
|
||||
synchronized (NMSReflect.class) {
|
||||
@ -137,7 +144,9 @@ public class NMSReflect {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the class mapping instance for the provided class.
|
||||
* @param mojName the binary name of the desired class, on the mojang mapping.
|
||||
* @return the class mapping instance for the provided class.
|
||||
* @throws NullPointerException if there is no mapping for the provided Mojang mapped class.
|
||||
*/
|
||||
public static ClassMapping mojClass(String mojName) {
|
||||
@ -171,7 +180,10 @@ public class NMSReflect {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prints an HTML rendering of the currently loaded obfuscation mapping, into the provided {@link PrintStream}.
|
||||
* @param out the stream in which to print the HTML content.
|
||||
*/
|
||||
public static void printHTMLMapping(PrintStream out) {
|
||||
String title = "Obfuscation mapping - " + Bukkit.getName() + " version " + Bukkit.getVersion();
|
||||
out.println("<!DOCTYPE html><html><head>\n"
|
||||
@ -277,10 +289,10 @@ public class NMSReflect {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static class ClassMapping {
|
||||
/**
|
||||
* Represents the mapping between the obfuscated and mojang names of a class and all its members.
|
||||
*/
|
||||
public static class ClassMapping {
|
||||
private static int nextID = 0;
|
||||
|
||||
/* package */ final int id = nextID++;
|
||||
@ -319,12 +331,20 @@ public class NMSReflect {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the actual runtime {@link Class} represented by this {@link ClassMapping}, wrapped into a
|
||||
* {@link ReflectClass}.
|
||||
* @return the actual runtime {@link Class} represented by this {@link ClassMapping}, wrapped into a
|
||||
* * {@link ReflectClass}.
|
||||
*/
|
||||
public ReflectClass<?> runtimeReflect() {
|
||||
return runtimeReflectClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the actual runtime Class represented by this {@link ClassMapping}.
|
||||
* @return the actual runtime Class represented by this {@link ClassMapping}.
|
||||
*/
|
||||
public Class<?> runtimeClass() {
|
||||
return runtimeReflectClass.get();
|
||||
}
|
||||
@ -333,11 +353,14 @@ public class NMSReflect {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the actual runtime Method that has the provided mojang name and parameter types, wrapped into a
|
||||
* {@link ReflectMethod}.
|
||||
* @param mojName the Mojang mapped name of the method.
|
||||
* @param mojParametersType the list of parameters of the method.
|
||||
* Each parameter type must be an instance of one of the following type:
|
||||
* {@link NMSTypeWrapper}, {@link Class}, {@link ReflectClass} or {@link ClassMapping}.
|
||||
* @return the actual runtime Method that has the provided mojang name and parameter types, wrapped into a
|
||||
* {@link ReflectMethod}.
|
||||
* @throws IllegalArgumentException if one of the parameter has an invalid type
|
||||
* @throws NullPointerException if one of the parameter is null, or if there is no mapping for the provided Mojang mapped method.
|
||||
* @throws ClassNotFoundException if there is no runtime class to represent one of the provided parametersType.
|
||||
@ -364,10 +387,11 @@ public class NMSReflect {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Returns the actual runtime Field that has the provided mojang name, wrapped into a {@link ReflectField}.
|
||||
* @param mojName the Mojang mapped name of the field.
|
||||
* @return the actual runtime Field that has the provided mojang name, wrapped into a {@link ReflectField}.
|
||||
* @throws NullPointerException if there is no mapping for the provided Mojang mapped field.
|
||||
* @throws NoSuchFieldException if there is no runtime method to represent the provided method.
|
||||
* @throws NoSuchFieldException if there is no runtime field to represent the provided mojang field.
|
||||
*/
|
||||
public ReflectField<?> mojField(String mojName) throws NoSuchFieldException {
|
||||
MemberMapping<String, ReflectField<?>> fm = fieldsByMoj.get(mojName);
|
||||
|
@ -5,6 +5,9 @@ import org.bukkit.Bukkit;
|
||||
import fr.pandacube.lib.reflect.Reflect;
|
||||
import fr.pandacube.lib.reflect.ReflectClass;
|
||||
|
||||
/**
|
||||
* Provides reflection tools related to {@code org.bukkit.craftbukkit}.
|
||||
*/
|
||||
public class OBCReflect {
|
||||
|
||||
private static final String OBC_PACKAGE_PREFIX = "org.bukkit.craftbukkit.";
|
||||
@ -20,7 +23,13 @@ public class OBCReflect {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the OBC class that has the provided name, wrapped into a {@link ReflectClass}.
|
||||
* @param obcClass the name of the class, including the subpackage in whitch the requested class is. This parameter
|
||||
* will be prefixed with the {@code OBC} package and the current package version.
|
||||
* @return the OBC class that has the provided name, wrapped into a {@link ReflectClass}.
|
||||
* @throws ClassNotFoundException if the provided class was not found in {@code OBC} package.
|
||||
*/
|
||||
public static ReflectClass<?> ofClass(String obcClass) throws ClassNotFoundException {
|
||||
return Reflect.ofClass(OBC_PACKAGE_PREFIX + OBC_PACKAGE_VERSION + "." + obcClass);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>META-INF/MANIFEDT.MF</exclude>
|
||||
<exclude>META-INF/MANIFEST.MF</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
|
Loading…
Reference in New Issue
Block a user