Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v2' into v2.sac
Browse files Browse the repository at this point in the history
  • Loading branch information
FloLoFlo committed Jun 19, 2024
2 parents 051a837 + 1351de3 commit d41d7f8
Show file tree
Hide file tree
Showing 48 changed files with 326 additions and 162 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'io.github.goooler.shadow' version '8.1.7'
}

shadowJar {
Expand Down
11 changes: 4 additions & 7 deletions bungee/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id 'com.github.johnrengelman.shadow'
id 'io.github.goooler.shadow'
}

evaluationDependsOn(':common') // Projects are evaluated by alphabetical order, but common should be evaluated before bungee
Expand All @@ -14,21 +14,18 @@ sourceSets {
}

repositories {
mavenCentral()
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'jitpack'
url 'https://jitpack.io'
}
}

dependencies {
api project(':common')
implementation 'org.bstats:bstats-bungeecord-lite:1.7'
compileOnly 'net.md-5:bungeecord-api:1.19-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-chat:1.19-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-api:1.20-R0.1-SNAPSHOT'
compileOnly 'net.md-5:bungeecord-chat:1.20-R0.1-SNAPSHOT'
compileOnly 'com.github.minecrafter:RedisBungee:master'
}

Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
id 'com.github.johnrengelman.shadow'
id 'io.github.goooler.shadow'
}

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion common/integrations/advancedban/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sourceSets {
}

