#help-development
1 messages · Page 449 of 1
Is that during server start?
It is when you load the world
And this traditionally lags every server that dynamically wants to load any world...
It's one world file that loads when the server starts. Would it be fine after that?
Sure, if its onEnable then no problem. I thought you wanted to have per-player worlds
I want it to seem like that, but they will be in the same world file
Names are totally preference but these seem fine tbh
good thanks, and any idea about this: #help-development message
Names are fine.
Implementation is not.
Static -> no state. you are having stateful statics. Dont do that.
uh i never learn this things (private, public, static, void and ...), what should it be
Not static
Can anyone give me a link for code for a simple NPC please?
so can i get access from other classes? what does the static do (tutorial links are fine too)?
can a message be sent asynchronously to a player or is that also forbidden?
NPCs are never simple. Use an existing library if you have trouble.
what code did you write?
You can send a message asynchronously, yes
Something that is static means it's not associated with an instance of its parent type
Foo fooInstance = new Foo();
fooInstance.bar(); // non-static. Requires an instance of Foo
Foo.baz(); // static. Does not require the 'fooInstance'```
sometimes static is fine
you just need to be careful
for example utils' classes are mostly fine with being static
Think of it this way. Player.getName() being static would make no sense. Which player?
there's a thin line between using static and engaging in static abuse
thats not the code you wrote
is a set config serializable
probably not
doesnt look like it
a set is just a list anyways
the set here is probably being saved as a map
No you can't insert a Set into a YAML config
no its just that the default config system is stupid
Set::toArray 🥲
there are probably just some helper functions you can find to save and load those containers
since you would save a set identical to a list in yaml
Yes but problem is
Set has no inherent notion of order
SortedSet does have that
But just Set does not ensure it
yea
for SequencedCollection https://openjdk.org/jeps/431
Foreal gonna be such a life saver
Believe there was a proposal of a sequenced set also
It's included in that JEP, yes

