Skip to content

Commit

Permalink
fixed crash + added noxesium as fabric client
Browse files Browse the repository at this point in the history
  • Loading branch information
czQery committed Aug 17, 2024
1 parent c0b5f60 commit a36239b
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 85 deletions.
26 changes: 13 additions & 13 deletions src/main/java/cz/qery/toolkit/Scripts.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
import net.minecraft.network.protocol.game.PacketPlayOutExplosion;
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityExperienceOrb;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.EntityTrackerEntry;
import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.entity.EntityExperienceOrb;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.phys.Vec3D;
import org.bukkit.*;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
Expand Down Expand Up @@ -149,31 +150,30 @@ public static void crash(Player p) throws InterruptedException {
Vec3D vec = new Vec3D(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE);

for (int i = 0; i < 100; i++) {
p_entity.c.b(new PacketPlayOutExplosion(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE, Float.MAX_VALUE, list, vec, Explosion.Effect.a, Particles.x, Particles.x, SoundEffects.hy));
p_entity.c.b(new PacketPlayOutExplosion(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE, Float.MAX_VALUE, list, vec, Explosion.Effect.a, Particles.x, Particles.x, SoundEffects.ap));
}

Thread.sleep(500);

for (int i = 0; i < 100; i++) {
p.spawnParticle(Particle.EXPLOSION_HUGE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.EXPLOSION_LARGE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.EXPLOSION_NORMAL, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.TOTEM, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.SMOKE_LARGE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.SMOKE_NORMAL, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.EXPLOSION, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.TOTEM_OF_UNDYING, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.SMOKE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.WHITE_SMOKE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.LARGE_SMOKE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.CAMPFIRE_SIGNAL_SMOKE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.DRAGON_BREATH, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.CLOUD, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.CRIT, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.CRIT_MAGIC, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.MOB_APPEARANCE, loc, Integer.MAX_VALUE);
p.spawnParticle(Particle.ENCHANTED_HIT, loc, Integer.MAX_VALUE);
}

Thread.sleep(500);

EntityExperienceOrb dd = new EntityExperienceOrb(p_entity.z(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), Integer.MAX_VALUE);

for (int i = 0; i < 30000; i++) {
p_entity.c.b(new PacketPlayOutSpawnEntityExperienceOrb(dd));
EntityExperienceOrb dd = new EntityExperienceOrb(p_entity.cN(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), Integer.MAX_VALUE);
p_entity.c.b(new PacketPlayOutSpawnEntityExperienceOrb(dd, new EntityTrackerEntry(p_entity.A(), p_entity, Integer.MAX_VALUE, true, null, null)));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/commands/CommandBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public record CommandBlock(String name) {
static Main plugin = Main.getPlugin(Main.class);
static String b = Main.colors.get("b");
static String n = Main.colors.get("n");
static String h = Main.colors.get("h");
//static String h = Main.colors.get("h");
static String t = Main.colors.get("t");

public static List<CommandBlock> cmdlist = new ArrayList<>();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cz/qery/toolkit/commands/ToolKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ToolKit implements CommandExecutor {
String t = Main.colors.get("t");
String h = Main.colors.get("h");

@SuppressWarnings("deprecation")
public boolean onCommand(CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {

String version = Objects.requireNonNull(Bukkit.getServer().getPluginManager().getPlugin("ToolKit")).getDescription().getVersion();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/commands/Troll.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.Plugin;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/events/ChannelListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onPluginMessageReceived(@NotNull String channel, @NotNull Player p,


if ("minecraft:brand".equals(channel)) {
if (!msg.toLowerCase().contains("vannila") && !msg.toLowerCase().contains("lunarclient") && !msg.toLowerCase().contains("fabric") && !msg.toLowerCase().contains("feather") && !msg.toLowerCase().contains("forge")) {
if (!msg.toLowerCase().contains("vanilla") && !msg.toLowerCase().contains("lunarclient") && !msg.toLowerCase().contains("fabric") && !msg.toLowerCase().contains("feather") && !msg.toLowerCase().contains("forge")) {
p.setMetadata("client", new FixedMetadataValue(plugin, msg));
Tools.log(b+"["+n+"SERVER"+b+"] "+h+p.getName()+t+" client "+h+msg);
}
Expand Down
68 changes: 34 additions & 34 deletions src/main/java/cz/qery/toolkit/events/ChannelRegister.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
package cz.qery.toolkit.events;

import cz.qery.toolkit.Main;
import cz.qery.toolkit.Scripts;
import cz.qery.toolkit.Tools;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRegisterChannelEvent;

public class ChannelRegister implements Listener {

public ChannelRegister(Main plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}

@EventHandler
public void onRegisterChannel(PlayerRegisterChannelEvent event) {
Player p = event.getPlayer();
String h = Main.colors.get("h");
String b = Main.colors.get("b");
String n = Main.colors.get("n");
String t = Main.colors.get("t");

switch (event.getChannel().split(":")[0]) {
case "lunar", "lunarclient" -> Scripts.addTrueClient(p, "LunarClient");
case "feather" -> Scripts.addTrueClient(p, "FeatherClient");
case "fabric", "fabric-screen-handler-api", "fabric-screen-handler-api-v1" -> Scripts.addTrueClient(p, "Fabric");
case "fml" -> Scripts.addTrueClient(p, "Forge");
default -> Tools.log(b + "[" + n + "SERVER" + b + "] " + h + event.getPlayer().getName() + t + " registered channel " + h + event.getChannel());
}
}
}
package cz.qery.toolkit.events;

import cz.qery.toolkit.Main;
import cz.qery.toolkit.Scripts;
import cz.qery.toolkit.Tools;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerRegisterChannelEvent;

public class ChannelRegister implements Listener {

public ChannelRegister(Main plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}

@EventHandler
public void onRegisterChannel(PlayerRegisterChannelEvent event) {
Player p = event.getPlayer();
String h = Main.colors.get("h");
String b = Main.colors.get("b");
String n = Main.colors.get("n");
String t = Main.colors.get("t");

switch (event.getChannel().split(":")[0]) {
case "lunar", "lunarclient" -> Scripts.addTrueClient(p, "LunarClient");
case "feather" -> Scripts.addTrueClient(p, "FeatherClient");
case "fabric", "fabric-screen-handler-api", "fabric-screen-handler-api-v1", "noxesium-v2" -> Scripts.addTrueClient(p, "Fabric");
case "fml" -> Scripts.addTrueClient(p, "Forge");
default -> Tools.log(b + "[" + n + "SERVER" + b + "] " + h + event.getPlayer().getName() + t + " registered channel " + h + event.getChannel());
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/cz/qery/toolkit/events/EntityDismount.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.spigotmc.event.entity.EntityDismountEvent;
import org.bukkit.event.entity.EntityDismountEvent;

import java.util.Objects;

Expand Down
5 changes: 4 additions & 1 deletion src/main/java/cz/qery/toolkit/events/Silent.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public void onFoodLevelChange(FoodLevelChangeEvent e) {
public void onPlayerInteract(PlayerInteractEvent e) {
if (Vnsh.Enabled(e.getPlayer()) && e.getAction() == Action.PHYSICAL) {
switch (Objects.requireNonNull(e.getClickedBlock()).getBlockData().getMaterial()) {
case POLISHED_BLACKSTONE_PRESSURE_PLATE, ACACIA_PRESSURE_PLATE, BIRCH_PRESSURE_PLATE, CRIMSON_PRESSURE_PLATE, DARK_OAK_PRESSURE_PLATE, HEAVY_WEIGHTED_PRESSURE_PLATE, JUNGLE_PRESSURE_PLATE, LIGHT_WEIGHTED_PRESSURE_PLATE, MANGROVE_PRESSURE_PLATE, OAK_PRESSURE_PLATE, SPRUCE_PRESSURE_PLATE, STONE_PRESSURE_PLATE, WARPED_PRESSURE_PLATE, TRIPWIRE ->
case POLISHED_BLACKSTONE_PRESSURE_PLATE, ACACIA_PRESSURE_PLATE, BIRCH_PRESSURE_PLATE,
CRIMSON_PRESSURE_PLATE, DARK_OAK_PRESSURE_PLATE, HEAVY_WEIGHTED_PRESSURE_PLATE,
JUNGLE_PRESSURE_PLATE, LIGHT_WEIGHTED_PRESSURE_PLATE, MANGROVE_PRESSURE_PLATE, OAK_PRESSURE_PLATE,
SPRUCE_PRESSURE_PLATE, STONE_PRESSURE_PLATE, WARPED_PRESSURE_PLATE, TRIPWIRE ->
e.setCancelled(true);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/cz/qery/toolkit/lunar/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ public static void Bypass(Player p) {
if (!mods_all.containsKey(mod.toLowerCase())) {
continue;
}
BukkitApollo.runForPlayer(p, apolloPlayer -> {
Mod.modSettingModule.getOptions().set(apolloPlayer, mods_all.get(mod.toLowerCase()), true);
});
BukkitApollo.runForPlayer(p, apolloPlayer -> Mod.modSettingModule.getOptions().set(apolloPlayer, mods_all.get(mod.toLowerCase()), true));
}
}
}
16 changes: 6 additions & 10 deletions src/main/java/cz/qery/toolkit/lunar/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ public static void Load() {
}

public static void Send(Player p, String msg) {
BukkitApollo.runForPlayer(p, apolloPlayer -> {
notificationModule.displayNotification(apolloPlayer, com.lunarclient.apollo.module.notification.Notification.builder()
.titleComponent(Component.text("Server"/*, NamedTextColor.RED*/))
.descriptionComponent(Component.text(msg))
.displayTime(Duration.ofSeconds(5))
.build());
});
BukkitApollo.runForPlayer(p, apolloPlayer -> notificationModule.displayNotification(apolloPlayer, com.lunarclient.apollo.module.notification.Notification.builder()
.titleComponent(Component.text("Server"/*, NamedTextColor.RED*/))
.descriptionComponent(Component.text(msg))
.displayTime(Duration.ofSeconds(5))
.build()));
}

public static void Cancel(Player p) {
BukkitApollo.runForPlayer(p, apolloPlayer -> {
notificationModule.resetNotifications(apolloPlayer);
});
BukkitApollo.runForPlayer(p, apolloPlayer -> notificationModule.resetNotifications(apolloPlayer));
}
}
36 changes: 16 additions & 20 deletions src/main/java/cz/qery/toolkit/lunar/Waypoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,21 @@ public static void SendOne(Player p) {
continue;
}

BukkitApollo.runForPlayer(p, apolloPlayer -> {
Waypoint.waypointModule.displayWaypoint(apolloPlayer, com.lunarclient.apollo.module.waypoint.Waypoint.builder()
.name(waypoint.name())
.location(ApolloBlockLocation.builder()
.world(waypoint.world())
.x(waypoint.x())
.y(waypoint.y())
.z(waypoint.z())
.build()
)

.color(java.awt.Color.decode(waypoint.color()))
.preventRemoval(true)
.hidden(false)
.build()
);
});
BukkitApollo.runForPlayer(p, apolloPlayer -> Waypoint.waypointModule.displayWaypoint(apolloPlayer, com.lunarclient.apollo.module.waypoint.Waypoint.builder()
.name(waypoint.name())
.location(ApolloBlockLocation.builder()
.world(waypoint.world())
.x(waypoint.x())
.y(waypoint.y())
.z(waypoint.z())
.build()
)

.color(java.awt.Color.decode(waypoint.color()))
.preventRemoval(true)
.hidden(false)
.build()
));
}
}

Expand All @@ -136,9 +134,7 @@ public static void Remove(String name) {
} else {
List<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
for (Player pp : players) {
BukkitApollo.runForPlayer(pp, apolloPlayer -> {
Waypoint.waypointModule.removeWaypoint(apolloPlayer, name);
});
BukkitApollo.runForPlayer(pp, apolloPlayer -> Waypoint.waypointModule.removeWaypoint(apolloPlayer, name));
}
}

Expand Down

0 comments on commit a36239b

Please sign in to comment.