#development
1 messages · Page 69 of 1
A few things I noticed:
- You don't have to use
replaceif it has the key andputotherwise, doing onlyputwill achieve the same functionality regardless
The following:
if(inventories.containsKey(player.getName() + "_" + world + "_" + "normal")) {
inventories.replace(player.getName() + "_" + world + "_" + "normal", oldInventory);
} else {
inventories.put(player.getName() + "_" + world + "_" + "normal", oldInventory);
}
can be reduced to this:
inventories.put(player.getName() + "_" + world + "_" + "normal", oldInventory);
- As
modealready contains eitherbuildornormalyou can also use that when specifying the hashmap key (rather than doing anifstatement checking the mode type, you could also use an enum for this)
For your specific issue there isn't something immediately wrong I could see--could you share how you're using those three methods?
Can someone help with updating a packet without removing it and adding it back?
another user here sugested I update the packet but that didint work it just didint even show up in the lab list
sorry I am talking about a fake player in a tablist
n = new FakePlayer(new FakePlayerUtil().getNextLetter(s), x.getHealth() + "", true);
n.getTablistAddPacket().sendPacketOnce(x);
updateFakePlayer(x);
}
@Override
public void updateFakePlayer(Player player) {
new BukkitRunnable() {
@Override
public void run() {
if(!player.isOnline()) {
this.cancel();
}
//add
n.getTabListUpdateFakePlayer(new FakePlayerUtil().getNextLetter(s), player.getHealth() + "").sendPacketOnce(player); // Update instead of adding or removing
}
}.runTaskTimer(MafanaNetwork.getInstance(), 0L, 20L);
}``` my code at the moment
protected TabListUpdateDisplayNamePacket(UUID uuid, String playerName, String displayText) {
super(uuid, playerName, displayText);
WrappedGameProfile gameProfile = new WrappedGameProfile(uuid, playerName);
PacketContainer packet = getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
setPacket(packet);
PlayerInfoData data = new PlayerInfoData(FakePlayerPacket.changeGameProfileSkin(gameProfile), 20, EnumWrappers.NativeGameMode.CREATIVE, WrappedChatComponent.fromText(displayText));
List<PlayerInfoData> infoLists = Collections.singletonList(data);
EnumSet<EnumWrappers.PlayerInfoAction> actions = EnumSet.noneOf(EnumWrappers.PlayerInfoAction.class);
actions.add(EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME);
packet.getPlayerInfoActions().write(0, actions);
packet.getPlayerInfoDataLists().write(1, infoLists);
}```
protected TabListAddFakePlayerPacket(UUID uuid, String playerName, String displayText) {
super(uuid, playerName, displayText);
WrappedGameProfile gameProfile = new WrappedGameProfile(uuid, playerName);
PacketContainer packet = getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
setPacket(packet);
PlayerInfoData data = new PlayerInfoData(FakePlayerPacket.changeGameProfileSkin(gameProfile), 20, EnumWrappers.NativeGameMode.CREATIVE, WrappedChatComponent.fromText(displayText));
List<PlayerInfoData> infoLists = Collections.singletonList(data);
if (VersionUtil.isNewTabList()) {
EnumSet<EnumWrappers.PlayerInfoAction> actions = EnumSet.of(
EnumWrappers.PlayerInfoAction.ADD_PLAYER,
EnumWrappers.PlayerInfoAction.UPDATE_LATENCY,
EnumWrappers.PlayerInfoAction.UPDATE_LISTED, EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME);
packet.getPlayerInfoActions().write(0, actions);
packet.getPlayerInfoDataLists().write(1, infoLists);
return;
}
packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER);
packet.getPlayerInfoDataLists().write(0, infoLists);
}```
Hi, thanks so much.
To be honest with you, I’ve used enums, but never really understood them before. Currently I have school, so I can’t send you the code, but the best thing I can do right now is first learn enums and then u can show me a way you found using them.
I’ll send the code in around 8 hours when school is finished
By the looks of your code they probably meant cache the PlayerInfoData packet or even PacketContainer, modify it then resend when you update it.
game doesnt detect
when breaking door top?
blockbreakevent doesnt fire even
nvm i found the reason!
nah nvm i didnt ifnd
0 sense
wtf is this
k this time ill also print what block his is
if not door
There is no time to wait! Ask your question @sonic nebula!
smelling dog what do you think about it
dog says its stinky
no no but why doesnt work
ill check ffor string value
200IQ
i break game mechanics his way
if (block.getType().name().contains("WOODEN_DOOR") || block.getType().name().contains("IRON_DOOR")) {😎 
still doesnt work
it legit prints
WOODEN_DOOR
can you show me a example i never worked with packets and I tried to stay away as much as I could its been 3 days and I cant figure it out
Probably the 1.13 compatibility fuckery fucking something up
it make 0 sense
like even after checking for string it prints
it still don't fire
event fires but its not the same shit as it prints
and it doesnt pass anything
idfk
Hi again, this is my usage of the commands. Now the only world its using is lobby, but when i complete the plugin i will replace that with the current world the player is in.
devoloper of what r u
wtf is this code not sure if its a troll or not
but please learn java basics
dont know if this is a serious answer or only a troll
u are the troll u dont have a big pp just bc u maybe can code "better". So stop trolling and let me learn
I mean, the code isnt perfect to say the least, there is a lot of room for improvement, I guess it will come with practice, but you really should put more time into learning the OOP/Java basics, if you havent already.
its not like i have 3 years of in person training with weekly progress and projects. I wanna have fun coding and dont get a hardcore nerd that feels like the king of the world, because he can say others on a discord server how bad their code is. (not meant towards u btw.)
For example you're methods constantly run getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
You should be caching it and modifying it.
Here is a sample class...```java
public class CachedPacket {
public ProtocolContainer packet;
public WrappedGameProfile profile;
public PlayerInfoData data;
public void generateFakePlayer(UUID uuid, String playerName, String displayName) {
profile = new WrappedGameProfile(uuid, playerName);
packet = getProtocolManager().createPacket(PacketType.Play.Server.PLAYER_INFO);
}
}
bud let em learn
at least be constructive
id also wouldnt be talking cuz the "troll" seems to know more about conventions than you
well i know as much as i have learned and that is much in specific areas and not much overall
i like to concrentrate and learn everything in a specific area first and then start learning something new
so ive stopped coding on the old version and tried using a custom class.
Can i just save the PlayerData to a json file and return the json data to the PlayerData custom class if i need to edit it?
And if yes, how would that work. well i know Json.stringify would work, but how to convert it back to json afterwards and then back to the custom class?
Hi, ive created this but i see a few problems and am unsure to solve them
- I can change the world but there is no instance of inventory/buildmode PER world. How it is now i can change the value of world and the others but i want to save inventory/buidmode PER world.
The json would look somethign like this:
UUID:
"lobbyworld":
buildmode: true
Inventory: Inventory
"citybuild":
buildmode: true
Inventory: Inventory
- I want there to be 2 inventories, but right now im only saving 1. If the player changes worlds the inventories should also change, but that would mean that i need 2 "slots" in my save file for the inventories. So 1 buildinventory and 1 normalinventory
I appreciate any help and critic, thanks
🤦 Spot the issue...```java
double x = x() - pos.x();
double y = x() - pos.y();
double z = x() - pos.z();
return (xx) + (yy) + (z*z);
the repeated x()?
Yeap. Only took me 2 hours xD
sounds like my sort of error
lol
Do maps keep their order?
Same
They should, but I wouldn't count on it
Yeah having a weird issue where a list keeps its order but the map won't
Lists do, maps should
Maps aren't meant to hold an order of entries
Since it's k/v
What type of map
Hashmap pretty sure
Normal (not tree)
Should it?
doesn't a linked map maintain order
A hashmap never maintains order because it uses order for hashing
A tree map does though
Yeah maybe? Not sure
👍
really?
Yeah like```java
sorted = sorted.entrySet().stream()
.sorted(compare)
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
Oh ok
Distance from locations
Then put the distance as the key and sort
I do
When retrieving or when setting
Sorry read that wrong... I have a compare to test distances of the keys
Now I'm confused
Not exact code;
Map<Location, Data> unsorted = collectLocations();
if(sort) {
Comparator<Entry<Location, Data>> compare = new Comparator<Entry<Location, Data>>() {
public int compare(Entry<Location, Data> first, Entry<Location, Data> second) {
return new Double(first.getKey().distanceSquared(minimum)).compareTo(second.getKey().distanceSquared(minimum));
}
};
return sorted.entrySet().stream()
.sorted(compare)
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
}else {
return unsorted;
}
```This is basically what I was doing because I thought maps held their order.
Oh
Any reason you aren't doing ArrayList<Pair<Location, Data>>
Or just include the loc in the data itself
Because he needs to get data from location and he probably doesn’t want to loop
Mh
Map was easier, and dido to pulsebeat lol
Also I'm unsure if it makes sense to compare the distances to 2 locations tbh
I can of course sort it later but was hoping to pass it sorted while it was still async.
Give me a sec
Nvm
Wdym? All he’s doing is checking which has a closer or farther distance to a fixed Location called “minimum”
Unsorted vs sorted
Hmmm
My old method was```java
List<Entry<Location, Data>> sortedEntries = new ArrayList<Entry<Location, Data>>(blockData.entrySet());
if(sort) {
Collections.sort(sortedEntries, new Comparator<Entry<Location, Data>>() {
public int compare(Entry<Location, Data> e1, Entry<Location, Data> e2) {
return new Double(e1.getKey().distanceSquared(minimum)).compareTo(e2.getKey().distanceSquared(minimum));
}
});
}
Hello, I might be blind, but I don't find the Java Docs for the 1.20.0->1.20.3 on https://helpch.at/docs/. I only see LATEST for 1.20.4 version.
I specially need those versions, because if I don't make mistake there was some changments between these versions
Thanks in advance !
Man
The guy says
He codes for 3 years
U don’t probably don’t know me because when someone really needs help I’ll help him and do my best if I do
But when someone seem to not understand starter level shit
No reason to even help
he says that he isnt coding for 3 years
Mayhaps you just use 1.20.4 instead?
Yes I could, but I there was some additions between 1.20 versions that I cannot ignore and I need the Java Doc 😅
🤨
I didn't understand something ?
Ur right but now when I think about it why I solve other people problems when they can’t help them self in first place
People should first try till failure and only then ask for help
Or ask about API or general questions
Not about their code
In some forums not gonna name them for such a question ur post won’t get posted and u will be banned
use the 1.20.4 javadocs, the only difference between 1.20.3 and 1.20.4 is a bug fix that doesnt effecr the api at all
tje bug fixed was to stop decorated pots from being deleted on world reload
Iirc 1.20.4 came out like 1 or 2 days after 1.20.3 lol
Thanks but for the 1.20.0 to 1.20.2 the changments isn't just a bugfix 😅
Why don't you upgrade directly to 1.20.4? You don't have to update each minor version
You should use the layest version
I make a plugin that support multiple version of Spigot
Then you should use the lowest version you want to support
Assuming you're not using nms
Or craftbukkit
No worries it doesn't make any difference
You can just use 1.20.4
And is more stable than others
There was difference between 1.20.1 and 1.20.4 that I cannot ignore
What difference?
TrialSpawner for example
Trialspawner?
what version are you developing for?
I use multiple versions, with maven module I make a module for each version and I check on wich version the server is to use the correct class
hey, everyone!
i'm a Reverse Engineering and Full Stack developer.
if you wanna get my help, dm me.
tbh id support the latest version thats available at the time for each individually major version and the subversions can just be like if ur not the latest one then suffer
this!
This might be a very easy question but i really dont get it. If i wanna create a double chest and put the players inventory onDeath, how to place the double chest. Im trying but it doesnt work..
it places 2 chest next to each other with the same rotation but not connected
chest1.setBlockData(Material.CHEST.createBlockData("[facing=east,type=right]"));
chest2.setBlockData(Material.CHEST.createBlockData("[facing=east,type=left]"));
Sorry
2 locations
Block chest1 = location.getBlock();
Block chest2 = location2.getBlock();
location2.getBlock
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Bukkit.broadcastMessage("killed event");
ItemStack[] items = event.getEntity().getInventory().getContents();
Player player = event.getEntity();
Location location = player.getLocation();
Location location2 = new Location(player.getWorld(), player.getLocation().getX() + 1, player.getLocation().getY(), player.getLocation().getZ());
location.getBlock().setType(Material.CHEST);
location2.getBlock().setType(Material.CHEST);
Block chest1 = location.getBlock();
Block chest2 = location2.getBlock();
Chest chest = (Chest) chest1.getState();
chest.getInventory().setContents(items);
chest.update();
chest1.setBlockData(Material.CHEST.createBlockData("[facing=east,type=right]"));
chest2.setBlockData(Material.CHEST.createBlockData("[facing=east,type=left]"));
chest1.getState().update();
chest2.getState().update();
}
can you try one second that:
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Bukkit.broadcastMessage("killed event");
ItemStack[] items = event.getEntity().getInventory().getContents();
Player player = event.getEntity();
Location location = player.getLocation();
Location location2 = new Location(player.getWorld(), player.getLocation().getX() + 1, player.getLocation().getY(), player.getLocation().getZ());
BlockData chest1Data = Material.CHEST.createBlockData();
BlockData chest2Data = Material.CHEST.createBlockData();
((Directional) chest1Data).setFacing(BlockFace.EAST);
((Chest) chest1Data).setType(Type.RIGHT);
((Directional) chest2Data).setFacing(BlockFace.EAST);
((Chest) chest2Data).setType(Type.LEFT);
location.getBlock().setBlockData(chest1Data);
location2.getBlock().setBlockData(chest2Data);
Chest chest1 = (Chest) location.getBlock().getState();
chest1.getInventory().setContents(items);
chest1.update();
}
.setType requires material not a type
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Location deathLocation = player.getLocation();
Block block = deathLocation.getBlock();
block.setType(Material.CHEST);
deathLocation.clone().add(1,0,0).getBlock().setType(Material.CHEST);
Chest chest = (Chest) block.getState();
Inventory chestInventory = chest.getInventory();
Inventory inventory = chestInventory instanceof DoubleChestInventory ? ((DoubleChest) chestInventory.getHolder()).getInventory() : chestInventory;
// Collect & store
}
its not like i have 3 years of in person training
its not like Tony has 3 years of in person training when it comes to reading
ive only seen u beat up peoples code and tell em to learn java lmao
omg how dare you!? Learn java! (/s)
Look at chat history
😉
It’s just pretty often here when people want get spoon feed
I don’t have big problem with spoon feed when it make sense
Not when the guy ask us to devolop and fix his code after language model which generates bullshit
also when i ask for help
no one help me
because when i ask for help there literally no answer on google for my problems
usually shit related to the API
Youre always telling people misunderstanding an api (usually bukkit) to learn java
Dudę the guy Herę
Used Break instead of return
And ton of wierd code
No sense code
Probably generated by language model
I will never support someone who doesn’t want to help him self in first place
anyway u cant understand simple api functions with java in garbage level
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
his commands thing
basically language model garbage
he has no clue what he does only spoonfeed appears here
he doesnt need help with the API he needs us to be his code slaves
i will never support never someone who did try did put his valuable time studying java
yeah because break is how you stop fall through (or whatever it's called) in switches?
sounds like someone needs to learn java
bud doesn't know java
sparky there no reason to break if its the end of the code block
blud doesn't know about switch fall through and is telling someone who does to learn java
the breaks are perfectly correct breaks lmao
i do know how switch cases work
so u wanna say our lad here knows what he is doing?
to be clear its his code?
0/1
no or yes
bud thinks hes a programmer cuz he said 0/1 💀
i do code for years i dont say im something
u assume that u piece of sh7t
u cant even say yes or no
ur acting cocky
because u know its model language sh7t
go to plugins help
even if hes using ai generated shit
ur the biggest yapper here
milad this chat is ffor people who need help
he doesnt deserve any help if he didnt put afford and time to study basics
if it was stackoverflow post was denied lol
he is being taught here
ur acting like ur everything lmao
idk abt milad but im here to tell u to not be a dick
pretty much
dude why do u care even
u have mental problems or something read ur answer and ur question
what.
Sparky im aint a dick but i dont support model language people here and highly against giving any help to them
he claims he did it , its not like something advanced tbh but anyway the reason behind is very clear
and that milad is a wierd idiot who join our conversation it took him couple of messages to just prove his poin
point
look at that
he came here because i was "crying for 2 days" , "why do you care even"
many people dont support spoon feeding
its not helping person
its like giving homeless a fish everyday instead of teaching him to fish fishes
u get what i mean?
im guessing you hunt for each of your meals rather than buying them
i know the saying im just pointing out that u got it wrong
maybe its not the most correct way ur right i should ignore those homeless idiots who ask people to code for them
ur right
they are not homeless but yeah ill just ignore the lazy 2 digits who appear here its a big group should be a common thing not every road rage i break people car mirrors
@sonic nebula how come I always come here and see walls of text from you?
classic tonyfalk schizo rant activities
@hoary scarab you're now officially the number 2
💀
😆
To try everything Brilliant has to offer—free—for a full 30 days, visit http://brilliant.org/fasterthanlime/. The first 200 of you will get 20% off Brilliant’s annual premium subscription.
This video was sponsored by Brilliant.
Follow me on Mastodon: https://hachyderm.io/@fasterthanlime
Support me on Patreon or GitHub: https://fasterthanli.me/...
Anyone know why EntityDamageByEntityEvent(Entity damager, Entity damagee, EntityDamageEvent.DamageCause cause, double damage) was deprecated in 1.8?
Its not in later versions.
Probably because it doesn’t mention any damage modifiers at all
But generally event constructors aren’t really api
Its not deprecated in later versions though.
Then it’s probably just md5 things
👍
If it didn’t exist in 1.7, it’s probably rather to mark it as experimental api
chill man, everyone isn’t always as perfect as you are
Just read the whole conversation and dude what the actual fuck
I'm trying to find how EntityDeathEvent has the drops added to it.
I foundjava CraftEventFactory.callEntityDeathEvent(this, this.drops); this.drops = new ArrayList(); in LivingEntity but I don't see anywhere drops is modified or added to...
check rhe super classes
Can someone help me? I have a vanilla resource pack and my textures for some items don't want to work, and when I try to merge two packs into one... it breaks completely. If someone can guide me on these fixes, it would be greatly appreciated!
iirc the drops are stored in the entity builder
net.minecraft.data.loot.EntityLoot
this.add(EntityType.SPIDER, LootTable
.lootTable()
.withPool(
LootPool.lootPool()
.setRolls(ConstantValue.exactly(1.0F))
.add(
LootItem
.lootTableItem(Items.STRING)
.apply(SetItemCountFunction.setCount(UniformGenerator.between(0.0F, 2.0F)))
.apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0.0F, 1.0F)))))
.withPool(
LootPool.lootPool()
.setRolls(ConstantValue.exactly(1.0F))
.add(
LootItem
.lootTableItem(Items.SPIDER_EYE)
.apply(SetItemCountFunction.setCount(UniformGenerator.between(-1.0F, 1.0F)))
.apply(LootingEnchantFunction.lootingMultiplier(UniformGenerator.between(0.0F, 1.0F))))
.when(LootItemKilledByPlayerCondition.killedByPlayer())
)
);
type deal
for each mob
👍 will look into it. Thanks.
someone help me with updating my fake player in the tab list I tried sending and then removing but I had a issue of a defualt minecraft skin flickering as the fake player skin which made it look bad YapperApps gave me a suggestion of caching it and modifying it but it dosnt update ```java
CachedPacket cachedPacket = new CachedPacket(UUID.randomUUID(), new FakePlayerUtil().getNextLetter(s), "");
@Override
public void updateFakePlayer(Player player) {
new BukkitRunnable() {
@Override
public void run() {
if (!player.isOnline()) {
this.cancel();
return;
}
cachedPacket.updateDisplayName(player.getHealth() + "");
cachedPacket.sendPacketOnce(player);
}
}.runTaskTimer(MafanaNetwork.getInstance(), 0L, 20L);
}```
public class CachedPacket {
private final ProtocolManager manager;
private final UUID uuid;
private final WrappedGameProfile profile;
public CachedPacket(UUID uuid, String playerName, String displayName) {
this.manager = ProtocolLibrary.getProtocolManager();
this.uuid = uuid;
this.profile = new WrappedGameProfile(uuid, playerName);
updateDisplayName(displayName);
}
public void sendPacketOnce(Player player) {
PacketContainer packet = createPacket();
this.manager.sendServerPacket(player, packet);
}
public void updateDisplayName(String newDisplayName) {
PacketContainer packet = createPacket();
List<PlayerInfoData> infoLists = new ArrayList<>();
PlayerInfoData playerInfoData = new PlayerInfoData(profile, 20, EnumWrappers.NativeGameMode.CREATIVE, WrappedChatComponent.fromText(newDisplayName));
infoLists.add(playerInfoData);
packet.getPlayerInfoDataLists().write(1, infoLists);
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
if (onlinePlayer.getUniqueId().equals(uuid)) {
this.manager.sendServerPacket(onlinePlayer, packet);
break;
}
}
}
private PacketContainer createPacket() {
PacketContainer packet = this.manager.createPacket(PacketType.Play.Server.PLAYER_INFO);
return packet;
}
}```
whats the reason for consistently sending the packet
You're still constantly creating a new packet. Try this:
private PacketContainer packet;
private PacketContainer createPacket() {
return packet = packet == null ? this.manager.createPacket(PacketType.Play.Server.PLAYER_INFO) : packet;
}
Also I'm curious to for what Ori asked. Are you trying to make a animated tablist or something?
YapperApps
And you missed a "y" lol
hello yapperapps
lol
How can I detect the if the player is by X blocks close to the wall of a CuboidArea? and get that closest location
No I am trying to display lets say coins of the player that updates every second on the tab list
even with the change the fake player doesnt even apear in my tab list
perhaps smth like this? https://stackoverflow.com/a/18157551
Yapper
Any errors in console?
u send packet spoof it..
i fixed it but another thing sparked my mind
could I save a player object/offline player in mysql?
becuase lets say i have a friends plugin and you can see your friends
player 1 is friends with player 2 there are 2 servers player 2 has never logged on to server 2 but player 1 has and player 1 uses the command /friends list java OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(uuid.getPlayerUUID()); player 2 wont be listed because he never logged on to server 2
you can save their UUID
no I know that but that uuid is usless if the player never loggs on to the server
im talking about a waterfall setup btw
does the waterfall proxy have a offlinePlayer system?
seems to be somewhat-working:
double dx = Math.max(area.getLowLocation().getX() - loc.getX(), loc.getX() - area.getHighLocation().getX());
double dz = Math.max(area.getLowLocation().getZ() - loc.getZ(), loc.getZ() - area.getHighLocation().getZ());
return Math.sqrt(dx * dx + dz * dz) < 5;
but it only works on the corners of the box
Are the coordinates right?
I would think so lol
also, if I add the 0 into the Math.max, then it doesnt work fsr
Welp, it seems like it is not that easy according to the replies to this post https://math.stackexchange.com/questions/2133217/minimal-distance-to-a-cube-in-2d-and-3d-from-a-point-lying-outside
I mean I've been thinking about a wacky solution, just not sure how performance heavy would it
Hmm, see the accepted answer, idk what "axis aligned" means
on player move:
get the player new location
loop through the cuboid low X -> high X by increments of 2-3 to save some performance
in loop check if the new location is near one of those X points
same for z
You could calculate the distance to the corners perhaps, depending how big this rectangle is ig
the max the area would be is 70x70
Welp
time for some trigonometry
eh kinda figured it out
now the tricky part is displaying the border correctly
fsr the blockX and Z are offset to one of the directions or my calculations are wrong
prob the latter
can someone pleasee help me with my ordering so im trying to display fake players in the tab list and forthem to be in order the GameProfile name has to be in alphebtical order right so a..b..c..d..z after z it goes za.zb..zc..zz right.... but after zz its not zza SO WHAT IS IT????????
see??
just check if the player's x,y and z are within the region's corner values
- the range to check
if its 0,0,0 10,10,10, check if the player's xyz is bigger/equal to -3 and is less/equal to 13
if your wanting a location thats inside the box thats closest to the player, then for each coord,
px >= bigX, closestX = bigX
px <= smallX, closestX = smallX
px between bigX and smallX? closestX = px set to int to remove decimal
do the same for each coord
i dont think theres a need to loop at all
Don’t do it on move event it’s gonna be kinda heavy
Just run a task instead every 5 ticks or so
Move event is executed even when player moves his head
Yeah I also didn’t get the reason for looping via all blocks inside the cube
If it’s a sphere , cube , cylinder border and not something different
I would suggest u instead ; the center of the arena the shrings or what ever
And calculate the distance from the center each time instead of calculating how close the place is to the borders
U can run it on asynchrony and when ever player gets closer and closer to the border run the task more often
By that way u can save ton of performance
For example if he is at the center run it every 60 ticks as he gets closer to the border of the arena 40,20,10…
Also for a cube u it would be different calculation since it’s not same distance from center to different borders when I think about it
Bruh
But u still can calculate the max distance that possible from the center towards x z
Because u know the direction using the coordinates I’ll explain later on when I wake up it’s 9am 😭😭😭
And to get the closest player u can wether use a map/list or just constantly update all of them or the closest via the check if he is closer then the other player that was set to be the closest before ^^
or have a map with uuid and last timestamp when it was last displayed to the player

U can instead of displaying actual number do text Far from ring , close , when very close display number since u gonna run the task often enough to give good updates on it
what number
i need help
There is no time to wait! Ask your question @small mango!
im currntly a dev for a anarchy server and the owner wants a ssh plugin
i tried
but hasnt succseded
its hard
pls help
hlep4
i mean
yes there is sshd
but he wants it that
its invisable
to other players
what are you blabbing about
read bruh\
SSH plugin?
If you don't know what you have to do, how could we help? 🙂
why not just ssh normally lol
there is already a plugin for this its called sshd on spigot mc how do i fork it to make it stelthy as the owner wanted
the word "stealthy" there gives me "I want to backdoor my server so I can fuck over my co-owner friends" kinda vibes
it aint 2b2t let me tell ya
and by stelthy i mean not appear in chat or to the console
here's your ssh plugin
systemctl enable sshd.service
you run that on the server machine
nah nah you dont get it
im tryina fork this
to not
give out messages
when anything happens
you are not receiving help installing a backdoor
Why is that even a thing
its not a backdoor
it has a good purpose
its not even for me
Remote access isn’t even that complex, if you have a windows VM its default, with Linux you 99% of the time have an SSH setup, and if you use a host they either use multicraft or ptero which can be accessed from your phone anywhere
there is already a plugin for this its called sshd on spigot mc how do i fork it to make it stelthy as the owner wanted
Read this again
he said he wanted so imma give
do it yourself idk
And I don’t understand why running console commands would print to the server chat, just disable the game rule in game and run commands through the server console
dont ask for help for seemingly sketchy stuff
There’s no need for a back door
then why the fuck did i come here to get support
people are free to refuse helping you lol

You’re asking for help on something sketchy
noone is obligated to help you, everyone is chipping in to help at no cost
i dont care what a i program if someone is paying me fuck it
Simple, tell the owner to just use Pterodactyl and they can remote access anywhere from a website and a login 
why does it even have to be a plugin lmao
not in a plugin
regular ssh exists for a reason
^^^
i think he should totally use shh instead of ssh
cuz its a vps of some kind
Literally use a mobile app called Termius
listen are you gonna help me or nah
no
and how is that accessed if not by ssh
magic vps
idk some kind of a website
aternos
like apex hosting but diffrent
Any vps can be accessed by ssh or a Remote Desktop depending on the OS
was about to say some sort of cpanel type shit but this is a MC server so that makes no sense
you do realise how sketchy this sounds, right?
Also isn’t there literally a game rule called ConsoleOutput that you can disable to make the console commands not print to the whole server / ops
that's only for some things, like vanilla commands
Ah
the way i read this, either ur client is trying to backdoor the MC server (and like, whytf?), or trying to do the sort of activity which at best is in violation of the hosting service's ToS, at worst a criminal offence
- Use the actual ssh
- Use the already existing ssh plugin
- Fork the existing plugin and make your changes accordingly (license btw)
- Do it yourself but dont expect any help
how bout i use chat gpt
now that i think about it
…
Lmao
thanks for wasting my time
you too
Don’t ask for help backdooring a server, easy
xd
tbh
i wasnt trying to make a backdoor
i was just following order for the paycheck
surely chatgpt will give you fully working code
no sometimes
and we just have to believe it

In other news, CompleteableFutures have broken my brain
so, can someone explain this to me:
if i run CompleteableFuture#runAsync without providing an executor (thereby using the common forkjoinpool) or using #join, the code never executes, but if i do the same thing except this time i provide a threadpoolexecutor as the executor, it runs
that's the thing, not only does the code never execute, the program just finishes as if it did run
also, it isn't/shouldn't be; this is a scratch program with nothing except this test program running
do you have a reproducer..?
a what
code that can reliably reproduce that behaviour
public static void main(String[] args) {
final var scheduler = ForkJoinPool.commonPool(); // swap between this and new AsyncExecutor();
final var startTime = System.currentTimeMillis();
CompletableFuture.runAsync(() -> {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}, scheduler).thenRun(() -> {
System.out.println("1: Hello from thread " + Thread.currentThread().getName());
System.out.println("1: Took " + (System.currentTimeMillis() - startTime) + "ms");
});
CompletableFuture.runAsync(() -> {
System.out.println("2: Hello from thread " + Thread.currentThread().getName());
System.out.println("2: Took " + (System.currentTimeMillis() - startTime) + "ms");
}, scheduler);
}
static final class AsyncExecutor extends ThreadPoolExecutor {
private static final int MIN_ASYNC_THREADS = Math.min(Runtime.getRuntime().availableProcessors(), 2);
private static final int MAX_ASYNC_THREADS = Runtime.getRuntime().availableProcessors();
private static final int ASYNC_THREAD_TIMEOUT = 60;
public AsyncExecutor() {
super(MIN_ASYNC_THREADS, MAX_ASYNC_THREADS, ASYNC_THREAD_TIMEOUT, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
allowCoreThreadTimeOut(true);
}
}
this environment is the only environment i'm testing it in
threads from the common pool are daemon threads, meaning the jvm won't wait for them to finish execution to exit
so, you'd need to .join or some other waiting mechanism
so if i want to have "launch and forget" save methods for example, I definitely need them to run on a custom executor?
well, yes and no, if you're maintaining your own pool of non-daemon threads you'd need to shut it down at, well, program shutdown, since the jvm would wait for those threads to finish but the pool is waiting for tasks to run, you need to signal to the pool to not accept any more jobs
the worse alternative is to spawn a new thread solely to run the task which is awful resource-wise
in this case, running shutdown on the pool in a plugin's onDisable
is this to say that using the threadpool is a bad idea, or using the "new Thread(runnable)" kinda stuff for every task is a bad idea
spawning a new thread to run one task, multiple times is certainly a bad idea
for context: this executor, whatever form it takes, will only be used for my database stuff
the common thread pool certainly does have its uses but it can easily be misused
and am i misusing it in this context
I barely understand a thing about concurrency, threads n pools n everything so i've just been going off of what i've seen others doing when it comes to these things
well, i think CompletableFutures using the common pool is a misuse of the common pool
I meant using the custom executor i showed
your issue is less about that and more about not ensuring your tasks run fully before shutting down
you don't really need a class extending TPE either, just create a new one
Yeah I don't really know why I did that
i think we established that shutting down the executor in onDisable dealt with those issues
yeah
ok so my other question with the whole forkjoin-TPE thing is:
If I have a CF stage which runs on the FJP, but later stages run on my TPE, could I run into the same issue of the code never executing due to the FJP
it can be prevented
e.g., I have a name -> UUID async loading cache which lazy-loads UUIDs using Paper's Server#getPlayerUniqueId method, this part (atm) just runs on the common pool, but the database futures which will consume that UUID mapping are all running on the TPE
Some of these won't necessarily have #joins or #gets
i don't know exactly how the server handles the executor that takes care of that, but if you want like complete control over that you can use a Phaser or some count-down mechanism
multithreading is not easy
I don't even know what a Phaser is and i'm not sure i want to know xD
yeah the other option is, don't worry about it
oh actually to be clear, the server doesn't have the CF that runs that method here, that's the cache that creates the CF; afaik the Server's method just runs sync
Am using Caffeine/Guava's AsyncCacheLoader:
@Override
public CompletableFuture<UUID> asyncLoad(final String name, final Executor executor) throws Exception {
return CompletableFuture.supplyAsync(() -> Bukkit.getPlayerUniqueId(name), executor);
}
I haven't provided the Cache builder with an executor so it defaults to the common FJP
So the question is, should I continue using the common FJP, create my own FJP, use my database TPE, or?
supplyAsync should run the task unless the common fjp is busy until the application is stopped
but early java 17 versions have a bug where that's not the case if you run your code on machines with only one core available to the jvm
so what i'm hearing is, just make my own FJP at least
that might be a good idea
Looking at LP (which is kinda my go-to reference for a lot of things), they make their own for this exact type of situation (using the cache-loader)
Java 21 virtual threads 😌
yeets kotlin coroutines
kotlin coroutines work with virtual threads
aww, java monopoly cancelled 😔
i mean virtual threads don't really solve anything in this situation lol
anyone here that can help with custom heads in itemmeta.yml?
- ==: SpawnItem
item:
==: org.bukkit.inventory.ItemStack
type: DIAMOND_SWORD
meta:
==: ItemMeta
meta-type: UNSPECIFIC
display-name: §c§lKITPVP §r§f(Right-Click)
lore:
- §7Start fighting with the
- §7premade kits and show
- §7how strong you are.
- ""
- §7(§fRight-Click§7 to join the §f§oKitpvp§7!)
Like a base 64 head instead of the diamond sword
base64: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODQ4OGIwMzQzOTgwZmNmMjE3ZDdjYmI3NWQ3MzBhZGNhMDRhOGI2YTdiMTM4Mzg2YWNhYTdmYzk5NGE4NThhMiJ9fX0=
who i have to blame for making the libs.version file on deluxemenus? 
this sounds like a perfect opportunity to use git-blame
Oh, nvm, just realised it was the initial commit so there's no attribution
Oh well, Blitz made the initial commit so you can blame them

i was trying to hook a plugin yesterday for 3 whole hours and i didnt succeed :/
skill issue? eh probably
Hey just wondering is there a way to have my plugin check if a papi library is installed?
Ah i think i know the fix
Are you using intellij?
follow the procedure and THEN
yeap
Once u've done everything on the wiki
ahh wait wont let me send ss ill dm u
Help pls
Me
i ll kiss u
PlaceholderAPI.isRegistered(String)
Thank you!
is that capital sensitive?
all identifiers for expansions in theory should be lowercased
ah ok
also anyway for me to make my code run after placeholder api install
basically i'm trying to install the dependency expansions in the plugin
ExpansionManager or something
not finding it when i do PlaceholderAPI.(tab complete in intellij)
where should i look for it?
there's 2 expansion managers in there
i think you need to go through and like, check if the expansion is already installed and if not download & install it using all the api methods
it's in PlaceholderAPIPlugin the getters
i feel like there should be a better way of doing it but im not sure
Cant see it in there
dm'ing u an image cuz i cant send it to u here
I'm pretty new to java, what do you mean by this? and how would i not access it statically?
:/
Like i understand the concept
kinda
shit
im dumb
its what i though
sorry abt that the 0039(time) is hitting hard
#straya
fr fr
being dumb late at night again. How do i call it like a function type thing
this aint working
wut
@NotNull Optional<CloudExpansion> vault = new PlaceholderAPIPlugin().getCloudExpansionManager().findCloudExpansionByName("vault");
new PlaceholderAPIPlugin().getCloudExpansionManager().downloadExpansion(vault);
you don't wanna call new on PlaceholderAPIPlugin
then waht do i call
brain die
you need to access an instance, if there's no static like #get or #getInstance methods then you should try the Bukkit#getPluginManager#getPlugin methods
so you're saying i should make 1 new in my main and then js access it?
no
in PlaceholderAPIPlugin?
lmfao
my fault
@NotNull Optional<CloudExpansion> vault = PlaceholderAPIPlugin.getInstance().getCloudExpansionManager().findCloudExpansionByName("vault");
PlaceholderAPIPlugin.getInstance().getCloudExpansionManager().downloadExpansion((CloudExpansion) vault);
The only problem i'm having is that its saying Optional<CloudExpansion> can't be cast to CloudExpansion
because it can't
well yes i got that part-
i think u need sleep
but what should i use instead
yes
you need to use the optional methods
to check if a result was returned
etc
go sleep u victorian/cockroach-nsw/ACT weirdo
;3
lmfao once i get this coded
cuz i need to put it on the server before the automated restart
or i will get yelled at by players
@flint kernel Ok i feel like im somewhat close only problem is this one
'downloadExpansion(me.clip.placeholderapi.expansion.cloud.@org.jetbrains.annotations.NotNull CloudExpansion, me.clip.placeholderapi.expansion.cloud.CloudExpansion.@org.jetbrains.annotations.NotNull Version)' in 'me.clip.placeholderapi.expansion.manager.CloudExpansionManager' cannot be applied to '(me.clip.placeholderapi.expansion.cloud.CloudExpansion)'
if (!(PlaceholderAPI.isRegistered("vault"))) {
@NotNull Optional<CloudExpansion> vault = PlaceholderAPIPlugin.getInstance().getCloudExpansionManager().findCloudExpansionByName("vault");
if (!(vault.isPresent())) {
plugin.getLogger().info("Vault Not Found!!!");
} else {
CloudExpansion vaultExpansion = vault.get();
PlaceholderAPIPlugin.getInstance().getCloudExpansionManager().downloadExpansion(vaultExpansion);
}
}
thats the only error the on e i snet
😢
i levelled up from asking for so much help
lel
ok wait wtf is going on with my ide
we have this error
Cannot resolve method 'isPresne' in 'Optional'
then that line is
if (!(vault.isPresent())) {
HAHA
woo
i fixed it
i die now thanks for the help
hey! I'm working on a custom papi expansion for my plugin, this is the current code ```java
public class VampirismMCExpansion extends PlaceholderExpansion {
private final VampirismMCPlugin plugin;
public VampirismMCExpansion(final VampirismMCPlugin plugin) {
this.plugin = plugin;
}
@NotNull
@Override
public String getAuthor() {
return "OliviaTheVampire";
}
@NotNull
@Override
public String getIdentifier() {
return "vampirismmc";
}
@NotNull
@Override
public String getVersion() {
return plugin.getDescription().getVersion();
}
@Override
public boolean persist() {
return true;
}
@Override
public String onRequest(final OfflinePlayer player, @NotNull final String params) {
String[] paramArray = params.split(" ");
String setName = paramArray[0];
String[] paramArray2 = paramArray[1].split("_");
String type = paramArray2[0];
String field = paramArray2[1];
return VampirismMCPlugin.INSTANCE.welcomeMessages.entrySet().stream().map(stringConfigurationSectionEntry -> {
if (!Objects.equals(stringConfigurationSectionEntry.getKey(), setName)) return "null";
return stringConfigurationSectionEntry.getValue().getConfigurationSection(type).getString(field);
}).toString();
}
}``` but I was suggested to cache all the config info when it initialises
return VampirismMCPlugin.INSTANCE.welcomeMessages.entrySet().stream().map(stringConfigurationSectionEntry -> {
if (!Objects.equals(stringConfigurationSectionEntry.getKey(), setName)) return "null";
return stringConfigurationSectionEntry.getValue().getConfigurationSection(type).getString(field);
}).toString();
All these values should be cached so you aren't constantly requesting them from the config.
well its all cached anyways
but caching it yourself is still nice since its more performant and readable
lol ya...
they were trying to ask for help on how to cache the values
since I told them they really should be
but good point, config is cached so
Is there a legitimate reason for Entity.getNearByEntities(x,y,z) not being allowed to run async?
I was thinking concurrency but based on the source it creates a new list anyways.
it still has to access chunks/the world
creating a new list doesn't matter at all there
(also source code isn't the specification)
Welp... Gotta use my work around then. sigh
that sounds like you're doing terrible stuff
Nah I just grab the list of entities from the worlds entity manager.
that's not thread safe either btw
Havent had any issues with it. Its just a list I make a copy of.
yeah, that's not thread safe
just because you haven't had any issues with it doesn't mean it might not randomly crash a server tomorrow
That can be said for anything.
How is it not thread safe and how can I make it thread safe?
I could but in this scenario I'm already running on async so I would be passing the data back and fourth between sync/async. Currently I'm using bukkit runnables so those can take multiple ticks to pass in which I could already be at the point where I need to collect the entities again.
guess what, whenever you do something async it only might happen when you need to collect the entities again
sounds like whatever you're doing is conceptually flawed already
That doesn't help make copying a list thread safe.
I do calculations, list modification etc async then pass it to sync so there is less the main thread has to do. If I go back and fourth between sync/async it could eventually overlap.
you could even see data outdated by minutes or hours in theory if you copy the list like that
If the server is lagging ofcourse. But I can also check for the time of list creation if I really thought it hasn't ran for that long.
that has nothing to do with lags, it has to do with how the jvm memory model works
Ok lets move back to thread safety.
I want to copy a list. What would you do to make that thread safe?
prevent any other thread from modifying the list during that time
So in my scenario... Should I just freeze the main thread while I make a copy of the list?
not sure how you want to freeze the main thread, but in that case you can just sync on it
So just clarifying, is reading lists not thread safe either? I thought just manipulating it wasn't (Adding, removing, setting).
So nothing can be read on multiple threads?
it depends
if you read from a constant with multiple threads, that's fine
class ShowStopper {
static boolean running = true;
public static void main(String[] args) throws Throwable {
var t0 = new Thread(() -> {
try {
Thread.sleep(10_000);
} catch (Exception e) {
e.printStackTrace();
}
running = false;
});
var t1 = new Thread(() -> {
while (running);
});
t1.start();
t0.start();
t1.join();
}
}
what would you expect this code to do?
After 10 seconds t1 should stop running.
you can try out and see if that's what happening
public class Testing {
private static boolean run = true;
public static void main(String[] args) {
//long startTime = System.currentTimeMillis();
Thread first = new Thread(() -> {
//System.out.println("Started: "+Thread.currentThread().getName());
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//System.out.println("run = false");
run = false;
}, "First");
Thread second = new Thread(() -> {
while (run) {
//long current = System.currentTimeMillis();
//System.out.println("Elapsed: "+((current-startTime)/1000)+" "+Thread.currentThread().getName());
}
}, "Second");
second.start();
first.start();
try {
second.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
```Wrote and tested stops after 10 seconds.
yep but that's different code
my code never stops (at least on my machine)
Yikes
if you remove the debug stuff, that most likely happens with your code on your machine too
Eclipse run
ah, that might cause some differences I guess
but that's a good example how testing on one machine isn't a proof that something works when dealing with multithreading
public class ShowStopper {
static AtomicBoolean running = new AtomicBoolean(true);
public static void main(String[] args) throws Throwable {
var t0 = new Thread(() -> {
try {
Thread.sleep(10_000);
} catch (Exception e) {
e.printStackTrace();
}
running.set(false);
});
var t1 = new Thread(() -> {
while (running.get());
});
t1.start();
t0.start();
t1.join();
}
}
```This should work for you.
yes that will work, that's a thread safe program
So why would this not be?
List<String> text = Arrays.asList("Test", "String", "Thread");
Thread first = new Thread(() -> text.forEach(s -> System.out.println("["+Thread.currentThread().getName()+"] "+s)), "First");
Thread second = new Thread(() -> {
List<String> modfiable = new ArrayList<>(text);
modfiable.addAll(Arrays.asList("String", "Thread", "Test"));
modfiable.forEach(s -> System.out.println("["+Thread.currentThread().getName()+"] "+s));
}, "Second");
that's thread safe too, because starting a thread always introduces a happens-before relationship with the code before it, in this case the list is created before the other threads are started, and when they start, they see the list as it is, and that list isn't modified anymore after that
That code is basically what I'm doing with the entities list.
no
no what?
it's not what you're doing with the entities list
How is it not? I take a list make a copy modify the copy and use the copy elsewhere.
yes, but the main thread can modify the list at the same time, and you don't have any happens-before relationship there anymore
It can modify the original list not the copy. I don't care about the modifications until a later time anyways.
but creating the copy isn't an atomic operation
eclipse 💀
Bukkit.getScheduler().runTaskAsynchronously(pl, () -> {
WorldServer minecraftWorld = (WorldServer) ((CraftWorld) world).getHandle();
Iterable<Entity> entities = minecraftWorld.M.d().a();
CopyOnWriteArrayList<Entity> entityList = new CopyOnWriteArrayList<>();
entities.forEach(entityList::add);
// Pass entityList to sync
});
```So this wouldn't be thread safe?
I don't know what M.d().a() is but most likely not
M = EntityManager
d() = getEntityManager()
a() = getAll()
not sure which mappings you're using there
but considering basically nothing is thread safe there, that most likely isn't either
Hello, i have a problem
I'm writing code in IntelliJ IDEA
cannot find symbol
symbol: variable PlaceholderAPI
location: class me.vexq.cubeplayportfel.Cubeplay_portfel```
Please help, I have all dependencies and repositories imported.
Where did you get that
I'm trying to open a custom inventory of an anvil, but i want to hide the players inventory contents from this gui, (without using any resource packs)
I couldn't find any way to do this easily, so I'm currently storing the players inventory contents, then clearing their inventory when opening the gui, then as they close it, im re-adding their items. This gets complicated pretty fast, cause i gotta make sure their items persist not in just memory (like if the server crashes when someone has the gui open) or handle player death, or itempickup when they got the inventory open
Basically what im asking, is there a better way to do this?
(note: i am using paper and not spigot, so im happy to use paper only methods that spigot doesnt have)
use packets to set the slots in their inventory?
means they arent actually removed, but they wouldnt show up in the menu
oh good idea, never used packets, is there an easy way to do something like that natively without nms, or will i need to learn to use something like protocollib
packetevents i think can do it
protocollib works too
or you could just do it with nms
any work
i guess i still come to the issue of needing to stop incoming changes like if a player picks up an item
(or stop the packet)
packets is probably the safest way to do it without wiping items, tho its probably one of the most tedious things cus you have to make sure you check for every edgecase
yeah, im guessing ill probably just stick with clearing and saving the items in the players pdc, then retrieving after inventory close, or player join (if the server crashed)
seems simpler, and probably has less issues
I would check how command panels does it.
Also, this can also lead to several issues, best way is def. packets, you only change it visually
like what issues tho?
comamndpanels just save their inventories to a file
so no different really than pdc
😄
fr? thought they did it with packets
I know that @scenic vapor did menus with packets and achieved exactly what you want. Maybe he can help?
i think im just gonna store them, seems a lot less complicated
ye but thats not safe at all
how
data lost
look
serializing is not instant
- errors can be thrown while saving/loading
you would always have to use completable future
to make it so there's a little delay
to make sure everything went how it should
im using pdc
and what
thats still serialization
- imagine that your server crashes
while a menu is opened
im storing to pdc before opening
no different from a player putting an item in their inventory and the server crashing and them losing that item
w custom items w some nbts, etc. etc.
it uses pdc, so it saves the same time any inventory items are saved
- there could be a pontential dupe glitch
how is there a dupe glitch
using items w abnormal nbt size
ok, then the inventory opens half a second later?
and thats it, the only delay
IF u have crazy nbt items
could what?
lose them
the worst scenario still results in zero items lost
how so
how would it?
other people can still have a menu opened
and meanwhile the error can be thrown
just make sure to make it as safe as possible 
bcs dupes and data lost is not fun
that's why Ive chosen packets which are in this case the easiest
and how is there any dupes ?
like in any other plugins that are serializing items
im not using some crazy method of saving, its using a spigot api using pdc
hi, please tell me what should I do. I installed the plugin, at first everything was fine, but then when I entered the /donate command, the server wrote: unknown command
worst case the player wiht crazy nbt opens the gui, it opens a second later cuz serializing takes long
if the plugin breaks/crashes at then no players lose any items, all players with inventory open have their items already saved, and the player who caused the crash inventory never got cleared
and where im saving is in pdc, of the specific player, so theres no contamination/breaking of the location
how?
if ur plugin crashes the server with packets u have to wait for the server to restart
no different than any plugin that crashes a server
the server is dead it has to restart
what?
n
no
lol
oh so if a server crashes, then you dont have to wait for the server to restart?

if I understood correctly, you use packets to send fake empty slots or whatever, your items are still there, just visually invisible. You dont need the server to restart or anything, since the items never left the players inventory
we're talking about a server crashing
which is independent of the plugin or method ur using
hes saying if the plugin crashes with his method, it doesnt lose data, which hes not wrong,
and im not arguing that, i fully understand his method
well, but if it crashes, in the rare case you want to access the players inventory or a plugin needs access to the players inv, imagine it gets the inventory before the items are back.
you have 0 control over that
if the server is crashed... then none of what ur saying happens
💀
hahhahahhaha
anyways, tldr, get some common sense. Better a bug be an actual bug or visual bug? Take your answer, and apply it to this.
I am going to go catch my plane
adios
idk, im just asking to explain how it causes issues, and ur reponse is how the packet method doesnt cause issues, (which i never said it didnt)
then when the explaination comes out, im saying how it doesnt happen with this method, and ur circling back to well the packet method works! without actually saying how the method i said causes issues
im not asking how the packet method is better, i understand how it works
god I am losing braincells
take me with you larkyy
shall we go get a cup of tea my friend?
you seem to not want help
what abt mcdonalds 
im just asking for an explaination
and no one is explaining, just saying theres an issue
I mean, depends, who pays? 
youuu? xD
Larky already mentioned some and so did I lol.
pain
if you decide to use packets anyways, you can take a look into my repo where Ive done the exact thing
https://github.com/MrLarkyy/AquaticShopExtension
The code is not the best as it was the first try of playing around w ShopGUI+, but it was working fine 
TLDR of the holy explanation is that messing with files is unpredictable.
I am actually surprised command panels does it like that, about to delete it from my plugin list
all u both did was praise the packet method, not explain how the other method is "unsafe", when u finally attempted to i explained how ur reasoning (which is valid is certain situations) isn't applicable for my implementation, and u keep doubling down reverting to praising the packet method instead of actually explaining whats unsafe
404 not found
go on his profile and i think its in GUIs aswell
its our job (actually, it isnt, sadly we dont get paid) to guide you and provide our input, we briefly explained it. We don't know whats behind your thinking and we are not google. You can do yourself some research or worse case scenario, try and see
now
Ive already told that performance wise and secure wise its worse to use your method
am only throwing you my opinions
What’s the other method?
which I guess are something that you wanted to hear
packets
i fully understand performance at scale (like large nbt items taking time to serialize)
im just asking the security and what makes it unsecure,
you throw out "dupes" and im saying how is there dupes? and if you don't know, then why are u saying dupes? what is inclining u to think there is dupes?
tip: your own message contains information about how you dupe.
what?
(the one you just sent above)
Why are you so upset, im sure they just wanted to help you out bud :>
Okay but the storing and clearing thing doesn't seem too bad, does it?
WorldServer
please, help
Got some code?
did you import PlaceholderAPI?
If you can't import it either, show build.gradle(.kts)/pom.xml
is https://helpch.at/docs/ not gonna be updated anymore?
1.19.4 through 1.20.4 r missing still
1.20.4 is latest
yeye, but rest
@wheat carbon boi
Looks like it just fell off our radar, no reason it cant be updated
ah alr good good ty
Nicee
_
yes wait
ooo, it turned out that after restarting the program and computer, it works, but thank you for your willingness to help! ❤️
could anyone help me out with a slight issue? i have a class called MineStatus which handles if a plugin's feature is active (via isActivated() method, now the issue is that the isActivated() method does not return true even if it's already set to true by another class/method via the toggleState() method, does anyone know the issue?
public class MineStatus {
public HashSet<String> activated = new HashSet<>();
public void toggleState() {
if (!activated.contains("activemine")) {
activated.add("activemine");
return;
}
if (activated.contains("activemine")) {
activated.remove("activemine");
return;
}
}
public Boolean isActivated() {
if (activated.contains("activemine")) {
return true;
}
return false;
}
}
``` MineStatus class
I know that it returns false because I have other classes that check if isActivated() is true
are you sure you are calling that on correct object instance
You're probably making a new MineStatuts class every time
pretty sure i am
you probably want a static map
nope, its outside of the event
ill try
yep, i had to have a static map for it to work, everything works fine now thanks
well, that means you are having multiple instances of that class, which you shouldn't (in this case)
Yep
you should also show us your use case
Hi. I have a problem again, the placeholderAPI plugin does not recognize my placeholder.
it's my CubeCoinsPlaceholder class
package me.vexq.cubeplayportfel;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.entity.Player;
public class CubeCoinsPlaceholder extends PlaceholderExpansion {
private Cubeplay_portfel plugin;
public CubeCoinsPlaceholder(Cubeplay_portfel plugin) {
this.plugin = plugin;
}
@Override
public String getIdentifier() {
return "cubecoins";
}
@Override
public String getAuthor() {
return "_VexQ"; // Zastąp "YourName" swoim nazwiskiem lub pseudonimem
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public String onPlaceholderRequest(Player player, String identifier) {
if (player == null) {
return "";
}
if (identifier.equals("balance")) {
return String.valueOf(plugin.getCubeCoins(player.getName()));
}
return null;
}
}```
it's my Main class (cubeplay_portfel)
public class Cubeplay_portfel extends JavaPlugin implements CommandExecutor, Listener {
private CubeCoinsPlaceholder placeholderExpansion;
@Override
public void onEnable() {
placeholderExpansion = new CubeCoinsPlaceholder(this);
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
placeholderExpansion.register();
}
}
//...
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
I don't think you need this line
Also, how are you testing it? ```
/papi parse me %cubecoins_balance%
I'm getting this error https://paste.helpch.at/niwuzamasu.css when my plugin is being loaded.
Doesn't HikariCP support Java 8?
The plugin (or program) you are trying to use was compiled using a newer Java version than the one you using.
To find what version you need, start from 52 which is Java 8 and for example, 60 is Java 16. (8 + 8 = 16 => 52 + 8 = 60)
why are you using java 8 🤨
Anyways, see https://github.com/brettwooldridge/HikariCP?tab=readme-ov-file#artifacts
not a big fan of Java 8 but customer's always right :d
thanks
Hey! Is there any way to create a custom NMS entity class which handles multiple entity types? I created one which worked perfectly in 1.20.2 but is now broken in 1.20.4 as I keep getting the error CustomEntity cannot be cast to class net.minecraft.world.entity.animal.EntityPig. I understand why the error happening but I am unsure of what changed between versions and I am just unsure of how to make the class generic again. Any help would be much appreciated (Please ping me if you can help so I dont miss it) 
I can get the class to work by simply changing the extends EntityCreature to extends EntityPig for example but I wanted to keep it generic like it was and not need to make a class for each entity
public class CustomEntity extends EntityCreature {
public CustomEntity(EntityTypes<? extends EntityCreature> entityType, Location location) {
super(entityType, ((CraftWorld) location.getWorld()).getHandle());
this.e(location.getX(), location.getY(), location.getZ());
((CraftWorld) location.getWorld()).addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
}
// ... Pathfinding and Behaviour modification
}
// Function I use in the spawning class to convert the spigot entity to the minecraft entity
public EntityTypes<? extends EntityCreature> convertEntityType(EntityType entityType) {
return switch (entityType) {
case PIG -> EntityTypes.aw;
case COW -> EntityTypes.u;
case CHICKEN -> EntityTypes.r;
case SHEEP -> EntityTypes.aG;
case HORSE -> EntityTypes.Z;
case TURTLE -> EntityTypes.be;
case BEE -> EntityTypes.h;
case GOAT -> EntityTypes.V;
case VILLAGER -> EntityTypes.bg;
case POLAR_BEAR -> EntityTypes.aA;
case WOLF -> EntityTypes.bp;
case PARROT -> EntityTypes.au;
//case BAT -> EntityTypes.g;
default -> null;
};
}
is registering events and initializing the plugin ASYNC bad?
or even possible
basically making onEnable async if that makes sense
might be a bad idea with little benefit
but depends on what you want to achieve I guess
whatever you want to do, you can most likely accomplish by just scheduling an async task in your onEnable
any possible drawbacks?
Im kinda working on a dumb module system, where I upload a new jar file and it reloads the new module and reregisters the listeners and whatever
thing is its sometimes heavy and blocks the main thread, making players unhappy with tps drops
Those things are most literally always try it and see
yeah I mean you should probably just like, restart the server and have scheduled maintenance when you want to change jars
even better if you're using a proxy cause you can just move people to another server or the hub during
I guess so
My issue not really into plugins but the map I have is not shown on 1.20
It works 1.8-1.19.4 but not 1.20
I spawn in a random generated map not the map I wanted
is there an event for the spawn of the wandering trader, so i can cancel it and he wont show up randomly in islands :/ ?
probably https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/CreatureSpawnEvent.html with SpawnReason = NATURAL ?
declaration: package: org.bukkit.event.entity, class: CreatureSpawnEvent
theres a gamerule for it
Vanilla command, no need for a plugin unless u want it disabled only in specific areas /gamerule doTraderSpawning false
lmao
thank uuu
How can I make a placeholder expansion that will send requests via http to the api and receive a response from it without delaying the main thread
Anyone a 5m dev?
I'm only a 10x dev, sorry
5 million $? Sure
yo pls help me in #placeholder-api
Not sure if it is possible
I'd probably create a variable that I update in like every 5 secs
cache value and update on change if possible ideally
is it possible to modify the NBT (PDC) of an offline player? maybe using something like item nbt api?
can i ask why your wanting to do that?
im currently storing player's data using PDC, but upon adding new features, that data is now needed if the player is offline
you probs shouldnt store that data in pdc then
afaik player nbt data isnt fully loading till they are online to save on ram or smth
oh
would "3rd-party" storage be the only alternative then (i.e. yml, sql, etc...)?
probably

like you could manually load the player's nbt data but if you arent already using nms then you cant
yeah that just sounds scary too lmao
json or some either sql or nosql db would be best
json better than yml?
for player data storage yeah probably
yaml is just a modified version of json with some extra speed issues
ur better off just using json from the start
oh true
hmhm alright
I like hocon more for configs, json is annoying because you can't write comments
unless the lib you use can ignore them ig
You could maybe parse it as yml and use yml semantical comments
Hi, I'm having some problems with my server launching. I can launch magma on its own, and i can launch my server files WITHOUT magma on its own, but when I try to use magma as the launch point for my start.bat on my server, i get this crash report: https://paste.helpch.at/cexobugude.yaml
I've already tried reconfiguring FoamFix, which is a mod I'm using, however even though it tends to hang on that line of code, it crashes despite removing it.
is this the right place ?
Not really, this is more about coding related problems
You shouldn't use hybrids because you will experience issues like those -- it's likely some magma version issue
yeah.
i really just wanna be able to use voice chat on an existing modpack
i dont want my community to have to manually download from somewhere else
none of them are tech savvy lmao
Have you tried https://modrinth.com/plugin/simple-voice-chat-discord-bridge
Oh wait nevermind it's fabric only
i think im just gonna make a custom modpack, itll be way easier
i feel bad because i already made the map for it and everything
Anyone have an example of the new PlayerProfile portion of the API? Its not loading textures for me.
PlayerProfile profile = Bukkit.createPlayerProfile(uuid);
PlayerTextures playerTextures = profile.getTextures();
playerTextures.setSkin(url);
//profile.setTextures(playerTextures);
//profile.update();
headMeta.setOwnerProfile(profile);
getLogger().info("DEBUG (Skin-URL) >> "+url);
you never call update on the profile
odd question, is it possible access bukkit/my plugin data from springboot if they are in separate jar files?
I've tested with it. Commented it just to show I know about it.
well you need to wait until the future finishes, obviously
Will try that. One sec
uh, if you load it?
Even just running profile = profile.update().get(); its not rendering.
what's headMeta? and what do you do with it afterwards?
🤦
Its SkullMeta I forgot to set the itemstacks meta.
NVM still not rendering.
depends on what you're trying to load, like a copy of the code? the plugin data as yaml or something? or are you trying to like communicate with the server as it's running?
I mean if I run a separate instance of spring, outside the "plugin ecosystem".
If I add my plugin as a library/dependency. Will I be able to access the plugin data if the server is running? I'm not too familiar with java VM schenanigans
yeah, basically this.
which one lol
I'm aware of the built-in solutions like mcspring, springlify, just not what I'm looking for. I want a separate spring application, outside of the server.
oh, I read the last sentence and replied to that lol
are you trying to like communicate with the server as it's running?
depends on the direction you want, I use HTTP/REST to communicate from servers -> website
if you want the other way around, RCON is probably your best bet
we use Pterodactyl Panel, so I end up using their REST API to send commands to the proxy sometimes
I also ended up using the LuckPerms REST API thingy for doing role changes and stuff, since you can just directly interact with it and get validation
oh I see, so you want to fetch data from the servers
I've been using Spark, had some problems with it so I switched to Javalin, but ideally I'd like to run the HTTP server outside the server
ah yeah I was gonna say, Javalin is probably your best bet
just runnign it on a single thread per server should be pretty light
but I guess it depends on what you're doing, if you just want getOnlinePlayers or similar, you could store the data in Redis or something and keep it up to date
