#help-development
1 messages · Page 573 of 1
dunno what you are on
Uncle Bob is best uncle
nobody really cares tho
you can have as much params as you like, unless they slow the code down
and make it unreadable
parameters always slow the code down 🤡
but then you dont know what alias is being used 🤡
dunno wheres thats useful for but whatever
useless
maybe for echoing the command usage back
you'd better move aliases to the command parameter ig
command contains the aliases yes, but without extra param you dont know which alias is being used
I mean isn't Command object constructed when onCommand is getting called
or it's predefined
and you just toss it from cache to the method
like you can just have an alias field if object is constructed with the onCommand call
so you do like command.getAlias()
and if the default command is used, it will just return the command name
or null
but i don't know the logic behind onCommand so
in onCommand label is the actual command that was typed
so the alias if it was used
ye ik
sorry that was the wrong ping
still wondering how id get rid of that offset, its only 0 in the first iteration, then it changes to 1
Tokenizer paramTokenizer = this;
do {
int posOffset = paramTokenizer == this ? 0 : 1; // TODO: only 0 for first iteration, avoid branch
paramTokenizer = paramTokenizer.branchOff(Utility::isValidArgument, paramTokenizer.pos + posOffset);
parameters.add(paramTokenizer.readTokens().solve());
} while (paramTokenizer.peek() == ',');```
lemme sent it like this
could do it like my old code but that looks kinda scuffed
// Tokenizer paramTokenizer = branchOff(Utility::isValidArgument, pos); // position them to read the first parameter
// parameters.add(paramTokenizer.readTokens().solve());
//
// while (paramTokenizer.peek() == ',') { // extra param coming
// paramTokenizer = paramTokenizer.branchOff(Utility::isValidArgument, paramTokenizer.pos + 1); // + 1 to consume comma
// parameters.add(paramTokenizer.readTokens().solve());
// }
// pos = paramTokenizer.pos;```
I wonder if this is gonna work lol https://paste.md-5.net/efomaquyuq.java
your data now belongs to the CCP
Why do you use strings for true false
whats the method to add something to an inventory but if its full drop the item instead of replacing
addItem will return a map of what it can’t add
I think it gets automatically translated
Which you can then use to drop
Yeah but why a string
A byte is going to be a bit smaller
it is yml
Hi, I tried to build a 1.8.8 version using BuildTools and encountered an error with org.codehaus.mojo:animal-sniffer-maven-plugin, which caused a build failure. Here is the complete error message:
Compiling CraftBukkit
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< org.bukkit:craftbukkit >-----------------------
[INFO] Building CraftBukkit 1.8.8-R0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ craftbukkit ---
[INFO]
[INFO] --- scriptus:0.2:describe (default) @ craftbukkit ---
[INFO] Set property "describe" to "git-Bukkit-741a1bd"
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ craftbukkit ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ craftbukkit ---
[INFO] Changes detected - recompiling the module!
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.13:check (default) @ craftbukkit ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java16:1.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.078 s
[INFO] Finished at: 2023-06-19T22:42:08+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check (default) on project craftbukkit: Execution default of goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.13:check failed.: IllegalArgumentException -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Exception in thread "main" java.lang.RuntimeException: Error running command, return status !=0: [D:\D▒veloppement\Minecraft\Spigot\Neisis 1.8.8\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=582a, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:1062)
at org.spigotmc.builder.Builder.runProcess(Builder.java:993)
at org.spigotmc.builder.Builder.runMaven0(Builder.java:962)
at org.spigotmc.builder.Builder.runMavenServer(Builder.java:931)
at org.spigotmc.builder.Builder.main(Builder.java:731)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
this isn't the full log, and odds are you are not using java 8
also known as java 1.8
also IIRC you must not have spaces in the build apth
What the heck is a maven sniffer plugin
animal sniffer josh
its for catching errors
you need it when you decompile and then what to compile again
it helps catch some problems before trying to compile again lol
I gave the logs where the problem happens, I have no problem before the craftbukkit part, and I am using java 8 fine
yes but there is useful info in the log before that for us
so we are not guessin
Ok mb, I'll send it right away then
@vernal sluice
I used everything, windows terminal, gitbash, cmd
interesting
how
Always the same problem
I have a right clicker listener (PlayerInteractEvent)
There is a bunch of code in it. It may causse NullPointerException etc.
But for some reason, unless it can exit the method without an error, the rest of the code doesn't run (like this sout at the very begining of the eventhandler)
Is there a way to fix that? Trying to debug rn
try catch
try removing spaces from the directory path
Neisis 1.8.8
remove the space here
and then try it again
Ok, i will try
public class dummy(){
try {
//ur code
} catch(NullpointerException ex) {
}
}
ok
Hi Olivo 😄
It's better to just prevent the null pointer to begin with
Why would you recommend a try catch instead of just an if statement
doesn't do anything
it's around 50 lines, bunch of code that you can't understand without knowing 3 other classes, there's no error in console
Whats wrong with my SHA-1 hashing for resource packs? I put the file from the variable in an online checksum and its fine (and my logs in minecraft match the online one)
But when I run this code the SHA-1 never matches the clients... (expected be5e06ed13636196ca94c1c661a9c00f6eafe5d8, found 0c8e074b3341d871d86938d4c30965e9331cff83)
?paste
@upbeat hornet
ok...
How do you know it's an null pointer if there is no error
RightClickListener.java https://paste.md-5.net/abilarigar.cs
Meteorite.java https://paste.md-5.net/nikelibuke.java
MeteoriteManager.java https://paste.md-5.net/anufezugud.cs
Hologram.java https://paste.md-5.net/idutopared.cs
idk if it's a nullpt, I just know there's an error
update this was a flaw in my async logic, was writing the sha1 while file wasnt closed 
because code doesn't execute
Then make debug messages
Which code doesn't execute
Does the rightclick event trigger at all?
oh wait cant screenshare
i know I have a problem with that
You probably forgot to register the listener if the sysout in the screenshot doesn't fire
Yea
It is registered. It works after reloading the plugin for some reason
never reload
I could explain in screenshare
So everything works now?
well no
because people aren't gonna reload every single time they want to play
and it only works one time
Ok
you need to :
- start
- reload
- do the thing
- reload
- do the thing
- ...
what happens on a reload
onDisable, onEnable
commenting line #82 on Meteorite.java fixes partially everything
Now for a question of my own, can i reconstruct a hashmap from a json string?
https://paste.md-5.net/ceviwovoxa.java
I can reconstruct a HashMap<String, ArrayList<Integer>> from this:
{
"uwu": [
[
-18,
64,
-8
]
]
}
Take a look at line 67 where I flush my memory to json
line 34 where I retrieve the json file and reconstruct a hashmap
?conventions
^ you should follow these
me or them?
You
Package names
shouldn't be capitalized, right
Whats the best way to go about making a config reload command?
yea
re read the data
from the file
I know how, just wondering what others do regarding the command
myPlugin.reloadConfig();
like do they make a command with the name of the plugin then have reload as an argument?
Yes, yes I know
[INFO] {"Settings":{"MongoDB":{"Encrypt-Pass":true,"Settings":{"Username":"*******","Database":"*****","Server-Link":"********.******.*******.***","Password":"*******************"}}}}
Just take a look at the Gson library
JsonObject = K/V
I brokey my JSON Config lib it aint saving anymore gimme a sec
try updating git
same problem :/
not sure why you would be having that problem unless you have some kind of bad version in your maven repo for the maven plugins
maybe try removing that from your maven repo and see if it downloads it appropriately
I'm not sure I understand, I know what a repository is, but I don't know how to access the maven repository unless you're talking about the pom.xml
your local maven repo is located in your user directory
so got to C:\ then windows, then users, then find your username click that
and then you should see a directory called .m2
Ok i found it
alright you are going to navigate to the org directory
then after that to codehaus
then delete the one that says mojo
I need to remove only org.codehaus.mojo.animal-sniffer?
yeah
Done, i restart build
now lets see if redownloading that fixes your problem lol
maven should automatically do that
because I can't see from the build log in why you would be having issues with that =/
typically that isn't even something someone has issues with
same error
try with a different build tools version
Maybe a problem with the version of the library, I don't know
its 1.8.8, nothing has changed XD
well that will most likely work
intelliJ doing the most useless quickfix again
what's the difference between accessing a private field (from an object, inside the object)
- this.name
- name
So in 1.12.2 it works
How come I cant import this class anywhere? It says Cannot resolve symbol 'SnowReports'
https://paste.md-5.net/vaxigomoge.java
In both cases I'm refering to the object's scope
what does Bukkit#broadcastMessage do under the hood?
if you have a parameter or variable called "name", then it'd be hidden when not using name
example:
public class MyClass {
private String name;
public MyClass(String name) {
this.name = name; // this.name is the field, name is the parameter
}
}
in this example this.holograms and holograms is the same right?
show a screenshot of where this message appears
yes
is that another project?
No, different class
@EventHandler
public void onBlockBreak(VehicleDestroyEvent event) {
Vehicle vehicle = event.getVehicle();
if(vehicle instanceof Boat) {
Boat boat = (Boat) event.getVehicle();
Bukkit.broadcastMessage("boat");
boat.getLocation().getBlock().getDrops().clear();
boat.getWorld().dropItemNaturally(boat.getLocation(), itemDictionary.getDinghy());
}
}
Any reason why its not clearing the regular boat drop?
how would i create a premium buyer checker for spigot?
CraftServer:
File -> Invalidate Caches -> Invalidate and restart
there's no reliable way
usually you can assume someone bought it if they have the .jar lol
yeah i mean i just want to verify it via a spigot user id tbf
Thank you
Do you guys listen to music while programming?
private String spigotUserId = "%%__USER__%%";
private char[] spigotUserIdChars = {'%','%','_','_','U', /* etc */, '%'};
public boolean isValidUser() {
return !spigotUserId.equals(new String(spigotUserIdChars));
}
sth like this will check if it actually got replaced. That way it returns false when compiling it yourself, but true if it was downloaded from SpigotMC
@chrome ferry
Sometimes
then I'm not sure what you're trying to do
Usually some informative youtube video in the background
you e.g. want to check whether user 123456 bought plugin 98765?
that will only work if you have the credentials of either the author of the plugin, or the credentials of the buyer, and then you gotta scrape the cloudflare-protected spigotmc website. There's libraries to avoid cloudflare's protection but they usually break every other week
NAHHHHHH BRO
I was debuging my code for around 2h and the fix was to remove a line that produced a nullpt onEnable. It was in the console but I ignored it for 2 hours
🙂 🔫
Anyone by chance know?
yep no error
It still drops the vanilla drops but also drops the item I itend it to drop
Ohh
Why would clearing the drops of the block stop the boat from dropping
you are doing that on the block
Ignoring the fact that block.getDrops is a clone
Well I didnt see any method to get the boat vehicle drops itself
Yeah you are removing the drops of the block it is on
I would event.cancel and kill the boat manually then drop your desired item
You’d have to keep track of the location
Ah yeah you could in theory also just .remove the boat
😄
I'll try both ideas then
Only do one 💀
yep
a Boat is an entity so perhaps check the EntityDeathEvent
Hey there 👋 I'm trying to create a packet that sets the armor of an npc when it's created, I did some online searching and looked at the packets wiki and came up with the code below. Everything goes through and I don' t revieve an error in console, but the armor does not show up on the npc. I'm using 1.18.2 so I don't know if anything changed packet wise. Any solutions? (Using protocolLib BTW)
a packet?
Yes a packet
Why would you need a packet? Can't you use built-in methods?
In that screenshot you are using air
Obviously air doesn’t render when worn as armor
I see
And you’ve got the items in the correct order
And they are actually armor items
Yes manually set the armor in code
and i've made sure im actually wearing armor in-game 😅
can you show me the class where you spawn the npc?
?
Thats were I set the armor for the npc
that will spawn a dead body
how do I shoot dragon breath? do I use DragonFireball class?
i have architectural question
lets say i have dimensions of the table
and the position of the cursor inside the table
should i make separate methods to get the specific axis of the dimension coordinate
or instead i should return Position and Dimension object
returning object seems pretty much solid
except for a fact that now im copying two fields at once
when I dont need one or the other in some purposes
getX(), getY() can be cumbersome to add to all classes separately
but at the same time, whenever i need one field i get one field, whenever i need two i call both methods
why not both
dry my ass
they both have a clear purpose
typing getx and gety constantly will repeat yourself so if you dont want that then go for the object
but then your memory copies wont be micro optimized i guess
I would just do both and call it done, then you have the answer for every case
dry or wet
I mean thats if you want usable code anyways..
raising the event only notifies other plugins you want to alter the health
it does no more than that
if after callEvent it's not cancelled you should apply the healing yourself
You need something like p.setHealth(health);
Does calling setHealth raise the event automatically?
I don;t believe so
if EntityRegainHealthEvent is a custom event, no
its custom when you raise it yourself
maybe someone finds this useful, idk https://github.com/mfnalex/PersistentDataSerializer/blob/main/src/main/java/com/jeff_media/persistentdataserializer/PersistentDataSerializer.java
You just need to add the new player health after calling the event
you should do if it isnt cancelled
Yeah, but what create an custom event for that?
It’s not custom
EntityRegainHealthEvent entityRegainHealthEvent = new EntityRegainHealthEvent(player, (player.getMaxHealth() - player.getHealth()), EntityRegainHealthEvent.RegainReason.CUSTOM);
Bukkit.getPluginManager().callEvent(entityRegainHealthEvent);
if (!entityRegainHealthEvent.isCancelled()) player.setHealth(stuff);
declaration: package: org.bukkit.event.entity, class: EntityRegainHealthEvent
I'd kill myself if I couldn't use at least 1.16.3
Then it’s probably in 1.12
Probably
It's not an event I need so I never paid attention to it
we need some context
you dont need to update if player is above limit if he is not moving right
Is there a way to get the entity that damaged another entity through a sweep attack? I tried browsing the forums on this, and it seems that the only event called when an entity is damaged by a sweep attack is EntityDamageEvent, not (somewhat strangely) EntityDamageByEntityEvent, which would have the methods I'm looking for.
Another solution appeared to have used a global map. I could do that, but I'm wondering if there's a cleaner API solution
Both should fire
That’s not really what villagers are for
But you can probably use the inventory click event to set the output when you place the input
You should be able to get the entity via the holder
You have the entities inventory
It’s the one you click on
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
By default, an item is just {id: "minecraft:...", Count: 1b} and if I add lore to it it becomes {id: "minecraft:...", tag: {display: {Lore: [...]}}, Count: 1b} but if I then remove that same lore by doing, for example, ItemMeta.lore(Collections.emptyList()) then it still leaves behind {id: "minecraft:...", tag: {display: {Lore: []}}, Count: 1b} so the item still shows the NBT: 1 tag(s) tooltip. It's a minor annoyance, but I'm curious how I can prevent/fix this?
STATUS: Unresolved
So I have a custom enchantment which when procs doubles the attack damage. My method to set damage is
public static void increaseEventDamage(double amount, EntityDamageByEntityEvent event) {
event.setDamage(event.getDamage() * amount);
}//increaseEventDamage
but the output of the damage with armor is messed up. If the player is naked the double'd damage scales fine. But if the player is wearing normal diamond armor (also occurs with other armors) without enchants i get a value that is not double...
As you can see the first attack where is normal damage gives off 0.8 damage
And the second attack where the enchantment is in effect gives off 2.09 damage
But the raw damage is doubled between the first and second attack.
Does the same occur with iron armor
let me check
Diamond armor has armor toughness which helps more against stronger attacks
Do all entities have the same default walk speed for the player, which is 0.2?
No
I see, thanks
That may just be how armor protection works
I don’t believe there is a way to set the final damage directly either
No protection is applied to the armor
idk if this is a minecraft thing or something on my side
I know protection does have a random variable in it to calculate damage taken
without armor is works fine. With armor I start having the issue.
I've done some more testing and found that tools that do the same damage by vanilla minecraft give off the same amount of damage my tools when the enchant is active.
Still confused why there seems to be some other factor with calculating damage with armor
I think it’s just higher damage gets reduced less
I’m developing an ambient sound plugin, and I’d like to have spore blossom particles falling from trees. I feel having dozens of particles consistently being spawned could be somewhat taxing. I’m guessing spore blossom particles from the block aren’t spawned server side, but are when the client detects them. Would actually placing the spore blossom on trees be drastically more efficient? I can make them invisible through the resource pack.
I believe they are fully client side, yes
But just having an async task spawn them isn’t going to kill the server
tbh neither would a sync one
I agree for a sing,e player, but what if their are several players? Spawning the particles async using packets wouldn’t with a single person, but what if there are many players?
Is there any other way to update resource packs without hash's?
Im actually fed up with this shit at this point
?paste
Class im using to zip file on my server: https://paste.md-5.net/wuwunofupe.java
How im using the class: https://paste.md-5.net/opewegeher.java
After its zipped its left in its directory and i have Spark serving the folder as a static resource for the resource pack
After the server is started, and queued players from my player join event get sent the rest servers link to where the resource pack gets hosted at, i also provide the hash as it needs to be able to be updated, here is how im calculating the hash: https://paste.md-5.net/equxefibov.cs
Im using apache's digest utils, but i also tried with the vanilla java way and im getting the same behaviour:
The behaviour: When i join the server after the resource pack is available, and the pack gets sent to me my client complains that the hash is INVALID File C:\Users\burch\AppData\Roaming\.minecraft\server-resource-packs\b3c641980ac1cc50c81cd5ce39255343a2104f9a had wrong hash (expected a69fa0068db5a4ae3fa57595394b1ff39630cb71, found 3adfc8a1816a85fd1e9586faed670127fd522f9a) then slightly after i get the message saying it deleted the resource pack
However, if I simply just rejoin the server I get sent the right hash: Found file C:\Users\burch\AppData\Roaming\.minecraft\server-resource-packs\b3c641980ac1cc50c81cd5ce39255343a2104f9a matching requested hash a69fa0068db5a4ae3fa57595394b1ff39630cb71
What the fuck is going on? Ive been beating myself up over this for hours now and im just so lost why the first hash is ALWAYS INVALID.
I am going to assume its because of the buffered input stream
Buffered input stream will typically have garbage data in it to keep the buffer open and by default i think that is 1024bytes
So when its requested a second time all the garbage data made it out and its just completely zip file after that
So how could i make it not add the garbage data into it for the first time? Or should i just use raw input streams and see how that works
Grab the file size and then use that size to make the buffer exact same
And then it should just contain nothing but the zip
If that doesnt work i would try raw input stream
Or just sha1 the file from file method lol
Well thats what im doing no? I also used the java way one sec
No you are doing it from the stream
changing it rn to do the buffer thing you told me, but this is what i was trying all last night (before trying the apache lib)
Instead just toss the file object in there
Have no idea from a glance in what you were trying lol
Ok you were sha1'ing each index in the array
That can work but only if bits end up in proper order and didnt have any uneven bits
Which i guess offset was supposed to handle that i assume
no idea tbh
idk how any of this sha1 works nor coud i rly care im just trying to find something that works lmao so i was just copying/pasting sha1 methods
Lol
stupid that it needs a sha1 to tell the client to update the pack imo
client should be able to dicpher it not the fuckin server
Well the client should inform the server what it has and then server should respond with the file.
If what client has doesnt match
There’s something called a DigestInputStream
Or just guava hasher
That actually might work. On phone so cant really just pull methods out lol
i believe i tried this too but was getting the same issue
Player joins, gets told hash is incorrect and just delete the resource pack
Player can rejoin and then it sends the right has
one sec lemme try with that
yeah same thing with that too
im at a lost and honestly im just tempted to kick the player if it fails
it ALWAYS succeeds infinitely after the first failure
also appears just passing null like the docs doesnt work at all
So like how tf are you supposed to updates resource packs seamlessly lmao, other people do it smh
The packs have a 4mb difference but the client ignores the change 👌
screw it im just gonna use UUID's as the file name and force the client to entirely redownload the pack everytime they update it
fuck theyre storage
yeah tbh i had issues with this pack even in my properties file
it just wouldnt ever update for nothing unless i changed the name
i would try this on an older version but i just cba
even ended up just versioning the name and everytime i add a texture i just bump the version for this pack, couldnt get this one working in my properties file for nothing
how can i regenerate chunks to how they originally were?
just like world edit's regen command
Block throwing Item
Anyone know why my document is null?
https://paste.md-5.net/yumolukuje.java
yes this isn't spigot but it's just the mongo stuff
It also doesn't make a database, I connected to my DB with MongoDBCompass and I had to create it myself
Alright
okay so about the database thing:
getDatabase does create the data yes
BUT
You need to write data into the database and then it should get created (According to the document ation online)
Reguarding document being null, which ones specifically?
also
Document document = NukkitCore.getInstance().getMongoCollection().find(Filters.eq("uuid", uuid.toString())).first(); This is what is null
I will take a look at it when i get home
found my class but tbh im doing the same exact thing as you when using it
Whats your error exactly?
No errors, just null
ayy ty :DD
it 100% exists in your mongodb? can i see the collection with the document there on your atlas?
Wdym
first() is null if find() is not found/empty
ie can you show me that document your trying to find in your mongodb
should look something like this
Can't because the database doesn't exist
yeah so if find() == null player doesnt exist -> inject data into database
and it will create the database when you inject the Document
does anyone know how many blocks far a 1 volume sound covers?
alternatively you can always make the DB yourself, youll still be null ofc ause that entry isnt there, but if it helps your sanity you can :p
can you explain a lil more im confused
wdym
sorry first() not find
So im amking a minigame where there is action and i wanna add pigstep and back music to fir in with the feel. The game map is around 9 chunks in a square form so 2 chunks out in each direction.
I wanna play a sound with enough volume to JUST cover this space
if your first() result is null the data doesnt exist so just go ahead and create it
idk what you mean sorry xd my brain isn't working rn it's late for me
oh you can just Player#playSound if they are in one of those chunks
You can use player.getLocation().getChunk() and compared it to the chunks your minigame is using
your first() is null
..
no... ud ont get me
first() == null
the document does not exists
insert data into database, inserting the document into a database that doesnt exist will create the database
they ARE in the chunks. Always. I just need to play a sound in the middle of the map with enough volume to cover the map
that's why i was asking, how many blocks wide can you hear a 1 volume sound
youll just have to send and see but imo this isnt a great approach
it will be MEGA LOUD at the origin
why not?
and at the corners it would be so soft youd prolly not even hear it
I thought loudness just meant how far the sound reaches
youd need a large volume to cover that + theres a max iirc
declaration: package: org.bukkit, interface: World
uhh wrong one scroll down one
but same thing
Ill just play a sound with high volume and see.. I dont think volume means how loud the overall sound is. just how far it travels
it 100% is how loud it is
I remember testing that
i mean it called volume....
right here
- i use it to adjust volume with my music plugin
louder sound = louder origin but further away
This is how most sound engines work tbh, if your wanting to do what you do your 100% better off just getting the players chunk, if player is in chunk play sounds, and when they exit (which i doubt is possible since its a minigame until you programatically leave) stop sound
Unless you want a super loud origin point for your sound, then go for it but turn your headset down
okay..
plays would likely find it annoying though going to the center of the map only to get earraped 
i dont mean to offend you if I still wanna test it out
go for it
are you playing it at a location tho
yes.
hmm
main.GAME_WORLD.playSound(gameBorder.getCenter(),Sound.MUSIC_DISC_PIGSTEP,100,1);
shouldnt be doing that but alright
I dont think minecraft's sound engine is capable of earrape
or atleast doesnt do that
wonder if its cause its music its doing that
Normally when you play a sound at a Location it only plays for that location and outwards x blocks
Entity sounds also have the same behavior
all sounds really..
another question... when I change a block from anything to lava. Would ir automatically start flowing without further updating?
like water from world edit?
I wanna place lava that does not flow
this one im not sure as its changed a lot throughout the years
You can listen to BlockPhysicsEvent for that one iirc
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockPhysicsEvent.html
yeee use getSourceBlock() and compare it location + type to the one you placed
declaration: package: org.bukkit.event.block, class: BlockPhysicsEvent
yeah but i would need to check if it's the lava i placed and alot checks to make sure i dont screw my other players.
just just compare locations and types....
HashMap<UUID, List<Location>> playerPlacedLavaPools = new HashMap<>();
is there some simple way to build a jar with gradle when trying to run the server locally in intellij and have it copy the jar to the plugins folder? I can have gradle build the jar before launch but that doesnt inject to the server after
okay.. ill look into it. this seems kinda doable atleast.
I have a more important problem now...
how can i regenerate the chunks to their original vanilla form???
regenchunk is depricated
i didnt find any other solution
declaration: package: org.bukkit, interface: Chunk
yea but when im playing in the chunk and start placing blocks and lava, the chunk IS already loaded..
I just wanna regenerate it when im done playing
ahh i see, while the player is in the chunk that one is gonna be tricky
youll likely have to create your own lil system for that with schematics or flashing the Chunk blocks and then replacing them when the game is over
no... a player wins, all players get teleported a way.. now i need to cleanup their mess
oh so then just load(true)
should work on already loaded ones, if not just unload()
what does that do?
oh..
check java doc here
Whether or not to generate a chunk if it doesn't already exist
ofc ofc
just unsure whtether or not unload() needs to be called before or not, i feel like it may not be needed but if you run into issues try that
that's easy to test.
yee
Easiest way is to use the default world as the lobby. Your game world is another world. Have your world copied somewhere. When the match is over unload world and delete it and then copy world from your master and then load up new world
No need to worry about so called regenerating 
yep that ways defo faster + you can do it async for the most part unlike with regenning chunks
Multiple games can happen at the smae time and end at different times
in the same world
I put a random 9 chunk square from -2999999 to 2999999 and teleport the players to it
after the game is done. i want those 9 chunks to be back again to their og form
while a game is going on. another game can start midway and end before the first, after at the same time. A third party can start playing before the second ends
I cant unload a world and make a new one either too resource intesive
maybe you can make one game happen per region and then just remove the region after
boom. that's waht im already doing
also weird question... how do I make a runTaskTimer stop itself from within?
a simple timer
Bukkit.getScheduler().runTaskTimer(main.main, new Runnable() {
int countDown = 3;
@Override
public void run() {
if(countDown <= 0){
Tools.announce(joinedList, ChatColor.AQUA + "Teleporting...");
new GameLobby(Tools.getLobbyFromOwner(OWNER).joinedList,OWNER);
InviteLobby.INVITE_LOBBY_LIST.remove(Tools.getLobbyFromOwner(OWNER));
//STOP HERE
}
Tools.announce(joinedList,ChatColor.RED + "Game starts" + ChatColor.RESET+ " in " + ChatColor.AQUA + countDown);
countDown--;
}
},0,21L);
cancel()?
i tried that.. doesnt exist
Use a lambda with a task
thanks
BukkitRunnable is deprecated in the scheduler
Bukkit.getScheduler().runTaskTimer(main.main, (task) -> task.cancel(), 0, 21L);
Also main.main 💀
okay...
Main main Main.main
?main
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
if only those rust enums existed in java lol
lmao not the custom result
ive been reading the rust book and i absolutely love everything so far
made me realize that Optional is also poorly implemented
thats what I said
instead of two classes they just do the checking at runtime
but the optional type i dont think would work as well in rust if it didnt have its exhaustive match expressions nor the pattern matching with the if let Some
like thats what makes it mwah
we have a stupid ifPresent
yeahhhh
cant afford doing checks at runtime
even c++ has std::variant :(
i always laughed at them but their newly added stuff is quite good
also being able to implement behavior for types external to your own project is wonderful
no more wrapper
Your best bet still is multiple worlds
You can have multiple games going in multiple worlds this is fine, just append a unique id to each new game world
but we already said how my server cant handle creating multiple worlds
lags the server till death
Well need to start planning some upgrades lol unfortunately cant do everything. Anyways your only alternative is to use schematics with a custom plugin
You would just paste in the schematic in that spot and voila
thanks man.
Could even optimize the schematic pasting by not overwriting thr block if its the one that needs to be there
But yeah that seems your only option at this point
But do plan for upgrading lol
Because at this rate you are going to need it and it will make things easier for you
how do I use an API in my plugin.. this is my first time.
Lets say for example I wanted to use WorldEdit in my plugin
Someone can help me?
For world edit its simple
You just add "WorldEdit" to your depends on section in your plugin.yml (depends means the plugin WILL NOT LOAD without world edit and will load after WorldEdit, soft-depends means the plugin WILL LOAD if there's no world edit, and after WorldEdit)
And then, ofc adding its dependency to your maven/gradle and reviewing the world edit documentations 🙂
some plugins have some extra steps
is there any way to get messages from the server console?
like Headdatabase you need to listen to theyre HeaddatabaseInit event before you can use theyre api
Hello there, I have a quick question: How can I determine if the person setting off the fireworks is a Player?
@EventHandler
public void onInteract(FireworkExplodeEvent event) {
if (!(event.getEntity() instanceof Player player)) return;
if (player.getLocation().getWorld() != PlayerUtil.getSpawnLocation().getWorld()) return;
player.sendMessage(Translator.translate("&4You cannot do this at spawn."));
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(Translator.translate("&4You cannot do this at spawn.")));
event.setCancelled(true);
}
can you explain a lil more
getEntity is a Firework
use PlayerInteractEvent
I need to forward messages from the console
and how do I use the actual API in my plugin code?
Thats where the documentation part comes in, reading theyre docs will show you there api methods 🙂
will be useful for you
thankss
The action of the event of right-clicking on a block with a firework does not trigger its activation.
https://worldedit.enginehub.org/en/latest/api/examples/clipboard/#schematic-examples
Also they do provide an example here luckily @somber scarab
This was my previous code:
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getItem() == null) return;
if(!event.getAction().equals(Action.RIGHT_CLICK_AIR) && !event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;
if(event.getPlayer().getLocation().getWorld() != PlayerUtil.getSpawnLocation().getWorld()) return;
if (event.getItem().getType() == Material.FIREWORK_ROCKET && event.getAction() == Action.RIGHT_CLICK_AIR) {
Player player = event.getPlayer();
player.sendMessage(Translator.translate("&4You cannot do this at spawn."));
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(Translator.translate("&4You cannot do this at spawn.")));
event.setCancelled(true);
}
}
your only checking for air activation on your 4th check
add right_click_block as well
aw shit
use the or operator for that one so both always fire :)) || clickTypeRightBlockHere
Thanks!
@noble lantern Why does my intellij say the dependency in my POM is wrong?
can yah show me it?
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
use worldedit-bukkit
7.2.9....
xD
doubt it may fix the issue though but still good to use the most recent one thats not a snapshot
okay.. i dont think changing anything there will fix it
make sure to add the repo as well
send whole pom?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>floorIsLava</groupId>
<artifactId>floorIsLava</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Floor Is Lava</name>
<description>You and your friends are trapped in a world where lava will rise till only one survives! Who will it
be?
</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>enginehub-maven</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.2.9</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
hmm works for me weird
i doubt this but
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
``` maybe its the repo ID
doubt it though but ***random bullshit go***
After this try invalidating intellij caches if it still doesnt work
?paste
hm...
how do i do that...?
the cache thing
top left -> File -> Invalidate Caches
huh
worked
no longer red
so NOW my plugin will not load unless worldedit 7.2.9 is running
any world edit version should be fine, dev and client versions are diff sometimes
as long as its somewhat modern
theyre api is pretty consistent like bukkit/spigots
oh okay cool
and yeah this happens sometimes, good lil trick to know if your maven/gradle starts acting weird
or like classes randomly stop importing
also there should be a channel for verifying info
its locked for verified users so icant ping it
org.bukkit.plugin.InvalidDescriptionException: depend is of wrong type
yea
wait
should be a string list like this (ignore softdepend its just what im using)
oh space between -
yeh
also why tf am i soft depending world guard wtf 💀
alr then
leftover code go brrrt
the worldedit api docs arent really that clear <.<
can i make IJ enforce this. prefix when its possible on formatting for consistency?
is there anywhere else i can learn them from?
i totally agree and when you ask for help you get eaten unfortunately
not sure but that would be pretty neat though
It DOES automaticallly do
SomeClass.this :p
but thats in some werid lambda cases
🐑da
steal code from github
thats what i do
well "borrow"
i just look at open source projects that do what i wanna do and see how they do it
like the other day i discoevered world guard has its own events and you dont cancel bukkit events for the flags you make
lamb bro
this is what happens when you develop musepluse for 4 days straight
better get atleast 1k downloads
it will be another 3 days
having some maaaajor api issues with hashes + resource packs not workin
so having to wedo some file structuring
i feel so fried from dealing with all this in java
Ill just shuffle through the intelisense and read the objects
so far i know now how to select a region and fill it with blocks
@noble lantern for some reason intellij doesnt highlight errors when made with world edit API calls
I'm going travelling and not sure if I will have internet... With that said I wanted to create an offline copy of the docs so I can still work and access docs if needed. I tried following the guide on spigot website but I got stuck on running the command. I'm not sure what parts of the command to replace with filepaths, and what those filepaths I'm putting there should lead to. Any insight is greatly appreciated. https://www.spigotmc.org/wiki/creating-offline-javadoc-for-the-spigot-api/#wikiPage
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
actually.. no hightlights at alll
Yes
I solved the problem, for those who also have this: I cleared my entire maven repo (I had already tried to simply delete the library in question, it did not change anything)
how to capture server console logs?
How to disable the ability to fish for custom mobs(dolphins)? Spigot 1.20
does anyone know WorldEdit's API??
EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD));
Region region = new CuboidRegion(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD),
BlockVector3.at(gameStartLoc.getX(), gameStartLoc.getY(), gameStartLoc.getZ()),
BlockVector3.at(gameEndLoc.getX(), gameEndLoc.getY(), gameEndLoc.getZ()));
Bukkit.getConsoleSender().sendMessage(region.getWorld().regenerate(region, editSession)+ "");
This prints out the correct region coords and prints out true as well but still doesnt regen the area to its original form
example, not tested
public class NMS extends JavaPlugin implements Listener {
private static final class MyLogWatcher extends AbstractAppender {
public MyLogWatcher(String name, Filter filter, Layout<? extends Serializable> layout, boolean ignoreExceptions, Property[] properties) {
super(name, filter, layout, ignoreExceptions, properties);
}
@Override
public void append(LogEvent event) {
// Something was logged
}
}
{
Logger root = LogManager.getRootLogger();
final Appender appender = new MyLogWatcher("Test", null, null, false, null); /* Not sure if they all accept null, if not get those properties from the root logger or sth, idk */
appender.start();
((org.apache.logging.log4j.core.Logger)root).addAppender(appender);
}
}
you either need to add log4j as a provided dependency, or use spigot instead of spigot-api to have the log4j classes on your classpath btw ^ @rose trail
note, you need the following imports, NOT the java.util.logging ones:
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.logging.log4j.core.config.Property;
import org.apache.logging.log4j.core.Filter;
btw it works fine, just tested it
I wonder what you need it for though, lmao
thanks ❤️
EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD));
Region region = new CuboidRegion(BukkitAdapter.adapt(FloorIsLava.GAME_WORLD),
BlockVector3.at(gameStartLoc.getX(), gameStartLoc.getY(), gameStartLoc.getZ()),
BlockVector3.at(gameEndLoc.getX(), gameEndLoc.getY(), gameEndLoc.getZ()));
Bukkit.getConsoleSender().sendMessage(region.getWorld().regenerate(region, editSession)+ "");
This prints out the correct region coords and prints out true as well but still doesnt regen the area to its original form
my PersistentDataSerializer is now done -> https://github.com/JEFF-Media-GbR/PersistentDataSerializer/tree/main
Is it theoretically possible to put two plugins into one jar?
time to update
Why would you
If you plan to combine Spigot and Bungee, yes that's possible
I'm just curious if that would be possible
So, I can force it to load as a bungee plugin on bungee and as a spigot plugin on spigot?
Two Spigot plugins? You could fizzle around with the plugin loaders. Somehow it's surely possible
Yes, you can have a plugin.yml and a bungee.yml file (I believe) with both different configurations
i dont have time to update 20+ plugins just because of this weird discord change lol
I gotta try that
yeah that's correct
This might be obvious, but just make sure that you aren't mixing up the Spigot and Bungee classes within your implementation
I wonder if it's possible to do packet fckery on bungeecord to make it seem the player is joining an empty world if the backend server is offline
That would be possible
I would bundle a simple Minestom implementation to make it easier
I just gogoled, so minestom is a server rewrite that barely has any functionality by default and you have to make it yourself using the api?
I gotta try it
And it can easily handle hundreds of players
Using a bungeecord as a minecraft server? That's something new
I wonder how many times it's been done before
(learning cmd blocks/redstone first, then brush up on java, & then spigot api) Wrong Discord to post this question in I guess but not in many servers on this new account right now so:
How would I go about using Glow to change colors when a players health state changes using cmd blocks? Unsure if this is a decent example but,
e.g. - Green=20, Yellow=14, Red=8
Likely just setup a loop for all players on the server every x ticks
if health <= amount set theyre glow color to your desires
Is it possible?
I may be misunderstanding but.. you can't fish for mobs in vanilla ?
I'm starting to think setResourcePack isn't entirely working as intended, or I'm horribly misunderstanding something here
I've entirely re-written my file system for creating the resource pack, and afterwards, I still get the expected issue:
- Client has a resource pack for the server already with 3 songs
- Server changes pack and sends the updated pack + hash with 4 songs
- Client says the hash is incorrect, and promptly just deletes the cached resource pack it has, and doesn't bother with the new resource pack that sent from the server
But, after i relog all is dandy, presumably because the server just yeeted the client-side resource pack & can freely download whatever now
So, does this method not automatically clear the cached resource pack? Why cant the client just download my resource pack with the modified hash?
Passing null as a second argument also doesnt seem to follow the documented directions: "If the hash is null and the client has downloaded and cached the same resource pack in the past, it will perform a file size check against the response content to determine if the resource pack has changed and needs to be downloaded again."
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#setResourcePack(java.lang.String,byte[])
anyone experiencing this at all on newer mc versions? Really hate to fill users drives up with renamed resource packs, not sure why this methods so bug-ridden
not using the one with force?
the force just makes them disconnect if they decline the pack
yep, then at least you would see if it's the client not downloading/updating. using force would kick them if it's the client refusing
I use a translator. I need the mob not to be distracted by fishing.
its definatly not the client downloading, im listening to the event already :p
What I mean is the server is at teh whim of the client in many instances
in certain cases the server can tell the client to do something but it can't force it to.
why I said to try with the force set is to see if it's an issue on teh client or the server when it doesn;t download your new pack
if it is kicked the client refused. if it isn;t kicked it's a server issue
Would there be a way to get around it if its a client issue?
I may not exactly understand your problem but maybe you can try sending an empty resourcepack first and then the one with new songs ?
tried that too (just an empty string)
the pack gets removed when server closes anyways
and isnt re-applied until its sent to the client
trying something whacky
my idea is that since the first call deletes the resource pack and results in a failed download, i might be able to just resend it again later
wish me luck 
seems it just ignores it the second time nice
ong the shittiest part of the spigot api ive ever touched
this shits worse than PrepareAnvilEvent
at this point looks like ill just have to spam the users servers resource packs with a bunchf of different-named resource packs
even though it should be an api feature to refresh the pack with a hash (It was in previous versions)
really dumb of mojang to remove this feature
I don't suppose you could shuffle between two names ?
ide be in the same boat of them not updating bc of hash's
this also doesnt work in server.properties tbh
aaah
im just hoping maybe someone else in here has had the same experience as me so i can stop going insane over this can just call it a limitation and move on
its 5am, been at this since i woke up today and its driving me nuts
tldr
the minecraft client is deleting resource packs without re-installing them with hash's
leading in a forced relog for the update to sync
imma try one more thing hrm
yeah apparently cant help with that, no clue of resourcepacks
oh this is mega fucked actually
brilliant api
Failed hash returns a successfull_loaded
this entire method is just fucked in 1.19
1.16 this was smooth as butter and i never even needed hashes
wait, why do you even need the hash ?
There is a method without hash
its to make the client update the pack
yeah that one doesnt make the client update
tried it + javadocs say so
unles you change the name
thats like my only work around rn but changing the name duplicates the files on the client
ill prolly make a spigot bug and see where it goes it put way to many hours into this
1.20 exists
guarantee its even more broken in that version
i knew i wasnt going insane
https://bugs.mojang.com/browse/MC-251126?jql=text ~ "hash" ORDER BY created DESC
So it 100% is some fuck shit with the client then
mojang is lame asf
seems it immediantly broke after 1.16 lmao
there is a workaround there too
it does what im doing already
changing the file name
and forcing client to download an entirely new rsource pack
Hey why can't I cast a MetadataValue object into a ArenaModel object?
public ArenaModel getPlayerArena(Player player) {
return (ArenaModel) player.getMetadata("currentArena").get(0);
}
The object does exist, right here:
public void teleportToArena(Player joiningPlayer,String arenaName ) {
if( this.arenaExists(arenaName) ) {
ArenaModel arenaModel = arenas.get(arenaName);
joiningPlayer.setMetadata("locationBeforeArena", new FixedMetadataValue(plugin,joiningPlayer.getLocation()) );
joiningPlayer.setMetadata("currentArena", new FixedMetadataValue(plugin,arenaModel) );
joiningPlayer.teleport(arenaModel.getLobbySpawn());
arenaModel.getCurrentPlayers().add(joiningPlayer.getUniqueId());
String message = String.format("§f%s§e joined! §a(%d/2)",joiningPlayer.getName(),arenaModel.getCurrentPlayers().size());
arenaModel.annunceMessage(message);
}
}
Thanks in advance.
the getMetadata returns FixedMetadataValue I believe
Caused by: java.lang.ClassCastException: class org.bukkit.metadata.FixedMetadataValue cannot be cast to class bonnie20402.simplespigotplugin.models.arena.ArenaModel (org.bukkit.metadata.FixedMetadataValue is in unnamed module of loader java.net.URLClassLoader @3d82c5f3; bonnie20402.simplespigotplugin.models.arena.ArenaModel is in unnamed module of loader 'SimpleSpigotPlugin-1.0-SNAPSHOT.jar' @30cd2e25)
I can't cast a FixedMetadataValue into ArenaModel
How do I convert it back then?
Ask this first then...
someone pls help
you can cast .value() from the FixedMetadataValue
when ever i do /shopkeeper citizen it says
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
alright
The shop ject type 'citizen' is disabled
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Thanik you for your help
wheneer i do /shopkeeper citizen it says The shop ject type 'citizen' is disabled
how do i fix that
Next time just send one message -_-
How is it related to #help-development
wrong channel heh
can someone help me stil?
ask in the correct channel
seems due to my spark server im actually unable to do this, doesnt respect that link with static resources lmao
oh well i can brush off this 20 gb of extra data as a limitation now though (okay its rly only like 120 mb per pack but still)
"complain to mojang, thanks"
which channel
im not verifed
seems like #help-server question
So if I understood correctly, unless the player leaves the server you can't update the resourcepack ?
If that is the case, you can at least limit the amount of new resourcepacks by sending _0, _1, _2 and reset the count every time the player leaves.
you cant see what packs the client has sadly so its impossible to limit it
And, the reason the relog fixes it is because the clients delete the resource pack
And this is only ever gonna be once while the players are online, packs only get sent to the client when new songs get added and the packs get re-built, however seomtimes if admins are doing configurations then yeah itll reload a few times while the players are online
well you can limit it you just have to force the relog
and im rly going for that seamless feel
I have permissions in my plugin and they are used for certain commands. For some reason, I can't execute some commands even being op or the console. I need it to be usable only by ops or those, who have permissions given by a certain permissions plugin. It works when using a permissions plugin and giving the perms btw.
My plugin.yml looks kinda like:
#
# default stuff like name and version here
#
commands:
tnt:
description: Spawn TNT at your location, also choose the number
usage: /tnt [number]
permission: serverplugin.tnt
aliases: [tntspawn]
permissions:
serverplugin.tnt:
description: Allows you to spawn TNT
default: false
default: op
default: op is the default default lol
he has default: false
yes op is a thing, also non-op
where can I look next time when I have those stupid moments?
google 🙂
thanks
Why can't I clear a metadatavalue after I don't need it anymore? Do I just leave it at memory for no reason?
private Location getLocationBeforeArena(Player player) {
Location location = (Location) player.getMetadata(plugin.getName() + "_locationBeforeArena").get(0).value();
player.getMetadata(plugin.getName() + "_locationBeforeArena").clear();
return location;
}
Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.clear(Collections.java:1086) ~[?:?]
(...)```
Does java garbage man takes care of it for me? There is technically still a reference to it tho, which is what im trying to remove
declaration: package: org.bukkit.metadata, interface: Metadatable
wait why arent you using PDC?
becuase I don't want to save the data
ah i see
Question, is metadata owned by my plugin acessible to other plugins?
I do believe so
Like if for some reason another plugin puts a metadata value with the same key as me would there be any issue?
There should not
alright then using plugin.getName() as prefix is just redundant
yeah, it probably creates a namespaced key from the plugin instance you pass it
thats probably the sole reason for it to want your plugin
10/10 status @noble lantern
I had something similar, but with spigot breaking vanilla feature
Ever noticed how items sometimes just levitate ?
Can be mostly seen when deforesting
I found the cause... after looking for it for hours and after building a redstone machine that exploits a vanilla item optimization
SPIGOT-7118
How do you make a project modular? I know it sounds a bit weird but lets say I have a permission plugin. I want this to be divided like permissions-api and permissions-plugin how do I do that with maven?
using latest?
its honestly amazing how many bugs are in this game and then you think you found some unique bug only to google it and shitloads of people including large yters even knew about it 
hmmm
You can simply use maven modules :))
I wonder if I still know some obscure ones 🤔
i wonder if the statistic bug i found got fixed
nice thanks
are you using latest?
also could you send me that resource pack
dw its a mc bug
past 1.16 hash's seem to say no
doesn't mean we can't make a pr to spigot to fix it
its a client thing
I wanna see you fix client
with spigot
client isnt redownloading the resource pack after clearing it
well generally the fix has always been renaming
and sending it againg a few seconds later doesnt help it, tried that too
yeah im doing that
but it created a bunch of files
but is what it is
"limitations" ill put it with a warning in the readme
I will have to take a look at the client code, might still be able to patch on spigot side to handle it
I get that
mojangs incompetence
but you are not understanding either
lets say for example the client hashes incorrectly, a fix would be to also hash incorrectly on the server side
it would match so as long as you are doing the same on server side
but you dont want them matching...
I said for example....
its an answer to those curious how you fix a client bug from the server side, answer is you don't, you just treat it like a feature 😛
yep hence why im just renaming files and pretending hash just doesnt exist anymore
So you're saying you want to create a workaround inside spigot just for this bug ?
using uuid's as a makeshift hash
aint worth it mojang just needs to fix theyre shit code
they just need to make the client redownload if the hash's mismatch
find a security vulnerability in it somehow, that'll force them to fix the bug :D
currently it just deletes and says thank you i successfully loaded the pack to the server
this isn't the first time bukkit or spigot had to do such things because mojang
it was quite common to fix Mojang mistakes and if it couldn't really fully be fixed, you just put a band aide on it and called it good 😄
i wonder if minecraft deletes server resource packs after some time
no
so they just indefinitely sit there dang
can someone help me understand inventories better?
I found this: https://www.spigotmc.org/threads/creating-guis-the-right-way.156378/
but I don't really understand it.
I need to make a "trade" gui, on the left i put 1 item and on the right i get an item in return, how do i check if im putting the right item in the right slot? I dont want to be able to put anything on the right side either. I also dont understand while i need to identify the inventories by uuid, im only making 1 gui and thats it. can someone help me please?
The UUID is used to identify who has the GUI currently open so you can do actions in the correct gui for the correct player.
You may be making only one gui, but there might be multiple instances of it.
making a trade ui like that will be kinda hard
yeah its my first time handling guis like this aswell
you gotta cancel the event based on which slots are interacted with
I cant avoid guis forever tho i gotta learn at some point lol
IMO smiles guide is 10x better
when you cancel a click event for example it will not allow you move the item to that slot
i had an idea with villagers which is what i saw on another server, villagers do the exact thing i want to do here
but idk how i can make dynamic trades with villagers, do i listen for inventroyclickevent?
and making custom villagers seems like more of a hassle
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
also is filled with a bunch of info you can read up on as well
and paginatation is super easy to implement with it
Idk how i can make a gui class for a gui like this tho
its too specific to make a general class for
your supposed to have a interface to make manipulating inventories easier, and you implement/extend said interface to create your "general" class
thats what smiles guide takes you through
class hierarchy 🙂
ah thanks but i think for my idea guis arent suitable and i should probably work with a villager since it already has the concept im looking for. i do need to learn guis so i might just do it just for experience haha
i have a menu interface and a basic implementation for it which does stuff like handle click events and add items to the inventory, then I have my specialized menus built on top of that basic implementation
idk how easy it is to customize the trade screen
p easy you just edit MerchantRecipe's on a Merchant
yeah surprisingly its one of the easier things to do lmao
basically like making a crafting table recipe
you can edit it before actually
Merchant itself store the trades
so youll never need to touch any invent code
basically what im trying to do is:
I have custom items with custom durabilitys and custom xp values, so for example a blood axe or whatever that is damaged to 100 durability would convert into 100 xp bottles. I dont know for sure which item im going to get in the trade so i need to change the outcome according to whatever item the player puts in
oof
ikr
i saw it being done on a really old server that was also on legacy versions tho
with villagers
you can probably do it with packets
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/MerchantRecipe.html
update it does support item stacks
declaration: package: org.bukkit.inventory, class: MerchantRecipe
but its complicated
update im on 1.12.2
addIngredient(itemStack)
even more than just making the custom gui probably
that api should be there
i mean i want the best for my server but....
if not then update
i cant update sadly
either way, 99% sure those classes exist on 1.12
just type em see if they do
Merchant might be AbstractVillager on that version if Merchant doesnt exist
so it is possible to change outcome while the inventory is open right?
no i checked it exists
not with villagers no not really
you set theyre trades before the gui is open normally
do I have yo use Spigot to work? I use paper
I guess that you are accessing NMS in one of your plugins, whose dependant Spigot version differs from the one that you are running right now as your server
= That plugin likely only supports 1.19.4
I completly forgot
wait if I use 1.19.2 and add Via version will that work fine?
or do I add support for all versions
For some reason my plugin doesnt appear on a friend's server. The server is 1.19.3, it is located in the server's plugins folder but for some reason it doesnt appear on the server. Is there something wrong with my code? I can send the .xml and .yml if needed.
I was asked to host a treasure hunt for the server so i need help
check server log for errors