-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from r3back/feature/nms-remapped-versions-unifi…
…cation Added particle lib for 1.21
- Loading branch information
Showing
22 changed files
with
1,397 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
api/src/main/java/com/qualityplus/assistant/api/util/ReflectionUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.qualityplus.assistant.api.util; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
import java.lang.invoke.MethodHandle; | ||
import java.lang.invoke.MethodHandles; | ||
import java.lang.reflect.Field; | ||
|
||
/** | ||
* Reflection utility class | ||
*/ | ||
@UtilityClass | ||
public final class ReflectionUtil { | ||
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); | ||
|
||
/** | ||
* Get Setter | ||
* | ||
* @param clazz clazz type | ||
* @param name name | ||
* @return {@link MethodHandle} | ||
*/ | ||
public static MethodHandle getSetter(final Class<?> clazz, final String name) { | ||
try { | ||
return LOOKUP.unreflectSetter(getField(clazz, name)); | ||
} catch (final IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
|
||
/** | ||
* Get field | ||
* | ||
* @param clazz clazz type | ||
* @param fieldName field name | ||
* @return {@link Field} | ||
*/ | ||
public static Field getField(final Class<?> clazz, final String fieldName) { | ||
if (clazz == null) { | ||
return null; | ||
} | ||
try { | ||
final Field field = clazz.getDeclaredField(fieldName); | ||
field.setAccessible(true); | ||
return field; | ||
} catch (final NoSuchFieldException | SecurityException e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
tasks { | ||
remap { | ||
version.set("1.20.4") | ||
} | ||
} | ||
|
||
dependencies { | ||
//Required for GameProfile | ||
compileOnly("com.mojang:authlib:1.5.25") | ||
compileOnly("com.mojang:brigadier:1.0.18") | ||
compileOnly("io.netty:netty-all:4.1.90.Final") | ||
compileOnly("com.mojang:datafixerupper:1.0.20") | ||
|
||
compileOnly("org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT:remapped-mojang@jar") { | ||
isTransitive = false | ||
} | ||
compileOnly("org.spigotmc:spigot-api:1.20.4-experimental-SNAPSHOT") { | ||
isTransitive = false | ||
} | ||
|
||
} | ||
|
142 changes: 142 additions & 0 deletions
142
nms/v1_20_R3/src/main/java/com/qualityplus/assistant/base/nms/EmptyChannel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
package com.qualityplus.assistant.base.nms; | ||
|
||
import io.netty.channel.AbstractChannel; | ||
import io.netty.channel.Channel; | ||
import io.netty.channel.ChannelConfig; | ||
import io.netty.channel.ChannelMetadata; | ||
import io.netty.channel.ChannelOutboundBuffer; | ||
import io.netty.channel.DefaultChannelConfig; | ||
import io.netty.channel.EventLoop; | ||
|
||
import java.net.SocketAddress; | ||
|
||
/** | ||
* Empty channel class | ||
*/ | ||
public final class EmptyChannel extends AbstractChannel { | ||
private final ChannelConfig config = new DefaultChannelConfig(this); | ||
|
||
/** | ||
* | ||
* @param parent {@link Channel} | ||
*/ | ||
public EmptyChannel(final Channel parent) { | ||
super(parent); | ||
} | ||
|
||
/** | ||
* | ||
* @return {@link ChannelConfig} | ||
*/ | ||
@Override | ||
public ChannelConfig config() { | ||
this.config.setAutoRead(true); | ||
return this.config; | ||
} | ||
|
||
/** | ||
* | ||
* @throws Exception thrown exception | ||
*/ | ||
@Override | ||
protected void doBeginRead() throws Exception { | ||
} | ||
|
||
/** | ||
* | ||
* @param arg0 {@link SocketAddress} | ||
* @throws Exception thrown exception | ||
*/ | ||
@Override | ||
protected void doBind(final SocketAddress arg0) throws Exception { | ||
} | ||
|
||
/** | ||
* | ||
* @throws Exception thrown exception | ||
*/ | ||
@Override | ||
protected void doClose() throws Exception { | ||
} | ||
|
||
/** | ||
* | ||
* @throws Exception thrown exception | ||
*/ | ||
@Override | ||
protected void doDisconnect() throws Exception { | ||
} | ||
|
||
/** | ||
* | ||
* @param arg0 {@link ChannelOutboundBuffer} | ||
* @throws Exception thrown exception | ||
*/ | ||
@Override | ||
protected void doWrite(final ChannelOutboundBuffer arg0) throws Exception { | ||
} | ||
|
||
/** | ||
* | ||
* @return if it's active | ||
*/ | ||
@Override | ||
public boolean isActive() { | ||
return false; | ||
} | ||
|
||
/** | ||
* | ||
* @param arg0 {@link EventLoop} | ||
* @return t | ||
*/ | ||
@Override | ||
protected boolean isCompatible(final EventLoop arg0) { | ||
return false; | ||
} | ||
|
||
/** | ||
* | ||
* @return if it's open | ||
*/ | ||
@Override | ||
public boolean isOpen() { | ||
return false; | ||
} | ||
|
||
/** | ||
* | ||
* @return {@link SocketAddress} | ||
*/ | ||
@Override | ||
protected SocketAddress localAddress0() { | ||
return null; | ||
} | ||
|
||
/** | ||
* | ||
* @return {@link ChannelMetadata} | ||
*/ | ||
@Override | ||
public ChannelMetadata metadata() { | ||
return new ChannelMetadata(true); | ||
} | ||
|
||
/** | ||
* | ||
* @return {@link AbstractUnsafe} | ||
*/ | ||
@Override | ||
protected AbstractUnsafe newUnsafe() { | ||
return null; | ||
} | ||
|
||
/** | ||
* | ||
* @return {@link SocketAddress} | ||
*/ | ||
@Override | ||
protected SocketAddress remoteAddress0() { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.