Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v5
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: 21
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v5
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version: 21
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ Constructor getFirstConstructor(Set<List<Class>> params);
```

#### Utils
<<<<<<< HEAD
`com.falchus.lib.utils.FileUtils`
```java
static void createFolder(Path path, FileAttribute<?>... attributes);
Expand All @@ -274,6 +275,8 @@ static void delete(Path path);
static void deleteFolder(Path path);
```

=======
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
`com.falchus.lib.utils.JsonUtils`
```java
static JsonElement get(String json, String path);
Expand Down Expand Up @@ -357,6 +360,7 @@ static boolean isSoftLanding(Block block);
`com.falchus.lib.minecraft.spigot.utils.EntityUtils`
```java
static Object getEntity(Entity entity);
<<<<<<< HEAD
static Object getEntityLiving(LivingEntity entity);

static Entity getBukkitEntity(WrappedEntity entity);
Expand All @@ -381,6 +385,33 @@ static boolean isOnClimbable(Entity entity);

static boolean isUnderBlock(Entity entity);

static double getAbsorption(Damageable entity);
static void setAbsorption(Damageable entity, double absorption);
=======

static Entity getBukkitEntity(Object entity);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git

static Entity getEntityById(World world, int id);

static WrappedAxisAlignedBB getBoundingBox(Entity entity);
static WrappedAxisAlignedBB modifyBoundingBox(WrappedAxisAlignedBB axisAlignedBB, double minX, double minY, double minZ, double maxX, double maxY, double maxZ);

static boolean isOnGround(Entity entity, double yExpand);
static boolean isOnGround(Entity entity);

static boolean isInLiquid(Entity entity);

static boolean isOnSlime(Entity entity);

static boolean isOnStairs(Entity entity);

static boolean isOnIce(Entity entity);

static boolean isOnClimbable(Entity entity);

static boolean isUnderBlock(Entity entity);

static double getAbsorption(Damageable entity);
static void setAbsorption(Damageable entity, double absorption);

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>4.0.0</version>
<version>4.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -78,7 +78,7 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.22.2</version>
<version>1.23.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ public static <T extends IPacketWrapper> T wrap(Object obj) {
}
current = current.getSuperclass();
}
<<<<<<< HEAD
return (T) new PacketWrapper(obj, Set.of(obj.getClass().getName()));
=======
for (Map.Entry<Class<?>, Function<Object, PacketWrapper>> entry : registry.entrySet()) {
if (entry.getKey().isAssignableFrom(packet.getClass())) {
return (T) entry.getValue().apply(packet);
}
}
return (T) new PacketWrapper(packet, Set.of(packet.getClass().getName()));
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
import lombok.experimental.FieldDefaults;

@FieldDefaults(makeFinal = true)
<<<<<<< HEAD
class PacketBlockActionWrapper extends PacketWrapper implements PacketBlockAction {
=======
class PacketBlockActionWrapper extends PacketWrapper {
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git

Field pos;
Field type;
Expand Down Expand Up @@ -45,9 +49,17 @@ public BlockPosition getPos() {
return SpigotWrapper.wrap(getFieldValue(pos));
}

<<<<<<< HEAD
@Override
public void setPos(BlockPosition pos) {
setField(this.pos, pos.getHandle());
=======
/**
* @param pos BlockPosition
*/
public void setPos(Object pos) {
setField(this.pos, pos);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}

@Override
Expand Down Expand Up @@ -75,8 +87,16 @@ public Block getBlock() {
return SpigotWrapper.wrap(getFieldValue(block));
}

<<<<<<< HEAD
@Override
public void setBlock(Block block) {
setField(this.block, block.getHandle());
=======
/**
* @param block Block
*/
public void setBlock(Object block) {
setField(this.block, block);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class WrappedPacketOutBlockAction extends PacketBlockActionWrapper {
);

private WrappedPacketOutBlockAction(@NonNull Object handle) {
<<<<<<< HEAD
super(handle, names);
}

Expand All @@ -41,5 +42,11 @@ public WrappedPacketOutBlockAction(@NonNull BlockPosition pos, @NonNull Block bl
data
)
).build());
=======
super(handle, Set.of(
version.getPackageNms() + "PacketPlayOutBlockAction",
networkProtocolGame + "PacketPlayOutBlockAction"
));
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import lombok.experimental.FieldDefaults;

@FieldDefaults(makeFinal = true)
<<<<<<< HEAD
class PacketBlockBreakAnimationWrapper extends PacketWrapper implements PacketBlockBreakAnimation {
=======
class PacketBlockBreakAnimationWrapper extends PacketWrapper {
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git

Field id;
Field pos;
Expand Down Expand Up @@ -49,9 +53,17 @@ public BlockPosition getPos() {
return SpigotWrapper.wrap(getFieldValue(pos));
}

<<<<<<< HEAD
@Override
public void setPos(BlockPosition pos) {
setField(this.pos, pos.getHandle());
=======
/**
* @param pos BlockPosition
*/
public void setPos(Object pos) {
setField(this.pos, pos);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class WrappedPacketOutBlockBreakAnimation extends PacketBlockBreakAnimati
);

private WrappedPacketOutBlockBreakAnimation(@NonNull Object handle) {
<<<<<<< HEAD
super(handle, names);
}

Expand All @@ -36,5 +37,11 @@ public WrappedPacketOutBlockBreakAnimation(int entityId, @NonNull BlockPosition
progress
)
).build());
=======
super(handle, Set.of(
version.getPackageNms() + "PacketPlayOutBlockBreakAnimation",
networkProtocolGame + "PacketPlayOutBlockBreakAnimation"
));
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import lombok.experimental.FieldDefaults;

@FieldDefaults(makeFinal = true)
<<<<<<< HEAD
class PacketBlockChangeWrapper extends PacketWrapper implements PacketBlockChange {
=======
class PacketBlockChangeWrapper extends PacketWrapper {
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git

Field pos;

Expand All @@ -29,8 +33,16 @@ public BlockPosition getPos() {
return SpigotWrapper.wrap(getFieldValue(pos));
}

<<<<<<< HEAD
@Override
public void setPos(BlockPosition pos) {
setField(this.pos, pos.getHandle());
=======
/**
* @param pos BlockPosition
*/
public void setPos(Object pos) {
setField(this.pos, pos);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
import java.util.Set;

import com.falchus.lib.minecraft.spigot.packets.wrapper.PacketWrapper;
<<<<<<< HEAD
import com.falchus.lib.minecraft.spigot.wrapper.SpigotWrapper;
import com.falchus.lib.minecraft.spigot.wrapper.core.baseblockposition.BlockPosition;
=======
import com.falchus.lib.minecraft.spigot.utils.ServerUtils;
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git

import lombok.NonNull;
import lombok.SneakyThrows;
import lombok.experimental.FieldDefaults;

@FieldDefaults(makeFinal = true)
<<<<<<< HEAD
class PacketBlockDigWrapper extends PacketWrapper implements PacketBlockDig {
=======
class PacketBlockDigWrapper extends PacketWrapper {
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git

Field pos;
Field direction;
Expand Down Expand Up @@ -40,31 +48,74 @@ public BlockPosition getPos() {
return SpigotWrapper.wrap(getFieldValue(pos));
}

<<<<<<< HEAD
@Override
public void setPos(BlockPosition pos) {
setField(this.pos, pos.getHandle());
=======
/**
* @param pos BlockPosition
*/
public void setPos(Object pos) {
setField(this.pos, pos);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}

@Override
public Direction getDirection() {
return Direction.valueOf(getFieldValue(direction, Enum.class).name());
}

<<<<<<< HEAD
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void setDirection(Direction direction) {
setField(this.direction, Enum.valueOf((Class<? extends Enum>) this.direction.getType(), direction.name()));
=======
/**
* @param direction EnumDirection
*/
public void setDirection(Object direction) {
setField(this.direction, direction);
}

public enum Action {
START_DESTROY_BLOCK,
ABORT_DESTROY_BLOCK,
STOP_DESTROY_BLOCK,
DROP_ALL_ITEMS,
DROP_ITEM,
RELEASE_USE_ITEM
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}

@SneakyThrows
@Override
public Action getAction() {
<<<<<<< HEAD
return Action.valueOf(getFieldValue(action, Enum.class).name());
=======
String name;
if (ServerUtils.getVersion().isBefore(Version.v1_17)) {
name = ((Enum<?>) getFieldValue(action)).name();
} else {
name = getFieldValue(action, Enum.class).name();
}
return Action.valueOf(name);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}

<<<<<<< HEAD
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void setAction(Action action) {
setField(this.action, Enum.valueOf((Class<? extends Enum>) this.action.getType(), action.name()));
=======
/**
* @param action EnumPlayerDigType
*/
public void setAction(Object action) {
setField(this.action, action);
>>>>>>> branch 'master' of https://github.com/Falchus/FalchusLib-Java.git
}
}
Loading
Loading