SequencedCollection, SequencedSet, and SequencedMap
Music to my ears
Seeing preview features hurts
Because you still have like 4 years to wait for them to be full release :p
Yea
have we got pattern matching switches yet
Should be a lot of releases and graduations in 21
Oh it is
Since its presumably much less work than implementing something like that structured concurrency api
Pattern matched switches included
What happened to everything having 13245345 previews
Yes, it would have to be a list of strings. UUIDs aren't serializable either
21 is LTS right
It is
Yup
There should be a lot more features in 21 than most others
Hows that foreign memory api
Yea
why is the open jdk website stuck in 2009
I haven't actually read much about it
well yeah but that doesnt matter for saving it
It's like a "safe" way of accessing raw memory isn't it
As "safe" as you can be, yeah
Yes, anyway my point is, to save a term of type Set, you can do it in N different ways where n is the size or cardinality of the term
Safe is better than unsafe
Yea
Specifically sun.misc.Unsafe
Well iirc its gonna be more or equally performant to unsafe
Whilst providing high usability and robust design
It's a shame plugins sometimes need to use Unsafe in the first place
But I guess you can only do so much when mojang likes static final fields
I mean ideally claims just aren't stored in a configuration format but rather a database (even flatfile like SQLite)
Loopy loop
to some extent yes
But I have that inspection set to hint
Instead of weak warning or whatever
you just reminded me i have to do my mysql storage handler
Do you have a MySQL server
i can get one
btw, I use this a lot when designing databases and testing queries, figured I might as well share http://sqlfiddle.com. It's awesome
Morice they have what’s called a sequence
DROP DATABASE testing;
list or array is not rly a thing
Am I doing this right
by specification you have yaml maps, yaml sequences and yaml scalars
then its up to the parser how this will be implemented regarding sourcing and sinking
Fiddle lets you setup your own schema. Left side (schema panel) allows table and insert operations, then you can build the schema, then the right side allows for non-table-altering queries
YAML is just a superset of JSON
Json only has objects, arrays, and key-value pairs as well
That too is true
why i dont have acess?
Not a fork. Superset 😛
whats jason a fork of
YAML can be converted to JSON and vice versa
May just need to recompile your project
Well comments you’d lose
But otherwise yea
I guess anchors also
but who cares, its still super cool :)
Yes, you would lose comments. Unless the converter does what JSON tends to standardize and uses a "comment" key-value pair
🥲
how?
Gson has an option that allows comments
Can someone help me with working with reflections?
I use a technique almost identical to this with my discord bot, and it works fine, but for some reason it doesn't want to work with my spigot plugin.
Originally I had this code: https://nekobin.com/sopivaduto.kt
Kinda ugly, and I didnt like having to put every new command here every time I make a new one
So I replaced it with this code: https://nekobin.com/kawitaneyi.kt
Much better imo, and like I said before, This code is almost perfectly copy/pasted from code that I used for my discord bot.
Here is the only command that I have implements the Command interface: https://nekobin.com/jonedozovo.kt
Here is the Command interface: https://nekobin.com/niwivekena.kt
And here is the error that it is outputting: https://nekobin.com/kicugefita.py
EDIT:
Needed to do this: https://nekobin.com/hekibowafi.kt
because kotlin is a special little snowflake
Yes setting leniency to true right
yes
Veru nice
Although gson is apparently old and smelly now
The design is nice for micro projects
But jackson is better for enterprise and then u got moshi
Lmao ye
I feel like moshi is nice, but gson works just fine and since its shipped why not use it yk (:
does moshi have an object mapper?
can someone eggsplain me this error? Its worked fine until the last build, but i changed nothing?
java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_17_R1/entity/CraftPlayer
pom.xml (part of it)
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
did you change some version?
no
Yes
i always believe those are slow
What it doesn’t ship is stuff like JsonArray, JsonElement etc
and thereby dont use them
Well
Moshi is faster than gson
Anyway fourteen to blow ur mind
iirc jackson with annots is incredibly fast
And reflection is faster depending on java version yk
idk i looked at jackson and i found the syntax weird
18+ means method handles implementation behind reflection
Yea
They have weird conventions
helo is there a way to get a world's height map?
Are there any good item gui libraries that anyone recommends?
be a true man and code it yourself
No need to reinvent the wheel if someone's already made a good one
public void PlayerDies(PlayerDeathEvent event) {
Player player = event.getEntity();
String playerUUID = player.getUniqueId().toString();
playersInCombat.remove(playerUUID);
if (player.getKiller() != null) {
}
}```
this detects respawn anchors for some reason
i want it to detect just players
and player.getKiller returns a player
so it shouldnt detect respawn anchors
They explode
Ah
You'd have to check the cause of the last damage event
Iirc there is a method for that
getLastDamageCause I think
how can override command executon on te server?
Probably killed itself after you froze the game with a while loop
Why wouldn't it
It's going to block the thread that you're on
doesn't matter if it's in a public void method, it depends what thread you called it from - and if you don't know the answer to that, you called it from the main thread. it looks like that while loop never finishes (NoFallToggled, is not ever set back to false). So it runs forever. On the main thread.
= 💀
Yeah but the bottom section won't ever be reached, because in the top section a never-ending loop is declared
Pretend you're the computer and walk through that logic
You'll find yourself never reaching the bottom
How should i add the SQLite driver in a bungeecord plugin? I tried doing this in the pom.xml but it isn't working
POM -> https://github.com/Gurwi30/UltimateBlacklist/blob/master/pom.xml
SQLite Class -> https://github.com/Gurwi30/UltimateBlacklist/blob/master/src/main/java/me/gurwi/ultimateblacklist/database/SQLite.java
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
;/
It is not loading the SQLite driver
an item frame with a filled map is 1/16th of a block wide, correct?
is it possible to like... say if at x0 y50 z0 u place a diamondblock is possible to code it so that it also places a second block on x1 y50 z0?
yea
Interesting I'm confused on how to go about it lol
check the BlockPlaceEvent
Right
it kinda doesn't have a pixel
I'd say it's 1/128th
but at work we just use 0.1
at work?
his company
I mean this:
you can hide the frame so make it disappear
I know I just want to know the width of that for mathematical calculations
that looks like 1px to me
1/16th of your map resolution
Hey Guys, I Just wrote an empty Class with the Command Executor thing. How can I now use org.bukkit.player to define a player?
you check if the sener is instance of Player
Check if the command sender is an instance of Player and cast
out of curiousity would i have to do something like getblock() then like something like setblock(x,y,z)?
ah, that
You call getRelative(dx, dy, dz) or getRelative(BlockFace.UP) to get the relative block and then set its Material
I was talking about invisible frames
Ah and that sets a block ontop of it?
You cant really set a block. You can only change the properties of a block
Got it done with the Player! How can I now add items to the Inventory of the player?
Basically a location represents... a location of a block
Changing the location just changes where it points to
soo i cant do like if a block is at x0 y50 z0 say diamondblock for instance... i cant make it so a stone block appears beside it aswell?
when its placed
Locations don't store block data, that's part of the Block implementation
;-;
getInventory() to get the inventory
addItem() to add items
new ItemStack(...) to create new items
You can get the block at a location by calling Location#getBlock
and check its type
then getting another block at another location and changing it
Sure you can do that
interesting
I should probably make like a github repo that's just a sample of how to use individual features
like a folder that has a sample on how to use inventories, and a sample project that'd use them

that'd be interesting
I just can't bother writing documentation for 8 hours straight to avoid answering questions for 10 minutes per day
i was just wondering if u can set a block at a location if a block is placed lol
if a block is placed
a.getClickedInventory().```
'getTitle()' and 'getView()' were both removed from the method (?) above. How can I get the title of the current inventory open?
There's not quite such a thing, a block is just a representation of a block at a given location, and its data
You can check if the block is empty (air)
Everything in the world is a block. Even the blocks you run through are 'placed' blocks. Just of type AIR.
You can only change its type.
Don't compare inventories by their name
Sooo basically just change the air on whatever axis?
I wouldn't advise doing title checks
Yeah
That also seemed unsafe to me, what else could I do?
but, InventoryClickEvent#getView -> InventoryView#getTitle should still work
why does this ```xml
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
DESERIALIZATION OF UNTRUSTED DATA IN ORG.YAML:SNAKEYAML
OUT-OF-BOUNDS WRITE IN ORG.YAML:SNAKEYAML
Check the inventory instance or use your own inventory holder
Or the InventoryView instance
I would use a collection to throw your opened inventories in and then check with contains()
or you can use the lovely inventory system that the guy above me wrote https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
who's that handsome fella

💀
Spigot probably has some outdated dependencies
so nothing i can fix?
You could probably make a PR
PR?
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
ah xD
the "getClickedInventory()" does have a .contains(), should I just write the title in the ()?
and update snakeyaml
also im using a locally by the BuildTools generated maven repository of spigot right?
Oooh
or is it requesting the api from the spigot server
yeah that's also my reaction when I see that pic
No. You create a gui manager class which contains a Set<Inventory>.
Add them to the collection when you open them.
Call contains on the collection to check if the clicked inv is in your collection.
Remove the inventories when they are closed.
nvm i just managed to pull a 1.19.2 api version which i never created locally
Is there any persistant data container which is always there?

Build tools is for generating the spigot artifact. (The Spigot jar) and installing it in to your local maven repo. You don't need it to get just the api since that is hosted online
The PDC on the default world
mongodb 
If you need access to internals you need to run BuildTools and depend on spigot instead of spigot-api
how do i get the default world without nowing the name?
getWorlds.get(0)
how do you feel about nms
Bukkit.getWorlds().get(0)
damn
I think I got sunburnt so I'm not gonna type mouthfulls
You could also pull the name from server.properties and use that
I'll try this out, thanks!
yea i figured, if i do not have a local copy it then instead requests the data from the server to create a local copy. in addition i made it pull the 1.16.1 api and there the snakeyml is not marked as deprecated
public String getDefaultWorldName() {
return ((CraftServer) Bukkit.getServer()).getServer().getProperties().levelName;
}
Hi everyone,
I have a question, i'm trying to build BuildTools for 1.19.3 and i receive this error every time:
https://paste.md-5.net/onutazesuj.makefile
I have the same issue at other versions
?paste As the message says send the log
probably your maven folder is messed up
Bukkit is currently using SnakeYaml 1.13
aight thanks guys for the quick replies i really aint that versed with maven xD
I tried to remove the m2 specialsource maven plugin and that didn't work
The next version is 2.0 which may have some breaking changes
The entire log
Oh one moment
How should i correctly import from main to class the config.yml file?
And how i import another file, like messages.yml?
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
No i dont refer to that, i refer from main to another class, lets say a command executor class.
any plugins for begginers I could make?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Thanks
can i figure out that PlayerMoveEvent is caused by what? teleport or the player it self
saved thanks
What are you trying to do?
Oh lol i solved it by deleting my specialsource m2 folder again
its a long story, wanna explain really?
Yea
ok then
The reason why could change the approach
InventoryView open = player.getOpenInventory();
for (int row = 0; row < open.countSlots(); row++) {
ItemStack item = open.getItem(row);
}
java.lang.IndexOutOfBoundsException: Index: 63, Size: 63
This is supposed to happen?xD
🤔
I'm creating a BattleRoyale plugin for my server events (not a public one)
when the match starts the players get teleported to the behind of a airplane, and they cannot move by canceling move event, i'm setting they're velocity for moving smoothly behind the airplane, but it seems setVelocity triggers the event too, i want the event to cancel it if the move is caused by the player
ive never seen that method either
(yes, the exception is from this ItemStack item = open.getItem(row); line)
Make the player ride an entity. Will make things smoother and easier to control
I have a messages.yml file in resources directory, how should i access it?
try countSlots - 1
keep a yamlconfiguration var in your main class
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
also last question, sorry for pinging again, can a list of players be the passenger of an armorstand? like 100 players
i think just one entity riding once
so update on the question, can 100 armorstand be in one place
Yeah but they will be on top of eachother like a pillar
yes
they're invisible, does that matter?
no
Might look a bit weird
even when both of them are invisible, huh why
Go with armor stands per player or mess with packets
so what i can do about it
(To remove invis players)
@EventHandler
public void onclickitemUnc(InventoryClickEvent a, InventoryOpenEvent s) {
Set<Inventory> siv = null;
Inventory iv = s.getInventory();
siv.add(iv);
if (siv.contains(a.getInventory())) {
a.setCancelled(true);
}
}```
It didn't work, I think I misunderstood
what if first clearing the player effects then unmount it?
You can only have one event per listener
A single entity can have multiple passengers in modern versions of mc
Same error
seems to be a spigot bug
(Version: 1.9 R1)
But I have no idea how that works with entities that only have 1 passenger point
unfortunately i'm on 1.12.2
new HashSet<>()?
1.12.2 should have that feature
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
It has existed for a long time
good, thanks again for help
how do I get the open inventories, then?
You start by learning the very basics of java.
At least until you know what a List, Set and Map is.
Yes
oh well
Java != JavaScript
Yeah, I know that, I just checked if it was any different, but I'll just check the documentation, thanks
As for your question you can get the inventory from the inventory click event
Can someone suggest me a plugin to replicate ( a simple one )
mcmmo
Hypixel Skyblock
Oh hey I did that when I was learning Java
:v
😄
Yes I learned Java and Spigot at the same time 💀
anyone?
What do you want to learn?
You could actually go for mcmmo
essentials x
anything tbh
If I want to add flags to the global region from worldedit
Which is called GLOBAL
Can I treat it as another region?
WorldGuard*
Probably
👍 Ty
But why do you need to mess with the global region?
I want to do some flag work
On a world that I create
And they need to be global
Ah
Today I lost respect for all Private Mine plugin makers
i didn't learned Java ever unfortunately and annoys me a lot, i just learned anything i needed to code about in Spigot at the moment
I'm generally a fast learner so it went pretty well
same here but oh boy were my first few form questions horrid
I never posted for help more than like twice
most of my posts were me not being proficient enough at google yet tbh
Wasnt it _GLOBAL_ or something with underscores
__GLOBAL__
"something with underscores" shows you haven't been using WorldGuard for months or maybe for years
Or it shows that a human being can forget something 🤯
I got my own protection system, so why should i...
Yeah, WG isn'tthat necessary
For 99% of servers it is
nice
always fun figuring out nullpointers in an interpreter
turns out java internally calls Objects.requireNotNull on a switch param
@lost matrix My server freezes when it tries to load up the world right after generating and switching generators. Do you know why that is? Heres the code
WorldCreator runs on main thread
also to add there is no Async World Creator
Hey I have a question about WG if anyone knows
No it crashes. I expect the generating to pause things, but the server crashes
After its done generating
worldguard is just decent at what it does
stack trace?
If there's an existing region with a specific name, and I try to create another region with the same name
Does it override
I kinda hate its internals but it's whatever
Or error
?paste
give stacktrace
I don't use it for protection, more like for defining abstract shapes for stuff like minigames
where I can just tell my teams to make a region for each door
and have 2 regions overlap at that door
I do my own stuff for minigames
and write code that automatically associates that door as a connection between both regions
with my game engine I just used bounding boxes lol
Error I believe but check the docs
I shall
my cod zombies minigame just uses regions to scan the entire map and automatically know what spawnpoints are enabled
based on where regions overlap
Like 37 is where it freezes. The rest is outputted when it gives up
https://paste.md-5.net/bahujopudu.md#
Looks like it took a very long time to generate the worlds
It's a custom generator that takes a while.
I'd space out the loading a bit and not create multiple worlds during the same tick
It's only one world file, if that's what youre talking about
Or if it's a private plugin you should be able to increase the watchdog timeout in the spigot.yml
It doesn't timeout, the server stops responding and doing anything. The generating finished. I can reboot it and the world is how I expect it
The code you sent shows you creating two worlds
oh true. I should delay the second one?
Yeah it blocks the main thread as stated earlier so the server will freeze. The error (thread dump) you sent is from the watchdog because the tick took too long
But the tick took too long because the server was frozen for minutes. There's some other issue I believe
Yeah. One world per tick should be fine
what do I do to delay it?
?scheduling
hey guys, is there some sort of discord i can join for 1.8.8 support since i know this discord hates questions regarding old versions lol
How can i get a Vector from where player is looking (i want to move something in player look direction)
everybody hates, so no
but you still can ask your questions
see right, every time anyone asks, they are absolutely berated with facts about why newer versions > older versions
i typed it wrong 😂
yes let me ask my brain, im sure its got this.
This is probably the best place. Some other discords have rules against old versions
Olivo maybe you can help
well aight, is there any documentation for just 1.8.8 stuff or is all documentation only new versions?
Should be getEyeDirection iirc
probably something on google
Helpchat has the javadocs
Or you can generate them yourself
not doing that for sure
i havent setup 1.8,8 yet, is there anything different in the ways of setup or na
yea getEyeLocation.getDirection
i was scared of a lot of calculation and math, whats why i asked before, it was easier that i thought
Ah right
No it's the same. You run BuildTools and then start the server
okay good to know, ill set that stuff up in a lil bit. also i heard something about pdc being different in older versions, what was that abt?
But knowing 1.8 users you're probably going to use some fork of a fork of a fork of a fork... that breaks Minecrafts copyright by distributing their code
PDC doesn't exist
You will need to implement that on your own using nms
@chrome beaconIt didn't work. it still froze at the same spot
it seems ArmorStand#setVisible(false); does not work if you mount something on it
any idea?
Hm is that why people usually use arrows?
or buttons?
No idea can't really check
ah 1 thing
i'm mounting a player on armorstand in somewhere else too
its invisible and fine
but ^
Haven't seen anyone do that
i did one a long time ago
Hm show your code
1 sec
(deleted code)
yes, seems my brain is not working anymore, i'm not even setting is not visible
Use the spawn method that takes a consumer
That will ensure the entity is modified before it's spawned so you avoid flickering and such
World#spawn(ArmorStand.class, (armorStand) -> { do stuff }, location)
No idea if that's correct going off memory
And writing on phone
Did that exist in 1.8
Do stuff would be set invis
They're on 1.12.2
o
yea thanks, i'll change all of my armor stands to that
I missed when my coding problems were small bugs in my plugin
I cant figure this out @chrome beacon
my server crashes every time now. In the past it would only happen like 50% of the time
Worldgen is a pain you can easily kill the server if it's too slow
I really dont think its the speed. It loads once, generates what I tell it to, and is all fine. Then it does something that it doesnt tell me for about a minute, and then it tries to load the world again and it stops on Preparing to start region for dimension
I've made it generate more than what I currently make it do and it worked sometimes before
@chrome beacon @young knoll after doing a lot of thing and put them together (its still not smooth)
Won't check that. I have limited internet atm
Im tryna make these cool mini world areas
Looks neat
it just not working the ways I need it to
the 2nd and third one i personally dislike
but
my opinion doesnt matter
since i couldnt do better than that
One of the problems is that it generates other chunks that I dont want it to
The bukkit wiki should have them
apparently this is deprecated and i dont find a new documentation
minecraft.command.op
however
PluginManager pluginManager = Bukkit.getPluginManager();
Permission opPermission = pluginManager.getPermission("minecraft.command.op");
if (opPermission != null)
{
opPermission.setDefault(PermissionDefault.FALSE);
}
else
{
Bukkit.broadcastMessage("Failed to remove op permission");
}
```returns null
?? What are you trying to do
Why remove that
💀
Don't give op to people you don't trust
to disable it
and replace it with my own
im rewriting my old permission plugin to be compatible with permission nodes
Bad idea
and i tried to print the permission node
and its null for /op
apparently the op command has no permission node
Normally you would add a permission attachment, not change defaults
It will be null onEnable
Default commands are added last so they can be replaced by plugins
why is writing my own permission plugin a bad idea
ill read myself into that ty
Though I'd just use LuckPerms since it has everything one could ever need
yea but i like to have control over a plugin's backend
LuckPerms is open source
It also offers like 234 backend options
hi
im facing this error for the first time when trying to build my plugin: Error:Cannot determine path to 'tools.jar' library for 17 (C:/Program Files/Eclipse Adoptium/jdk-17.0.6.10-hotspot)
it was working for some reason this time it wont
How are you building your plugin
ctrl+f9
i did
r u talking bout the IDE??
Are you using intellij?
ye
i tried the latest versions but it wont work with the spigot api for some reason so im using the version 2020.1
Well that's rubbish, spigot API doesn't depend on your ide version
ik but it just didnt work
Well install the latest version and come.back
i didnt delete it i just instaled the older one
Ok now what is the issue with the newer one
it didnt register it as a spigot plugin at first it wouldnt let me import stuff from bukkit.org
That's an issue with the build path, not the IDE itself
The NoCheatPlus people say that 1.19.4 doesn't fire player move events for players riding in minecarts. Instead, a single event is fired when the player exits the minecart, covering the entire distance the player traveled (which freaks out the anti-cheat).
Is this an intentional change?
do i see it correct that a permission attachement invalidates upon logout?
I doubt that was an intentional change
Judging from the log and the first-hand testing, the player seemingly tries to cover with a single player move event the distance traveled with the minecart (from the mounting location to dismounting location).
Was not able to reproduce this with other vehicles (horses, boats ...).Now, because this does not happen on 1.19.3, either Mojang or Spigot changed something regarding player/vehicle move when updating to 1.19.4... Will need some further checking.
MD is around, maybe he knows more
PlayerMoveEvent never fired in vehicles, VehicleMoveEvent did
I'm just going by what the NCP people were saying.
Maybe the player move event firing for the entire distance ridden is new?
No idea
they invalidate on logout right? also if i add a permission attachment it does not automatically update the player?
Yes they invalidate; they do automatically update though
that they can use the command*
i do not see the "added" command in the command list although i can use it
adding an attachment/permission does not update the command map that is sent to the client unless you call an update
You're adding the perms after join in which case you need to .resyncCommands or whatever the method is
updateCommands() I believe
this yes i found it works fine now ty
sorry to bother again but since i got the master here xD, when exactly does a permission given like this invalidate? ```java
Player player = (Player)sender;
PermissionAttachment attachment = player.addAttachment(this);
attachment.setPermission("ranks.commands.rank", true);
Bukkit.broadcastMessage("player has been given rank permission");
player.updateCommands();
Wdym
on log out
btw @tardy delta @eternal oxide I made it work at the end
14 years without anyone opening it
the psu sounded like a helicopter
like if a player is given permission to use a command this way, when does the permission attachment invalidate
hm
and is there a permanent option? like until removed
no
huh
you have to re-apply it on join
yes, its called a permissions plugin
as it's always a fresh Player object
oh that pc
it isn't that bad of a pc ngl
i dont complain that it doesnt work, just trying to understand the scope im working with
Yeah you'll need to handle saving and loading them yourself
aight thenks
to me?
if so thats not a problem ill serialize/deserialize everything
👍
and then apply/remove it to from players as required
I need help my commad wont work it says unknown command
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
oh ye lemme send u the entire thing
Is it in your plugin.yml
i used a command base
did you register the command with that
or did you like use the annotation
send the code & what lib
Can I change the spawner to type item?
Yes
ye
send the code because you're doing something wrong
and what library are you using...?
You can set it to an item
But I don't think you can change what item with just the API
I find the spawners api lacking
I couldn't find a way to set it as an item.
True
Won't you need nms to specify what item is dropped
Yes
How do I set which item to drop?
I imagine it will default to stone
NMS
Can you give an example source? I will read
@chrome beacon you're still here!
Could you maybe see if you could help me with the world gen stuff? Im really struggling
Main.java :
package me.balls;
import me.balls.utils.commands.Ruby;
import org.bukkit.plugin.java.JavaPlugin;
public class Balls extends JavaPlugin {
private static Balls instance;
public void onEnable() {
instance = this;
new Ruby();
}
public void onDisable() {}
public static Balls getInstance() {
return instance;
}
}
Msg.java:
package me.balls.utils;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class Msg {
public static void send(CommandSender sender, String message) {
send(sender, message, "&");
}
public static void send(CommandSender sender, String message, String prefix) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', prefix + message));
}
}
CommandBase.java:
private List<String> delayedPlayers = null;
private int delay = 0;
private final int minArguments;
private int maxArguments;
private final boolean playerOnly;
public CommandBase(String command) {
this(command, 0);
}
public CommandBase(String command, boolean playerOnly) {
this(command, 0, playerOnly);
}
public CommandBase(String command, int requiredArguments) {
this(command, requiredArguments, requiredArguments);
}
public CommandBase(String command, int minArguments, int maxArguments) {
this(command, minArguments, maxArguments, false);
}
public CommandBase(String command, int requiredArguments, boolean playerOnly) {
this(command, requiredArguments, requiredArguments, playerOnly);
}
public CommandBase(String command, int minArguments, int maxArguments, boolean playerOnly) {
super(command);
this.minArguments = minArguments;
this.maxArguments = maxArguments;
this.playerOnly = playerOnly;
CommandMap commandMap = getCommandMap();
if (commandMap != null) {
commandMap.register(command, this);
}
}
public CommandMap getCommandMap() {
try{
if (Bukkit.getPluginManager() instanceof SimplePluginManager) {
Field field = SimplePluginManager.class.getDeclaredField("commandMap");
field.setAccessible(true);
return (CommandMap) field.get(Bukkit.getPluginManager());
}
}catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
public CommandBase enableDelay(int delay) {
this.delay = delay;
this.delayedPlayers = new ArrayList<>();
return this;
}
public void removePlay(Player player) {
this.delayedPlayers.remove(player.getName());
}
public void sendUsage(CommandSender sender) {
Msg.send(sender, getUsage());
}
public boolean execute(CommandSender sender, String aliase, String [] arguments) {
if (arguments.length < minArguments || (arguments.length > maxArguments && maxArguments != -1)) {
sendUsage(sender);
return true;
}
if (playerOnly && !(sender instanceof Player)) {
Msg.send(sender, "&cOnly players can use this command,");
return true;
}
String permission = getPermission();
if (permission != null && !sender.hasPermission(permission)) {
Msg.send(sender, "&cYou do not have permission!!");
return true;
}
if (delayedPlayers != null && sender instanceof Player) {
Player player = (Player) sender;
if (delayedPlayers.contains(player.getName())) {
Msg.send(player, "&cPlease wait before using this command again!");
return true;
}
delayedPlayers.add(player.getName());
Bukkit.getScheduler().scheduleSyncDelayedTask(Balls.getInstance(), () -> {
delayedPlayers.remove(player.getName());
}, 20L * delay);
}
if (!onCommand(sender, arguments)) {
sendUsage(sender);
}
return true;
}
public boolean onCommand(CommandSender sender, Command command, String alias, String [] arguments) {
this.onCommand(sender, arguments);
return true;
}
public abstract boolean onCommand(CommandSender sender, String [] arguments);
public abstract String getUsage();
command: package me.balls.utils.commands;
import me.balls.utils.CommandBase;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class Ruby {
public Ruby() {
new CommandBase("ruby", true) {
@Override
public boolean onCommand(CommandSender sender, String [] arguments) {
Player player = (Player) sender;
ItemStack item = new ItemStack(Material.DIAMOND);
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.setDisplayName("§4Ruby");
List<String> lore = new ArrayList<>();
lore.add("§bUse this at your own risk,");
lore.add("§bAnd §4Be Careful");
meta.setLore(lore);
item.setItemMeta(meta);
}
player.getInventory().addItem(item);
return true;
}
@Override
public String getUsage() {
return "/ruby";
}
};
}
}
i wasnt able to send the file so i copy pasted it
i forgot that was a thing
lmao ye
You didn't register the command executor
Hm did I miss it while scrolling
though that is definitely not how they want you to use CommandBase
you're meant to extend it and call super
not what whatever the fuck
but it's okay
should sitll work
verify your plugin is in /pl first
then if it is, getCommandMap() is null
Ah modifying the command map 💀
CommandMap commandMap = getCommandMap();
if (commandMap != null) {
commandMap.register(command, this);
}
but like, this is so scuffed
use a library, please
search "Lamp spigot", "ACF spigot" or "CLOUD spigot"
how do i verify it in /pl ?
mate is there your plugin
are you a troll?
send the output of /pl please as a screenshot
wym by /pl?
oh
this is why I dont enter this channel Olivo
Yeah I've spent too much time here
where do i send it i cant append images
?img
Not verified? Upload screenshots here: https://prnt.sc/
?img
Not verified? Upload screenshots here: https://prnt.sc/
I agree, but he literally sent "/pl" in the discord channel ._.
are any of those your plugins
i didnt know it was a command in the console
ye
name: balls
version: 1.0.0
main: me.balls.Balls
api-version: 1.19.4
authors: [FiryDev]
depend:
description: Balls!!
send a screenshot of the file explorer on the side of the IDE
why the empty depend line? delete that
api-version: 1.19.4
Should be 1.19, not 1.19.4
ah yeah that too
ok
if the plugin.yml is in the right place, the jar is in your plugins folder, then there's something in your console log about this plugin called "balls"
thats not the screenshot
plugin.yml in wrong spot
there isn't even a src/main or src/resources folder
._.
oh sry
lemme try it
ok
Did you ChatGPT the plugin or smth
nop
Just copy pasting code then?
nop
I have no idea how you figured out how to access the command map without knowing how to setup a java project
no ive seen that clas sbefore, he copied it online
Ah so they're just lying then
video processing, give me a minute
https://www.youtube.com/watch?v=eRmtcxBp4l4 instructions on how to add a resources folder and proper placement of your plugin.yml is here
follow the necessary steps, some are erroneous because I didnt have a spigot plugin improperly configured on hand
and of course I haven't manually re-configured source and resource roots in a long time
idk how the hell u setup that project but sheesh
and make sure the main in the plugin.yml isn't as I typed, I put me.balls.Main because that's your package and my default class name from when I just made the project, but it should be me.balls.Balls for you
ik
no you clearly don't, but alright
i've read some documentations and maybe some tutorials but idk how to setup a java project i kind of tried to understand what the class was didnt copy paste or somethhing
CommandBase was definitely copy-pasted
huh
that one is cus when i made my own version it gave me an error i didnt find a solution for it
because I doubt someone who can figure out how to reflectively access the CommandMap and use constructor overloading can't also realize you don't make it an anonymous class or that you require a plugin.yml in the resources root of your project
🤷 that's what he was asking when he said "Just copy pasting code then?"
welcome to the spigot discord btw, sorry I'm being an ass just no patience atm
lmao
oh
it did register it now
ty
this is my first time making a spigot plugin so im sry
i make bedrock addons usually
its not my first time coding anythin tho
ty
oh ye dont ask why the plugin is named balls cus idk i asked one of my friends what should i name it she said balls
fair
Region: 08341680-0904-4271-af2e-24cc49b12952-mine (type=cuboid, priority=0)
Flags: entry -g NON_OWNERS: DENY
Owners: TSans_*
Members: (none)
Bounds: (-11, 23, 122) -> (141, 167, 284)
Why would I be getting, not allowed to enter flag
If i'm added as the owner
Line 17, this.getCommand("test").setExecutor(new FloodgateTest());
You can't instantiate your plugin class
That line entirely is useless because the plugin class is automatically assigned to handle commands, so you can remove it all together and it should still work 🙂
ty choco
o/
how to make a player invincible?
i know there's a method
but i dont remember it
ive tried with setInvincible
Player#setInvulnerable()
thanks
Your IDE should tell you tho
What's wrong with ConfigurationSerializable
final ConfigurationSection elperSection = permissionSection.getConfigurationSection(elperId);
elper
Actually you can cast a map from yaml
even a list of maps
It will be an unsave cast though. I got plenty of those
I have this List<Map<String, Double>>
Well a set is a list (just without an order)
you can do new HashSet<>(yourList) if you really want a set
Yeah I'm not using a single ConfigurationSerializable as of now. That will be cleanup/optimization at a later point
The function does look horrible though
yes
I can show you xD
?paste
what is the current name of PacketPlayOutUpdateSign at 1.19.3?
So basically you can code your own events (or use mine) and set them up for certain regions, customize them, combine them etc
It will be open source anyway. It's already functional but I wanna do some quality of life and then some optimizations at the end
To be fair: With all those checks it might not even be possible to make the code I sent much prettier 😅
Yeah that would work. I'm more concerned about all those type casts
List<Map<String, Double>> enabledTimedEvents = (List<Map<String, Double>>) map.get("enabledTimedEvents");
like this
There's a reason why I wanna make all that configurable with commands/GUIs. Writing all that configuration by hand is pain
Well not really possible if you need a bunch of strings
I mean you could always close it and tell them to type it in the chat and then reopen but that's tedious aswell
Yeah for version 1 I'll probably still require the events to be configured in the yml directly. Only the regions can then be modified entirely ingame
sleep well :)
thx
Depending on your audience this is sometimes highly inconvenient
I'm aware of that but the config is quite complex since you can have CompositeEvents that basically consist of multiple other events. And obviously a CompositeEvent can hold another CompositeEvent etc
I was thinking about a webeditor tbh.
The only problem is that I don't know if (especially rented) servers are fine with running an application on another port.
Well maybe for your advance users you could still allow manual configuration. But if you do provide this i would recommend a command to reset configs lol. And basically put a warning that manual configuration you will not provide support for. But this really just depends on your audience.
That is if you have plenty who like this to make it worth it to do
The default event config is empty. Resetting won't be hard ^^
Only issue with this is them web panel hosts dont allow additional ports to be opened usually but i never consider them real hosts anyways lol
A web editor would be pretty neat for complex configurations. And doing something like serverport+30000 = webeditor port would probably work for most servers
You could host the web editor
I could but I'm really not that comfortable with putting my real address on a website (and german law requires that for any public website)
But yeah you could implement a mini webserver to allow editing from a browser
Interesting, just have alex host it for you lol
I thought about it but I haven't seen any other plugin do it so I wasn't sure if that's common practice
If he's fine with it I could do that lol
Itd rarely done. There is some plugins that do it just rare
LuckPerms does it
Just talk to him. Sure you both could come to some kind of agreement
So does ExcellentEnchants
But they all host it on their own domains, no?
No
Oh so they actually run a webserver on the mc server?
In that case I can do that, too. Also ensures that it's always accessible
Yes, easy to implement a small webserver in java. Doesnt take much. Just use the apache lib
spark?
Apache provides a websever lib
It has methods and utilitied to implement a small web server easily without you needing to code a whole lot yourself
Just make sure to run the webserver in a daemon thread
I'll surely not do that on the main thread lol
And I will not keep it up either. I'll just start it on demand, generate a unique token and put that in a link that gets send in the chat
Nice
https://www.spigotmc.org/resources/excellentenchants-vanilla-like-enchantments.61693/
I'm either blind or this thing does not have a web editor.
What spigot version are you on?
1.8.8
Yeah then it's not there
damn
mfw that API is 7 and a half years old
xD
You can use the EntityDamageEvent
But I'd not support 1.8 (ever)
As Choco said - this is waaay to old and outdated
Sorry wrong one, its AdvancedEnchants
i should make that
But i have this command /god ye
so the original plan was to use setInvunerable
but, well it doesnt exist
Well that's a paid one. Wanted to check what lib they used but I'm not buying it just for that^^
how i make the listener know that the player is invunerable?
how to make a note to the player
lets say
Store the players/uuids in a list/set and check if they are inside that list/set inside the listener
Odds are its the apache lib
Apache has smaller slpit up libs for their webserver stuff
Is there any way to make it so one tick goes by every time generateChunkSquare(), but that the server waits for it to finish before doing something else?
dont variables in bukkit tasks have to be final?
If you declare it in the task. But you would use a method outside the task to get and set i
Hey @flint coyote look at this
@EventHandler
public void entityDamageEvent(EntityDamageEvent event){
if (event.getEntity() instanceof Player){
Player player = (Player) event.getEntity();
UUID playerUUID = player.getUniqueId();
if (GodCommand.godPlayers.contains(playerUUID)){
event.setCancelled(true);
}
}
}
i made this
how do I insert code into discord?
```lang
code
```
Not a big fan of the static access but besides that that's how it's done, yes
Would it be possible to use books for GUI? When I need a list of strings the chat would be annoying but a book would be fine
Could use the conversation api
Conversation API is nice but chat is a bit annoying to use for text input
anvil guis?
The player has to press an extra button to open it :p
How so?
Its designed for text input lol
But the extra button press!
Lol no different then clicking
I prefer to hop from an Inventory into a book and back. But I will take a look at the conversation api aswell. Although if it's chat based I can probably do it myself
Don't you have to click "sign" on books?
True
Conversation api uses the chat but nice thing is you can put the player in a separate channel and then when done move them back to global and they wont have their chat cleared for that
And signs only allow like 10 characters per line
Wish more people knew about the conversation API
It's great
A bit dated, but great
10 characters would be sufficient but I'll need more than 4 lines and opening 10 signs in a row might be annoying
does anybody know the inventory slot ids for armor slots
Its ironic for how old it is and many dont know about it
i searched online and everything was either 100s or less than 5, and 100s crashes my game
I guess no one really thinks there is an api for that until someone tells them
Its been there since like mc 1.2
dated by who
ChatPaginator too is often overlooked
Hmm it doesn't sound that bad at first glance. However I don't want one entry of the list to be unchangeable after it was entered. Lets say you have to specify a list of valid entities. Then you would type SHEEP enter WOLF enter COW enter and then you notice you don't want the sheep. Feel like a book where you can continously type whatever you like and then "commit" it at once is better for that
It could use a bit of updating. It works but it could use some additional stuff
Wtf is ChatPaginator
You can go back with the api
Just a quick utility class to help with word wrapping
Let me get you a link for an example
For some things lol
I will definitely compare both variants but the question is: How complex is a book GUI? Do I need nms or packets or is it easy to make?
Oh wait you could use this for stuff like lore so it doesn’t go way off the edge of the screen
Conversation api is going to be easier then messing with books
Less to check for and manage
I wrote my own method for this a while ago D:
Guess I should browse the API more
lol
NPE when calling config (Isnt done that way?):
Configuration config;
@Override
public void onEnable() {
saveDefaultConfig();
config = getConfig();
Bukkit.getServer().getPluginManager().registerEvents(new PlayerListener(), this);
//Commands
getCommand("gamemode").setExecutor(new GamemodeCommand());
getCommand("god").setExecutor(new GodCommand(config));
getCommand("fly").setExecutor(new FlyCommand());
getCommand("vote").setExecutor(new VoteCommand());
//Listener
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
enableMessage();
}
I know, i initialize the variable, then assign the config, no?
Need to nake sure config file actually exists if not create it
it exists
Are you building with maven/gradle
maven