#help-development
1 messages Β· Page 1038 of 1
lets say I wanted to set a Block to bedrock from a location,
Location location....
location.getBlock().setType(Material.BEDROCK)
What would be the new way to do this?
yeah i mean that
We just nerd an api to add to registries kekw
Some are interfaces
Some are abstract classes
Biome is an abstract class for example
Get to work then :D
After inventories last night though was talking with lynx regarding a syncing bug I was having and turns out our drag system breaks ensuring inventories are synced
Which is just beautiful
Yay
He said the only way to fix it is a breaking change apparently but idfk where I'd even start with a pr for that idk where the drag stuff is
All I can say is that eill be time consuming to fix
Considering I didn't even know this until yesterday

guys is there an api for creating packet entities?
Protocol Lib?
thats not really api is it
no i mean with a good api that has the entities implemented into classes, i dont want to write the packets myself
with this index stuff
PacketEvents has something for it
Yes
I mean, drag event firing is. PrepareAnvil might be solvable?
How do I set the attributes to an empty list here? I have no clue what this input type is meant to be.
how do i spawn something with packetevents?
witch jdk do u use
21 openjdk
and what version for the server
1.20.4
java*
it hasnt ran on the server
this is what happens when compiling plugin in intellij idea ultimate
ensure your project java version matches with your installed java version
oh shoot whats the newest version
2.0.3
I got the version 60 error recently, and that one had to do with my maven shade plugin version.
at least that didn't cause any other issues (I hope)
Eh it was broken code anyways haha
Hi, I'll show you a link to this video where you'll learn how to use it, what the plugins and commands are, and also some tutorials on how the balloon moves in the air and how the earth rotates. Here is the link: https://streamable.com/ae543b
Hey guys, I'm trying to make the packet entity using ProtocolLib, but I'm getting some strange errors. This is my code. If anyone is more familiar with Plib lemme know what I'm doing wrong. I've looked into docs and seems like I'm following the correct format. No idea what's wrong to be completely honest.
public class KnockbackEntity {
@Getter
private FixerPlayer fixerPlayer;
private ArrayList<FixerPlayer> affectedPlayers = new ArrayList<>();
private final int entityId;
@Getter
private Location lastLoc;
private static final HashMap<Integer, KnockbackEntity> entities = new HashMap<>();
public KnockbackEntity(FixerPlayer fixerPlayer) {
this.fixerPlayer = fixerPlayer;
this.entityId = (int)(Math.random() * 2.147483647E9D);
entities.put(this.entityId, this);
}
public void updateLoc(Location loc, ArrayList<FixerPlayer> players) {
if (Config.getBoolean(Config.HD_ENABLE_HITBOX_OPTIMIZER)) {
ProtocolManager pm = ModernKnockback.getInstance().getProtocolManager();
PacketContainer despawnPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
despawnPacket.getIntLists().write(0, Collections.singletonList(this.entityId));
PacketContainer locPacket = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
locPacket.getIntegers().write(0, this.entityId)
.write(1, (int) (loc.getX() * 32.0D))
.write(2, (int) (loc.getY() * 32.0D))
.write(3, (int) (loc.getZ() * 32.0D));
PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
EntityType entityType = EntityType.valueOf(Config.getString(Config.HD_ENABLE_HITBOX_ENTITY));
Entity entity = this.fixerPlayer.getPlayer().getWorld().spawnEntity(new Location(this.fixerPlayer.getPlayer().getWorld(), 0.0D, 256.0D, 0.0D), entityType);
WrappedDataWatcher watcher = WrappedDataWatcher.getEntityWatcher(entity).deepClone();
entity.remove();
spawnPacket.getIntegers().write(0, this.entityId)
.write(1, entityType.ordinal())
.write(2, (int) (loc.getX() * 32.0D))
.write(3, (int) (loc.getY() * 32.0D))
.write(4, (int) (loc.getZ() * 32.0D));
spawnPacket.getDataWatcherModifier().write(0, watcher);
PacketContainer metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
watcher.setObject(0, (byte) 32);
metaPacket.getIntegers().write(0, this.entityId);
metaPacket.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());
for (FixerPlayer fp : players) {
if (!this.affectedPlayers.contains(fp)) {
pm.sendServerPacket(fp.getPlayer(), spawnPacket);
}
pm.sendServerPacket(fp.getPlayer(), locPacket);
}
for (FixerPlayer fp : this.affectedPlayers) {
if (!players.contains(fp)) {
pm.sendServerPacket(fp.getPlayer(), despawnPacket);
}
}
this.affectedPlayers = players;
this.lastLoc = loc;
}
}
public static KnockbackEntity getKnockbackFixerEntity(int id) {
return entities.get(id);
}
}```
Probably better off sending in the PLib discord if they have one
And this is the error. It comes from the method updateLoc
https://cdn.discordapp.com/attachments/1252226191621099530/1252259459758030848/image.png?ex=667239c1&is=6670e841&hm=14e3e31b460fd96765ffc5ecfc717c13b1d6171a03f5485e84db6c743541bbce&
make the index 0 instead of 1
use a set btw
Is there any way to add optinal arguments to a BrigadierCommand?
The event for prepare is fine the issue is the packets aren't updated for a single click
I'll figure it out later thougj
when using packetevents, how do i properly send a entity metadata packet, which makes the entity invisible? im dont really get the params i need
did you check on the protocol wiki? usually you can get a good idea of how the wrapper has been implemented by going there first
im there
but i dont really get it
new WrapperPlayServerEntityMetadata(int entityId, List.of(new EntityData(int index, EntityDataType type, Object value));
shouldnt there be more ?
index is 0, type should be byte, but then i should also be able to say its 0x20 and then the value to 1
right?
what mc version
1.21
did packetevents update?
not sure, but i think i got it now
I think this packet has changed in 1.21
only problem i dont know how to make it visible again
Error:
https://paste.md-5.net/imipakomib.bash
plugin.getSQL.getData()
public String getData(OfflinePlayer player, String query) throws SQLException {
if (!playerExists(player)) addPlayer(player);
if (sqlContains(query) != 1) return null;
try (PreparedStatement preparedStatement = connection.prepareStatement("SELECT ?, uuid FROM Players WHERE uuid = ?")) {
preparedStatement.setString(1, query);
preparedStatement.setString(2, player.getUniqueId().toString());
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) return resultSet.getString(query);
else return null;
}
}
msscu.claim() (ONly Relevant Section)
https://paste.md-5.net/uxejewewel.cs
For some reason it wont let me get the lang or any other column of a player
db
#1 was set to lang
#2 was set to "test"
This error has tortured me for ages
ping me with response please :)
what is the query
String lang = "en";
try {
if (player != null && plugin.getSQL().playerExists(player)) {
lang = plugin.getSQL().getData(player, "lang");
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
what is the structure of the table?
as in, how was it setup?
statement.execute("""
CREATE TABLE IF NOT EXISTS Players (
uuid TEXT PRIMARY KEY,
name TEXT,
lang TEXT DEFAULT 'en',
boat1 VARBINARY,
boat2 VARBINARY,
boat3 VARBINARY
);
""");
varbinary?
for an uuid?
um
this shows lowercase for lang
nvm I am seeing stuff
anyways, are you sure its not converting the type in some weird way?
few i thought i really made a case error and was abt to jump off a cliff
not even sure how you would test that
dont think so
sqlite will convert types in queries
based on some rules
normally shouldn't cause any issues, but it can if you specified your sqlite db to be strict
i dont know how to specify my sqlite db to be strict but π€·ββοΈ
how are you connecting to it?
public SQL(String path) throws SQLException {
connection = DriverManager.getConnection("jdbc:sqlite:" + path);
try (Statement statement = connection.createStatement()) {
statement.execute("""
CREATE TABLE IF NOT EXISTS Players (
uuid TEXT PRIMARY KEY,
name TEXT,
lang TEXT DEFAULT 'en',
boat1 VARBINARY,
boat2 VARBINARY,
boat3 VARBINARY
);
""");
}
}
creation
and this worked for creating it?
try {
if (!getDataFolder().exists()) {
getDataFolder().mkdirs();
}
sql = new SQL(getDataFolder().getAbsolutePath() + "/advancedboating.db");
} catch (SQLException error) {
throw new RuntimeException(error);
}
Is there an easy way to split a string into lore sections?
Capping each line at a set amount of letters cuts off words;
Capping the word count per line can make it look horrible because some words are longer than others.
yeap
the file appears
it opens in datagrip and everything
lang appears
in the datagrip
At a set amount of characters? Idk, a for loop?
char limit then if dont let it cut off the word
i'd split at spaces
get length of each one or whatever
try executing the query as just a statement and not a prepared one
just hardcode the query for now to make it easier to do that lol
whatd this look like codewise im not familiar with SQL inside of java
oh chill
there is statement
its like preparedstatement except you can't build it, it needs to be constructed when its initialized
chimken
I just want to see if its preparedstatement doing something weird =/
sqlite isn't quite like MySQL
why are you giving out other db names?
public String getData(OfflinePlayer player, String query) throws SQLException {
if (!playerExists(player)) addPlayer(player);
if (sqlContains(query) != 1) return null;
try (Statement statement = connection.createStatement()) {
ResultSet resultSet = statement.executeQuery("SELECT lang FROM Players WHERE uuid = '77e27de9-5c36-40b7-b793-013e2f2312ea'");
return resultSet.getString("lang");
}
// try (PreparedStatement preparedStatement = connection.prepareStatement("SELECT ?, uuid FROM Players WHERE uuid = ?")) {
// preparedStatement.setString(1, query);
// preparedStatement.setString(2, player.getUniqueId().toString());
// ResultSet resultSet = preparedStatement.executeQuery();
// if (resultSet.next()) return resultSet.getString(query);
// else return null;
// }
}
this doesnt return the error...
so preparedStatement is being weird
ffs
guys is nbt usable for 1.8?
i dont think getData() should create the player though, seems like a design issue
define usable?
thats not a problem here
and its like that for defaults
well it has to do with that sqlite implements prepared statement differently then what java probably expects
can i use it and make it work properly
Sure
is there a specific sqlite java library i can point to or ?
But there is no PDC api in 1.8 so you'll need something like NBTApi or just NMS
I had to look at the compiling of prepared statement in sqlite to even think it may be prepared statement XD
hahaha
well, not sure how your queries are derived but if you implement properly you can get away without not using prepared statements
just have to take extra care in regards to sanitizing if the inputs come from players directly
they dont
so i shouldnt have to worry?
not if the players can't input anything directly
ResultSet resultSet = statement.executeQuery("SELECT " + query + " FROM Players WHERE uuid = '" + player.getUniqueId() + "'");
is this stupid code gonna work
I am not sure what version of sqlite jdbc you are using either
but there was some bugs in one of the versions of sqlite 3
right makes sense
as long as its correct it should
oh ur saying this so no one " lang ; DROP TABLE Players"
if it comes to it how easy is it to switch to mysql
kekw
would take minimal effort to move to mysql, just pull the sql code for your current DB upload it to mysql
whats the diff again between
conn.prepareStatement(xyz)
ps.execute()
//and
conn.prepareStatement()
ps.execute(xyz)
former caching the statement?
would be a shame if spigot has a version of sqlite that has the bugs
hmm?
it does
3.46.0.0
oh well if you are on latest mc version for spigot you shouldn't really be having issues with sqlite =/
3.46 is quite a many versions away from the 3.14 series
3.42 is used in 1.20.4
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
How craft heart
Do trial spawners have an inventory
I mean they probably do everything that contains items has an inventory
I thought the result was in nbt, if not probably not then
Carfter has an inventory and menu tho UwU
The funniest inventory is probably the lectern tbh
Ph yeah the vault is what I was thinking of
I forgot they were different
why is that a thing?

probably a great time to waste a diamond hmm?
You can take it out with the take book button dw
like that time someone on the spigot smp put an item in a vase and couldnt figure out how to get it back lol
Kekw break the vase!
Try OfflinePlayer.getPlayerProfile().update() and use it for the player profile ban list
bukkit.getbanlist or smth
:noway:
:yesway:
ban list not have unbun method
pardon()
wha
unbun
should be a function called banlist.pardon
because vanilla command is /pardon im pretty sure
^
pardon me my well established gentleman
void pardon(@org.jetbrains.annotations.NotNull T t);
what the t i need get from player profile?
T is the player profile in this case
no
Hi there. Is creating a new inventory each time (with cached itemstacks) much more resource-expensive than updating it on the fly?
I actually just did something like this
It cleans up inventory creation a lot
Yes
Oh wait, are you in favor of recreating the inventory each time?
public class Button {
private final Material materialType;
private final String displayName;
private final List<String> lore;
public Button(Material materialType, String displayName, String... lore) {
this.materialType = materialType;
this.displayName = displayName;
this.lore = new ArrayList<>();
for (String string : lore){
this.lore.add(ChatColor.translateAlternateColorCodes('&', string));
}
}
public ItemStack getItemStack(){
ItemStack stack = new ItemStack(materialType);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
meta.setLore(lore);
stack.setItemMeta(meta);
return stack;
}```
For all my buttons, which turns itemstack creation into a one liner: new Button(material, "name", lore...);
I do yes
Creation being a player opening the gui
oh well... I'm actually recreating it from scratch each time:
public void generateInventory() {
...
// Parsing details
// Required details
int size = guiDetails.getInventorySize();
InventoryType type = guiDetails.getGuiType()
.toInventoryType();
// Optional details
Component title = guiDetails.getInventoryName();
// guiDetails.setTempPageElements(new HashMap<>()); // reset temp
// Generating inventory
Inventory inventory;
if (type != InventoryType.CHEST) {
inventory = Bukkit.createInventory(this, type, ComponentsUtil.serialize(title));
} else {
// We cannot extract to specify
// the size of the inventory
inventory = Bukkit.createInventory(this, size, ComponentsUtil.serialize(title));
}
// Populating inventory
this.populateInventory(
inventory
);
this.inventory = inventory;
}
no this not
"cant resolve"
server.getBanList(BanList.Type.PROFILE).pardon(offlinePlayer.getPlayerProfile());
That was something I was toying with as well, the generalization of inventory creation was very hard and I ended up just sticking with something like this:
private static final Button BACK_BUTTON = new Button(Material.RED_STAINED_GLASS_PANE, "&cBack", "&7Click to go back to the previous menu!");
private static final Button BORDER = new Button(Material.GRAY_STAINED_GLASS_PANE, " ");
private static final Button REMOVE_SINGLE_APPLE_BUTTON = new Button(Material.RED_WOOL, "&c [-] &f: &4Apple", "&7Click to remove one apple from your purchase!");
private static final Button REMOVE_16_APPLES_BUTTON = new Button(Material.RED_WOOL, "&c [-] &7<&c16&7> &f: &4Apples", "&7Click to remove 16 apples from your purchase!");
private static final Button ADD_SINGLE_APPLE_BUTTON = new Button(Material.GREEN_WOOL, "&a [+] &f: &4Apple", "&7Click to add one apple to your purchase!");
private static final Button ADD_16_APPLES_BUTTON = new Button(Material.GREEN_WOOL, "&a [+] &7<&a16&7> &f: &4Apples", "&7Click to add 16 apples to your purchase!");
...
/**
* Money To Apple Conversion Menu
*
* @param appleAmount The amount of apples to display.
* @param cost The cost of how many apples.
* @param player We get the player here to display their balance.
* @return Returns the created inventory.
*/
private Inventory moneyToAppleConversionMenu(int appleAmount, double cost, Player player){
Inventory appleConversionMenu = Bukkit.createInventory(null, 27, ChatColor.translateAlternateColorCodes('&', "&4Buy Apple Menu"));
NumberFormat numberFormat = NumberFormat.getInstance();
Economy economy = NormalConversions.getEconomy();
Button appleAmountButton = new Button(Material.APPLE, "&4Apple : &f" + appleAmount);
Button appleConversionRateButton = new Button(Material.ENCHANTED_BOOK, "&cApple &fConversion Rate:", "&7[ &f1 : %appleRate% &7]".replace("%appleRate%", numberFormat.format(conversionRates.getMoneyToAppleConversionRate())));
Button buyButton = new Button(Material.GREEN_STAINED_GLASS_PANE, "&cClick To Buy!", "&7 [ &c%cost% &7] ".replace("%cost%", numberFormat.format(cost)));
String playerBalance = "&cYour balance &f: &7<&f %playerBalance% &7>".replace("%playerBalance", String.valueOf(economy.getBalance(player)));
Button playerBalanceButton = new Button(Material.PAPER, ChatColor.translateAlternateColorCodes('&', playerBalance));
appleConversionMenu.setItem(11, REMOVE_16_APPLES_BUTTON.getItemStack());
appleConversionMenu.setItem(12, REMOVE_SINGLE_APPLE_BUTTON.getItemStack());
appleConversionMenu.setItem(13, appleAmountButton.getItemStack());
appleConversionMenu.setItem(14, ADD_SINGLE_APPLE_BUTTON.getItemStack());
appleConversionMenu.setItem(15, ADD_16_APPLES_BUTTON.getItemStack());
// Gives us a border like appearance surrounding the other buttons.
for (int i = 0; i < appleConversionMenu.getSize(); i++){
if (i < 10 || i > 16){
appleConversionMenu.setItem(i, BORDER.getItemStack());
}
}
// Set the buttons after the border buttons are placed, as these buttons are placed in spots of borders.
appleConversionMenu.setItem(4, appleConversionRateButton.getItemStack());
appleConversionMenu.setItem(22, buyButton.getItemStack());
appleConversionMenu.setItem(26, BACK_BUTTON.getItemStack());
appleConversionMenu.setItem(8, playerBalanceButton.getItemStack());
return appleConversionMenu;
}
I've got my reusable buttons at the top
and populate the inventory I guess what you could say "normally"
It's just a little hardcoded π
Sure, but I suppose thats why we have javadocs eh?
I'm not sure about that ahaha
Btw, we're doing the same thing, nice! π
Javadocs to explain why we do what we do I meant kek
"I was too lazy to make this abstract enough so I hardcoded it"
If you can figure how to create + cache populated inventories, lmk cuz it'd be nice to not hardcode all of my inventories kek
@chrome beacon Sorry to tag you, but you've been in this field for decades. I trust your skills, haha. Do you think this approach is overkill?
Just create an inventory object, add stuff to it, and then hold it in a variable somewhere?
It depends on what you're making but generally just keep a ref to the inventory
A map with a string key for the inventory name is fine
I generally only have global inventories be cached
Thank you for your reply! I appreciate that π
Hmm, would just Bukkit#createInventory be expensive? Or is it also re-setting each element?
Probably not that expensive
Anything with contents that pertain to a specific player I make on the fly
and by resetting, I mean
inventory.setItem(cacheEntry.getKey(), cacheEntry.getValue())
but a map lookup is faster than recreating the entire inventory
Thank you all! Amazing help π
It's not expensive no
Resetting each element is meh it's just a for loop but the conversion of bukkit item stacks to jms stacks can be heavy if you do it often but it really depends in your frequency
Ohh... I've already cached itemstacks
I see
Thank you!!
I mean, I guess this applies for my case... I only have one button in the conversion menus that are player specific but also buttons with metadata that needs changed based on certain gui interactions, but that's only 3-4 total buttons
Otherwise they're all shared
ANyone else has the problem with /spawn ?
It says "no permissions" but I have the perms in LPB
Can u send us the class of the command?
it sounds like a #help-server issue
is there like an api way to start a zombie siege in a village?
It summons herobrine
There is zero context in here
xd
sound that gets played when player is sneaking, which triggers a teleportation
anyone know how to solve these 2 errors? They occur when after a while once I've unloaded a world using Bukkit.unloadWorld and then deleted the world folder.
java.nio.file.NoSuchFileException: .\void_active_1718736968389\data\raids.dat
``` ```
[20:00:54 ERROR]: Failed to save level .\void_active_1718736968389
java.nio.file.NoSuchFileException: .\void_active_1718736968389\level14083239363489905074.dat
Is elevatorWhooshDown a Sound?
Yessir
Uhh sounds may have been moved into registries
Look into Bukkit.getRegistry(Registry.SOUND) (see if that exists)
Probably BlockData#getSoundGroup()#whateverSoundYouNeed()
I'm not sure
I think u deleted ur world
Just restart your server
yeah thats what I'm tryna do. im working on a map system, so I need to be able to delete and create worlds. I can't really restart after deleting every world
Ok, wait a sec
Ill have to start my pc rq
just create a new world
dont know, if this is up to date, but it could work, just try it out:
WorldCreator worldCreator = new WorldCreator("name");
worldCreator.environment(World.Environment.NORMAL);
worldCreator.type(WorldType.NORMAL);
worldCreator.createWorld();
ight ill run that rq, it looks correct and will prolly work
yeah thats all working fine
Nice c:
does Player#isOnGround work?
lol
are you working with packets
because the combination of bukkit and packets doesnβt always yield the most accurate reaults
results
i mean it will work but if being (i think) one tick off bothers you
you then you might have to reconsider
Itβs client controlled
elevatorWhooshDOWN π
π
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingβgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! π
CraftCrafterView is such a silly class name
Bruh
CraftCraftingTable
how do i make this animation https://youtu.be/Yw4iA8sVVko?t=279
we thought we completed it but pretty sure we didn't do the last bit so don't think its a completion, really interesting boss tho! teammate got fifth master star lol, my job was pretty much keeping the tank alive
Discord - https://discord.gg/TqjM76T
β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬β¬
Texture Pack / Shaders - Just ask me in comments with timestamp...
Hello guys ! I'm facing a problem with the HumanEntity.discoverRecipe method. It seems it only work during a PlayerJoinEvent ... when I try to use it anywhere (after cmd, etc..) it doesn't work ... Have you already saw that ?
it should work everywhere
It should yes ^^
and it does, there is no such thing in java to cancel methods depending on the place they are called
are you returning at some point?
when you call the method
are you making sure it even reaches that point?
No I'm using method before and after this one and they all execute without error
I'm using it in a scheduleSyncDelayedTask, do you think it could me it not working ?
i dont think this would affect it
ok so I have no clue ^^
my method is used in a scheduleSyncDelayedTask and in the PlayerJoinEvent and it's only working on this last one
tf is going on there
Do you have any source code that could point to this?
when using packets how can i unset a value again from the index 0? as far as i know i can only send with the byte and no true or false with it?
Yes I'm sure everything is called π
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
What's the proper way to set a yaml value to an empty dictionary?
?
I guess I'm not doing anything wrong then
ConfigurationSection#createSection(String)
Doesn't that only work if the key doesn't exist yet?
Would there be any way for me to create a world that simply saves nothing on the disk, I have a custom world format to provide chunks from and save changes to that I want to use
It overrides all the previous values in the path
Better question, any way to make a custom world format without using NMS?
pressing f3 on material is one of the top worst things to happen to me today
f3?
I forgot I haven't different hotkeys
I decompiled it
Does WrittenBook have WritableBookMeta or BookMeta
Its BookMeta
xdd
You can't. You need to know and include the other values as well
is there any way for spigot to use the server's CommandDispatcher?
i wanna make commands in a spigot plugin that mcfunctions can use
i feel like i read something like this.. but not sure..
not really possible on spigot. JavaPlugin exists after mcfunctions are loaded and parsed
you could use the brig API recently added to paper with the bootstrap system to register commands before mcfunction parsing happens
ah ok ty
?whereami ??????????????
?whereami
no yeah this is the papermc discord are yall ok???
js grabbed this ss from the top left rn actually
this is literally papermc
Yes
But...
What is discord?
This is NOT paper
If it was my name wouldn't be BananaRobot29498
but your name isn't BananaRobot29498
your name is "Stasis, The Shattered" ???
Not here because it made me link it to some account with an Xbox randomly generated ass username
lmao
Lol
how do i play the block break particles? i forgor π
i need to play the full block break effect, specifically
because i am manually breaking the block in the code
should I treat Level class (moj mappings nms) as autoclosable or should I just ignore that
Ignore that
thank god, been ignoring it since long ago and now i feel relieved
got a new kind of malware spammer, someone linking to a github project telling people to run some shady program because they're getting an error with it
seems like it's a crypto miner
Fun
Where can I get it?
viruses? doesn't take much effort to find one
But, which is the best way to get one?
visit porn sites with adverts enabled
based on how you're asking this I'm guessing you probably have a few regardless
Oh I take that back then, you definitely have a few already
It kills all 100% accurately
Ahahahahah
to tell the truth all I have is Defender + adblock.
no viruses and Im even on Win7 π
Windows 7 is the best
Only protection against viruses is knowing what you dowload
yep
well
also be aware of what sites you visit
Virus payloads in adverts/JS has been one of the most used way to infect computer.
But is it still possible nowadays?
yes
...
They can't steal me any money, because I'm poor
can steal you identity
but they hacked your computer adn recorded you watchign porn.
and take loans out in your name
I don't have a camera
π«‘
anyone here good at trigonometry
pub fn calc_view_angles(&self, dest: &Entity) -> Vector2 {
let delta_x = dest.head_position.0 - self.head_position.0;
let delta_y = dest.head_position.1 - self.head_position.1;
let angle = delta_y.atan2(delta_x);
let yaw = angle * (180.0 / f32_consts::PI) + 90.0;
let delta_z = dest.head_position.2 - self.head_position.2;
let angle = -(delta_z / delta_y).atan();
let pitch = angle * (180.0 / f32_consts::PI);
Vector2(yaw, pitch)
}
something about my math is wrong
like it works sometimes but then i start aiming at the sky lmfao
what language is that
y is the up and down in that scenario right?
Just confirming
I believe you're negating both deltaZ an deltaY
while you only want to negate deltaZ and keep deltaY positive?
And for your "yaw" (which is minecraft's pitch because you only have a single axis) you might want to use sin instead of atan?
Just doing loose conversions here
honestly what if you just convert the code from minecraft to make an entity look at a player into this...
that should work right?
angle == acos(cos(angle))
angle == asin(sin(angle))
pretty much what I suggested
yea
try this maybe?
pub fn calc_view_angles(&self, dest: &Entity) -> Vector2 {
let pi_2 = f32_consts::PI * 2;
let normalized_delta = (dest.headposition - self.headposition).normalize();
let delta_x = normalized_delta.0;
let delta_y = normalized_delta.1;
let delta_z = normalized_delta.2;
let theta = delta_y.atan2(delta_x);
let yaw = (theta + (pi_2)) % (pi_2);
let delta_x_squared = x * x;
let delta_z_squared = z * z;
let delta_xz_sqrt = (delta_x_squared + delta_z_squared).sqrt();
let pitch = (-delta_y / delta_xz_sqrt).atan();
Vector2(yaw.to_degrees(), pitch.to_degrees())
}```
that's basically minecraft's code in rust ig
@celest wadi
misplaced a parenthesis
not sure if there's a PI_2 in rust so I just did PI * 2
the code I sent?
aight
honestly maybe the vector need to be normalized
I edited it, just incase there's a normalize function for that vector type
or maybe even try remove the to_degrees calls
shit works majestically
it's wack
had to help a friend out with trig like 3 days ago
re-learned the basics there and then
well almost
a little rough at times but way better than what i had
no more random spinning at least
shii i like your ways
actually what's your current code
let delta_x = dest.head_position.0 - self.head_position.0;
let delta_y = dest.head_position.1 - self.head_position.1;
let delta_z = dest.head_position.2 - self.head_position.2;
let angle = delta_y.atan2(delta_x).cos().acos();
let yaw = angle * (180.0 / f32_consts::PI) + 90.0;
let angle = -(delta_z / delta_y).sin().asin();
let pitch = angle * (180.0 / f32_consts::PI);
Vector2(yaw, pitch)
mf im copyin and pastin
give me truth or give me lies and you give me lies
i failed my math classes and still passed this aint my fault
blame the system
delta_x.asin()
-delta_z.atan2(delta_y)
crashes my game
honestly I forgot my trig shit
lmfao wot
wtf
basically the equivalent of
yaw = toDeg(asin(deltaHeight))
pitch = toDeg(atan2(-deltaLength, deltaWidth))
wait I think I see what I did wrong..
you dont gotta write it in rust btw pseudocodes fine
hey guys, I'm trying to make custom recipe like, 4x4 in the inventory
@Override
protected void onClick(InventoryClickEvent event) {
int slot = event.getSlot();
Inventory inventory = event.getInventory();
ItemStack[][] test = getRecipeItems(inventory);
System.out.println(event.getAction());
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
for (CraftingItemRecipe recipe : craftingRecipeRegistry.getRecipes()) {
if (recipe.matches(test)) {
ItemStack resultItem = recipe.getResult();
inventory.setItem(RESULT_SLOT, resultItem);
break;
}
}
});
}
Ive tried this :
but even when I fit the recipe the result item won't set in the RESULT_SLOT, but I clicked again somewhere in inventory, the resultItem just appear how can I check if the inventory's recipe fit or not ?
maybe we should move to like #bot-commands so i dont ruin this guys chances of getting a response
pub fn calc_view_angles(&self, dest: &Entity) -> Vector2 {
let pi_2 = f32_consts::PI * 2;
let delta = self.headposition - dest.headposition;
let delta_x = delta.0;
let delta_y = delta.1;
let delta_z = delta.2;
let theta = (-delta_x).atan2(delta_z);
let yaw = (theta + pi_2) % pi_2;
let delta_x_squared = x * x;
let delta_z_squared = z * z;
let delta_xz_sqrt = (delta_x_squared + delta_z_squared).sqrt();
let pitch = (-delta_y / delta_xz_sqrt).atan();
Vector2(yaw.to_degrees(), pitch.to_degrees())
}```
maybe that?
please don't run tasks asynchronously which modify an inventory
if that doesn't work, try remove the to_degrees or add .normalized() on the delta with it surrounded in parentheses like (dest.headposition - self.headposition).normalized(); Or maybe even both? @celest wadi
hmm then how can I check the recipe immediately when players put the recipe slots?
why are you not just registering the recipe like normal?
wdym normal? like, BukkitRecipe?
yeah like Bukkit.addRecipe
why are you evaluating it manually
hmm i thought it just only work when 3x3 recipe
it works in the other inventory?
yep
oh wow
but
{
"recipes": [
{
"id": "kimchi_pancake",
"recipeType": "hidden",
"pattern": [
"ABC",
"D# "
],
"key": {
"A": {"itemsadder": "pepper"},
"B": {"itemsadder": "eggplant"},
"C": {"material": "ROTTEN_FLESH"},
"D": {"material": "WHEAT"},
"#": {"itemsadder": "parsley"}
},
"result": {"itemsadder": "kimchi_pancake"}
}
]
}
I have to add special item like, in itemsadder or customfishing
so I made it own myself
if it requires special things you can listen to CraftItemEvent then check the items again
it's far less buggy and error prone to manually evaluating the inventory
theres also https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/RecipeChoice.ExactChoice.html
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
when I check the items again, can I get the id for itemsadder?
yes
sure, thats up to you
oh I've gotta consider that your recommend thank you
can I ask how to get itemsadder id from itemstack?
but if there's no way to get id from itemstack then how can I check the recipe immediately ?
there is a way i just don't know how, I don't use ItemsAdder
look at their api docs and you will find out
How would i make sqlite change to mysql
well
how do i update the sqlite im running
can someone remind me what the link was to see old versions of the api docs
not sure if its the one you want but helpch.at/docs has em
just found it thanks
(MCCSU) Claim Function
https://paste.md-5.net/ecefumaquj.cs
plugin.getSQL().updateData()
public void updateData(OfflinePlayer player, String query, byte[] data) throws SQLException {
if (!playerExists(player)) addPlayer(player);
if (sqlContains(query) != 2) {
return;
}
Bukkit.getLogger().info("Why tf? 2");
// try (Statement statement = connection.createStatement()) {
// statement.executeUpdate("UPDATE Players SET " + query + " = " + data + " WHERE uuid = '" + player.getUniqueId().toString() + "'");
// }
try (PreparedStatement preparedStatement = connection.prepareStatement("UPDATE Players SET ? = ? WHERE uuid = ?")) {
preparedStatement.setString(1, query);
Bukkit.getLogger().info(query);
preparedStatement.setBytes(2, data);
Bukkit.getLogger().info(String.valueOf(data));
preparedStatement.setString(3, player.getUniqueId().toString());
Bukkit.getLogger().info(player.getUniqueId().toString());
preparedStatement.executeUpdate();
}
}
Output Error:
https://paste.md-5.net/qawalilohu.cs
Was previously having this error with preparedStatement and sqllite
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-text-minimessage</artifactId>
<version>4.16.0</version>
</dependency>
<dependency>
<groupId>com.tchristofferson</groupId>
<artifactId>ConfigUpdater</artifactId>
<version>2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.5</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.46.0.0</version>
</dependency>
</dependencies>
might be wrong but i dont think you can put ? for the column name
What's the best way to handle receiving a packet on a server? It's a custom packet, if that's relevant, so of course only clients that know it exists will send it and that's fine
if its custom you'll have to intercept it with with a netty packet listener
Oh what do i put instead?
the column already exists i know that for certain
looking at the table in datagrip it shows up
Is there any documentation on it?
and running that query using datagrip its functional
you can try and just concatenate it with a string, but prepareStatement evaluates the query before you even pass any arguments, so it's expecting a column
It's not really supported by spigot at all, there may be a few but they are most likely outdated nms stuff
you'll have to do a lot of research yourself
look into protocol lib's packet listener, I think they use it
will d,o thank you
hello, I have a doubt, I downloaded a project that is made in eclipse and I want to know if I can transform it to a maven project in intellij, is it possible?
nope
Change it over to maven in eclipse
Then it should move over to intellij without any changes
ok i'll try, thank you!
sick this worked ur great :)
real quick did material names change for 1.21?
None that I know of, just added
I feel like a tool that just lists every enum in spigot for each version to comparw would be nice
Bit niche but would come in handy for specific things
I created a script called enum yoinker that downloads all enums on spigot with a click (and on the backup api website as well) and I just dumped it into chatgpt to get it to spot changes, didn't find any
what is the current recommended way of getting a potion effect type from name or key?
who knew sending packets would be the hard part..
Should've used the right library
Trying not to use any library right now, funnily enough
just spigot and NMS
believe the issue's because it's a custom packet though, and something is trying to cast it to DiscardedPayload
Yeah, go figure then
can someone help me with something in vc?
it about spawn rate in server problem
VC?
Voice chat prob
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I went and figured
time to fix my tab complete
?xy
ty
elitePotionEffect.getPotionEffect().getType().getKey().getKey() for when you really, really want that key
damn
Is it possible to make World.strikeLightningEffect(loc) silent? I know there are no other arguments but would it be possible with something like reflection?
Packets then?
actually I 1-upped myself entry.getKey().getKey().getKey().toLowerCase(Locale.ROOT)
I REALLY want that key boys
can i just be double sure i got that key and get the key again
does Bukkit.unloadWorld() deletes the world?
no
weird
how so
any protocol experts? i have no clue why its not working
WitherSkeleton witherSkeleton = player.getWorld().spawn(player.getLocation(), WitherSkeleton.class);
GameEntity.setOwner(player, witherSkeleton);
PacketContainer packet = ProtocolLibrary.getProtocolManager()
.createPacket(PacketType.Play.Server.ENTITY_METADATA);
packet.getIntegers().write(0, witherSkeleton.getEntityId());
WrappedDataWatcher dataWatcher = new WrappedDataWatcher();
dataWatcher.setEntity(witherSkeleton);
dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(6,
WrappedDataWatcher.Registry.getChatComponentSerializer(true)), Optional.of(WrappedChatComponent.fromText("Test")));
packet.getWatchableCollectionModifier().write(0, dataWatcher.getWatchableObjects());
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
i get kicked for Failed to encode packet 'clientbound/set_entity_data'
pretty sure protocollib has their own discord. Pretty sure they are the experts of their plugin
if not using that plugin, which I just assumed. Then the error is simple, you didn't encode the packet
they dont have a discord
at least i couldnt find one
I thought they had one π€
well while you wait for someone to help I guess, you could ensure you are using an appropriate ProtocolLib version for whatever version of MC you are using
yeah, of course
what mc version is this
1.20.6
Caused by: java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$c (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$c are in unnamed module of loader java.net.URLClassLoader @65b3120a)
all i want is to send a unique custom name to specific players
i have no idea why it wants to cast $Item to $c
Am i the only one that has issues with arrows being deflected by shield and shot from bows or crossbows? This instantly kills the server
Mc 1.21
Spigot with bukkittools
on latest?
run /version to make sure you are running the latest version, if not then run buildtools and try again
if the error still persists with no plugins on the server, report it to jira
Im kinda new here, any link to jira?
?jira
Ill update mine and see if the error persists. It throws an error in console
yeah
just run /version to see if it says something like "you are running the latest version" or "you are X versions behind"
and make sure that the error happens with no plugins on the server
Okidoki
I think right now there are new versions like twice a day so make sure you actually have latest haha
Wow great effort for the coders
my fucking kotlinx.serializable class is serializing transient fields π wtf is going on
wtf is transient
Marks this property invisible for the whole serialization process, including serial descriptors. Transient properties must have default values.
so thats a fucking lie
Transient properties can be serialized in special cases
such as?
it's not a property in this case though it's just a field
Well exact cases depend on the library. But jackson for example serializes everything that has a function called "get<Name>"
well i'm using kotlinx.serialization
https://stackoverflow.com/questions/39315427/can-a-transient-variable-be-serialized-in-any-way
Maybe you'll find your answer here, it's about java but I suppose that most cases will match
Today I learned this is an interview question
i don't think this fits my problem unfortunately
Could it be about the default getters created by kotlin? Although i'd doubt that on a kotlin lib
uhh maybe but i haven't had this problem like ever idk
i'll change var to val
perhaps that helps
Did you use the correct annotation? Correct package?
yes
i think that var is the problem because it vaguely matches the description of "should implement readObject() & writeObject()
and i don't need it to be a var anyway it's fine as a val
kotlin moment
nope
var = variable
val = valiable?
valiable xD
const
I am talking about what the word is a shortning of
value
maybe throw your class in chatgpt and ask why that field is serialized.
I know it's a gamble but it's worth a try
no thanks
why not
maybe a minimal sample of it? If you don't wanna "publish" the code
i want to solve the problem myself and not try to employ shitgpt that won't even understand my problem
it's gonna be open source anyway
well asking us is not different
you are not shitgpt you have a brain
there is literally no difference between asking here or asking chatgpt
for all you know the people answering you are using chatgpt
yes there is lol
skill issue
If it gives you a direction and it helps you finding the problem it doesn't really matter if it understood the problem
unless you are a language model
and the average person seeking support here is far worse at programming than chatgpt regardless
ofc I am, we are just way better than chatgpt about things we do know
i've tried using this wonderful piece of software multiple times, it spat out something illegible and not remotely linked to my problem
i'm not going to try again
Yeah I had those cases, too
but the things we dont know, π€·ββοΈ
Most of the time actually. But for some things it was useful so when I'm at a dead end I might aswell try
and you have tried google?
:NOWAY:
wtf does that mean
no way as in you havent
or no way as in you have but there was not solution
as in this is the most fucking obvious thing you could've suggested
the only worse is "did you try turning it off and then on again"
what a fun thing you're here doing, asking for support and then shitting on the people trying to help you
it usually works though
telling me to google my problem is not trying to help me
if you don't go to google first to resolve your problem, you need some other form of help anyway
Alright I have one more idea: Go debug if it's actually the kotlinx library that is serializing your class.
If there's multiple libs that can serialize, they might ignore your annotation when the wrong one is used
chatgpt seems to give a plausible response when I ask it but I don't use kotlin so I am not inclined to fact check if it works
what does it say then
yeah im pretty sure i set kotlinx for serialization, unless i switched it to gson at some point
i don't think i did though
lemme see
wow you're spot on lmao
ty i'll fix that
assuming this is even the right question, I don't really care to help that person
π
see this is precisely why i'm not using chatgpt
it yaps so much but in total says so little meaningful stuff
yeah like telling you to use kotlinx serialization
ion need to see all that code
thats bacause you dont know how to ask
this wasn't even my screenshot?
if you want it to explain the code principles behind it instead you can just say that
i don't even need that π i know how to use fucking kotlinx serialization. i had a problem that looked like a bug, which is a field with @Transient being serialized (and fields with @Transient are NOT supposed to be serialized and there's NOTHING in the docs that says that there is any case under which it would be serialized). for chatgpt to properly point out my problem, i'd have to specify that i'm using ktor, which i could, but obviously it wouldn't be my first idea, because at first glance the problem seems to be inside of kotlinx.serialization and not the fact that i commented out one singular line in my serialization configurtaion
why do you have Since on a transient field?
my Since is my own annotation
just to show in which version of my plugin i added some field/variable
not some lib's annotation
there's a decent chance that if you fed it the entire class it could've guessed it
quite literally this
or given you debug steps
my class is. 2000 lines long
Bungeecord permissions can be set when joining a server with a PermissionAttachment?
chatgpt has a 130k context size
why does it have a default value lol
you can probably feed it your entire plugin and it won't blink
though it's less if you're on the free version
yeah im not doing that, copilot is already yanking my code, i don't need some other ai to do that too
only 130k
and you say it's open source huh
Why isn't this dealing extra damage?
Entity entity = e.getEntity();
if (!(entity instanceof LivingEntity livingEntity))
return;
double damage = e.getDamage();
new BukkitRunnable() {
@Override
public void run() {
if (livingEntity != null && !livingEntity.isDead()) {
double additionalDamage = damage * 0.75;
livingEntity.damage(additionalDamage, player);
System.out.println(livingEntity.getHealth());
}
}
}.runTaskLater(plugin, 2);
}```
Do someone know?
it is
big brain my dude
i don't want it to be used soullessly as a means of teaching some ai though
i'm not forbidding it
i just don't want it
am i allowed to not WANT something done with my code?
what the actual fuck
yeah so you'll just allow it to do it, but not take any benefits from it doing it
copilot is benefitting me
i'm not using chatgpt however so i don't want it to also yank my code
I would assume that your delay is too short. An entity can't be damaged again within a short timeframe of getting damaged
but I would suggest you just use .setDamage() instead
chatgpt has definitely yanked code from github in the past and it will definitely do it again in the future
oh yea
can do that
and use the scheduler instead of creating random bukkitrunnables :|
you are correct. and i have nothing to combat that. the only thing i CAN do is not willingly give it my entire codebase but just wait until it stumbles upon it
brilliant attitude
something wrong?
lol
not at all, I think it completely befits you
cool π good to know
163 results on "scheduler"
To be fair, that is still what the guide says :/
https://www.spigotmc.org/wiki/scheduler-programming/
thats what governments these days do
Although it does mention the scheduler
hm does intellij have any kind of ai refactoring for stuff like this
it's definitely possible to do
regex maybe
ah no the format is too different for a simple fix
I do it 106 times in my project lol
how cruel
I use schedule 17 times
i have static functions to schedule tasks in my plugin class 
I maxed out the rowing machine today, shit's heavy
Thanks for reminding me to drink my protein shake
I made my own timer class so my schedulers can be "restarted"
why is that
doesnt aikars taskchain have that?
possibly, never heard of it
that acf dude
or that startup flags dude
youre acting like I know things
he did quite a lot of things
yeah was hoping so
oh acf is for commands
oh folia support is gonna be painful like this
I like making my own things so yesh I never really look for libraries unless I need something I cant be arsed to do myself like packetevents
how does folia support even work
Hello
this code is in 1.19.4 ServerPlayer
protected void defineSynchedData() {
super.defineSynchedData();
this.entityData.define(DATA_PLAYER_ABSORPTION_ID, 0.0F);
this.entityData.define(DATA_SCORE_ID, 0);
this.entityData.define(DATA_PLAYER_MODE_CUSTOMISATION, (byte)0);
this.entityData.define(DATA_PLAYER_MAIN_HAND, (byte)1);
this.entityData.define(DATA_SHOULDER_LEFT, new CompoundTag());
this.entityData.define(DATA_SHOULDER_RIGHT, new CompoundTag());
}
in https://wiki.vg/Entity_metadata#Living_Entity, i can't find the index for DATA_PLAYER_MODE_CUSTOMISATION. is it the same thing as skin parts?
how does folia even ask you to do it
a whole diff scheduler
oh then im in luck
a folia scheduler I guess
there is no "sync" in there
folia support is likely a pain either way
there is no "ticks" for delay, they use TimeUnit
is folia that regionized ticking thing?
yeah I don't really care to support folia tbh
there's so much behavior that would be questionable it's not even funny
seems like once again static is the way to go π
I was thinking about centralizing my scheduler assignment tbh
can we not abuse static? :(
there's a slim line between using and abusing static
the line is how much effort you wanna put in
there's a very wide and generous line between using and abusing static
too bad that this line is very different for each person
meh that depends on who you ask sometimes
people decrying static abuse end up causing the complete inverse problem where things that should blatantly just be static get overengineered
yes
how do you serialize org.bukkit.Location into ByteArray
I don't mind static lib classes - but then pls don't forget the private constructor
have you tried?
that's what I get sonarlint to yell at me for
though I might have to find a different one soon, it's been completely glitching out lately
BBOS
sorry
BOOS
it's spelled BBNO$
declaration: package: org.bukkit.util.io, class: BukkitObjectOutputStream
and don't make classes that can be instantiated and have a static state.
Looking at you DateFormat / SimpleDateFormat
just take a ByteBuffer and write longs and floats to it :/
o i see
baby no dollar
yea that's how i realized it isn't that straightforward
how isnt it straightforward
i checked google however it seems like you have to make your own serializable class
could someone help me over at help-server please?
toString().toByteArray()
does this save everything tho
ByteArray b = new ByteArray() // or smth
b.putLong(world.getUid().getMsb())
b.putLong(world.getUid().getLsb())
b.putFloat(loc.x)
b.putFloat(loc.y)
b.putFloat(loc.z)
b.toBytes()
idk
is there a better linter than sonarlint ? I've not been keeping up
what else is there to save besides position and world name
yea that's what i saw
the only ways I have serialized location is by letting the file configuration do it
well I just want to save whole Location so its easier to teleport the player back in once the world is loaded again
object output stream uses reflection, dunno how it would handle a weakref to a world
maybe transient already
or does it use ConfigurationSerializable? idk i prefer doing things myself
it does
but iirc it saves the world name
not 100% sure though
I know it crashes when trying to deserialize when loading a world that doesnt exist
and idk how to change that
is anyone keeping up with wg right now, have any idea of how far along into the 1.21 update they are?
I'm kinda waiting on them
wg?
worldguard
lmao
just checked
they released the first beta 2 hours ago
perfect because I'm also ready
lmao nice
do buildtools decompile the whole vanilla jar , apply patches, recompile it? if yes, I wonder how they do that without a bunch of errors from decompilation
Yeah exactly how it works
how can that be possible, when I decompile vanilla jar with or without mojang mappings I get a TON and I mean A TON of errors
with like 5 different decompilers
With fernflower?
fernflower, vineflower, forgeflower, cfr
Β―_(γ)_/Β―
also tried with help of enigma
"decompileCommand": "java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -asc=1 -udv=0 -rsy=1 -aoa=1 {0} {1}"
How buildtools does it
where did you find that?
BuildData repo, info.json
Contains decompilation and remapping commands as well as some useful links
I still don't get it, it automatically decompiles vanilla jar and applies patches without any errors at all and then simply recompiles it
Look at the BuildTools source code and the BuildData repo
I know that decompiling vanilla jars and patching it with my code is useless for the most part because I can use mod and plugin APIs but still I want to do it for myself because using plain fernflower and other decompilers gives you a lot of errors
Well, look at how buildtools does it and do the same step by step
Hi , i need help with the Desirlizer
Caused by: java.lang.NullPointerException
at org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder.decodeLines(Base64Coder.java:211) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.skywars.api.utils.BukkitSerialization.itemStackArrayFromBase64(BukkitSerialization.java:184) ~[?:?]
iam using this :
https://github.com/fschmalzel/xTravel/blob/master/src/main/java/com/gmail/xlifehd/xtravel/BukkitSerialization.java
First time seeing Gmail for package name xd
nvm the list was null
it was not a bug from the class :-:
We do have to fix a decent amount of decompile errors
then @shadow night I don't know exactly what you meant, if they have to fix errors. Buildtools indeed decompile, apply patches, recompile into spigot jar, but if they have to fix errors, there is a step missing or something that I don't understand
The decompile error fixes are in the patches
If you think that's bad, you're in for a rude awakening
All the packages for all minecraft plugins were scraped a while ago
What
A list of old bukkit plugins with valid package IDs:
https://pastes.dev/BtJ87koLZy
A list of old bukkit plugins with invalid package IDs:
gmail, github, etc. are only the start
i used nms in 1.8 and i got this error
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/minecraft/server/v1_8_R3/NBTBase
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.java:291) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:152) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:505) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at java.base/java.lang.Thread.run(Thread.java:833) [?:?]
anyone know how to fix this or something?
lol```
Looks like you used a newer nms version than the server supports
Why are you running such an old version ._.
If you really have to use 1.8 at least use 1.8.8
you use 1.8 for minecraft server??
so if I understand this is how buildtools work:
1.) they download craftbukkit repo, bukkit repo, builddata repo,
2.) download vanilla jar, copy it into new one, remove META-INF/MOJANGCS.RSA,MOJANGCS.SF files
3.) loads mappings, run some maven?
4.) firstly use specialsource to apply mappings
5.) decompile vanilla jar
6.) apply bukkit patches, those are .patch files that contain fixes, not whole class files
7.) create bukkit jar?
8.) apply spigot patches differently
9.) compile spigot jar
i do
Decompile before remap afaik
so?
Hm you sure
Sounds like an odd way to go about it
Can you remap the raw binary files?
im sure you can help me to make hosting i also got some custom plugins i've made
I think that it firstly applys maps, see:
but honestly I didn't know that is possible
to first map
so in patches you basically fix errors and put bukkit and spigot code?
Yes
Yes
Pretty sure it's faster to do it that way
Fair
I remap the binary for Vineyard
maybe it also causes less errors than the other way around but not sure
Yeah, it's harder to check what the class of a called method is in code than in bytecode
props to the guy that created buildtools
It's not made by a single person
please never talk about mappings here
And it's pretty shit
kekw
Spigot? Mojmaps? Want yarn mapped spigot plugins?
YES I DO WANT THOSE
as long as it's yarn you can talk about it
Damn okay you do better then
i bet he could
You don't need to be a cook to taste food
Maybe
lmao
write it in kotlin
u r using mojang mappings right?
did you add the plugin for that?
1.8 mojang mappings? Lol
1.8?
^^3
(i don't use 1.8)
what?
they said they use 1.8 .-.
oh, im blind x3
and it says that in the logs too..
I think yarn can be ported to 1.8, mojmaps only theoretically, but could partially be migrated
Noice
i didnt read the whole error message
im lazy x3
beeg update
I was able to just CTRL c CTRL v my NMS
look at all them removals
Granted I donβt have much atm
can you tell I'm doing some spring cleaning lol
I pretty much do the same thing
Most updates very little changes
Thanks to item components the amount of code I need to maintain went down
dropping legacy lets go
We dropped NMS... it was amazing.
Even when you are using modern versions though, for anything overly complicated, there are basically two options:
- spending countless hours fiddling with nms
- spending countless hours trying to get replacements for the nms pr'd upstream.
A while ago we suceeded with number two, and were able to abandon our nms implementations
this is the mantained download site right? https://mvnrepository.com/artifact/net.md-5/SpecialSource

