#help-development
1 messages · Page 1989 of 1
you only gave it an hour
Someone did
Yea but I replied to them
I said what's config
they haven't replied
Yea normally it's instantaneous
Then just use a Boolean
You expect people to help instantly?!
Boolean where though
Yes that's what normally happens :)
In your listener
We're not being paid to help you, we're only doing it in our spare time so don't expect instant replies
I'm not complaining
You seem to be
I'm not
Yes that's what normally happens
Just that my question was bumped up
Seems like you're complaining you didn't get a response quick enough
Oh I'm not arguing I'm stating a fact
make a getter & setter
?learnjava I feel like you need to learn Java from one of these
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Ya I think that was his goal
how do i only make an event handler happen when i do a command, and make it stop when i do another command
ah
WHAT AH
just use Bukkit.getPluginManager().registerEvents(listener, plugin) and HanderList.unRegisterAll(listener) to register and unregister a listener
i guess you're trying to stop listening for certain events when you run your command
and start it again when running the command again
otherwise your question would make sense as events are just fired and dont "stay" for a while
👀
chat ded
kekw
thats the spiwit
YEA LIKE THAT
17:06:39 [INFO] 1: [md.mirrerror.cloudbans.units.punishments.TempBanPunishment@7ef35e8a]
17:06:39 [INFO] before: [md.mirrerror.cloudbans.units.punishments.TempBanPunishment@7ef35e8a]
17:06:39 [INFO] after: []
17:06:39 [INFO] 2: [md.mirrerror.cloudbans.units.punishments.TempBanPunishment@7ef35e8a]
ProxiedPlayer proxiedPlayer = event.getPlayer();
CloudPlayer cloudPlayer = new CloudPlayer(proxiedPlayer);
String playerIp = proxiedPlayer.getAddress().getHostName();
cloudPlayer.setLastJoinDate(LocalDateTime.now());
cloudPlayer.setLastIp(playerIp);
System.out.println("1: " + cloudPlayer.getPunishments());
for (Punishment punishment : cloudPlayer.getPunishments()) {
if (punishment instanceof TemporaryPunishment) {
TemporaryPunishment temporaryPunishment = (TemporaryPunishment) punishment;
if (temporaryPunishment.getEndTime().isBefore(LocalDateTime.now())) temporaryPunishment.remove();
}
}
System.out.println("2: " + cloudPlayer.getPunishments());
System.out.println("before: " + punishments);
punishments.removeIf(entry -> entry.getId().equals(punishment.getId()));
System.out.println("after: " + punishments);
Why isn't the cloudPlayer.getPunishments() list empty in the second case?
@ancient plank
don't ping staff for server or development help
ok, sorry
you haven't sent enough code for us to tell
Help me now dinotouch
lmao, i was confused where this notification came from
what do u want me to send u?
TemporaryPunishment is an interface, so I will send u the method from another object
@Override
public void remove() {
ProxiedPlayer proxiedTarget = ProxyServer.getInstance().getPlayer(target);
if(proxiedTarget != null) {
CloudPlayer cloudPlayer = new CloudPlayer(proxiedTarget);
cloudPlayer.removePunishment(this);
} else {
OfflineCloudPlayer offlineCloudPlayer = new OfflineCloudPlayer(target);
offlineCloudPlayer.removePunishment(this);
}
}
that would be why then
you're making a new CloudPlayer in the remove
so the original CloudPlayer isn't being modified
so it doesn't know a punishment has been removed
If you really want to implement that, I would opt to accept a CloudPlayer instance to that method
@Override
public void remove(CloudPlayer player) {
player.removePunishment(this);
}```
Though that just becomes a convenience method
Eh, I guess your punishment contains a target. Yeah. You should have some sort of internal Map/cache of UUID -> CloudPlayer instances
yeah, I have it
well
ty, guys
uhh
Im using this article https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
Strings are immutable
could you elaborate
your original string won't change
iirc it just makes a new string
and colors that
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?database
should be added
okay
then.... why'd you ask?
also not
note
color codes don't get removed
it just converts it to the actual char
no
it translates alternate color codes
as the name suggests
idk how to type the char
but if you put "&" in there it converts it to another char
doesn't delete
It's the section character, §
i feel like thats only a character in the english keyboard
It's not lol
it's not on our keyboard
I had to google it and copy paste
it's alt 12
isnt that his own class?
no, it will only replace the ones before a valid color code
yeah
thanks
Hey guys, got a small mathematical question:
Let's say I draw a line with particles in the middle of a block. How would I rotate it so it's on another block but 90 degrees rotated?
the problem is with importing it
check the article I am using
ye i did and i guess he made that class on his own
i made a thread
Why can't you use &
what's HandlerList
It's how Spigot keeps track of all the listening classes iirc
replace y with x and x with 1-y,
where x and y are 0-1 (float within the bounds of a block)
or something like that
how do i use it
I mean every character is really gonna be used regularly, unless it's just not on the keyboard. You can just replace the char in translateAlternateColorCodes.
i gave you the methods so register and unregister listeners
You don't, let spigot use it.
How can I set the worldborder with 2 Location points?
Does it make a square
get the midpoint of the 2 points, use that as center, then set the size as the distance between the midpoint and 1 of the points
^
Ok so I have to calculate the distance between the 2 points then?
Center was already clear
Thanks guys, I will try it out
Heyo,
Is there a raw format for spigot timings? https://timings.spigotmc.org/?url=huqitapewo — such as a JSON/whatever?
Is it possible to enable monster spawning outside the world border?
i remembered wrong, worldborders use side length as the size, the distance is incorrect.
also, there is only 1 size value, so your resulting border will always be a square when looked at top down.
you can get the side length by subtracting the points basically.
You would have to manually spawn them
I don't like where this is going :/
World border size is a diameter, yes
Well, alternatively, you could send packets to players as the worldborder so the server doesn't know it's there lol
But the player can still see it

this is what i do in my plugin, because my borders are round and they push you.
but i was only using nms to do the pink screen tinting, the border itself was just applying velocities to players
I tried using packet borders but since minecraft packages etc is very different in 1.17+ from 1.16 I've got my problems getting support for all my plugin's supported minecraft version
I didn't even manage to get a single net.minecraft class with reflections but it worked fine with hardcoding the exact same class I failed to get with reflections (ClassNotFound)
Am I being stupid or is this method annotated with @NotNull https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/EntityEquipment.html#getItem(org.bukkit.inventory.EquipmentSlot)
declaration: package: org.bukkit.inventory, interface: EntityEquipment
https://paste.md-5.net/yonoruvomi.cs Hi! Does anybody understand what is this problem?
jdbc
It's a weird thing to annotate because getItemInMain/OffHand() are NotNull but getChestplate(), getHelmet(), etc. are nullable
There's no error there
but thats the line it says
179?
That's a warning
Hover over it, I assume that its telling you it's always true/false.
Are ok ty, isn't there like an unknown notnull annotation thing, I will see if I can find it
Just search for java mysql tutorials online ^^ This one should help you: https://www.youtube.com/watch?v=KRhv4iPgzHE
Bukkit does have @UndefinedNullability but I mean in this case the method should probably just be @Nullable
that tutorial is from 2014
Still works tho
Got you ty for the help 🙂
Just use the latest dependencies shouldn't be much changed
I dont want a "still works tho" way
I want a way that is new and reliable
Alternatively we could re-implement that method so that it returns an AIR ItemStack if the fetched value is null
Maybe better to do that tbh
there is no "new" way
its the same as ever before
I really wish Spigot EITHER returned null or an air itemstack consistently lol
not either or 
It is super inconsistent, yeah
One of the pain points of working with inventories
Issue being that changing it now would break API contracts and break some plugins
Yeah
https://docs.oracle.com/javase/tutorial/jdbc/basics/index.html
mysql isn't new so you probably aren't going to find a new way to use it.
fire has been the same for millions of years though and it's still reliable and effective
I just made a isNullOrAir check and called it a day lol
Alternatively you can search for newer tutorials if you insist on learning from a newer one
@worldly ingot ive definitely run into the issue where spigot says an item will be not null and it ends up being null lol
i even think it was for getting the item in hand
at willocore.willocore.structures.ItemBuilder.updateItemStack(ItemBuilder.java:180) ~[?:?]
did you look at the error paste?
Oh I didn't even see you sent that lol
What is the warning on 179? Probably has something to do with it
statList is just null
Also whilst Im here, anyone noticed a problem with worlds getting stuck on this message when the server is disabling, Im using 1.18.2 but I have looked every where and can't see someone else with the same problem, so I can't tell if its vanilla, a plugin, paper (Ima ask paper too) or something else (Been like this for 2 hours)
;p there's literally nothing else there that can cause an NPE
statList can't be null
^
Probably
yup
but i'm checking that
you're not checking statList.getStats() for null
If you have an account on the JIRA, we're eyeing some shutdown hangs for 1.18.2. So input would helpful if you have any, or at the very least confirming that you are experiencing it as well
https://hub.spigotmc.org/jira/browse/SPIGOT-6956
oh awesome ty
Also relevant, https://hub.spigotmc.org/jira/browse/SPIGOT-6950
Now resolved I believe but Slime says it was to do with a world generator
The former issue, however, is without a world generator as far as I'm aware
i hope my new steps actually let other people reproduce 6956.
hard to tell what's going on, but ya i don't think it's caused by world generation
Yeah I think Marvin was able to reproduce with those steps under specific conditions
Him, Doc, and md are actively looking into it. I'm not great with world stuff so that rules me out
how can i set an item to be unstackable or to have an amount limit without modifing its nbt? I want to have player heads that are not stackable (which normally isn't possible [i guess]) and to have them in a crafting recipe. However i tried adding an nbt that that has just a random number in it so that every itemstack is technically different. But that also counted towards the recipe which did no longer work.
"3: install the attached plugin on your server. (it's a minimal reproducer jar)." ?
Yeah, the attached NoSpawnChunks.jar which just triggers the possible conditions of hanging
It's no more than this https://hub.spigotmc.org/jira/secure/attachment/19607/NoSpawnChunks.java
good to hear, thankyou, wish i knew enough to help.
interesting, maybe thats why I dont see that behavior
I've not updated my local test server to Spigot 1.18.2, only testing things on CraftBukkit 1.18.2. Though no issues there either. It's happening for a small few
Is it possible to add another line in a custom name for an entity?
no, you must use armourstands
ah ok
@vague oracle is your server running on an HDD or an SSD?
Im currently setting the armorstand position to the entity's location, but it doesnt snap fast enough. Any way i can fix this?
im already calling the teleport every tick
Mention that you're using an SSD as well if you haven't already. Relevant for that issue
any ideas?
I don't think there's a way to limit that without just adding some unique NBT, but yeah... fucks with recipes
Maybe this? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html#setMaxStackSize(int)
Wouldn't work if you needed to stack other items as well though probably.
Why did that person tell me to use it
Because you still need it to be there, you just don't do anything with it except return it in the static method.
is it a placeholder
No
but then where would I use HanderList.unRegisterAll(listener)
Anywhere you want to disable that listener
But it’s not referencing your HandlerList variable
It’s a static method call against the HandlerList class
im only half understanding what he's trying to do
Idk what he's doing either lol
Wait, Orla, what are you trying to do?
in a minigame i wrote i got around this with player heads by adding a timestamp hidden with color codes to the lore. kinda janky but it was good enough
What I'm trying to make is a bedwars plugin.
When I do /start, then the Event Handler will activate, containing all the events for the game to happen, along with the initiation of the game.
When the game ends, either with a command or automatically, then I will unregister all the handlers
Then that’s it
But where do I use HanderList.unRegisterAll(listener)
Anywhere
When the game ends
^
it's in red though
that would mean you're having listeners for each game?
but wouldn't this count to the recipe?
Because the method name is wrong
It’s unregisterAll
Alex gave you the right one
Import it
hander was spelt wrong

why dont you just register the event on enable and listen for games globally?
on creation of the head i would get the timestamp (system time millis) and add it to the lore, it wasn't part of a recipe
If I was implementing this each instance of the game would be its own listener
So after it ends it would need unregistering
Orla should learn java, I think
True
I supposedly did a "Java course", turns out it wasn't so helpful
but i would use this as an ingredient. i know how to limit it to 1 but i wonder how to do that without modifing the item meta
you could make the recipes to just take whatever player head, and then set the result to air in PrepareItemCraftEvent if the heads provided don't match how you want them to
the event lets you examine the crafting grid
but the recipes are not made by my own plugin
ty for the help but i guess its impossible
It’s not impossible
PlayerInventory playerInventory = (PlayerInventory) Bukkit.createInventory(requestingPlayer, InventoryType.PLAYER, PlayerStatusMenuConfig.getGearChestMenuName());
This gets me a ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.inventory.CraftInventoryCustom cannot be cast to class org.bukkit.inventory.PlayerInventory so I guess that's not possible to cast, is there a way for me to get a PlayerInventory object out of this?
You can listen to a bunch of events to prevent the heads from stacking @midnight shore
It’s just gonna be a pain for you
No, because it’s not creating a PlayerInventory object, which is why you can’t do the cast
You can’t cast it to a player inventory when it isn’t one
is inventorytype player not a PlayerINventory?
Nope
oh
That’s why the cast doesn’t work
You would want to use a chest
I was trying to avoid using a chest tbh
Why
You can’t show a player two player inventory pages anyway
the client is dumb, minecraft 2 when
You’d have to basically trick the client into thinking their inventory was whatever the display inventory was
Which you can do
oh I'm so sorry
What did I walk into
What is getKey()
sorry
the key to the universe
You need e.getBlock().getType().getKey().getKey()
oh ok
Ahh I see
The first getKey() returns a NamespacedKey, the second returns a String
Well there’s an easier way to check if it’s a bed
instanceof
if you really want to use the player's inventory you could store all of the player's inventory somewhere, then clear it, and add some transactional logic to update an internal collection of itemstacks when they close the inventory, but i don't think it's possible to tell the client to open the player's inventory screen either so this probably isn't a helpful message...
You can probably check instanceof, or does checking the material not work?
yea but different colours
That’s a very good point
i keep fogetting to use that
BlockState
^
Thank you
oh i just did e.getBlock
Yea just slap on the getData()
Same thing
Idk why I put get twice
having to make one book menu for java edition users and one mirrored menu for bedrock edition users is making me want to jump off a cliff twice as tall as usual
I’m using block tk refer to a random block what you put was fine
L
so i don't need getBlockData?
Nvm I thought you meant something else
yes or no
Yes you need the block data
lmao i just tried to do this
Bukkit.broadcastMessage(`${team} just got `)
from javascript lol
Holy shot
oh shoot im so dumb
uhm
did i got an answer for my request lmao
anyway i cant find my request
i need to save data when server stop
save it on onDisable?
wdym?
i mean i made a method for sethome
but 7something7 said i dont need to do that
i dont know im so confused
7something7
lmao best joke i heard today
Hi everyone,
is anyone willing to help me with my plugin (in private)?
I tried to post it in the premium section but it was rejected for "coding mistakes" and I can't figure out the errors.
or just here so other people can say things too?
smile XD
well then show the errors i guess
?paste
paste it there
The plugin does not have any error, it was just rejected for "coding mistakes".
means your doing something wrong with how you work with your code
any more information? i guess not
This is the message:
"Unfortunately, your recent report has been rejected: Resource Update in 'Keycard and Keypad Plugin [PREMIUM]' - Resource with beginner coding mistakes. Improve the quality of your code design (by properly and efficiently using OOP/Bukkit/Java API and using efficient data storage and retrieval) if you want to release it as a premium resource!"
um, I'd rather not.
How can I check if a sign is placed on a chest?
don't think you can be helped if you don't show the code to anyone
well then how can we help you?
In private I can send the code.
How much qt have you done, or just I'm done coding and submitted it?
Sorry I'm not familiar with English, what do you mean by qt?
Quality testing
I did a lot of tests and the "basic" plugin was downloaded 2870 times
All bug fix requests sent to me have been resolved
looks serious when they say youre not using OOP properly
I can send the "lite" plugin, in which I think the errors are present.
you can
Can I send the link of the plugin?
does it has the source code on github or something?
otherwise the link would be useful
Um no, I only have the link for spigot.
lol luyten slow
well the first thing i see is that you're exposing static collections
is there a way to play custom sounds by forcing a recoursepack
i see why they didnt allow it
I made this plugin a few years ago, but I thought it was fine anyway.
If the problem is big I can do it again.
A little
don't blind cast
And this is my code:
try{
WallSign sign = (WallSign) e.getBlock();
Location chestloc = new Location(p.getWorld(), sign.getFacing().getOppositeFace().getModX(), sign.getFacing().getOppositeFace().getModY(), sign.getFacing().getOppositeFace().getModZ());
if(chestloc.getBlock().getType() == Material.CHEST) {
if(line1.equalsIgnoreCase("[Shop]")) {
try {
Integer.parseInt(line2);
Integer level = Integer.parseInt(line2);
e.setLine(0, "§e-----[§6Shop§e]-----");
e.setLine(1, line2 + "$");
e.setLine(2, p.getDisplayName());
e.setLine(3, "§e---------------");
} catch (NumberFormatException error) {
p.sendMessage("§eOn the second line you have to write the price, so just a number!");
e.setLine(0, "§c§l[ERROR]");
}
} else return;
} else {
e.setLine(0, "§c§l[ERROR]");
e.setLine(1, "§0Shop signs can");
e.setLine(2, "§0only get placed");
e.setLine(3, "§0on chests");
}
} catch (NullPointerException error) {
return;
}
}
It says something about nms
but I didn't even import any nms into that class
WallSign sign = (WallSign) e.getBlock(); is a blind cast. You never check to see if the block IS a wall sign
How can I do that?
because WallSign is not a material
and I don't want to do it for all the sign materials
How hard is it to make a custom attribute modifier
how do i make something happen every 1 second
?scheduling
thank
has anyone ever used the proguard maven plugin?
i'm facing an issue with a module of a project that i use, the dependency that that module has isn't being seen and it results in this issue
So you recommend that I redo it directly? Eventually what do you think are the biggest mistakes present?
how do i get world in a command
As an argument or from the sender
singletons, exposing variables and working on collections directly, not delegating responsability to the proper class are the things that i would say when looking at it from the moment
Thank you very much for your time, just one last thing, what do you mean by "exposing variables" and "not delegating responsability to the proper class"?
I really suck at English...
like this, making your collections public and working on them directly
instead of having like a KeypadManager with methods to modify the collection
try to make things clean and choose where you put your methods
Hello, is there a way to modify default minecraft command's tab completions? I tried TabCompleteEvent, but it only catches commands that are registered by a plugin
implement TabCompleter and do Command#setTabCompleter
then override onTabComplete
i can show an example
you basically have to return a List<String> based on the args and the length of thr args
lol i push to github and intellij is broken
I'm a little confused here. I'm talking about minecraft default commands (like /ban, /tp etc), not that are made by plugin. I just want to override existing tab-completions
great
and do you think the saving system is ok?
Someone good with vectors and maths and could maybe help me?
ah default commands, not sure if you can set a tabcompleter for that, i would listen for the TabCompletEvent
hello?
Bukkit.getWorld(args)
When I disable commands in the bungee config, they are still tab completed. Any way to fix this?
I tried that already, I might try looking at the packets I guess
why
what are my args
the argument that the user specifies in a command
like args[0] or something
if your command is /command <world>
hm
no
lol it duplicated config files
like no args
depends
use libs for command if you dont know how to 😄
How can I check if a Block is a Wallsign placed on a chest?
nah
So wait, is tab-completion for default minecraft commands handled client-side or something? Because not even protocollib packet listener could catch it, it works for plugin commands tho
basic java ik but im dumb,
how do i replace the first slash in a string cus if i try i get this
alright
making a loop command took me way longer than it should
which event would i use for checking if player had the damage taken by Void? its a 1.8.8 (ik its old its just for someone requesting it and buying it from me)
EntityDamageEvent
but there isnt damagecause
how to get who did the damage in EntityDamageByEntityEvent
getDamager
ok thanks
Hello, is there any way to get a list of blocks that have no hitbox like fire lava and water or check if a block does not have hitbox?
Would this work?
@EventHandler
public void arrowHit (EntityDamageByEntityEvent e) {
Entity damager = e.getDamager();
if(damager.getType() == EntityType.PLAYER) {
Player p = damager.getServer().getPlayer(damager.getUniqueId());
}
}```
You can just cast damager to player
k
and check if it's null?
@EventHandler
public void arrowHit (EntityDamageByEntityEvent e) {
Entity damager = (Player) e.getDamager();
if(damager != null) {
Player p = damager.getServer().getPlayer(damager.getUniqueId());
ItemStack item = p.getInventory().getItemInMainHand();
}
}```
is this good now @young knoll
This is close
Just replace the getPlayer part with a cast
ok
use instanceof
Heyo, what is the alternative for ItemMeta#setLore (Deprecated)? The Javadocs are not up to date yet 😐
which version?
1.18.1
This is good?
@EventHandler
public void arrowHit (EntityDamageByEntityEvent e) {
Entity damager = e.getDamager();
if(damager instanceof Player) {
Player p = (Player) e.getEntity();
ItemStack item = p.getInventory().getItemInMainHand();
ItemMeta im = item.getItemMeta();
if(im.getDisplayName().contains("Levitation Bow")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 5, 1));
}
}
}```
@tardy delta @young knoll
?
instanceof
Looks reasonable
i dont think you know what youre doing
Entity damager = e.getDamager();
if(damager instanceof Player) {
Player p = (Player) e.getEntity();
what
i did what coll dude said
checking if damager instanceof Player and then blind casting the entity?
instead of the damager
i did what coll said
coll 
what do i have to change
that's his name?
lol
ok
lmao
so i cast now?
better?
if(e.getDamager() instanceof Player) {
Player damager = (Player) e.getDamager();```
ye
personally I prefer to do this
if(!(e.getDamager() instanceof Player) ){ return; } Player damager = (Player) e.getDamager();
ok
if (event.getDamager() instanceof Player damager)```
kekw
yes you kan do that to
you mean java 16+ way
if i do this, i don't have to cast right
oh wait i'm java 8
yea thats java 16, not 8
move to something newer
why not.
Does 1.8 run on 16?
nope
it does
this good?
@EventHandler
public void arrowHit (EntityDamageByEntityEvent e) {
if (e.getDamager() instanceof Player damager) {
if (e.getEntity() instanceof Player p) {
ItemStack item = p.getInventory().getItemInMainHand();
ItemMeta im = item.getItemMeta();
if (im.getDisplayName().contains("Levitation Bow")) {
p.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 5, 1));
}
}
}
}```
Your gonna need to check if the item has an itemmeta before accessing it
i mean, i would not use the display name to check for your unique item.
Use PDC Instead ^
im in 16 now
i'm in 1.18
then use nbt
so what are you suggesting i do now?
Another good way of identifying custom items is using localized names
aaaa so many people
Nah
Which can’t be affected by the player
what's the final answer
well ur using 1.18 so use pdc to check for your custom item
ok
Does anyone know how I can get the Location 5 blocks in the line of sight of a player?
why does the displayName not work
for example yes
You disabled anvils?
player#getTargetBlock ?
anyways gtg
and if there is air?
remember to check if itemmeta exists before using it btw
then it will return that air block iirc
You'll have to find out what happens
That's an api abuse; we all know that it should not be used like that
Since PDC exists, what's the point?
i was gonna say that
How would you do it without PDC ?
With a 1.8 version for example
how is it api abuse
It doesnt look like any abuse
a custom item has a custom localized name
😊
it just makes sense to me
NBT API
Or just NMS
Oh I see
or any library
Ty
Why
Then don't use 1.8
You should never use nms for something that exists in the api
Doesn't exist in the 1.8 api
localized name does not?
take L 1.8 users
Not sure actually
ok it doesnt
ugh 1.8
imagine blaming devs for doing what their owners want
Well, sure it can have, same with display name and lore. However, all of those can be easily changed by other plugins and never were intended to be used as data storage
Imagine working for owners who still on 1.8
you're setting the internal name for a custom item
imagine being a developer whos fine with an owner with 1.8
it looks normal to me
That's not what we're talking about ...
If you wanna check if an Item is one of your custom items, without PDC, we can use a NBT API
It is not internal name, just a localized one
Why would you even use another library for that
still
nbt api is a crap
sorry the code is awful
their fault
still wasnt meant to be used as storage.. But why tf if you have such a powerful API such as PDC?
Wait, what's a localized name for you ?
To me, it's the method for items to get the name of the item, without taking account the display name
I actually have no idea what it does tbh
Wdym storage
you're gonna store the item name
its meant to be the item name
and its essentially that?
Well it looks like getLocalizedName is just a method existing only because dumb spigot doesnt supports Components in item names
eitherway
imo that's definitely not api abuse
as long as ur not storing some random shit that isnt related to the item name
its just a convenient way to check if an item is yours, without the risk of using display name which can be modified by players
You can store the Item name here, but you definetly shouldnt use it as identity
its not editable by players, so why not
AyUniz stop reacting messages with 😂
Why not ?
localized : assign (something) to a particular place.
idk just feels weird
we refer to objects with names, so why not do that for items
if u think about it, its sort of an internal name, internal as it cant be modified by players, so storing the custom item's name there, and checking for it to identify it, would make complete sense to me
because localized name.. is a f**king Localized Name, not an identifier?
like,
Red Glass
or minecraft:red_glass
But it doesn't identify the item as a custom item
I dont get what you're talking about
Objects doesnt have names, fields and variables do. But as you can see field names are short and informative without spaces
objects in real life i meant
its a human readable, uneditable by players name
names identify an object or a person
for example if you had a forge custom item
and it was a clone of the apple item, but with some extra stuff to it.
Programming is different
@grim ice Here is the main problem.
Imagine you create a custom item as Heal Stick (that's an example, nothing more)
How can you use localized names to see if a stick is your heal stick ?
Yes
setLocalizedName, getLocalizedName
There's a reason why mojang use id's instead of just checking the display name of itme
it isnt a display name
the whole point is that its not one, and it cant be edited by the player
Mojang doesn't check for localized name either. They use proper ids
Ah, I didn't know we could set a custom localized name.
I though it was the base ID of an item (like minecraft:stick)
My bad, thank you
this is exactly why it exists
that doesn't change anything
just because they dont use it
it doesnt mean that we cannot use it
and it makes perfect sense to use it
No it doesnt
and what is an example of "proper ids"
Namespaced Keys, integers, UUIDs?
How many general programmers want to reference an ID chart every time they program something with or for an ID?
integers?
Yes, widely used in databases
and you talk about identifiying
yes i do
that doesnt identify the item
It can
gets the item info from registry
tells me that
the item is a green apple
its just simple and human readable
iwjefiuwhefouwaebhfunawefuabwefuoawnefp
wat
im not writing a uuid btw im lazy
what item is that?
namespacedkeys make sense
a uuid also makes sense i guess but its not human readable
and it doesnt identify it outside of the code
Takes unnecessary space. An idnetifier should be short and point to the actual info, not representing them
for uuids and integers i just get info i need from a registry, rather than storing it as key directly
and it can be as long as the actual identifier ive talked about
It does give a pointer, still
for example if u had 1000 items
an item name can be that amount of digits
and it identifies an item
even outside of code
which makes it way more convenient
than having to memorize a number for items
what is more convenient?
Memorizing DIRT for dirt OR
2 for DIRT
2 is simple so you can memorize that
but as the number grows, it gets complicated
what are we talking about? 👀
read up the conversation
value of using setLocalizedName, getLocalizedName
Just use PDC and short descriptive identifiers rather than full names
I'm not going to argue anymore it seems pointless
the longer your code length gets, the more valid it's use is in preventing errors
it's a better way. but for legacy versions (Which you cant stop people from using, get over it) it doesnt exist, and using another library for that is dumb
and i would use localizednames even in 1.99
as long as there isnt another simple human readable, uneditable by players, almost invisible to users way
why does almost every platform in the internet use a username
since it identifies yo
they couldve just used the ids
pdc
like in discord
oftenly ids are used but hidden
e.g
Hello! How's your day 518325046528442369?
Hello! How's your day Domino?
Numbers are just faster than strings
I know that
Separate Display Names and Identifiers
but for items it's a separate case, you can replace the "518325046528442369" with a "DOMINO"
using gApple, rApple, yApple etc within something like an apple orchard code is reasonable, sure you could use the 2 +1 id but how easy would it be to find the reason for the wrong color apples growing under a certain condition?
but people can have the same names in discord
so that would not work out
and a string will 100% do the identifying job better than integers
Well, and store it in pdc. Localized name is not an identifier
no
How about legacy versions?
Heck em
dont bring the "omg legacy stop support" argument please
No
maintain your own fork or something
I'm not using nms for that, that's even worse
that's your problem forcing you to use workarounds
What problem do you have with localizednames
it makes perfect sense to use them, regardless of the version
no
the guy supports russia I'd stop arguing
You're breaking method contract at least
I do not care what country he supports
Fuck off; this is not anyhow related to the discussion
My point is that you can't win his argument
he's not willing to accept your opinion
if you write something to support both java and bedrock, localized names make things much simpler
Not really
what's the best way to store per-player-data, while wishing for the ability to access all of it would the need arise?
pdc
A relational database
(yes i know PCD is a thing but i really dont think it would be a good idea to iterate over every player that ever visited the server)
or that
You didnt give enough information in your question
you did not mention iterating
SQL priobably
NoSQL would work too? or not?
Yeah
tf is NoSQL
Something queryable though
garbage
e.g mongodb
Like Mongo
mongo uses documents
how much and wht type of per player data?
you would want to learn that
yeah
for example 4mb of data
u cant store data with pdc
a bunch of values, and one inventory
reason im sceptical about pcd is if i want to check against offline players specifically
a database possibly
or to check over all players
ofc i could just stuff everyting in a datastream and serialize that
You can use config files, as a second option if the server doesnt own a database
which im not sure if you want to do that
as for large networks, it would get very messy
but if its a large network, they would have a db
do you already use an anti-griefing plugin/database?
so they can turn the option to use a db on
no but i have db access
its a mysql one
still
the reason i ask is because of that 'check all players' thing
your answers are a bit confusing, why do you need to check offline player inventory?
Yeah you generally want a DB if you are going to be checking all players
just trying to sort out if you are better hooking into coreportect/prism rather than rewriting the wheel
say what now?
both those store all player data in a database that you can access
wouldnt that make a plugin dependent on the presence of those plugins?
iirc the database coreprotect generates is about the same size as the world
yes it would, but you also would not have to collect and maintain the collection
sounds like it'd be a good idea to just stuff a few options in the config file for which plugin or database to use if any
it comes down to "why do you need to check offline player inventory"
I asked about type and how much player data
If you are intending to undo an action or remove inventory items, then using one of those two others would be advisable
ah that makes sense
some of the things i plan on doing would benefit from having a stack/history to pop
wat an wat now?
DataOutputStream wrapped with DeflaterOutputStream
DataInputStream wrapped with InflaterInputStream
or reverse
idk
thats for storage efficient storage
Hey, I want to make a class that will be handling configuration files (messages and per player config (playerdata)). I can't seem to find an example on how to do that and the current implementation that I'm using is throwing a NPE. Can someone provide me with some examples please?
and its fast
multiple configs?
Yes, I need one for my messages file and per player config.
this
alternatively if its not data that's need to know for anything but the plugin look into PDC
you can have really small files with alot of data
because its the same thing over and over again
I'd recon that makes the compression a lot more efficient
I'm sorry, was that answer for me?
Hello, how can I make it so that when a player places a block, they have to wait 10 seconds for it to break?
placeBlockEvent and timer
ok grax
and also breakBlockEvent
if you are going to have a ton of blocks like that you may want to think about putting timestamps on the blocks via metadata instead of using timers
why not do Bukkit.getScheduler.runTaskLater
Because it will consume lot of resources == tps down
wait seriously?
ya that's another option, but players can place blocks fast and metadata would probably be better than flooding the scheduler with tasks
+1
if thats a rickroll I stg
Timestamp its a number (type: Long) that you assign and compare
yep, usually a long
how do you actually know which blocks to check tho
because the player tried to break it
well then you know which block to add the timestamp on
but i aint checking the entire world each tick if the block should break
i am using a sceduler there
just check if it has the metadatavalue on block break
if yes, is timestamp older than 10 seconds from now?
if yes then allow the break and remove the metadata
doesnt metadata get erased anyways when a block turns into an item?
no, it stays at that xyz until the server shuts down
and pistons moving blocks will not move the metadata
because it's location based (afaik)
no i don't think so
why be choosy about the block to break, your players would probably be less confused by a general cooldown than a specific block?
sees a player miss-placing a block on a build and destroying all the blocks around the wrong one ... and then complaining about it
What is a good name to give to a plugin that allows for completely customizable items with different effects, of all kinds?
ItemEditor? CustomizableItems?
anothercustomitemsplugin
ACIP
It is more of a core plugin to provide options for others to hook into
An api of an api? Hmn
going the TooManyItems, JustEnoughItems, etc option huh?
Yet Another Custom Items Plugin
YACIP
but no, forreal
...
sort of guessing you might need to go backwards if you want anything containing "custom items"
how about ChallengerCI ?
oh god no I hate such names with "Pro", "Elite", "Boss", "Ultimate"
looks at your username
I CANT CHANGE IT OKAY
its konstanius ingame
this one is so old
ok u know what
Which netty module should i use as dependency?
It seems i cannot find the api module
should i learn python mainly for ML?
or is it possible to do ML in java
For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.
Ask for support
where ;-;
?support
....
Or just tag a staff and explain your problem
Do I dare?
And dont get mad lmaoo. Im just trying to help you
nono its all okay, thank you ^^ I just dont like emails
Oh ok my bad
Just go to #general and tag a staff. And they wont ban you if you explain what happening
where did the 'e' come from? why aren't they called imails?
uwu are you mail or femail
electronic apple didnt make the i[phone by then
I'm gmail
electronic
it wasnt originally the internet
the internet wasnt really a popular term back then
the internet didnt* exists let say, it just where peer-peer connection
If im not wrong
lmao 10/10 my english "wasnt exists"
lol
trying to help MS create more "correct" spellings
How to translate both normal color codes and hex color codes from a string to colors in chat?
some university/tech school does
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
sir
Sir?
pretty sure none of these
has any topic related to ml except maybe oracle
and i doubt it
im not a uni student
Lol?
are you asking about the language or machine learning?
machine learning
You are like me that doesnt study?
my irl life has nothing to do with coding atm
Wha tthe heck?
