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
[General] | |
Name=Profile name | |
[Output] | |
Mode=Advanced | |
FilenameFormatting=%CCYY-%MM-%DD %hh-%mm-%ss | |
DelayEnable=false | |
DelaySec=20 | |
DelayPreserve=true | |
Reconnect=true |
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
import lombok.NonNull; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { |
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
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.HIGHEST, List.of(PacketType.fromClass(ServerboundContainerClickPacket.class)), ListenerOptions.SYNC) { | |
@Override | |
public void onPacketReceiving(PacketEvent event) { | |
ServerboundContainerClickPacket packet = (ServerboundContainerClickPacket) event.getPacket().getHandle(); | |
ServerPlayer serverPlayer = ((CraftPlayer) event.getPlayer()).getHandle(); | |
PacketUtil.handleContainerClick(packet, serverPlayer); | |
event.setCancelled(true); |
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
#!/bin/bash | |
# checks if this script was executed correctly | |
if (( $# == 0 )); then | |
echo -e "Usage: $0 <version> [Java path]" | |
exit 2 | |
fi | |
digit_regex="^[0-9]+$" |
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
@Override | |
public void onPacketSending(PacketEvent event) { | |
ClientboundLoginPacket packet = (ClientboundLoginPacket) event.getPacket().getHandle(); | |
Holder.Reference<DimensionType> dimensionType = (Holder.Reference<DimensionType>) clone((Holder.Reference<?>) packet.dimensionType(), clone(packet.dimensionType().value())); | |
event.setPacket(new PacketContainer( | |
PacketType.fromClass(packet.getClass()), | |
new ClientboundLoginPacket( | |
packet.playerId(), | |
packet.hardcore(), | |
packet.gameType(), |
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
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.nio.file.Files; | |
public class BuildToolsExecutor { | |
//java -Dversion=1.19.2 BuildToolsExecutor.java | |
//java -Djava=custom_path -Dversion=1.19.2 BuildToolsExecutor.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
PersistentDataContainer container = /*your container*/; | |
container.set(KEY, SerializableDataType.INSTANCE, new Location(Bukkit.getWorld("world"), 0, 64, 0)); | |
container.set(KEY, SerializableDataType.INSTANCE, Map.of("test key", "test value")); |
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
// Method copied from CraftInventory#addItem, but I removed the code that adds items to the inventory | |
public static boolean canFit(Inventory inventory, ItemStack... items) { | |
Validate.noNullElements(items, "Item cannot be null"); | |
ItemStack[] inventoryItems = getContents(inventory); | |
for (ItemStack item : items) { | |
while (true) { | |
int firstPartial = firstPartial(inventoryItems, item); |
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
private Scoreboard getPlayerScoreboard(Player player) { | |
GamePlayer gamePlayer = getPlayer(player); | |
List<GamePlayer> bestPlayers = getBestPlayers(3); | |
Scoreboard scoreboard = ScoreboardUtil.create( | |
"§c§lSolo §e§lMode", | |
"§aYour kills: §f" + gamePlayer.getKills(), | |
"§aYour lives: " + (gamePlayer.getLives() == 0 ? "§cDEAD" : "§f" + gamePlayer.getLives()), | |
"", | |
"§61. " + (bestPlayers.get(0) == null ? "None" : bestPlayers.get(0).getName() + ": §f" + bestPlayers.get(0).getKills()), |
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
@RequiredArgsConstructor | |
public class Example extends PacketListener { | |
private static final java.lang.Class<?> CLAZZ; | |
static { | |
try { | |
CLAZZ = java.lang.Class.forName("net.minecraft.network.protocol.game.PacketPlayInUseEntity$d"); | |
} catch (ClassNotFoundException e) { | |
throw new IllegalArgumentException(e); |
NewerOlder