#help-archived
1 messages · Page 167 of 1
why does nocheat plus lag my players back
there are forums for that
ok do u have a link
use google
??111 whats google never heard of it
what is windows
what is love
How would the clientbound packet that shows text right above the inventory be called?
I can't seem to find it on wiki.vg
this maybe?
why are people so hateful regarding a free anti cheat?
Which packet do you mean
@nimble stump The text right above the inventory
Yeah that’s the action bar
Ok thank you , i had no idea it was called like that
IChatBaseComponent
There’s the packet
Player#spigot()#sendMessage(messageType, message);
It’s a game info chat message
oh so it's a special chat message type
Also
That one apparently accepts the new JSON formatting
Instead of the legacy color codes
im on 1.8.8 🤷♂️
wow
Then yeah use the chat one
yeah it's this 99%
Hey guys 🙂
I need to store a bunch of objects into a file as part of my plugin
Is there any standard procedure for doing this?
could you link me to a guide?
Alternatively
I have no idea how to do any of those things ;-;
in SQL?
I'll explain what I have
I'm making a crate opening plugin
so on a server, you can get crates
when u right click on it
bunch fo items scroll across the screen
yeah my option was probably what you needed
u get the one which lands in the middlle
I need to store the objects inside the crate
and the weight of each item
I actually had made such a plugin some time ago
but I also am going to have multiple crates
I actually had made such a plugin some time ago
@sturdy oar cool
Use yaml configs
guid plzz
Already built into spigot
If it's going to be configurable by the user definetively don't use JSON
it is
9yo kids will be scared to edit .json files
ah
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
my plan is to allow users to make they're own crates in game, and stick in all the items they want in game
declaration: package: org.bukkit.configuration.serialization, interface: ConfigurationSerializable
If you use JSON you’ll need to shade in an external library
I'll check them all out
Do you know how to do that?
If you use JSON you’ll need to shade in an external library
@nimble stump no
nope lmao
GSON is already present at runtime
as I said, I'm new to this 😮
Gson is shaded in now?
@formal nimbus I would recommend using the config system spigot has built in
what do you mean by shaded in?
It’s very easy to use
No need to over complicate things
hmm
If i use that, how easy will it be for people to edit the config file?
Very
because I feel like being able to create crates in game and in the config file will be veru useful
kk good
@sturdy oar says deprecated
because that means people can copy config file text
Yes
Then it's somewhere else, but it must be shaded in , because 2 of my plugins entirely depend on GSON and i'm not shading it
¯_(ツ)_/¯
I mean it’s definitely in there
But if it’s deprecated it means they may remove it any time
anyway, time to read these guides. Thx for help! I'll come back if I have any more issues
wait
Yes?
@nimble stump are you a mineplex dev?
I was the lead dev until this month
ah
Guys i dont Want drop items on death. How can i make it ?
The server’s doing very well
it was a good server though ;-;
teach me how to code mineplex style :d
hmm, not as well as it used to do
Guys i dont Want drop items on death. How can i make it ?
PlayerDeathEvent#getDrops
my experience was trash
👍
bought a product on mineplex, didn't receive it in 24hours, asked refund, got money back, got banned. If you think this is normal @nimble stump
yes
they didn't respect their 24h delivery
Technical difficulties do sometimes happen
bruh, dont play minecraft, just develop
they offer refunds don't they
You should’ve gone through the support system, they could have easily sorted your rank out
It’s pretty standard across the board to ban chargebackers
🤷♂️
is mineplex hiring minigame devs ? 👀
@nimble stump how does mineplex do it's double jump?
there’s a jobs page
cause there's no way to detect somebody tapping space key in mid air
ahh
@formal nimbus ToggleFlightEvent
yuh
but you need to give them flight on movement
or playerjumpevent on paper
that's kinda cool
or Jump statistic increase on Spigot
They never actually get to fly
@nimble stump unless the server lags
Is there an event for statistic increase?
There's an event, yes
That’s just client side @formal nimbus
hmm
The client can do all sorts of dumb shit when the server lags
PlayerStatisticIncrementEvent
lag for a second, it still happens
Your client can send movement packets sure
But still the event will get fired a LOT. Its probably cheaper to just poll the statistic every tick. Or better is PlayerJumpEvent
Polling every tick sounds far more expensive than listening to the stat increment
Pretty sure PlayerJumpEvent in Paper listens to the stat increase event
smile just do a small check to trigger it on block change only
the event is not heavy if used correctly
it's just gonna show pain fast if used incorrectly
well that would be a bummer because internaly the server can tell when the player is jumping
Oh thought it would fire for every statistic... in this case its probably cheaper. But there are some statistics that would mean the event would have gotten fired several times per tick per player so i thought polling was better.
i think this way is a joke
I got
mavenCentral()
maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}
dependencies {
compileOnly 'org.spigotmc:spigot:1.16.1.-R0.1-SNAPSHOT'
}```
in my build.gradle and when I try to build it i get this:
```Could not find org.spigotmc:spigot:1.16.1.-R0.1-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.16.1.-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot/1.16.1.-R0.1-SNAPSHOT/spigot-1.16.1.-R0.1-SNAPSHOT.pom
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.16.1.-R0.1-SNAPSHOT/maven-metadata.xml
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot/1.16.1.-R0.1-SNAPSHOT/spigot-1.16.1.-R0.1-SNAPSHOT.pom
Required by:
project :```
Spigot server dependency is not hosted on the Nexus. Would be distributing the server jar
It should be in your local maven repository after running BuildTools as it local installs it for you
guys how to check when a pressure plate is activated? (by a player or by an item)
PlayerInteractEvent with Action.PHYSICAL for the first one but I honestly don’t know if an event gets fired for items
tried already... also doesn't work if the pressure plates are gold or iron ones
they are not recognized in the PlayerInteractEvent, one way could be to use a PlayerMoveEvent and check if they step on a pressure plate, but it won't work with items
I need it to be working for both players and items
like that if they throw an item on the pressure plate and they don't have permission the pressure won't power on
It should be in your local maven repository after running BuildTools as it local installs it for you
@subtle blade when I run this https://hub.spigotmc.org/jenkins/job/BuildTools/lastBuild/ it downloads 1.15.2 I need 1.16.1
—rev 1.16.1
Like this? java -Xmx1024M -jar BuildTools.jar -rev 1.16.1
yea --rev 1.16.1 should work
Ok it worked thanks
Also @zealous shore you are looking for version "1.16.1.-R0....", you got an extra period in the before the -
yes i noticed that lol thanks
need help, when i run buildtools it says java cannot be installed
@undone pine What?... Install Java then i guess.
and the run the build tools with something like
java -jar BuildTools.jar
Go into your terminal and type
java -version
to see if you got java isntalled
mfw not having Java installed
What is this, 2002?
i have java installed 🤦♂️ but it still doesnt work
what version?
java -version <- What did you get
why the prefix of luckperms isn t showing
Have you java installed @left walrus ?
yes
XDD
- Tell us what you did
- Tell us what you expected to happen
- Tell us what actually happened instead
i have essentials not x
do you
have a
chat plugin
Hello quick lazy question: what's the max progress value of a bossbar?
1.0
Thanks
i have essentials not x
@left walrus why lmao
I don't see any reason to use Essentials over EssentialsX in 2020
Maybe he runs 1.7
😂
@sturdy oar thanks i has an old version of essentials.
yeah EssentialsX is the updated fork
thanks
👨⚖️ ok
Weeks ago I filled the SpigotMC CLA but did never get a response, anyone knows if they reply every petition?
I don't think they're ever replied to, but it's possible you would have access at this point
?stash
If you have access to the PRs, you're good to go
tried toString'ing a Location but it shows like this in a .yml
Location{world=CraftWorld{name=world},x=86:
0,y=64:
0,z=187:
0,pitch=0:
0,yaw=0:
0}: 1594302452063
You could edit this by making your own toString right?
So I created this:
public String locToString(Location loc){
return loc.getWorld().getName()+","+loc.getBlockX()+","+loc.getBlockY()+","+loc.getBlockZ();
}```
Attributes is so confusing
but the main questions i what should this be replaced with rn?
for (Location blocation : Bucket.blockLocation.keySet()) {
getConfig().set(blocation.toString(), Bucket.blockLocation.get(blocation));
}```, Created the weird setup in config. I want it to get the location from the locToString()
config.yml isn't to be found
:/
shouldn't it create it automatically?
it should
try creating one and do it
where do I make it?
what or where
do you store anything in it?
yes
I'm storing crate objects
I'm going to break them down into primatives
store the primatives in the folder
then reconstruct them on load up from the primatives
k...
unless you got paths already
wdym?
have you looked at a tutorial or something for creating custom configs?
Would suggest that to understand it better
have you looked at a tutorial or something for creating custom configs?
@frigid ember I have a guide but I thought keepign it simple would be better
what ide are u using?
why are you making it like me jetcobblestone jetcobblestonecrates
include .
me.name.project
its ur choice ofc
but it will look clear
¯_(ツ)_/¯
hi
hi
how hub ?
@frigid ember it has been made 😮
🙂
Hm, still can't find a way to edit attributes.
./sethub
nice
that was the easy part @formal nimbus
does spigot support gui? and how i make my server support it
the hard part is making it configurable
well not even that difficult
but storing/loading hashmaps is a bit difficult
I don't think they're ever replied to, but it's possible you would have access at this point
@subtle blade im not even able to log in. "You do not have permission to access Bitbucket". Should I resubmit the CLA?
but storing/loading hashmaps is a bit difficult
@frigid ember I aint storing hashmaps, I've already written some code which should store a crate?
I've probably butchered it tohugh
*though
;D
Which line should it be on
😮
it has worked...
kind of
the itemStacks aren't great though :/
I don't think I'll be able to reconstruct an ItemStack from that ;-;
when you bug disappears when you add debugging code and you don't know why...
lol
the issue was occuring, then coudn't nail down what packet it was overflowing in, but I think theres some sort of buffer overflow occuring that happens only in rare cases
You should be able to reconstruct an itemstack by using ConfigurationSection#getItemStack() @formal nimbus
config.getItemStack("cool.location");
wdym? it just looks like your console is reading the colorcode a bit wrong
Does Player#setGamemode requires the player to be online? If not how does one change the gamemode of a player that left the server
§ is for old color codes, hex is new and not all plugins support it
@sturdy oar I belive the player needs to be online, but you could set it when the player joins or leaves. You probably also modify the player file directly but I wouldn't suggest it
There is §x everywhere
@graceful wagon §x§0§0§8§0§8§0 would be #008080
is there anyway I can set a variable declaroid to a value inside of a config file?
I was making a small plugin that gives spectator and action bar on death for 5 seconds, however i have to think of all possible cases, such as player quits during that
actually...
ah cool didn't know Netsu :) I haven't used spigot 1.16 yet
I don't think I need to do that....??
What exactly are you trying to do?
o sorry
didn't see ur msg
I'm trying to make a function which loads my crates back in
@mellow wave
I've made this xD
the problem is
my list will just be filled with a bunch of crateObjects called 'crate'
I just tried running the function 😮
no errors
but I have no way of testing if it workjs xD
Yeah you need to make sure that you have a fail safe incase a user adds the wrong type of object in the config
ah
how to do dat
try except?
what if I just yeet the entire thing in a try and catch
and if I get an error, just say 'invalid config'
how vague 😄
You could but if you use config.get<insert type here>("locationHere", defaultValue") then it should solve most of the issues
com.comphenix.protocol.reflect.FieldAccessException: No field with type byte exists in class PacketPlayInChat. I've tried setting the Chat Packet Position, which is marked as "Byte" value in Wiki.vg, however it says that there are no fields of that type? Am I doing something wrong here?
why don't you check the nms too?
me?
com.comphenix.protocol.reflect.FieldAccessException: No field with type byte exists in class PacketPlayInChat.I've tried setting the Chat Packet Position, which is marked as "Byte" value in Wiki.vg, however it says that there are no fields of that type? Am I doing something wrong here?
@sturdy oar so did you set the index as 0 or 1?
yes fendi
@frigid ember i'm setting byte index 0 , to (byte) 0x02
it only has a string
the packets wiki has a backup copy for 1.8 in the history part
yeah in fact
still a string
protocolib has a issue with explaining stuff like this...
maybe it's client side
youre not the only one who encountered this issue
try writing in index 1 and see if that works
i don't see byte values tho in NMS
and try writing chat before byte (maybe it has an issue with that?)
is wikivg wrong
it's not wrong, just confusing
Does anyone know a good plugin(s) I can use to make a menu item. I need an item that will execute a command on right-click and be locked on the 9th slot. If anyone knows a plugin that can do any of that I would be very grateful if they tell me which one because I can't seem to find any. I've already made a whole menu, but I want it to be accessible via a simple item.
and it may just count starting at 1 for no reason
Great
I just loaded and used a crate from a config file :0
Last time I used ProtocolLib index started at 0 tho
that's actually suppeppreprpprepr cooool#
at least for read
big hype
I'm trying to make a function which loads my crates back in
@formal nimbus for what you are trying to do, you should use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/configuration/file/YamlConfiguration.html
Is an extension of FileConfiguration and it handles all the process of loading the data.
declaration: package: org.bukkit.configuration.file, class: YamlConfiguration
Read what he just said instead
@sturdy oar there are multiple get byte methods for protocolib, have you tried them?
with PacketContainer I mean
getBytes is the only one which would make sense tbh
I'm trying what you told me but i don't think it has any effect
have you tried
looking up instances of that packet code on github
to see what others are doing?
oh wait i think maybe i found the issue
hm?
let's see if it works now
well it's just a string input
yay, it's not perfect but i like it
Note: PacketPlayIn = Client -> Server, PacketPlayOut = Server -> Client
there's so many things that can't be done with Bukkit\Spigot , so i had to learn packets
there's also NMS as well
really lacking libraries for that except for that nbt library
The next thing I'm going to do is place a "fake" player sleeping where the original one died
this is going to be fun
Version?
?
What's the version you're doing this on?
1.8.8
Oh yeah good luck :D
i mean it's pretty much the same on 1.16 still
permissions:
- smm.founder
- smm.managegroups
Pretty sure someone asked this last night but I wasn't there for the answer.
How can I make the config write to the permissions key, adding to the list that smm.founder and smm.managegroups are in?
I think with that fendi
hmmm
you just send a create player packet to a bunch of people
yeah i know
I have encountered a strange issue
so I have this function:
most of it you can ignore
this part at the bottom is the important bit
@tiny pebble are you asking how to add another value to the permissions key?
yeppers
when I call the function, I run a little debug
to add it just like how the list is
@tiny pebble are you using YamlConfiguration configs?
👍
and also every time an item is added to the list, I send a message
the function is called twice, as we can see
but there are 4 items in the list
??
how does this make any sense?
@tiny pebble those are a list of strings, so you can get them using config.getStringList(path);
Then modify the list and save it
I only call 'crateList.add(crate);' twice, yet 4 items are added?
well I tried groupsConfig.getStringList("groups." + groupString + ".permissions").add(perm);, and it didn't add 🤔
if you look at the list printed, each object added is repeated twice?
never mind, ignore everything i have said lmao
I'm just dumb
@tiny pebble
Create a new list object, add to that and then save it. It won't update with the way you did it
I already incoperated the crate being added to the list when the crate is created
>.... [15:15:59 WARN]: Can't keep up! Is the server overloaded? Running 69817ms or 1396 ticks behind
>.... [15:16:02 INFO]: [WorldBorder] [Fill] 125 more chunks processed (1107139 total, ~2.8%) (free mem: 5214 MB)
>.... [15:16:07 INFO]: [WorldBorder] [Fill] 312 more chunks processed (1107451 total, ~2.8%) (free mem: 4990 MB)```
anyone know why is this shit?
private void saveDataBlocks() {
for (Location blocation : Bucket.blockLocation.keySet()) {
getConfig().set(locToString(blocation), Bucket.blockLocation.get(blocation));
}```
I also need to get the value of the hashmap, how would I fit that in here?
worldborder loading so slow
and having 0tps
Make another for-loop but than with Bucket.blockLocation.values()?
or is there another way:p
@frigid ember Bucket.blockLocation.get(location) ?
?
public static final HashMap<Location, Long> blockLocation = new HashMap<>();
the Long
got it to work! thank ya 😛
Am I not getting something here? you're already getting the long value at Bucket.blockLocation.get(blocation)
:D
guys, how to convert a string to an int?
Integer.valueOf(string)
@formal nimbus
hmm
I think you didnt read me before, but you should use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/configuration/file/YamlConfiguration.html
declaration: package: org.bukkit.configuration.file, class: YamlConfiguration
It handles all the data loading
but I just did it ;-;
huh
@frigid ember the only two time I worked with worldborder, it was slow as fuck, I don't remember the ideal configuration I found (I believe it was 4 chunks per tick? Don't know exactly), but having no players while it generates chunks helped a lot with the crashes lol
It reconstruct the objects used to generate the saved files
cool
it doesn't matter now tho
I just got my stuff to work
and the config is really easy to edit
well, creating the ItemStacks in a config file I guess isn't
but that's why I'm also going to have an in game way to create them
@frigid ember is there any better plugin
or way to do it faster? this is slow af
If there is, I don't know of any
Is anyone aware of the *@r @e @p etc selectors not working in command blocks for custom plugins?
If you want faster world gen then upgrade the host. Worldgeneration takes time
@peak marten Selectors only work in vanilla commands or plugins that has addedd support for it. If the selectors doesn't work then you probably have essentials installed which is overriding the commands. This can be bypassed by adding minecraft: before the command
So the command block is unable to determine the nearest or a random player if it is not a vanilla command?
someone is asking me why /somecommand @p is not working
I do however know of another "version" of a Minecraft server that is not made in Java, it does save the worlds in the same format, and you can tweak a lot of values for world generation and it is blazing fast. I could have used that for world generation and upload it to the server later
But again, it's not Java, and it's most definitely not spigot (and it's 1.12.2)
Command blocks are only running the command. It's up to the plugin developers to make the selectors work
I'm the plugin developer, so how do I make the selectors work then?
I need to manually code the logic ?
for nearest, random, etc .. ?
Yes
I belive so I haven't seen anything better
I believe you can make some voodoo magic to hook your plugin with Brigadier and the selectors will work
^
voodoo is always nice
But that's a bit next level, for me at least lol
Yeah I've never even tried to use Brigadier
This also looks interesting:
most likely that is the solution
Looks cool never seen it before, bookmarked for later use
Oo that's interesting
There is a methor for plugins to use selectors
it's from md5
Bukkit#selectEntities()
That's exactly what the demo is showing lol
Yeah
Never heard of it
So basically getServer().selectEntities( sender, arg )
and arg is @p for example
Looks like it is
How do I make custom names to not show?
the isCustomNameVisible()
seem to only get the result
ok i found it
nvm
👍
I've created a PersistentDataType for storing UUIDs in persistent data (with a lot of help from here), but whenever I'm trying to use container.has(UUIDKey, uuidType) to check if anything is set, I'm getting a null pointer exception, and I'm not sure if its something wrong with my container, or if its something wrong with the PDT I made. If anyone wants to look this over heres the code, null pointer exception on line 9 https://pastebin.com/7A5wwt1T
private final HashMap<Location, Long> blockLocation = new HashMap<>();
public void checkBuckets() {
new BukkitRunnable() {
@Override
public void run() {
for(Location b : blockLocation.keySet()){
long placeTime = blockLocation.get(b);
if ((placeTime + 2000L) <= System.currentTimeMillis())
{
b.getBlock().setType(Material.AIR);
blockLocation.remove(b);
}
}
}
}.runTaskTimer(this.plugin, 0L, 100L);//20=1s
}```
im using this but after the restart when I saved the hashmap and loaded it
the water doesnt get removed
this is just the part that should check wether there is information in the hashmap
@frigid ember sorry if I ping you , however you seemed experienced with this:
do you know if it's possible to send a player in the sleeping animation, but without actually spawning it?
im using this but after the restart when I saved the hashmap and loaded it
the water doesnt get removed
Are you sure you loaded properly the data from your data file to the memory?
yes
can we see that
private void loadData() {
if(getConfig().getConfigurationSection("data.playerdata") != null) {
for (String str : getConfig().getConfigurationSection("data.playerdata").getKeys(false)) {
Location blocation = (Location) getConfig().get("data.playerdata");
long seconds = getConfig().getLong(str);
Bucket.blockLocation.put(blocation, seconds);
}
}
}
private void saveDataBlocks() {
for (Location blocation : Bucket.blockLocation.keySet()) {
getConfig().set(locToString(blocation), Bucket.blockLocation.get(blocation));
}
saveConfig();
}
public String locToString(Location loc){
return "Location: "+loc.getWorld().getName()+", "+loc.getBlockX()+", "+loc.getBlockY()+", "+loc.getBlockZ();
}```
loadData(); in onEnable saveData(); in onDisable ofc
Location blocation = (Location) getConfig().get("data.playerdata");``` Maybe its this part
must be it than
only part where I have my doubts about
cuz the path leads to the whole config.yml part basically
There are things that should be changed:
- First, in getConfig().getConfigurationSection != null, use
getConfig#isConfigurationSectionits better - Don't use Map.keySet, use instead
.entrySetto iterate all data, so you can get safely the Long from the memory hashmap.
Also data.playerdata actually is a ConfigurationSection?
@rare prairie how would I get the Location on loadData()?
use list instead and cast to List<Location>
out of the config.yml
Hey! how do i disable seeing these messages?
okay thankyou 😄 sorry if i interrupted some important chat or something
nah bro ur good:D
It's all good
can someone help me im new to spigot and i got this error when i want to enter this thing:
java -jar BuildTools.jar --rev 1.15.2
and then i got this message that i believe its an error:
BuildTools requires at least 512M of memory to run (1024M recommended), but has only detected 247M.
can someone help me because im new here ;-; so im stuped
You need more ram
@rare prairie List<Location> sorry how exactly in this Location blocation =
The setCustomNameVisible(value) isn't working I set the value to false and then even logged the value to check if it's false but the name is still visible when hovering over the mob
You need more ram
my laptop ram?
Yes
Yeah, that's saying you only have 247M available
Probably close all other programs that might be taking significant portion of your RAM maybe
ohh ok thanks its working now 😄
The
setCustomNameVisible(value)isn't working I set the value to false and then even logged the value to check if it's false but the name is still visible when hovering over the mob
oh it's working I misunderstood what visibility false actually meant
@rare prairie List<Location> sorry how exactly in this Location blocation =
? ;p
Is there a way to have multiple ender dragon fights active at once?
becuase the EnderDragon.Phase is static
I have a PlayerJoinEvent that checks for a players permission group within my custom config, and adds their permission on join. It works, but if I update my config and save it, I have to reload the server to get it to apply again. I'd rather have it so they can just leave and join again. Is there a way I can make it so it doesn't need to reload?
TL;DR the config only actually updates when the server is reloaded, can it just update whenever I save it or nah?
? ;p
@frigid ember
List<Location> list = (List<Location>) getConfig().get("data");
ohh that'll get it?
if that a list of location
Type safety: Unchecked cast from Object to List<Location>
I have a PlayerJoinEvent that checks for a players permission group within my custom config, and adds their permission on join. It works, but if I update my config and save it, I have to reload the server to get it to apply again. I'd rather have it so they can just leave and join again. Is there a way I can make it so it doesn't need to reload?
@tiny pebble you can schedule a task that checks if the date of last modification of the file has changed, and then, reload the data
Type safety: Unchecked cast from Object to List<Location>
add a suppresswarning above that
or ignore it
hm alright, i'll see what i can do with that
Bucket.blockLocation.put(blocation, seconds);
but my hashmap is Location, Long
and now I have to set put(List, Long) Basically
use for loop to add locations
bruh, I'm said this how you can
@covert bronze is there any sort of eventhandler for checking for the configuration or nah hahaha that would just make it easier if anything 😛
i doubt there is just wondering
@SuppressWarnings("unchecked")
List<Location> loc = (List<Location>) config.get("data.loc");
if (loc == null) {
return;
}
for (Location l : loc) {
map.put(time, l);
}
they only need to be get out of the config
Does JavaPlugin#reloadConfig() reload every config, or just config.yml? I have a custom config
alright
Guys, i need some help with NMS DataWatcher, I'm not familiarized with metadatas, for some reason when I spawn a fake player npc, the Hat dosen't show. This is my actual code: npc class https://paste.gg/p/llgava/4f3dd08d9eae46e7a2efae1d6c251f05 | Screenshot in-game: https://imgur.com/a/zrB897g
Weird question, is there a way to convert a String to a Player, or something similar? Basically a way to get Player from their display name... so the opposite of Player#getDisplayName()
because you need to set the datawatcher that shows the outer layer
ah i could do a loop through all UUIDs of all online players, seeing if it equals a player display name..?
because you need to set the datawatcher that shows the outer layer
@tiny dagger And how I can do this?
Weird question, is there a way to convert a
Stringto aPlayer, or something similar? Basically a way to getPlayerfrom their display name... so the opposite ofPlayer#getDisplayName()
getDisplayName returns the colored and/or chat thing, usePlayer#getName,Bukkit#getPlayer
datawatcher.set(bt, (byte) 0xFF);
this is how it would look on 1.14.4
ah okay
datawatcher.set(bt, (byte) 0xFF);
this is how it would look on 1.14.4
@tiny dagger I'm using 1.12.2
well find the datawatcher for 1.12,2 then :p
ahhaha, ok, I will search about it, if I need some help, i quote you, thx man
no problem
Alright so basically... I want to get the user's UUID from their name, because I already have the name and it's set up like that for my config. The reason why doesn't matter. But, my goal here is to get their UUID from their name as said. So, is there a way to get their UUID from their name, being the Player#getName()?
preferably without a whole buncha for loops since thats the way i know how to do it, though if there is a much less complicated procedure that would be lovely
Bukkit.getOfflinePlayer("test");
OfflinePlayer is not null
therefore you can get it's uuid
I know, I was going to have a way to listen to a name change and reset the config, but meh
actually i guess i'll work on making it based from uuid's, having the names in another config
yeah that makes sense
Getting an offline player from their name is blocking if player has never played on the server before
You can try and parse usercache.json for name->uuid conversions though
At that point you'd just use Bukkit#getOfflinePlayer(). That's where it pulls from
Yes, but it'll also pull from the server if it can't find one
Which for me usually takes more than a second.
commands cant have spaces
you can have arguments in the command
or you could make another command that just runs /warp shop as the sender or something
No, the command would be in the yml file. If it were /warp shop, warp would be in plugin.yml. In your CommandExecutor class, you would just do an if statement to check for your arguments.
if (args[0].equalsIgnoreCase("warp") {
...
}
Also just wanted to say Bukkit#getOfflinePlayer(String) is deprecated, so idk why that was recommended to me. I have the players stored as UUIDs, though I don't want a command to execute using the player's UUID, and rather using the string. So could I go from string to Player to UUID...? Haha this is getting out of hand for me
The reason Bukkit#getOfflinePlayer is depracated is because if a player by the name hasn't joined the server, it'll make a call to the mojang servers to find the player information, which is potentially blocking. I.e see the source:
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/CraftServer.java#1419
Now, if you know the player has joined, then you'd be fine using that.
Ah, I see! Sorry for the misinterpretation, that's on me
You didn't necessarily misinterpret anything 🙂
Yo. How do I manually make the player glide?
I made sure that the player 1) is in the air, 2) has an elytra
declaration: package: org.bukkit.entity, interface: LivingEntity
I tried doing .setGliding(true) but that did not work
Tried that.
I'm on version 1.12.2 BTW
Not sure about legacy versions. You'll have to do your own debugging
Okay
Can anyone explain me a few things about the Paper Timings
Paper is a fork of Spigot - you'd be better off discussing it on their discord
ok thx anyway
@wraith thicket What are the things that toggle off gliding?
Same method, pass false
I know, what are the things that you do in minecraft that toggle off gliding?
automatically
When you hit a wall/ground? I don't know - you can try it and see
Can anyone help me with some questions about the Paper Timings
In the proper server, go to paper
Search for the fork on google - you'll find their website along with their discord
Wait, what does .setGliding() even do? Does it make it so you don't have to click on the spacebar?
Javadocs I linked to:
"Makes entity start or stop gliding. This will work even if an Elytra is not equipped, but will be reverted by the server immediately after unless an event-cancelling mechanism is put in place."
https://prnt.sc/texv83 this is "gliding" correct?
how I can get all generated Chunks in a List or Collection
You can't and don't want to either
You can use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#isChunkGenerated(int,int)
declaration: package: org.bukkit, interface: World
The issues is, a semi-large server could have generated literally millions of chunks
Hi, I’m just wondering why checking for left click air always returns false?
void onAbility(PlayerInteractEvent e){
if(e.getAction() == Action.LEFT_CLICK_AIR) {
//do stuff
}
}```
Just a quick example but the //doStuff will never run because for some reason the event always returns false
Do you have the @ EventHandler annotation and register the event?
So if later on I’m trying to check if the event has been cancelled to run other code, it’s always already cancelled
Yeah yeah that’s just quick code I’m doing to showcase my point
I've personally never had this issue before
All the code worked beforehand but now in latest spigot it’s always returning false
Let me pull up some of the actual code
It's because when you click the air - nothing is supposed to happen
The javadocs are quite clear:
"This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air)"
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
But we have a plugin that makes stuff happen when you left click air
Great
xd
But that doesn't mean the event will be uncancelled, unless you set it to be
but we can't check for it being cancelled as it's always cancelled
can i paste some code
?paste
i'll cut out unnecesary parts
?paste
?paste
But what you can do is set the event as not cancelled in the LOWEST priority event handler
And then have other handlers at normal priority
In the newest version of spigot, even with no plugins
there is a lot of lag
and the server times out
try Paper
You can use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#isChunkGenerated(int,int)
@wraith thicket So i thought I can make a plugin that load a chunk than clear all entities and than unload the chunk and all this with every generated chunk so I can do a hardly entity clear when nobody is on the server
I hope you understand what I think
Is there a way to check if a ConfigurationSection's keys have a key of their own all at once? Checking the keys of a key's key 🤔
Basically:
groups:
a:
users:
b:
c:
d:
I want to check if ANY of groups' keys have users, such as a does. But I don't want to loop through, because then it checks a, then b, thenc, so on
isSection
so for each configuration
check the keys gotten if they are sections on their own
so just... isConfigurationSection("users")? I don't have to give a direct path? If I do give a direct path I'd have to provide whether it's a, b, c, or d
yeah
huh, didn't think that would work
there is no way to just parse for those without actually knowing
But what you can do is set the event as not cancelled in the LOWEST priority event handler
And then have other handlers at normal priority
LOWEST is called second to last
Actually, nevermind. Ignore me lol
You're right 
It's good to be right 🙂
Proof that those priority names still fuck with me despite it being 6 years working with 'em
They're not all that intuitive
@reef sparrow
You can't get a list of generated chunks. Best I can think of is to use the method I provided above and simply start from some x and y values and start iterating until some other x and y.
However, bare in mind that, you will need to spread this out between multiple ticks. Loading chunk takes time (and memory!).
@tiny dagger Still seemed to run the way I didn't want it to. Made a check to see if the ConfigurationSection existed, and even when it existed under Section d, it ran.
Trying to check all 4 sections as one to see if it includes the one section
You can't "check all sections at once"
going backwards is much harder
alrighty, that was the original question, i can find a way around it just wanted to know if it was possible 😛
if there was such a method it wouldn't be done different tho
@reef sparrow
You can't get a list of generated chunks. Best I can think of is to use the method I provided above and simply start from somexandyvalues and start iterating until some otherxandy.
However, bare in mind that, you will need to spread this out between multiple ticks. Loading chunk takes time (and memory!).
@wraith thicket Ok and I know that this would take a lot off memory
but do you work with files directly?
you should just store them in memory and save them if needed only
But are there a method to generate a specific chunk?
When you get a chunk, it'll need to be generated
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getChunkAt(int,int)
declaration: package: org.bukkit, interface: World
But can I get the chuk when its not even generated
No - that makes no sense
A chunk defines/holds the stuff that's generated within it
If it's not been generated, getting it would mean you'd get an empty container
I mean you can get it when it's not been generated, but the result will be that it will be generated and the chunk you get is the generated chunk
I think you didnt understand me so when a chunk is never been entered by a player before can I get this chunk by getChunkAt()
Yes, you can use the method to get it. If it's not previosuly been generated, it will be generated by calling that method
But again, doing that over and over again will freeze your server while this is happening and if you do it for enoug chunks, it'll crash
Okay but can I get a chunk without trying to generate it
@reef sparrow - no, you cannot. Like I said above, that makes no sense
@tranquil edge It depends on the code. Perhaps the one you're referring to uses gradle instead?
[22:37:33 WARN]: [DelayBuckets] Task #11 for DelayBuckets v1.0 generated an exception
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(Unknown Source) ~[?:1.8.0_251]
at java.util.HashMap$KeyIterator.next(Unknown Source) ~[?:1.8.0_251]
at me.Lazinq.DelayBuckets.objects.Bucket$1.run(Bucket.java:54) ~[?:?]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:76) ~[server.jar:git-Spigot-dcd1643-e60fc34]
at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:361) [server.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [server.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [server.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [server.jar:git-Spigot-dcd1643-e60fc34]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [server.jar:git-Spigot-dcd1643-e60fc34]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_251]```
my plugin gives me an error but it works :/
at me.Lazinq.DelayBuckets.objects.Bucket$1.run(Bucket.java:54) ~[?:?] = for (Location b : blockLocation.keySet()){
blockLocation = hashmap name
You're most likely removing an item from the map while iterating over it
Don't do that.
im replacing it with air yes
b.getBlock().setType(Material.AIR);
what should I do instead to remove it? 😐
Depends. You can use a Iterator for removing elements while iterating.
Or you can create a new collection, store all elements that should be removed after iteration in it and
use the removeAll bulk operation to remove all elements in the origin collection.
Like this
Or like this
There is also a fancy way with streams...
hmmm
@reef sparrow What are you trying to do? I wrote a chunk pregenerator so maybe i can help you.
@grim halo So i thought I can make a plugin that load a chunk than clear all entities and than unload the chunk and all this with every generated chunk so I can do a hardly entity clear when nobody is on the server
I hope you understand what I think
Yes. So your problem is getten every generated chunk without generating new ones right?
for (Location b : blockLocation.keySet()){
long placeTime = blockLocation.get(b);
if ((placeTime + 750L) <= System.currentTimeMillis()){
b.getBlock().setType(Material.AIR);
blockLocation.remove(b);
}```
itss saying my problem is in here
Yes. So your problem is getten every generated chunk without generating new ones right?
@grim halo Yes right
Ok so the simplest way is letting the user specify a radius in chunks, then starting at -x -z and looping through x, z.
You can check if a chunk is generated with:
from World
XD
Yes i know but is there another way without specifiying a radius
Then whats the problem? Does he want to absolutely get every chunk
Then whats the problem? Does he want to absolutely get every chunk
@grim halo Eyery GENERATED chunk ...yes
Ah ok. Thats a bit more tricky. I believe you need to read the region files then
Which is not within the API
So... the files are named like this:
r.x.z...
So you got x and z. The problem is that you cant just take thos coordinates and multiply them by 4 bacause a region file could
contain 4 or only one chunk... So if you dont mind generating SOME chunks. You can just parse the file names
Okay no thats too hard for me i think
Ok so I dont even know how exactly I implement that IDEA in a plugin
guys what plugin is causing anti fish farm, its like disallows u to fish in a specific place and it says there is no fish here
guys what plugin is causing anti fish farm, its like disallows u to fish in a specific place and it says there is no fish here
@tulip orchid in 1.16 or above this is a vanilla minecraft function
i know but my server is 1.14.4
Oh ok
how can I check if a persistentdatacontainer is null? it says container==null is always false, but I get null pointer exceptions when I get the container from a block thats not a tile entity
arent try catches pretty expensive?
Not all blocks have persistent data
I need to run this check on every hopper move item event
I know, I want to detect if the block doesn't and skip it
than use the throw argument I think this is not such expensive
okay\
You can simply check if the BlockState is an instance PersistentDataHolder
And if it is, cast and use #getPersistenDataContainer
The container will not be null
are timing reports expensive when i turn it on and wait a hole day or something
However, PersistentDataContainer#get may very well return null, which means the key is not set
okay, so how do I check if blockstate is an instance of persistent dataholder
You do an instanceof check...
@reef sparrow
public static List<int[]> loadedChunkCoords(final World world) {
final List<int[]> coords = new ArrayList<>();
// List region files
for (final File regionFile : new File(world.getWorldFolder() + File.separator + "region").listFiles()) {
final String[] split = regionFile.getName().split("\\.");
// Parse region X and Z
final int regionX = Integer.parseInt(split[1]);
final int regionZ = Integer.parseInt(split[2]);
// Loop over all potential chunks
for (int x = 0; x < 4; x++) {
for (int z = 0; z < 4; z++) {
final int chunkX = regionX * 4 + x;
final int chunkY = regionZ * 4 + z;
// If chunk is generated add to List
if (world.isChunkGenerated(chunkX, chunkY)) {
coords.add(new int[]{chunkX, chunkY});
}
}
}
}
return coords;
}
like this blockToCheck.getState() instanceof PersistentDataHolder?
@reef sparrow
public static List<int[]> loadedChunkCoords(final World world) { final List<int[]> coords = new ArrayList<>(); // List region files for (final File regionFile : new File(world.getWorldFolder() + File.separator + "region").listFiles()) { final String[] split = regionFile.getName().split("\\."); // Parse region X and Z final int regionX = Integer.parseInt(split[1]); final int regionZ = Integer.parseInt(split[2]); // Loop over all potential chunks for (int x = 0; x < 4; x++) { for (int z = 0; z < 4; z++) { final int chunkX = regionX * 4 + x; final int chunkY = regionZ * 4 + z; // If chunk is generated add to List if (world.isChunkGenerated(chunkX, chunkY)) { coords.add(new int[]{chunkX, chunkY}); } } } } return coords; }
@grim halo and this returns all generated chunks in one list?
@fringe cairn Yes
Im not 100% sure if the chunks line up like this but i think it will list all chunk coordinates of the world
But its quite a heavy method. You should probably disect it and split the task over several ticks.
Don't regions have 32 chunks, not 4?
Yeah but did I get also the non generated chunks in this list
Ah
Well, 32 x 32 chunks
right. drives_a_ford is right
So replace the 4s with 32s
Try reading the code line by line including the comments. Then you should be able to answer your question yourself.
If not: Dont use this code or you might freeze your server.
And you should maybe take a look into the calculation of the chunks.
I kind of eyeballed them
Should be fine though
Anyone here familiar with NMS?
This is what I have from using buildtools, now what?
How do I import it to my maven pom.xml, etc
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
skip the "repo" section
If you run BuildTools then the source code should be installed in your maven repo.
No
no
huh
It'll install the necessary things in your local repo, for me it's the .m2/repository folder. And Maven will know to pull from there.
mavenLocal() is the repository
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Help
My server starts and then my whole nodes shuts down
The penultimate line of that log shows the "Can't keep up! Is the server overloaded? Running 7066ms or 141 ticks behind"
how can I tell if a block is a double chest?
- Fix this
does Entity#getTicksLived() returns the amount of ticks from when the entity has spawned, or does it return the amount of ticks where the Entity#tick method has been called?
That's not the error, I already removed that plugin and try to run the server
mfw "BUILDTOOLS SHIT" lol. 11/10 directory name
@NarutoGames1 Then... dont show us an old log...
how can I tell if a block is a double chest?
@fringe cairn https://github.com/2008Choco/LockSecurity/blob/master/LockSecurity-Plugin/src/main/java/wtf/choco/locksecurity/listener/LockedBlockInteractionListener.java#L400-L403
I can't get a new Log
@paper basin returns the amount of ticks it has been alive since it was spawned
Lmao buildtools shit best folder name
@keen compass yeah but I mean
it can be alive without being ticked by the server
it is an nbt data that gets stored with the entity
not exactly possible to not tick an entity entirely
usually what it means by not ticking entities, is that it isn't doing anything with its AI
in my case it's a projectile, I want to check if the projectile is moving or not because out of range
Every entity gets ticked unless its not loaded...
That is pretty much what I said
then comes my question: Entity#getTicksLived() will return the same value again and again unless the server starts ticking it again, right?
aw
well, I will test and tell you
but the projectile entity isn't unloaded
then it won't get saved until then, but doesn't mean it won't update the ticksLived() lol
Entity#isValid returns true
anyways if you want to know if an arrow is still moving, not sure how exactly you are doing this
but you could just use its velocity
well, I was right
Entity#getTicksLived() freezes when the entity is no longer ticked because too far away from players
no, the projectile's velocity stays the same in that case
the entity is just no longer moved
technically when you get too far away from players it gets unloaded
its the same thing with chunks. Chunks don't immediately get unloaded, but they go in a sort of cache first for a bit of time before being fully unloaded. But entity activation range affects when entities will get unloaded
maybe it does not work like this for projectiles
I am aware that I keep asking this in different forms, but here goes.
With getKeys(true), I receive all of the keys as well as their keys. Such as: keya keya.keyb keya.keyb.keyc. So, is it possible to check if anything consists of one key? Like, *.keyc? rather than specifying the path?
If it isn't possible then that's fine, I just want to find a way around my problem haha
what exactly is your problem?
no, #getKeys(boolean) returns just a map, not a searching algorithm
you will have to code one yourself or find a good one on the internet
keyc doesn't necessarily mean it is the same key as a key that belongs to the path before that one. So you can technically have two keyc's but they are both different
what you can do however, is create loops using getKeys()
In order to check if there's anything ending with .keyc, you'll need to iterate over the Set of returned keys and check
a better more optimal way would probably to memory map the file and check it that way instead of using yaml and some regex to do it. But either way works lol. But maybe you could explain why you would need something like this? o.O
you can dynamically loop through paths without actually hardcoding the path btw
It's probably because they've not thought through their data scheme enough
I'm doing a check to see if a ConfigurationSection named users exists within any key, and if it doesn't I want it to create one that I consider it being its default. Though I'm pretty sure I found a work-around not requiring all of this confusion lol
that is a possibility and probably the case
and yeah that too probably
considering I'm only a few months into coding with java, that is most likely the case 😂
If you need to search some data, a database is also a great tool 🙂
You could re-organize your data so that you don't actually have to do that
should*
how does nested Serializables work.
For example,
public Map<String, Object> serialize() {
Map<String, Object> map = new HashMap<>();
map.put(KEY, anotherSerializable);
return map;
}
How does spigot pass the anotherSerializable back?
If I got the Map<String, Object from spigot in my deserialize method, what should I expect to find when I do map#get(KEY)?
sorry for cutting in btw
Ah okay, I'll look for a better way to organize it
Anyways your options are either read the file line by line, which is the more optimal method but harder to code or you can create recursive loop to find what you are looking for
no worries, pretty sure that was the solution
@terse locust there is two answers to that, either it means another object that is capable of being serialized or because of the vagueness you gave it means an object that has already been serialized.
so you can either expect an object that can be serialized
or serialized data of an object
Also I do just want to say thank you for being so kind and patient with me :)
I know not everything I ask is confusing, but some of it is when I'm overworked. Not many servers respond well when I speak nonsense, but thanks for helping me!
so I can expect to get a Map<String, Object> which I can deserialize myself then?
You are welcome, most of us here are patient 🙂
You mean which you can serialize if you are talking about unserialized serializable
Then the answer is what you said
righty, thanks
best event for checking boats placed?
PlayerInteractEvent most likely
Hey guys, Im trying to set permissions from my plugin using attachment.setPermission(permission, true); that kinda works, like when given the permission a player can execute the commands, but the client doesnt show its possible. (It just makes the message red as you are writing and says it is an error)
do i need to do something else?
doesn't it also throw an entity spawn event as well @wraith thicket ?
I'd assume so, but the interact event could allow you to retain the boat
It depends on what they want to do, though
But since they wanted the "place" event, I figured that one was more appropriate
VehicleCreateEvent?
or is that something different? 😐
easiest thing is I think indeed playerinteractevent check entity in hand & check if it right clicks on water
That one should work as well
that would work too
But it all depends on what you want to achieve
boat extends Vehicle
ohh than I'll try that
I want it to remove vehicles after x seconds
but no one has to be in it for the timer to start
@graceful shard try calling Permissible#recalculatePermissions
then that would be the best event to use then
ok I'll work with that one 🙂
actually I lied
:/
@frigid ember best event to use for your case is VehicleExitEvent
since you want the timer to start when they exit
but what if the player places it and doesnt actually enters te vehicle
could use both 😄
@graceful shard try calling Permissible#recalculatePermissions
@covert bronze hm that didnt seem to help
:p
Well now you have two events to use to your advantage 😉
good luck
can use the createvent for a timer if they don't enter it. Cancel the timer if they do. When they exit, create a new timer for when to remove it.
VehicleCreateEvent doesnt has a player variable :/
only vehicle
How would I check if there actually are players in the vehicle
this is the code Im using to set permissions btw: https://pastebin.com/AjtcMHSY
for the create event you can get the vehicles location and detect players nearby
players are not going to be farther then about 2-3 blocks
Is there TerrainGenerator for 1.16?
if (e.getVehicle().getPassengers() != e.getVehicle().getLocation().add(2, 2, 2)) {
so something like this
to detect players?
getPassengers() returns a list of players or player in a vehicle, not outside of it
for outside of it, you would create a loop to check 2-3 blocks away
for players
this is one of those use cases where the optimal way to loop is to use bitshifting, but if you don't know what that is I recommend to stick with the traditional way of looping 😛