dependencies {
compileOnly 'com.github.DevLeoko:AdvancedBan:v2.2.1'
compileOnly 'com.github.DevLeoko:AdvancedBan:v2.3.0'
api project(':common')
//compileOnly(project(':common'))
}
4 changes: 2 additions & 2 deletions common/integrations/floodgate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ sourceSets {
repositories {
maven {
name 'geyser'
url 'https://repo.opencollab.dev/maven-snapshots/'
url 'https://repo.opencollab.dev/main/'
}
}

dependencies {
compileOnly 'org.geysermc.floodgate:api:2.2.0-SNAPSHOT'
compileOnly 'org.geysermc.floodgate:api:2.2.2-SNAPSHOT'
api(project(':common'))
}
4 changes: 2 additions & 2 deletions common/integrations/geysermc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ configurations {

repositories {
maven {
name 'geyser'
url 'https://repo.opencollab.dev/maven-snapshots/'
name 'geyser-main'
url 'https://repo.opencollab.dev/main/'
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/integrations/litebans/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ sourceSets {
}

dependencies {
compileOnly 'com.gitlab.ruany:LiteBansAPI:0.3.4'
compileOnly 'com.gitlab.ruany:LiteBansAPI:0.5.0'
api(project(':common'))
}
2 changes: 1 addition & 1 deletion common/integrations/viaversion/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ repositories {
}

dependencies {
compileOnly 'com.viaversion:viaversion-api:4.7.0'
compileOnly 'com.viaversion:viaversion-api:4.10.2'
api(project(':common'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public void setProtocolVersion(int protocolVersion) {
public Location getLocation() {
return location;
}


@Override
public void setLocation(Location location) {
this.location = location;
}
Expand Down
8 changes: 1 addition & 7 deletions common/src/com/elikill58/negativity/api/entity/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ public interface Player extends OfflinePlayer {
@Nullable
String getIP();

/**
* Know if the player is dead
*
* @return true if the player is dead
*/
boolean isDead();

/**
* Know if the player is sleeping
*
Expand Down Expand Up @@ -225,6 +218,7 @@ default void setSleeping(boolean b) {
*
* @return the world where the player is
*/
@Override
CompensatedWorld getWorld();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public InventoryManager() {
AbstractInventory.getInventories().forEach(AbstractInventory::load);
}

@SuppressWarnings({ "rawtypes" })
@EventListener
public void onInventoryClick(InventoryClickEvent e) {
PlatformHolder holder = e.getClickedInventory().getHolder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*
* @author FangYidong
*/
@SuppressWarnings({ "rawtypes"})
public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware {
private static final long serialVersionUID = 3957988303675231981L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*
* @author FangYidong
*/
@SuppressWarnings({"rawtypes"})
public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAware{

private static final long serialVersionUID = -503443796854799292L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
/**
* @author FangYidong
*/
@SuppressWarnings("rawtypes")
public class JSONValue {
/**
* Parse JSON text into java object from the input source. Please use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*
* @author FangYidong
*/
@SuppressWarnings("rawtypes")
public interface ContainerFactory {
/**
* @return A Map instance to store JSON object, or null if you want to use org.json.JSONObject.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*
* @author FangYidong
*/
@SuppressWarnings({"rawtypes"})
public class JSONParser {
public static final int S_INIT=0;
public static final int S_IN_FINISHED_VALUE=1;//string,number,boolean,null,object,array
Expand Down
18 changes: 18 additions & 0 deletions common/src/com/elikill58/negativity/api/packets/PacketType.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,25 @@ enum Client implements PacketType {
CHAT(NPacketPlayInChat::new),
CHAT_ACK,
CHAT_COMMAND,
/**
* Since MC 1.20.5
*/
CHAT_COMMAND_SIGNED,
CHAT_PREVIEW,
CHAT_SESSION_UPDATE,
CHUNK_BATCH_RECEIVED,
CLIENT_COMMAND,
CLOSE_WINDOW,
CONFIGURATION_ACKNOWLEDGED,
/**
* Since MC 1.20.5
*/
COOKIE_RESPONSE,
CUSTOM_PAYLOAD(NPacketPlayInCustomPayload::new),
/**
* Since MC 1.20.5
*/
DEBUG_SAMPLE_SUBSCRIPTION,
DIFFICULTY_CHANGE,
DIFFICULTY_LOCK,
ENCHANT_ITEM,
Expand Down Expand Up @@ -295,12 +307,15 @@ enum Server implements PacketType {
COMBAT_ENTER_EVENT,
COMBAT_KILL_EVENT,
COMMANDS,
COOKIE_STORE,
COOKIE_REQUEST,
CHUNK_BATCH_FINISHED,
CHUNK_BATCH_STARTED,
CHUNK_BIOMES,
CUSTOM_PAYLOAD(NPacketPlayOutCustomPayload::new),
CUSTOM_SOUND_EFFECT,
DAMAGE_EVENT,
DEBUG_SAMPLE,
ENTITY,
ENTITY_DESTROY(NPacketPlayOutEntityDestroy::new),
ENTITY_EFFECT(NPacketPlayOutEntityEffect::new),
Expand All @@ -316,6 +331,7 @@ enum Server implements PacketType {
GAME_STATE_CHANGE,
HELD_ITEM_SLOT,
HIT_ANIMATION,
HURT_ANIMATION,
INITIALIZE_BORDER,
KEEP_ALIVE(NPacketPlayOutKeepAlive::new),
KICK_DISCONNECT,
Expand All @@ -340,6 +356,7 @@ enum Server implements PacketType {
PLAYER_INFO_UPDATE,
PLAYER_LIST_HEADER_FOOTER,
POSITION(NPacketPlayOutPosition::new),
PROJECTILE_POWER,
RECIPES,
RECIPE_UPDATE,
REL_ENTITY_LOOK(NPacketPlayOutRelEntityLook::new),
Expand Down Expand Up @@ -388,6 +405,7 @@ enum Server implements PacketType {
TICKING_STEP,
TILE_ENTITY_DATA,
TITLE,
TRANSFERT,
PING(NPacketPlayOutPing::new),
PONG,
UNLOAD_CHUNK(NPacketPlayOutUnloadChunk::new),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.elikill58.negativity.api.packets.nms.versions;

import java.util.Arrays;

import com.elikill58.negativity.api.entity.EntityType;
import com.elikill58.negativity.api.packets.PacketType.Client;
import com.elikill58.negativity.api.packets.PacketType.Server;
import com.elikill58.negativity.api.packets.nms.NamedVersion;

public class Version1_20_5 extends NamedVersion {

public Version1_20_5() {
super("1.20.5");
// packets ID seems not same as 1.20
int i = 0;
for (Client type : Arrays.asList(Client.TELEPORT_ACCEPT, Client.TILE_NBT_QUERY, Client.DIFFICULTY_CHANGE,
Client.CHAT_ACK, Client.CHAT_COMMAND, Client.CHAT_COMMAND_SIGNED, Client.CHAT,
Client.CHAT_SESSION_UPDATE, Client.CHUNK_BATCH_RECEIVED, Client.CLIENT_COMMAND, Client.SETTINGS,
Client.TAB_COMPLETE, Client.CONFIGURATION_ACKNOWLEDGED, Client.ENCHANT_ITEM, Client.WINDOW_CLICK,
Client.CLOSE_WINDOW, Client.SLOT_STATE_CHANGE, Client.COOKIE_RESPONSE, Client.CUSTOM_PAYLOAD,
Client.DEBUG_SAMPLE_SUBSCRIPTION, Client.BEDIT, Client.ENTITY_NBT_QUERY, Client.USE_ENTITY,
Client.JIGSAW_GENERATE, Client.KEEP_ALIVE, Client.DIFFICULTY_LOCK, Client.POSITION,
Client.POSITION_LOOK, Client.LOOK, Client.GROUND, Client.VEHICLE_MOVE, Client.BOAT_MOVE,
Client.PICK_ITEM, Client.PING, Client.AUTO_RECIPE, Client.ABILITIES, Client.BLOCK_DIG,
Client.ENTITY_ACTION, Client.STEER_VEHICLE, Client.PONG, Client.RECIPE_SETTINGS,
Client.RECIPE_DISPLAYED, Client.ITEM_NAME, Client.RESOURCE_PACK_STATUS, Client.ADVANCEMENTS,
Client.TR_SEL, Client.BEACON, Client.HELD_ITEM_SLOT, Client.SET_COMMAND_BLOCK,
Client.SET_COMMAND_MINECART, Client.SET_CREATIVE_SLOT, Client.SET_JIGSAW, Client.STRUCT,
Client.UPDATE_SIGN, Client.ARM_ANIMATION, Client.SPECTATE, Client.USE_ITEM, Client.BLOCK_PLACE)) {
playIn.put(i++, type);
}
i = 0;
for (Server type : Arrays.asList(Server.BUNDLE, Server.SPAWN_ENTITY, Server.SPAWN_ENTITY_EXPERIENCE_ORB,
Server.ANIMATION, Server.STATISTIC, Server.BLOCK_CHANGED_ACK, Server.BLOCK_BREAK_ANIMATION,
Server.TILE_ENTITY_DATA, Server.BLOCK_ACTION, Server.BLOCK_CHANGE, Server.BOSS,
Server.SERVER_DIFFICULTY, Server.CHUNK_BATCH_FINISHED, Server.CHUNK_BATCH_STARTED, Server.CHUNK_BIOMES,
Server.CLEAR_TITLE, Server.TAB_COMPLETE, Server.COMMANDS, Server.CLOSE_WINDOW, Server.WINDOW_ITEMS,
Server.WINDOW_DATA, Server.SET_SLOT, Server.COOKIE_REQUEST, Server.SET_COOLDOWN,
Server.CHAT_CUSTOM_COMPLETION, Server.CUSTOM_PAYLOAD, Server.DAMAGE_EVENT, Server.DEBUG_SAMPLE,
Server.CHAT_DELETE, Server.KICK_DISCONNECT, Server.CHAT_DISGUISED, Server.ENTITY_STATUS,
Server.EXPLOSION, Server.UNLOAD_CHUNK, Server.GAME_STATE_CHANGE, Server.OPEN_WINDOW_HORSE,
Server.HURT_ANIMATION, Server.INITIALIZE_BORDER, Server.KEEP_ALIVE, Server.LEVEL_CHUNK_LIGHT,
Server.WORLD_EVENT, Server.WORLD_PARTICLES, Server.LIGHT_UPDATE, Server.LOGIN, Server.MAP,
Server.OPEN_WINDOW_MERCHANT, Server.REL_ENTITY_MOVE, Server.REL_ENTITY_MOVE_LOOK,
Server.REL_ENTITY_LOOK, Server.VEHICLE_MOVE, Server.OPEN_BOOK, Server.OPEN_WINDOW,
Server.OPEN_SIGN_EDITOR, Server.PING, Server.PONG, Server.AUTO_RECIPE, Server.ABILITIES, Server.CHAT,
Server.COMBAT_END_EVENT, Server.COMBAT_ENTER_EVENT, Server.COMBAT_KILL_EVENT, Server.PLAYER_INFO_REMOVE,
Server.PLAYER_INFO_UPDATE, Server.LOOK_AT, Server.POSITION, Server.RECIPES, Server.ENTITY_DESTROY,
Server.REMOVE_ENTITY_EFFECT, Server.SCOREBOARD_RESET, Server.RESOURCE_PACK_POP,
Server.RESOURCE_PACK_SEND, Server.RESPAWN, Server.ENTITY_HEAD_ROTATION, Server.MULTI_BLOCK_CHANGE,
Server.SELECT_ADVANCEMENT_TAB, Server.SERVER_DATA, Server.SET_ACTION_BAR_TEXT, Server.SET_BORDER_CENTER,
Server.SET_BORDER_LERP_SIZE, Server.SET_BORDER_SIZE, Server.SET_BORDER_WARNING_DELAY,
Server.SET_BORDER_WARNING_DISTANCE, Server.CAMERA, Server.HELD_ITEM_SLOT, Server.VIEW_CENTRE,
Server.VIEW_DISTANCE, Server.SPAWN_POSITION, Server.SCOREBOARD_DISPLAY_OBJECTIVE,
Server.ENTITY_METADATA, Server.ATTACH_ENTITY, Server.ENTITY_VELOCITY, Server.ENTITY_EQUIPMENT,
Server.EXPERIENCE, Server.UPDATE_HEALTH, Server.SCOREBOARD_OBJECTIVE, Server.MOUNT,
Server.SCOREBOARD_TEAM, Server.SCOREBOARD_SCORE, Server.SIMULATION_DISTANCE, Server.SET_SUBTITLE_TEXT,
Server.UPDATE_TIME, Server.SET_TITLE_TEXT, Server.SET_TITLE_ANIMATION, Server.ENTITY_SOUND,
Server.NAMED_SOUND_EFFECT, Server.START_CONFIGURATION, Server.STOP_SOUND, Server.COOKIE_STORE,
Server.SYSTEM_CHAT, Server.PLAYER_LIST_HEADER_FOOTER, Server.NBT_QUERY, Server.COLLECT,
Server.ENTITY_TELEPORT, Server.TICKING_STATE, Server.TICKING_STEP, Server.TRANSFERT,
Server.ADVANCEMENTS, Server.UPDATE_ATTRIBUTES, Server.ENTITY_EFFECT, Server.RECIPE_UPDATE, Server.TAGS,
Server.PROJECTILE_POWER)) {
playOut.put(i++, type);
}
i = 0;
for (EntityType types : Arrays.asList(EntityType.ALLAY, EntityType.AREA_EFFECT_CLOUD, EntityType.ARMOR_STAND,
EntityType.ARROW, EntityType.AXOLOTL, EntityType.BAT, EntityType.BEE, EntityType.BLAZE, EntityType.BOAT,
EntityType.CHEST_BOAT, EntityType.CAT, EntityType.CAVE_SPIDER, EntityType.CHICKEN, EntityType.COD,
EntityType.COW, EntityType.CREEPER, EntityType.DOLPHIN, EntityType.DONKEY, EntityType.DRAGON_FIREBALL,
EntityType.DROWNED, EntityType.ELDER_GUARDIAN, EntityType.ENDER_CRYSTAL, EntityType.ENDER_DRAGON,
EntityType.ENDERMAN, EntityType.ENDERMITE, EntityType.EVOKER, EntityType.EVOKER_FANGS,
EntityType.EXPERIENCE_ORB, EntityType.EYE_OF_ENDER, EntityType.FALLING_BLOCK, EntityType.FIREWORK,
EntityType.FOX, EntityType.FROG, EntityType.GHAST, EntityType.GIANT, EntityType.GLOW_ITEM_FRAME,
EntityType.GLOW_SQUID, EntityType.GOAT, EntityType.GUARDIAN, EntityType.HOGLIN, EntityType.HORSE,
EntityType.HUSK, EntityType.ILLUSIONER, EntityType.IRON_GOLEM, EntityType.DROPPED_ITEM,
EntityType.ITEM_FRAME, EntityType.FIREBALL, EntityType.LEASH_KNOT, EntityType.LIGHTNING,
EntityType.LLAMA, EntityType.LLAMA_SPIT, EntityType.MAGMA_CUBE, EntityType.MARKER, EntityType.MINECART,
EntityType.MINECART_CHEST, EntityType.MINECART_COMMAND_BLOCK, EntityType.MINECART_FURNACE,
EntityType.MINECART_HOPPER, EntityType.MINECART_MOB_SPAWNER, EntityType.MINECART_TNT, EntityType.MULE,
EntityType.MOOSHROOM, EntityType.OCELOT, EntityType.PAINTING, EntityType.PANDA, EntityType.PARROT,
EntityType.PHANTOM, EntityType.PIG, EntityType.PIGLIN, EntityType.PIGLIN_BRUTE, EntityType.PILLAGER,
EntityType.POLAR_BEAR, EntityType.PRIMED_TNT, EntityType.PUFFER_FISH, EntityType.RABBIT,
EntityType.RAVAGER, EntityType.SALMON, EntityType.SHEEP, EntityType.SHULKER, EntityType.SHULKER_BULLET,
EntityType.SILVERFISH, EntityType.SKELETON, EntityType.SKELETON_HORSE, EntityType.SLIME,
EntityType.SMALL_FIREBALL, EntityType.SNOW_GOLEM, EntityType.SNOW_BALL, EntityType.SPECTRAL_ARROW,
EntityType.SPIDER, EntityType.SQUID, EntityType.STRAY, EntityType.STRIDER, EntityType.TADPOLE,
EntityType.EGG, EntityType.ENDER_PEARL, EntityType.EXP_BOTTLE, EntityType.SPLASH_POTION,
EntityType.TRIDENT, EntityType.LLAMA_TRADER, EntityType.TROPICAL_FISH, EntityType.TURTLE,
EntityType.VEX, EntityType.VILLAGER, EntityType.VINDICATOR, EntityType.WANDERING_TRADER,
EntityType.WARDEN, EntityType.WITCH, EntityType.WITHER, EntityType.WITHER_SKELETON,
EntityType.WITHER_SKULL, EntityType.WOLF, EntityType.ZOGLIN, EntityType.ZOMBIE,
EntityType.ZOMBIE_VILLAGER, EntityType.PIG_ZOMBIE, EntityType.PLAYER, EntityType.FISHING_HOOK)) {
entityTypes.put(i++, types);
}
loadPostFlattening("/versions/v1_19_3/");

log();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ default void read(PacketSerializer serializer, Version version) {
}

void setPacketName(String name);


@Override
String getPacketName();

void setPacketTypeCible(PacketType type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public BlockRayBuilder neededPositions(List<Vector> vec) {
*
* @return the block ray
*/
@Override
public BlockRay build() {
if(search == null || !search.isValid(this))
throw new IllegalArgumentException("Please check what you set as param before running ray.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public EntityRayBuilder searched(Entity searched) {
*
* @return the block ray
*/
@Override
public EntityRay build() {
return new EntityRay(w, position, vector, maxDistance, onlyPlayer, bypassEntities, searched);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void onGroundSpoof(PlayerMoveEvent e, NegativityPlayer np, GroundSpoofDat
return;
}
double diffY = e.getTo().getY() - e.getFrom().getY();
if (diffY <= p.getWalkSpeed())
if (diffY <= p.getWalkSpeed() || diffY == 0.1647732818260721) // specific value for MC 1.20.5
return;
if (data.wasAlert)
Negativity.alertMod(ReportType.WARNING, p, this, getReliability(p), "check-blocks-under",
Expand Down
Loading

0 comments on commit d41d7f8

Please sign in to comment.