#help-development
1 messages · Page 808 of 1
i.e.
that'll never get accepted we want to try to avoid a general packet API
forget it
I want to modulate this when I import uuid from every plugin
why
paper has a one liner to add your handler to the netty pipeline when a channel is initialized
public interface Packet {
String getName();
int getId();
<T> T getNMSPacket();
}
spigot wouldn't do it maybe others
whole point of an injector is to inject into a section where the player handler is ready
to add your handler
MD has said that such a general packet API isn't fit for the API itself
iirc its in the readme of either CB or B
It wouldn't be a general packet API, you'd still need NMS
@rough drift unnecessary
it would be difficult to maintain yeah
just what paper does as i described would be enough
i mean the truth is that u cant do everything with api
0-maintenance change tho
k
true, which is why when it comes to packets we wrap the packets which is why there are sendX methods
I love hangar /s
spigot doesnt add stuff for nms related stuff because its nms, if there something missing from the api make a jira ticket for a feature request and someone might do it
Spigot cant just provide packet manipulation api tho.
they shouldnt
can you tell me the code in paper?
we ain't talking about your problem
you'll probably have to fork bukkit and craftbukkit at worst
i can
UUID is pretty deeply rooted
he wants to spoof UUIDs for some reason
My suggestion is just to add a listener which makes it much easier to use handlers, but provides no actual packet data other than class name / packet id, it wouldn't be a packet API imho
like uproot the entire UUID system for players
just use protocollib or packetevents
switch to a server side mod and use mixins or fork the server
you can just change the return value from the auth API or change it when sending to players
ty
@alpine urchin where is this Paper API thingy
https://github.com/ViaVersion/ViaVersion/blob/master/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/PaperViaInjector.java they use reflection cause they wanna support spigot too i think
ah I see
hi i need help
private Villager survivalNPC;
@Override
public void onEnable() {
instance = this;
getServer().getPluginManager().registerEvents(new joinEvent(), this);
getServer().getPluginManager().registerEvents(new npcClick(), this);
getServer().getPluginManager().registerEvents(new compassClick(), this);
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
getServer().getPluginManager().registerEvents(new spawnProt(), this);
Location survivalnpclocation = new Location(Bukkit.getWorld("spawn"), 17.466, 5, 8.646);
if (survivalNPC == null || survivalNPC.isDead()) {
survivalNPC = (Villager) Objects.requireNonNull(Bukkit.getWorld("spawn")).spawnEntity(survivalnpclocation, EntityType.VILLAGER);
survivalNPC.setAI(false);
survivalNPC.setCollidable(false);
survivalNPC.setCustomName(ChatColor.GREEN + "Survival");
survivalNPC.setCustomNameVisible(true);
survivalNPC.setRotation(survivalNPC.getLocation().getYaw() + 90, 0);
}
else{
return;
}
}```
after restarting the server, even though the npc is already spawned, it spawns a new one
yeah ofc it will
You need to check if it already exsists
oh and use the spawn method that takes a consumer
I checked
no you dont
If survivalNPC == null
So how can I fix it?
by restarting that value becomes null so its going to spawn again, you need to save something relating to it eg a uuid and a location to check before you spawn it
What?
you need to save the villagers uuid
then check to see if the entity with that uuid exists at the location before spawning it
how?
to start with use to start use your config.yml
Ok
then change it to be a custom file once you know how to use the api
declaration: package: org.bukkit, class: Bukkit
you will also need to check the chunk its in is loaded
It will work without it?
if the chunk isnt loaded nope
your question makes no sense
So I need to check if the chunk is loaded?
yes, if its not loaded you have to load it
I've got a full-time job, the skyblock core is a passion project
I accept donations and work on it when I feel like it
I also accept donations btw
Last thing I was working on was uh
itemstack system
Then I was going to do a menu system
I also want to do a library loader
Because I have like 10 different libs I partially depend on
And I don't want to shade 40mb worth of libs
like abstraction across different server jars?
Yep
yk what, I just did smth like that
Not sure if that is the same thing
where AbstractionFrameworkItemStack just has delgated methods from itemstack
AHHHHHHHH
Totally
private val boneMealItemStack by lazy {
@Suppress("DEPRECATION")
when (ReflectionSupplier.getLegacy().new) {
true -> ReflectionSupplier
.CRAFT_ITEM_STACK_METHOD_ACCESS
.invoke(
null,
ReflectionSupplier.CRAFT_ITEM_STACK_AS_NMS_COPY,
ItemStack(Material.BONE_MEAL)
)
else -> ReflectionSupplier
.CRAFT_ITEM_STACK_METHOD_ACCESS
.invoke(
null,
ReflectionSupplier.CRAFT_ITEM_STACK_AS_NMS_COPY,
ItemStack(Material.getMaterial("INK_SACK")!!, 1, 15)
)
}
}
Bro what 💀
😭
what the hedge
How can I made a plugin compatible with version 1.8 to latest
Do I need to toString this or is the variable already the normal username?
write an adapter for every spigot version
and write abstraction furthermore
thats only if you are using NMS
because
Look at
?jd-s
I think Bukkit.getOnlinePlayers() returned different types from 1.8 to 1.12
true
ah its getNam
e
Also is the getFirstPlayed and lastPlayed reliable or should I save their data when they join/leave instead?
It is reliable somewhat if they have played
is there any good api for nicknames?
What do you expect to send and what to receive?
as long as their player.dat file is intact, it's reliable
What kind of statistics are they talking about?
the statistics in the escape menu
Oh cool I thought those were only clientside
echo shard
in the Material class it's called the same?
and you know any good nickname APIs?
or do I just change the String name in GameProfile?
cant say i know of any nickname apis, so probably custom
How do I get a player from a "String" that has never joined the server before, therefore I want to run whitelist true on the player
subscribe is a blocking method and should be ran in another (Daemon) thread
Should I use offline player?
Sure
so async?
You can, though I think usernames on offline player's are deprecated
it just becomes null with offline player
you can use Mojang's api to resolve a person from their username to their UUID
Spigot will already do that for you
But if you already have their username, cant you whitelist them wihtout needing the player object?
Just get the offline player
I just get null though :/
Cannot invoke "org.bukkit.OfflinePlayer.setWhitelisted(boolean)" because "target" is null
I think I found the error
hi , uhh is this wrong?
its not getting executed
its not working in the JedisPupSub , how i can fix it?
Should I use "Bukkit.getOfflinePlayer" instead?
if you want to whitelist offline players too sure, but that will query mojang servers if theplayer hasnt joined before
spooky!
hi miles
miles when kilometer shows up
bruh
hello! i'm trying to create a plugin that uses javalin as an api. on local machine it works fine but on pterodactyl (docker) it says sh class org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory can not implement org.eclipse.jetty.websocket.api.WebSocketPolicy, because it is not an interface (org.eclipse.jetty.websocket.api.WebSocketPolicy is in unnamed module of loader cpw.mod
why in the world do you have something from cpw running on a bukkit server - whatever.
At it happens to be - yesterday I coincidentally read something that may be related to your issue; Perhaps following https://javalin.io/tutorials/javalin-and-minecraft-servers may work?
Although imo this is an noticeably strange hack, though I guess this is related to service lookup stuff
yes i already followed that as without it the plug-in will not work at all. as i said the problem is related to docker (and its network manager i guess) as on local machine the plugins works perfectly
What you have here seems more like something else using a different version of jetty already and the classloader seems to prefer that
The only hack that comes to mind is to start your javalin instance in an isolated classloader instance, but that is a lot of trouble
I'd ask the pterodactyl people for guidance, they probably will know why and how your server uses jetty and how to best work around this issue
the thing is that i’m not using javalin bundle and jetty isn’t in build.gradle
jetty is a dependency of javalin
yes makes a lot of sense
You could try shading it and relocating, that may work - however for such a complicated project that may cause issues. But that is the option that was so obvious I almost forgot it
so you mean the current “stable version”
Likely by configuring the logger accordingly?
the only really mainted version is latest so pretty much just newest mc version, the latest rev is updated after a few weeks or months when its stable
You cannot call that maintained at all
they arent maintained, they get like very critical security updates
if you just want the versions theres a jenkins url to format
Uh great question - you probably need to register your own config to Log4J, but how to do it via code at runtime? - no clue
man it really goes down hill after 1.8.4
you wouldn't get it though
You're right I don't
Hi!
That's the only real list
Like maven? 🙂
Maven would be something "similar" to a rest api and is capable of listing every accessible api version.
Is it possible for me to modify a ban reason without having to unban and reban the player?
I have some modules
COMMON, API, VELOCITY, SPIGOT
Common contains all of my configs
I changed something in it
but when e.g. the velocity gets shaded, it doesn't change
but the individual common jar does change
any ideas why?
The method doesnt return anything so you cant store it in a variable.
just reuse the reason variable
what are you trying to do/expecting from this code
/changebanreason command
do you want the old reason or smth?
you already have the reason in the reason variable so just reuse that
no I want to change the ban reason to the reason which is variable "reason" which is a String
yes but its saying it requires a void not a string
or am i missing something
Could be anything. clean before compiling
so String banReason = setReason() wont work
will try
thx
yes
I just copy pasted the code from another command and didnt realise
thanks
it worked
Btw, if something is underlined in yellow, then you should probably fix it.
Its mostly depracted stuff
is that bad?
Deprecated means that there is a better alternative. (Aside from Bukkit.getPlayer(String) i think)
Ok thanks, I'll try to find the better alternatives
I heard that you can change the sound of breaking a block through packages, but I don’t understand which package is responsible for sending the sound of breaking to protocolLib
i was try find like "SOUND", "BREAK" but not find
inventory open
InventoryOpenEvent
inventory.getLocation
oh
this not exists in 1.8?
Well, maybe then get the chest block that the player is looking at?
when open it
idk obaut it but the code will work immediately after opening
I don't see any other options but in any case, you can get the nearest chests from where the player is looking if the ping does not turn the player too much
and check opened inventory name with chests inventory name
just get chest from radius regarding location were player stand or look
how i can adjust?
what?
duplicte
i want know if i do "updateScore(4, "Tesxt 1") " and "updateScore(4, "Tesxt 2")" do it
.
ee simple
for (String entry : scoreboard.getEntries()) {
scoreboard.resetScores(entry);
}
mmm
to clear whole scoreboard
i try
scoreboard it's so a hassle
i think no
I don't agree with this
too many methods to simply animate texts or make it beautiful
this is how to constantly write data from the config to a class
scoreboard is simple
not difficult but tedious
?paste
yeah cuz most people use it for things it wasnt designed to do
which is fine but just a bit of a pain
https://paste.md-5.net/enoluwukud.xml
I don't know why, but everything is being shaded but my actual code, it's not in the jar file.
Don't use system path dependencies
it's just for testing purposes, because i don't even know if it'll work just yet, and I don't want to keep adding versions.
even when I do it from a repository it still cant "find the class" IntelliJ knows it's there
System path dependencies aren't shaded
Just do it the proper way and install it to your local maven repo
the heck
minecraft is doing drugs
you know I am not having a good time when I have 3 different intellij projects open to fix 1 bug
delightful
Is this normal?
Yeah
dealing with plain objects is probably not going to be ergonomic on either side of the interface
tf is ergonomic
bad posture
then how do I generalize that I want an object in here
since im gonna have different object for each stored data
this is so weird
the hit box gets represented correctly from a visual standpoint but it seems to be 2x beyond what it shold be
ideally you'd genericize the interface, but that won't work if you want to pass in different types
well ok mojang
then you can add a generic on the interface and use it instead of Object
I guess hitboxes expect to be halved
no idea what that is
okay but
my classes wont have the same amount of parameters
hm?
uh wait
do I just do it like that?
and like
T would stand for what kind of object it is?
okay okay
so generics are used for generalizing things based on parameters that you provide?
yea
your implementation of that interface will implement DataManagementInterface<PlayerStatsDAO> for example and you can reference it as such
you'd have to cast it to get the desired type
yea
okay that is very useful
the generic ends up doing the same thing under the hood, but it is nicer with it
my cooldown isnt working and idk why
i have this bug since thursday
and i have made everything
originally CooldownLoader was accessed with a @Getter and @Setter
i made it static
so its more simple to understand
now, cooldown loader is: https://paste.md-5.net/weroyoxiqa.cs
and CooldownManager is: https://paste.md-5.net/ibihowidix.cpp
and where im using it is: https://paste.md-5.net/ramiqixizu.pl
i dont know what else to do
intellij only knows how to blaze it up
wow
Do you get the ability to change your nickname if you donate?
?donor
Hold up
L imagine
You're a booster, not a donor. :p
thats what i asked
.
How tf is your name different then?
I'm a l33t h4x0r with connections to the spigot deepstate
I want in. :3
You shouldn't be creating multiple instances of a manager class. You're probably pulling data that doesn't exist. Why do you have two classes that basically function the same? You should be able to simplify this and just use your CooldownManager class for what you need.
so
lemme explain
CooldownManager represents 1 cooldown right?
<UUID, Duration> i think
and CooldownLoader
is
<Kit, CooldownManager>
each kit has a cooldown manager
oh fuck now i know what it is
UUID doesnt exist on map cause i never enter it
no i didnt say anything
and yeah
cooldown loader just enters values in Cooldown for each Kit
how should i implement it in your opinion?
cause in my mind it works
hello im trying to add a lore in my item ItemMeta meta = this.skull.getItemMeta();
int amount = 1;
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
this.meta.setDisplayName("§6Golden Heads");
lore = meta.getLore();
System.out.println(lore);
lore.add(args[0]);
meta.setLore(lore);
send full code in class:
?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.
?paste
The way you are describing your "Manager" class is what was confusing me. I'd rename it to just Cooldown as it's not exactly managing much of anything since you have delegated that to your CooldownLoader class.
okay
but i get error it ask me to initialize i don't understand
but i still doesnt know how to solve the error
damn, thats straight java
?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.
im new friend
you can't tell me quick fix friend :-:
Yea. The way I handle cooldowns is to just have a cooldown class that holds the bare minimum information. Usually just UUID and 2 long variables for start and end. Then my manager class holds everything related to what I need to keep track of.
Your case may be a bit different from mine since you have multiple cases of cooldowns that seem to happen simultaneously.
if you don't know what initializing means then you haven't even started learning programming
Give a man a fish and he will eat today. Teach him to fish and he will eat for the rest of his life.
i understand
i was thinking on using millis and stuff but i really didnt understand
i did it with Instant and Duration with a forum on spigot
it does work the CooldownManager class
but in this time, where i need not specific cases, since kits can be created by the user
its difficult to implement
Is it just a cooldown for receiving each kit? Where each kit has its own cooldown?
yes
exactly that
I think I tried messing around with a system like that before. Wasn't the cleanest implementation, but it did work.
It was basically a Map<UUID, Set<Cooldown>> where Cooldown had a string attached to it so the player could have multiple cooldowns tied to them for different actions. Could probably be applied in your case since there are multiple unique cooldowns.
but how would i identify Cooldown?
by the kit?
like i add a Cooldown Member
private Kit kit;
thats set on the Constructor?
Pretty much. In my case, the string was the piece that would tie everything together. Your kit name, or even the Kit object itself could be used to identify which kit the player recieved.
String is more generic though. If you use the Kit object, it'll reduce the flexibility of your cooldown system a little bit, but that's your call.
https://github.com/MagmaGuy/EliteMobs/tree/master/src/main/java/com/magmaguy/elitemobs/quests/playercooldowns this is how I did my persistent cooldowns if you want to take a look
i thought on doing a class
specially
for kits cooldowns
like KitCooldown or smth like that
"persistent" means something?
never searched abt it
persists through restarts and reloads
oh okay
That's another way to approach it. Probably better to do that as you could turn that into a robust system.
k
thanks both of you
MC hitboxes are so janky man
honestly it's tempting to just make my own
guess I might do that later
is it normal that i cant cast a noteblock's blockdata to NoteBlock
are you casting it to the right noteblock
if (block.getType() == Material.NOTE_BLOCK) {
NoteBlock noteBlock = (NoteBlock) block.getBlockData().clone(); // wadafuc
}```
check if it's the expected import
uh
well
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.type.NoteBlock (org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData and org.bukkit.block.data.type.NoteBlock are in unnamed module of loader java.net.URLClassLoader @5c29bfd)```
Wouldn't it be BlockState?
powerable extends blockdata
but not craftblockdata maybe?
why is that craftblockdata and not blockdata?
outstanding question
my imports are just java import org.bukkit.block.Block; import org.bukkit.block.data.type.NoteBlock;
but yeah NoteBlock extends Powerable extends BlockData
so its a bit odd i cant cast a noteblock to a noteblock
it's been a while since I've messed with block data
and I really should release this lol, I just finished working on the last bug
she's a beaut
got everything basically working
I want to say that's a bug
Probably won't throw an exception if you don't clone it (which you don't even need to do, mind you)
I actually went and checked and the clone should be retuning BlockData but yeah that would also be my guess
Well, yeah, it's returning BlockData. It's not returning anything more specific
Unsure if the native clone() actually handles child classes correctly
My guess is that it doesn't
really wish java would improve the ability to clone classes
I don't want to do all that nerd shit that is required to implement it, just let me tag it and go
look
smth like this
Those methods are usually what you'd find in your manager class. I was referring to a system where you have a generic Cooldown class and any other forms of cooldown like your KitCooldown would basically extend Cooldown and have that extra piece of information needed to distinguish itself from the generic cooldown.
What you have there is basically a manager class.
better?
and now ig i modify CooldownLoader first to CooldownManager
and then
make a general CooldownManager
and then KitCooldownManager extends CooldownManager?
and implement the same kit stuff
or idk
Ideally you'd only have one CooldownManager that well... manages all the cooldowns for the plugins. Your different types of cooldowns that you create are there to help you distinguish between what type they are. The manager will do all of the adding, removing, and comparing.
ooh
i just had an idea
maybe doesnt matter
but
what if i make
a Cooldown<T> class
and use it for everycooldown i need
idk
its just an idea
that ill look further into in the future lol
What would T stand for if I may ask (didn't read the entire conversation)?
The target object that is cooled down?
its a generic class
like you could use
Cooldown<String>
Cooldown<Integer>
and stuff
its a way to make a class compatible with all datatypes, or i'll describe it that way
a good example
is all data structures
List<V>, HashMap<K, V>
etc.
just a placeholder, to say that way
but i guess, yes, the target object
now thinking it better, making it generic is useless
Oracle explains naming convention of T, V, K etc.
public class LaserPointer implements Listener {
private int length = 20;
@EventHandler
private void onInteractEvent(PlayerInteractEvent e) {
if (!(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (e.getItem() == null) {
return;
}
if(!(e.getItem().getType() == Material.NETHER_STAR)) {
return;
}
Player p = e.getPlayer();
Location pLocation = p.getLocation();
Location pLocationEye = pLocation.add(0,1.5,0);
Vector pDirection = pLocation.getDirection();
for (int i = 1; i < length; i++) {
Vector particleSpawn = pDirection.multiply(i);
Location forwLocation = pLocationEye.add(particleSpawn);
pLocation.getWorld().spawnParticle(Particle.REDSTONE, forwLocation, 30, new Particle.DustOptions(Color.RED,5));
}
}
}```
for some reason, instead of incrementally increasing the distance between the particles, it instead just does 3 in a strange pattern, 2 close and then 1 somewhat far away, please excuse any math issues since im a beginner when it comes to even vector math
That's not what I meant with my question, what I meant is what you will use the generic parameter for
Exactly that's why I was wondering what you meant
Location and Vector are mutable, this may be the root of your problems
So by executing operations on them you mutate (ie modify) their state
Use .clone instead or alternatively try and use more primitives and avoid object allocation (but that's not really needed, just being premature optimization)
okay, thank you :)
Honestly these objects being mutable is always pain in the ass, having an immutable class and a mutable that can build an immutable out of the current state would be much better
yea
hmm so im using protocollib and PacketType.Play.Client.ARM_ANIMATION, and im trying to prevent right clicking a block from being displayed but left clicking still being displayed, what would b the best way to implement this
the packet data is kinda useless for this
maybe obfuscate? Pretty sure obfuscation can help minimize your jar a little
ahhh me thoughts it was premium
I have no premium plugins
really I thought you did
bro be leaking everything
just to get ignored 😔
L
not sure how I managed to get my particle drawing correct which USES my bounding box only for the entire bounding box to be off by 1
I'm so confused
let them know ur using the player interact event as well
nuh uh
so basically me the past 3 days
ye u cant just get it from the packet
yea but i cant get it from the event bc the packet fires before the event
did i ask
🥹 I don't understand why
well there is no way u can do it
time to keep printing debugs ig
u shouldve seen our chat 😭
https://www.spigotmc.org/resources/free-minecraft-models.111660/ haha get shrecked I figured mine out and even released it just now
animations are now fully working
it was beautiful
wait maybe i got it
let me cook
lol that's my boundingbox class
you're probably passing ints instead of doubles
or you're using block centers
.toBlockCuboid might fix it
well yours was working but I changed a few things xD
I am passing ints but shouldnt it still work with ints?
wait their was a regression its not even misaligned by 1 block now
PlayerChangedWorldEvent is fired after the player has already changed worlds...is there a way to execute code before they actually change worlds?
@echo basalt stupid mistake on my end
I'm not getting BlockX of the location I'm checking
I'm pretty sure its that
wait nvm guh My brain is dying
@echo basalt ik what i fucked up I accidently changed volume to a double FML
I literally just alt+f4d intellij
If I am making an McMMO equivalent plugin is it better to use MySQL or MongoDB for storage
alright on another note how does one color note particles
Become based. Use PostgreSQL
If you are just using SQL then MySQL, if you are going to use the features of Mongo properly, then Mongo
It all depends on your experience
Postgre is also a good choice
but anything other than MySQL you are going to have to include drivers.
minor patch
Is there no way to do this? lol
yo @vagrant stratus can you clarify a point for me?
it's against spigot rules to compensate people for positive reviews (obviously) and iirc it's also against the rules asking people to just go post positive reviews on a plugin but just asking people to rate a plugin in general is not against the rules, correct?
I think that's how it went
Incidentally, the answer is to use PlayerTeleportEvent, if anyone else comes here trying to find the answer
no? how are u meant to detect that
what do u need this for?
no
pretty sure every dev does it lmso
but kinda unprofessional icl
It is
Oh he asked more than what it said in the reply thing
Yes 👌🏻
I personally do not and I haven't received reviews in a very long time
Shitty plugins /s
Hi, so i want to disable specific aspects of the /tp command like tping players around but keep tping entitys around, how should i go about that
How this is happening?
What code is causing it? Because if you're trying to cast a Double to an int it will not work
This.
Oh my
idk what kls.java.cast does but I'm assuming it's casting a value to the wrong type
yeah that's not gonna work
Hello! im new to spigot, how can i give the player an item
or is there something like runCommand()
hmmk
what is an ItemStack?
i want to give the player a paper item with a custom model data
Just create a new one via https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemStack.html#<init>(org.bukkit.Material)
declaration: package: org.bukkit.inventory, class: ItemStack
You'd pass Material.PAPER for paper for example
yeah i figured that out
but how would i add a custom model data to its nbt
like paper{CustomModelData:1} ingame
You'd grab the item meta via getItemMeta
Item meta basically holds the "nbt" tag
Notably, getItemMeta always yields you a copy, so after editing it in any way you gotta call ItemStack#setItemMeta for it to apply to the item sraxk
ItemStack kuromiHat = new ItemStack(Material.PAPER);
kuromiHat.setItemMeta(kuromiHat.getItemMeta().setCustomModelData(1));
like this?
Store the meta in a variable
setCustomModelData doesn't return the meta back
It has a void return type
ItemStack _item = new ItemStack(item);
ItemMeta _itemMeta = _item.getItemMeta();
_itemMeta.setCustomModelData(customModelData);
_item.setItemMeta(_itemMeta);
so like that
Yea just
Follow java naming conventions XD
But beyond that, if item is a material
And customModelData is an int
You should be good
sorry I use js all the time 😅
e
OMG FINALLY AFTER 1 HOUR OF DEBUGGING
i succesfully stopped the plugin crashing when the user provides an invalid syntax
How can i add tab completion to my commands?
Implement TabCompleter
Create a String ArrayList and return it
If you create a seperate class for the completer you need to register it to ifs corresponding command
And those names follow no naming convention known to me...
Underscores in the beginning are usually indicators for access modifiers in languages which have none.
I mean it's part of jdk, I assume it does work
Question is if you need your stream to be parallel
i generate chunk so yes
or this not will work?
?paste
No that shouldn't be parallel
because when populate returns the chunk should be populated
the populator itself will be async if you override the other non-deprecated method https://hub.spigotmc.org/javadocs/spigot/org/bukkit/generator/BlockPopulator.html
declaration: package: org.bukkit.generator, class: BlockPopulator
Why would there be custom blocks in a newly generated chunk anyways?
Did only skim this. Is it alex's custom blocks thing?
idk maybe
Nah doesnt look like it
i not can get biom from this chunk yea?
Btw this line i useless if (customBlocks.isEmpty()) return;
can i get ur idea ?
yea thf
becuse anyaws loop will skip it
If you call a bulk operation on an empty collection, nothing happens anyways.
So the code runs the same, even without this line.
Get it out then
i will write to general
bcs not for development
i need idea for minecraft server project
i will write give me sec
i can get biome from this chunk when generate it or this useless?
Only use the BlockState returned by LimitedRegion, never use methods from a World to modify the chunk.
This mean i really not can get biome?
becuse this not generated ?
i in 1,16,5
Population should be called after the chunk is already generated (Including its biome)
Which one?
"Only use the BlockState returned by LimitedRegion, never use methods from a World to modify the chunk."
i wrote to general
This one has no correlation to your situation and still stands.
wdym when i need get biome i use world method
and when replace block too
because they are the only ones
Kind of contradictory don’t you think?
Getting the biome from your chunk doesnt modify it. However:
What prevents you from just following the hecking javadocs and getting your biome from the LimitedRegion??
ehh becuse is not exists in my version i gess?
i have fileds like : World, Chunk, Random
this all
What version are you on?
1.16.5
I mean... if you use old versions, then you shouldnt be perplexed why the latest javadocs might not apply to you.
This just doesnt make sense.
oh this for last version ? were i can find for 1.16.5
You can build them. Just use the biome from your chunk variable and see if it works (It should).
Help chat has some old ones hosted
i found It seems these restrictions for some reason do not apply to my version
?
How do i call methods everytime my plugin ist being reloaded
Spigot doesnt support reloading, neither should you.
That being said: Reloading calls onDisable and onEnable when the user reloads.
(Or do you mean your own reload method)
now that i think about it, there is no sane way to automate building using actions if I rely on NMS right
someone made a resource for it
whoa
How would i go about making custom advancements?
if i leave the permission value blank on my command will everyone be able to use it?
if it has no permission everyone can use it
great!
I wanted to make sure my plugin doesnt break when someone reloads the server
lots of testing
?
You have to be very careful with reload as not all objects/instances are cleared from the class loader
in certain instances static singletons will remain
then see what breaks and fix it 🙂
I know whar breaks only way to fix it is doing somwthing on reload
The user should expect plugins to break on reload...
okay
But if you really want to support reloading, then you need to design your whole plugin around
a clean teardown and startup, independent of your onEnable and onDisable.
Also, no matter how careful you are plugins like PlugMan will break shit all over the place
how can i add nbt data to an ItemStack so it has the invisible tag for an item frame?
hello, i have more general java question, so i have this code reading file:
public static String readFile(String path) {
File file = new File(path);
StringBuilder code = new StringBuilder();
String line;
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
line = reader.readLine();
do {
code.append(line);
if((line = reader.readLine()) != null) code.append("\n");
} while (line != null);
} catch (IOException e) {
e.printStackTrace();
}
return code.toString();
}```
and it seems that it doesnt recognize tabulators, can anyone help?
Your method could be shortened to just
public static String readFile(String path) {
Path filePath = Paths.get(path);
return Files.readString(filePath);
}
oh omg thanks
will it recognize tabulators?
I dont see why no
It should even reading it from a BufferedReader
Didn't realize this existed lol
I always did Files#newBufferedReader. Granted how often do you read a file and not parse something
it doesnt, idk why
and this doesnt too
Are you printing it to console?
no i am checking the string char by char and looking for tabulator
it seems to work fine
jshell> Path p = Path.of("hello.txt")
jshell> Files.writeString(p, "hello\tworld")
jshell> String str = Files.readString(p)
jshell> str.indexOf('\t')
$4 ==> 5
yes
In notepad you could just press tab too
a tab is a tab no matter where it is written from
you may have your text editor configured so tabs are written as spaces :^)
oh
(notepad is not one of those kinds of text editors, it's as raw as it gets)
i havent thought about it
do you know if intellj idea is cofigured like that by default?
by default i don't know
you'd need to check in the settings or just don't use intellij for that file
How tf does unbanning someone increase the ban counter?
int banAmount = Bukkit.getBanList(BanList.Type.PROFILE).getEntries().size();
Here's a part of the BanCommand class
https://paste.md-5.net/gocazuvapi.coffeescript
And here's unbancommand
https://paste.md-5.net/etuwupaguc.bash
I mean, neither snippet you sent there actually increments the ban count at all
Ok I fixed it
By moving the int banAmount after the banPlayer method
and pardon methods
Oh my this is why we need components so much ChatColor everywhere my poor soul
1.20.3, first thing on my todo list
Yay!! By 1.20.1 you think?
.21 you mean? That's the hope, but you never really know
I want to say there's a method patched into the NMS Container interface to get an InventoryHolder instance
Or something to that effect
Yeah, IInventory
they dont
get to work
Me wonders why InventoryHolder works with createInventory in the first place
are you an inventory holder
Because createInventory is not connected to world but InventoryHolder is much wacky
Adding preconditions instead 🧠
Preconditions.checkArgument(holder == null, "https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/ ");
hello again, how can i do this item_frame{Entity_Tag:{Invisible:1b} using spigot and doing addItem?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/ItemFrame.html#setVisible(boolean)
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/ItemFrame.html#setItem(org.bukkit.inventory.ItemStack)
declaration: package: org.bukkit.entity, interface: ItemFrame
If it's any insight, we considered deprecating those methods like 5 years ago
I mean I guess this warrants more discussion then I'd need a reason InventoryHolders are beneficial there other than the standard api abuse
Well regardless just remembered I'd need it for legacy compatibility 🥲
How i can protect my plugins if i can't use my custom license system?
Because one got leaked and i can't know who is
Make it open source and don't chase after sales you won't be making anyways
Sounds like a good option to me
What a lot of people fail to realize is that you can have any license you'd like, but if you can't enforce it, that license means nothing :p
So if you want to have a custom license, you'd best have a lawyer ready to enforce it for you
Oh, sorry, license "system"
It won't work lol
I, like many others, can decompile your plugin and just remove the license check
Yes but 90% of people don't do this
@cosmic spear I'm a big fan of wanting to learn asm If you find a great license system lmk I wanna have some fun
So its impossible protect our plugins
Even if you found out who leaked it, what are you going to do?
Usually just limiting support is the easiest way
^
If you have some way of determining whether or not a build is redistributed via unofficial means, then yeah, just say "Sorry, can't support you until you buy it"
okok
Do like most premium plugins and have it open source on git but paid on spigot and you pay for support
what does it mean
I'd do this if I ever sold plugins
Well, "most" is an overstatement lol
that's the trick, you don't sell plugins, you sell support :thinksmart:
Lol
thanks babe
Besides the point
if you do find a goot licensing system
he wants to test it out
can i c ur current lciensing system?
the one u cant use?
Lol
java.lang.NoSuchMethodError: 'void org.eclipse.jetty.servlet.ServletHolder.<init>(javax.servlet.Servlet)'
at io.javalin.jetty.JettyServer.start(JettyServer.kt:57) ~[LiquidREST-0.1-all.jar:?]
at io.javalin.Javalin.start(Javalin.java:174) ~[LiquidREST-0.1-all.jar:?]
at io.javalin.Javalin.start(Javalin.java:148) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.Main.onEnable(Main.java:39) ~[LiquidREST-0.1-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:273) ~[forge:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) ~[forge:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:502) ~[forge:7e29f765-296df566-9fb885e8]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:414) ~[forge:7e29f765-296df566-9fb885e8]
at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:427) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:347) ~[?:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:227) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:768) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:267) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[15:54:17 INFO]: [LiquidREST] Disabling LiquidREST v0.1.```
does someone may know what does trigger this error, it works perfectly fine on local machine.
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Main.java and build gradle?
You should relocate jetty
hybrid 💀
just trying
https://hastebin.com/share/ujucayikus.bash buildgradle
https://hastebin.com/share/xodidefena.java Main.java
?main
Thats how ill be doing in the future
It works well 🤷♂️
thanks, good to know. i'm new to java and spigot development
Where i need to report my leaked plugins?
Leaked on an external website, or did someone post your plugin on spigot?
on an external webiste
Uhm you get a lawyer and sue in a court of law I do so believe
Did you embed a software license?
Send them a dmca take down request and follow up with legal forums of they do not respond
First you'd ofcourse have to consult a lawyer to make sure you can sue and have taken the steps to affiliate a license with your plugin
you mean in the page of the plugin?
But i'm in italy waiting 9 year to have response
lol
💀
Im assuming not then. As y2k suggested, its probably an intellectual property dispute then.
@cosmic spear I will warn you though it's not worth the time or money
Much bigger companies struggle to do what your attempting to do and have much bigger pockets for legal action
How do I fix this?
Being in Italy (EU) you'd have to prove monetary loss.
The best you could achieve is to get teh site to take the resource down
You can issue a DMCA yourself, but seek legal advice
Depends on what you think the problem is here
is it normaal that if you put an armorstand on an entity it doesnt move anymore?
Alright, then ill just shoot into the dark.
Right click your src folder -> "Mark Directory as" -> "Sources Root"
English language weakness detected 😄
As in: The language fails to clarify why "it" refers to
If they are mounted on something, they sure should move
He could mean that the mountee still moves without the armorstand
Ah. Should still move, right?
but i already found the error already so its alright

whats the event for a guardian shooting his laser
i mainly mean the whole action
like
if its possible to cancel his whole attack before the laser even apears
thats what im trying to do
wasnt sure if they were seperate eventy
just trying to make the guardian stop attacking with his laser
but like
Myeah but cancelling it wont stop the laser from appearing, right?
Only the damage
ay guys, how do i check if a player tries to double jump
like u know when they try to use an elytra so they jump and then jump again?
im tryna setGliding for them at that moment to true
ToggleFlightEvent or something like that
thank you
?
you download it
Okay thx
Not enough info
nope, same version, same java
what do you need?
send the errors
hey how do you check if material exists without try catch
do I really have to use it
is it still efficient to use Material.values() then?
and .contains() method on it
[17:15:08 ERROR]: Error occurred while enabling LiquidREST v0.1.0 (Is it up to date?)
java.lang.NoSuchMethodError: 'void org.eclipse.jetty.servlet.ServletHolder.<init>(javax.servlet.Servlet)'
at io.javalin.jetty.JettyServer.start(JettyServer.kt:57) ~[LiquidREST-0.1-all.jar:?]
at io.javalin.Javalin.start(Javalin.java:174) ~[LiquidREST-0.1-all.jar:?]
at io.javalin.Javalin.start(Javalin.java:148) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.LiquidREST.onEnable(LiquidREST.java:36) ~[LiquidREST-0.1-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:273) ~[forge:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) ~[forge:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:502) ~[forge:7e29f765-296df566-9fb885e8]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:414) ~[forge:7e29f765-296df566-9fb885e8]
at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:427) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:347) ~[?:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:227) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:768) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:267) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[17:15:08 INFO]: [LiquidREST] Disabling LiquidREST v0.1.0```
ty
Use the method that returns null if not found
try running a clean and package
what javav verison are you running/
8
seems to be the ideal for 1.16.5
Pretty sure 1.16 is java 11 already
as 7sm said, use 11
1.16.5 will work on Java 8
idk, i read something that says java 8 is better for <1.17
Its [52, 60] compatible. So 8 to 16. I would def go with the highest LTS version. Especially for running the server
to reap the jvm improvements.
should i use java 11 or 16?
still doesn't
Did you relocate already?
shadowJar {
relocate 'io.javalin:javalin:4.6.8', 'shadow.io.javalin'
relocate 'org.slf4j:slf4j-simple:2.0.7', 'shadow.org.slf4j'
relocate 'com.fasterxml.jackson.core:jackson-databind:2.13.2', 'shadow.com.fasterxml.jackson.core'
relocate 'org.eclipse.jetty:jetty-servlet:9.4.48.v20220622', 'shadow.org.eclipse.jetty.servlet'
relocate 'io.javalin.jetty:jetty-server:9.4.48.v20220622', 'shadow.io.javalin.jetty'
}```
11 is the latest LTS version. If you write all plugins yourself, and want the higher language features then go for 16
Decompile your jar (Or just open it with 7zip/winrar), make sure that the org.eclipse.jetty.servlet.ServletHolder class is in there and check if it has a
constructor with only one javax.servlet.Servlet parameter.
how fast is World#getNearbyEntities()? like would it be acceptable to do that every tick to figure out the closest entity to a projectile?
may i know how do i check the parameter? (org.eclipse.jetty.servlet.ServletHolder is in there)
No
i figured lol
Meh. Not good, not terrible.
But there are better approaches.
the other approach would be to have that "closest entity" be determined on shooting based on which entity is closest to the shooter's line of sight
It's honestly not horrible. Mostly just numerical comparisons
no every-tick nonsense
I am sure you don’t need every tick though
No probably not
Is it a physical projectile? If not, then ray tracing forward might be a bit faster than getting nearby entities.
wanting to make a homing projectile property which i would like to be workable with fast and slow projectiles
I just recently did repeating getNearbyEntities() lookups with a bounding box and I only do it once every 5 ticks
That's still 4 times/second which is relatively quick
Keep in mind that hoppers probably do this a lot more 
4 times a second is quick but for very fast projectiles it probably isnt enough but ill figure something out
Ideally you would dynamically change the polling rate, depending on your projectiles velocity, to reduce overlapping volumes getting scanned too much
@EventHandler
public void onJumpTwice(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
if(players.contains(player)) {
player.setGliding(false);
players.remove(player);
return;
}
player.setGliding(true);
players.add(player);
System.out.println(players);
}
@EventHandler
public void onGlideCancel(EntityToggleGlideEvent event) {
if(players.contains((Player) event.getEntity())) event.setCancelled(true);
}
event call not happen do what now
listener registered?
Registered, the listener?
The player needs allow flight properties
its in the main class
im just testing so didnt create a new class
how to add flight props
yeah but did you register it
you still gotta register your listeners even if they are the main class
ahhhhhhhhhh
Player#setAllowFlight()
thank you
that will allow the player to fly though
declaration: package: org.bukkit.entity, interface: Player
hey
hello
does getOfflinePlayer() work both for online and offline players?
Yeah
ok ty
You can pass player as offline player also
But if I only know the name, specified as a command argument, then how can I get the UUID? I see that getOfflinePlayer(String name) is deprecated
I can do this differently but I was just thinking if there is a simpler way
Its deprecated because of security issues
I wouldn't call it security issues
Access uuid from mojang api
getOfflinePlayer will already do that for you
if you only have the player name it's fine to use it
It's just a warning telling users to not store the username as a player identifier
declaration: package: org.bukkit, class: Bukkit
Deprecated.
Persistent storage of users should be by UUID as names are no longer unique past a single session.
What if offline player does not even joined the server?
how can i prevent that message being sent
As I said it does a mojang api lookup
