#help-development
1 messages Β· Page 1035 of 1
I am just looking for help on my plugin. Thank You though
I do not need links to other peoples code
ok
Hey, so version 1.20.6 is now supporting forward client as we mentioned some time ago?
Yes
At least if you're refering to the transfer packet
Which I assume you are
yeah I want to rewrite Bungeecord plugin to force a client to reconnect to another IP/Domain address
Hello there. Can you please help me with this error that occurs while registering a listener?
// GuiListener
this.getServer().getPluginManager().registerEvents( // Error line
new GuiCloseListener(this),
this
);
org.bukkit.plugin.IllegalPluginAccessException: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "o" is null
Yeah, please, remove this config file from here
Thank you! π
Full code full error. Can't be there, you have no variable called o
Um, this is like the purpose of bungee. Not sure why you need a plugin for it
I have a question about shading plugin libraries, Right now I am shading packetevents, but lets say the admin also wanted to add another plugin that uses packetevents as hard dependency (i.e. just a jar in the plugins folder), does that mean that packetevents will essentially be running twice?
Depends if you relocate it or not. But it you don't relocate it then things could get messy
right
so I have relocated it to be under by namespace
does it just use the plugin twice?
I mean I guess I can try by putting the jar in the plugins folder..
but then I think there would be no way to change that
like say if the plugin folder does have packetevents, then use that instead of the one I shaded
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.3.1:resources (default-resources) on project paper: filtering ...\src\main\resources\translations\es.properties to ...\target\classes\translations\es.properties failed with MalformedInputException: Input length = 1 -> [Help 1]
Someone knows how to fix this or what is happening?
hmm yeah it just starts the plugin twice. Oh well.. I guess nothing to do about that haha
what happened to the org.bukkit.Tag.ITEMS_MUSIC_DISCS field in 1.21?
I need to check if an item is a music disc, but I can't do Tag.ITEMS_MUSIC_DISCS.isTagged(type) anymore
iirc it's not a tag anymore, but a data component
idk if there is API for it in ItemMeta, check the javadoc
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
!verify
Usage: !verify <forums username>
!verify Zedgo
A private message has been sent to your SpigotMC.org account for verification!
Can't find any solution for this
anyone able to help me with a problem im having, im trying to make it so i can apply a custom lore to an item basted on the item i am holding in my inventory and when i click on a helmet TL:DR A custom enchant plugin, but it doesn't seem to work and i don't get any errors.
yikes checking meta instead of pdc
pdc?
persistentDataContainer
looking it up now
not sure it will solve my issue but does seem interesting
i was looking for a way other than meta and item names or lore looks like i've found one
they added that?
Your code has a lot of unnecessary checks
possibly, but removing the checks wouldn't fix my issue
@river oracle have fun https://hub.spigotmc.org/jira/browse/SPIGOT-7757
Does bungeecord have better performance than velocity?
Oh yes after merger of InventoryView stuffs that'll second on chopping block
guess it's on the chopping block now
Probably now works
what?
https://hub.spigotmc.org/jira/browse/SPIGOT-7764 if someone wants to have a go at contributing to Spigot
You need to apply the ench with the new method first
I edited your code
i got a new version working but it keeps deleting the items and i don't understand why
?paste
Did you cancel the event?
Anyway
Check my code and add invEvent.setCancelled(true) at the end
(After it passes all the checks)
added invEvent.setCancelled(true) and it doesn't delete the item now
no idea why
i honestly don't understand that but thanks
yeah
i don't understand how but it does
i added the cancel thing to my code and it worked
after all the checks like you said
Probably because if the event isn't cancelled the cursor and the clicked item will be swapped and you set the cursor to air, so the clicked item becomes the cursor so it becomes air
i sent you the video of it working
Nice
I recommend you to clean up your code, take a look at the one i sent
Most checks are useless
sounds like a query for the plugin author
hi , is this good ? and can i improve it further in terms of performance and consistnsy :
this is a load method , it load kits from a specfic mode
for example solo kits
this will load all solo kits
it works π , but can i improve it further?
You can have multiple fields defined inside a try-with-resources
Quick question: is it possible to run a world async?
No
Why? Two worlds don't need to be synced
Also, if you want, just copy and paste the code inside of
?paste
and send it here
Idk π€·ββοΈ I mean dig into nms and make it run on a separate thread
I realize that players are loaded on the server and not world, so probably it fucked up totally
Also, you don't need to be so verbose on the field names unless you're doing something with them - I would recommend it to look like this as it's a lot cleaner and easier to read
https://paste.md-5.net/xigejutoyo.java
Having that many fields defined can make your code look unclean and hard to read
i see π i forgot about that
yeah i think now its better thanks for the help π
also what do you think about this save?
That looks fine, just the same goes with the try-with-resources how two fields can be in the same try block
someone told me its varnuable to sql injections?
Since it's a preparedstatement, if used correctly - they aren't exactly vulnerable to sql injection, your code looks fine and it uses the prepared statement well
good to know π
If you're using Java 17 or above, you should use text blocks 
IJ has a feature for it
welp i want to get rid of it xD
we are not the same hahaha xDD
yeah
lets say i edit 1 thing in lobby server (both servers connected into the same database) will it change directly or i need to restart ot do smth?
I mean the database will update, but your other server would have to read from it again if it has a cached value
the game-servers (for arenas)
Completely depends on what that thing is and how itβs fetched
Inventory PR step 2 commences!
great things are ahead I feel it in the air
was going to go to bed but the inventory PR beckons me
I feel that
considering most of my NMS use is with menus I have a large insentive to just get this in
Wow minestom and spigot having inventory rehauls at the same time !?
I've been working towards this all year
kekw just getting the ball rolling now finally tho
why tf is this client sided
that's so aggrovating
okay ig its not I'm just not updating with the right packet internally ig
Hi, When a player got mooved (to another server) , the on join event is called before the leave event on the last server. But is it a question of time? Or is it once the join event has finished?
This is even a problem with the current API π i stg if the server can't fix this it'll be so sad
did it work?
how old are you markdown version 5
that should be easy to know
after join event or asyncpreloginjoinevent?
I dont know
is allways after join or prelogin event because the proxy wait one of these event to disconnecnt to the last server or it's not waiting for the event, just a matter of time?
if a player is moving between servers, a login event shouldn't happen
since they are already logged in o.O
I could be wrong, but it wouldn't make sense to have a login event on a server move
for the server it's moved to, it's just connected (it doesn't look to see if it's from another server or not)?
I think
intellij smokes crack
PlayerConnection needs to not use hardcoded reach values for the raytrace
when calling PlayerInteractEvent
someone forgot to account for the fact that minecraft added reach attributes
these shouldnβt be based off a ternary anymore
based on*
?jira
iβm not making an account
public class PlayerStepHandler implements Listener {
@EventHandler
public void onMove(PlayerMoveEvent e) {
Location l = e.getPlayer().getLocation();
l.setY(l.getBlockY() - 1);
World w = e.getPlayer().getWorld();
Block b = w.getBlockAt(l.getBlockX(), l.getBlockY(), l.getBlockZ());
PlayerStepEvent ev = new PlayerStepEvent(e.getPlayer(), e.getPlayer().isOnGround(), b, w, b.isEmpty() || b.getType() == Material.AIR);
Bukkit.getServer().getPluginManager().callEvent(ev);
}
}
@Override
public void onEnable() {
// Plugin startup logic
creatingUtils();
JerryWeapon.setup();
NewbieWeapon.setup();
DungeonPig.setup();
new DungeonPig().run();
createShopSetup();
pm.registerEvents(new PlayerJoinHandler(), this);
pm.registerEvents(new FarmShop(), this);
pm.registerEvents(new WeaponShop(), this);
pm.registerEvents(new DungeonPig(), this);
pm.registerEvents(new NPCIdChecker(), this);
pm.registerEvents(new DamageSystemHandler(), this);
pm.registerEvents(new PlayerStepHandler(), this);
pm.registerEvents(new PlayerWarpHandler(), this);
}
public class PlayerWarpHandler implements Listener {
@EventHandler
public void onStep(PlayerStepEvent e) {
e.getPlayer().sendMessage(e.getWorld().getName());
if (e.getWorld().getName().contains("dungeon")) {
if (e.getBlock().getType() == Material.SMOOTH_QUARTZ) {
e.getPlayer().sendMessage(Plugin.INSTANCE.TELEPORT_MESSAGE.createTeleportMessage("λ‘λΉ"));
Plugin.INSTANCE.MULTIVERSE_CORE.teleportPlayer(Bukkit.getConsoleSender(), e.getPlayer(), Plugin.INSTANCE.MULTIVERSE_CORE.getMVWorldManager()
.getMVWorld(Worlds.WORLD_LOBBY.getWorld()).getSpawnLocation());
}
}
}
}
It doesn't work
how to fix it?
?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.
press alt and f4
do yourself
non junk
make a runnable instead
you are moving the player down 1 block every move event
it is teleport
I am making warp
um, what exactly are you trying to do?
step smooth quartz -> teleport to lobby
if they step on smooth quarts, teleport?
yes
event doesn't called
Bukkit.getServer().getPluginManager().callEvent(ev); not worked
if (event.getTo().getBlock() == event.getFrom().getBlock()) return;
if event.getTo().getBlock().getRelative(BlockFace.DOWN).getType() == QUARTZ) teleport;```
damn
that code will only teleport them IF they moved onto a new block and it's quarts
really?
Alternatively you could do arithmetics checks instead of calling getBlock() to prevent a CraftBlock instance being created.
But probably not that much of a difference
oh I missed one thing. I'll fixc it
Probably getRelative
ye. it doesn't work
yes it does
Show your code and tell us what happens.
I fixed it, added teh getRelative
THANKS YOU SO MUCH!
What even is a "PlayerStepEven"?
I assumed his own event
same with Skript's on step
but it doesn't called
^_^
?
wrong channel
is there a way to get the resource id as i am uploading my plugin so i dont have to then put out another version for my update checker
I just check the version against teh current release on Github
Your resource id should not change with an update. Only when you first post
Yes but you need the id for the update checker
So you need to post, then add the id and release an update
I'm trying to create a currency plugin that sync between servers in real-time, basically I want to do this:
- Server A reduce Player A balance -> sends notification to all servers
- Server B receive notification -> reduce the Player A balance
What would be the easiest solution for this?
Yes but I need a real-time update since I cache the user data inside a map.
supabase has a good postgres based database + they have realtime stuff
caching and cross server is a royal pain
I was thinking about using bungeecord plugin messaging but it requires an online player.
just save the data in a db and then when the player joins the second server THEN load their data into cache and then unload it when they leave
when they join second server, first server unloads from cache
leave/join is too fast for teh db to update between connections using bungee
it's what i use for realtime stat updating
What if I want to create a /currency pay command.
That works accross servers.
Hi ppl, can someone please direct me to the mappings website, I never seem to remember it.
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
screaming sandals or smth?
ty π
hm... what if you made a bungee plugin and just cache everything there..?
make it a bungee command
uhh
when a player leaves, save their cached data to a more permanent db and then unload their data from cache to save resources
when they join, load it
I've never created bungee plugin but I could try yeah.
its a lot easier than whatever you were thinking of doing
outdated iirc
i mean
not outdated
but there's a new prefereed site
who even makes sandals scream?
some interested individuals
Yeah, I'll try that but at the same time I want to create a shop inside the spigot server with that currency, how can the spigot server use the currency?
PMC
or make an admin command for /currency take <player> <amount> and give perms for it to admins but then the spigot plugin can also just use that command
I mean like, the shop will be in a gui, and I need to check if player has enough balance to purchase that.
once again, PMC
just make one request to deduct the balance from the player, and that returns one of 2 enums, either INSUFFICIENT_FUNDS or SUCCESS
put an if condition in your spigot plugin
Alright, I'll try to do that, thanks!
you'll probably have to give each request an ID of some sort because its not like a promise its more of like your plugin will just run a diff function when it gets a reply
so with the id you know which purchase is being talked about
planetminecraft?
sure
?pmc
why is all unresolved reference?
Hello, I saw that in 1.21 org.spigotmc.event.entity.EntityMountEvent has been relocated to org.bukkit.event.entity.EntityMountEvent.
What is the best way, to have my listener working with both for 1.21- and 1.21+. I think using reflection can work, but for this case I have no idea how to use it :/ Someone have an idea ?
import org.spigotmc.event.entity.EntityMountEvent;
public class PlayerMountEvent implements Listener {
@EventHandler
public void entityMountEvent(EntityMountEvent e) {
if (e.getEntity() instanceof Player) {
EventInfo eInfo = new EventInfo(e);
eInfo.setPlayer(Optional.of((Player) e.getEntity()));
eInfo.setTargetEntity(Optional.of(e.getMount()));
EventsManager.getInstance().activeOption(Option.PLAYER_MOUNT, eInfo, new ArrayList<>());
}
}
}```
Build against 1.20.6 and let commodore in spigot handle it itself.
Or register different event listeners based on the version + use multiple modules.
I prefer build in 1.21 to have the 1.21 features
These 1.21 features that you don't have in <= 1.20.6
Yeah but that is not a problem for 1.21 features, I can handle these features with just a if, I dont need reflection
Hey, I'm working on plugin that has some basic lucky block functionallity and one lucky block should spawn a sign that says "Look up!" and then spawns 3x3 anvils above the player.
That all works fine but I'm really struggling with facing the sign in the direction of the player, has anyone ever done something similar:
https://paste.md-5.net/uquruxoziv.java
Is there a way to spawn the sign diagonally? When I place a regular sign in game, that works but there seems to be no way in code, only facing it North, Sout, etc.
If anyone could take a look that would be great!
Don;t spawn a sign, spawn a TextDisplay
Hi iam getting a problem with something , hope anyone can help me :
so if i use this SOLO , it load the solo kits :
and it works just fine
but if i do
it does not load them
they are already in the database
and the kit_mode for the kits are solo
what iam missing?
If I extend JavaPlugin, I won't have issues with casting it to Plugin, right? I committed oopsie daisies on a function parameter, nevermind.
so empty, it throws an illegal arg?
youre not handling the exception of the completable future
so thenAccept will never run as the future completed exceptionally
you get it?
could do that, or whenComplete, which is one method but looks ass when putting an if inside
alright π
i think its time for me to start writing plugins again
was thinking of a custom items plugin
nice
well there are allot of custom items plugin π
maybe do something (Timed items) ?
and in lore it will have expired time
timed items?
I guess they mean cooldowns?
ah
Hi, my scoreboard (tablist) is like overwriten by the scoreboard on the sidebar but I'm using the .getMainScoreboard() fot tablist. And .getNewScoreboard() for the sidebar one. Its the same scoreboard then?
a player can only have one scoreboard
the main scoreboard is the one vanilla uses when you use commands
but then how its possible to set tablist and sidebar score
and any new scoreboard is one you have to set to pthe player manually
you add another objective
ohh okay
each objective has the display property
this allows you to reuse the teams and stuff that are on that scoreboard across multiple displays
which is good for scores but terrible for anything else π
I need some ideas. I want to create some custom entity event like EntityExtinguishEvent. I got a packet listener and got all the logic working. The only problem i am having it that if there are multi players around of course the packet will be send to every player so the event will also be ran mutliple times. Any idea how to fix this issue? A list of all the packet that have been done i think will work but doesn't sound as a great idea.
depends on what the event is actually doing
EntityExtinguishEvent, EntityMoveEvent and prod more later
What packet are you listening to
ClientboundSetEntityDataPacket
You should only really be listening to server bound packets if itβs an event thing
and ClientbounadMoveEntityPacket
Reason?
Well for one it will solve the issue youβre having, and it follows SRP
hi, how would i make it so if i click on an item in a gui , it will listen to the chat async event and it will close the inv , and if i type for example rare , it will take that word only , and use it in the code
albeit an abstract interpretation, but still SRP
i am doing that , but for some reason the inventory is not closing
How will it fix the issue?
iam already registered it
Serverbound gets sent once no matter how many players there are
plus i kanda need the ClientboundSetEntityDataPacket for the EntityExtingushEvent
You shouldnt be relying on the fact that there are players online for it to work
nothing happens when i click on it :
In a hypothetical situation where there are no players online, it should still be invoked
?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.
.
Mb
this is what happens ..
Fair but every player will still have there packet Listener so it will be run multiple times still
it should :
- close inv
- listen for chat
- take the word from the chat i type for example (iam editing the rarity of the kit) so i type RARE
- it set it RARE to the rartity of the kit
Itβs definitely calling the lambda right?
yes
See no reason why it wouldnt close
Why are there multiple listeners per player? You should only need one
Try closing it next tick
In a runnable
I have one per player
You should only need one
If theres something you have to check per player, iterate over a map
More listeners is just more hoops the packet needs to jump through, could cause lag
This is my current setup. It work with player event only but i want to make some into entity event
So i will still need the multi packet listeners for the player events
the display name is also the hologram of the player above the head?
fixed π thanks
hi guys
i have a function
ternaryOperator(condition, resultIfTrue, resultIfFalse);```
which is used in this scenario:
what's that event dsl π
public static void main(String[] args) {
Predicate<Object> condition = Objects::isNull;
Function<Object, Integer> resultIfTrue = obj -> 0;
Function<List<Integer>, Integer> resultIfFalse = List::size;
Function<List<Integer>, Integer> safeListSize = ternaryOperator(condition, resultIfTrue, resultIfFalse);
List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
System.out.println(safeListSize.apply(list) + ", " + safeListSize.apply(null));
}```
i need to write this functions code: it should return resultIfTrue if condition is true and resultIfFalse if condition returns false
inline fun event<reified E : Event>(block: E.() -> Unit) {
Bukkit.getPluginManager().registerEvent(plugin, ::block)
}
probably
no shit
not talking about the fun signature
private static Function<List<Integer>, Integer> ternaryOperator(Predicate<Object> condition, Function<Object, Integer> resultIfTrue, Function<List<Integer>, Integer> resultIfFalse) {
// code
}```
Pls use generics
this is such a java moment
idt you can just register that no?
forgot the params of registerEvent
custom with kotlin
inline fun <reified T : Event> event(
priority: EventPriority = EventPriority.NORMAL,
ignoreCancelled: Boolean = false,
crossinline callback: T.() -> Unit
): UndefinedListener = UndefinedListener().apply{
API.plugin.server.pluginManager.registerEvent(
T::class.java,
this,
priority,
{ _, event ->
if (event is T) callback(event)
},
API.plugin,
ignoreCancelled
)
}
if somebody can help me with this shit i will at least understand what i'm asked to do xD
as a result this function should print 5, 0
use ToIntFunction btw
i don't even know what the hell is going on rn
I dont get what youβre having an issue with
That is so verbose
idk what's going on and why i need fucntion/predicate
Return condition ? resultIfTrue : resultIfFalse
hi is it possible to add placeholderapi support to existing plugins that are on bungeecord?
why are you even writing that shit
i mean uβd just use a boolean parameter and not a predicate since the boolean parameter is evaluated every time anyways
can't convert from Predicate<Object> to boolean xD
I'm using the TAB plugin, with TAB-Bridge, and i've created my own placeholders for my server core, but they will work on the standalone server but won't display on a message sent through the proxy
Well you need an instance of Object to test predicate with
Guy asked me
where do i get it from if i have this exact method signature
as in /papi parse me %my_placeholder% works fine, but they won't work with /btab parse me %my_placeholder%
You cant lol
Predicate<List<?>> p = bool ? ifTrue : ifFalse
var res = p.test(obj)
?
then this task is uncompletable
i personally can, but if it's inside the method signature i'm not allowed to
public static void main(String[] args) {
Predicate<Object> condition = Objects::isNull;
Function<Object, Integer> resultIfTrue = obj -> 0;
Function<List<Integer>, Integer> resultIfFalse = List::size;
Function<List<Integer>, Integer> safeListSize = ternaryOperator(condition, resultIfTrue, resultIfFalse);
List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
System.out.println(safeListSize.apply(list) + ", " + safeListSize.apply(null)); // should return "5, 0"
}
private static Function<List<Integer>, Integer> ternaryOperator(Predicate<Object> condition, Function<Object, Integer> resultIfTrue, Function<List<Integer>, Integer> resultIfFalse) {
// code
}```
i am only allowed to change code of the function
thatβs dumb, but alright
hi iam working on a kit system for now :
- kit are stored in database
- kit are loaded from database
...
in this case i have made a editing menu for the kit, so i can edit it in 1 server , and it should save the editing and push it to all servers connected to same database
yes
is there a better way?
feels alr
Nah thats fine
Just update the other servers cache
Youβre gonna need to give us some more details I think if you want relevant feedback
oh how i can do that?
you can just attach some kind of listener to when you push it
so other servers update their current kit set
and use redis maybe?
redis is one way, I mean do you wanna centralize around redis?
Redis is a bit overkill
i don't want too ..
What database ru using?
i just want it to be editable in lobby , and in game servers it will auto get updates
mysql for now
yk u can write a really duct taped pubsub with mysql
I think luckperms does that for instance
How so?
if you wanna communicate across different servers instead of relying on redis
Mypubmysub
yeah i want that
if i decided to use redis , will it be overkill?
or is it alright?
for performance ?
isn't redis for synchronisation
it will only push updates when i edit the kit
of data
Performance is good
across servers
Correct π
But sorta overkill for the usecase
a lot of my plugins have used it before.
I mean I only use redis if I need its caching capabilities, but like, I hate having to depend on multiple cache layers, it always make the application so complex due to the nature of caching
Like how often are you gonna be editiing kits?
Very overkill though for a 3 server network with mongodb and redis lol
everytime i create a new kit π
often lets say
Well if you see yourself using it in the future go for it
already using it π
Just feels like something you could definitely put in a YAML file or something. Or even defined in source. You'd just have to reboot your servers when games are done :p
Can always reuse the redis server for pther purposes
for arena updates push
that's the thing , i don't want to edit kits in all sub servers
or game servers
and copy paste the .yml files
Well that'd be why you have a proper deployment system
One that copies files from a git repository or something
well its not a privite plugin , it will be public maybe ..
that's why i need to make it configurable and easy for the end user
Then YAML is definitely the way to go - but the way another user sets up their server is up to them
and keep in mind performance
Storing kits in databases is probably less performant than just reading from disk. Doesn't require an internet connection
I mean yea in one way its kind of like that, but like its also for data storing and data availability as well as pub subbing (and it has some great tools to deal with all of this)
yeah i thought about it , bcz when ever a game server is started it will connect to database and it load kits from there ..
that will be really overkill if for example i have 64 game servers running
(skywars games) ..
Maybe host an AWS ec2 instance to run a kit manager which stores kit data on a bucket
as i said its public plugin in the future that would not do it ..
money πΏ
Then proxy with clpud tunnel, using graphql
I made a core for my plugins a long time ago that i still use to this day
It allows me to use most data storage
Huh what what is that?
i thank my past self for doing that because i would never have the motivation today
but Killer, if this is a public software application, youβre gonna have to demand customers and clients to use proper service tools like a proper database service and a proper message broker service etc if theyβre gonna have 64 servers running concurrently
i think it supports like almost every file format i can think of
and even custom syntax for custom file formats lmfao
idk what i did with my life back then
Just fucking with you lol
what should i do then?
There's a reason we call them configuration files :p They're for configuration. To configure the plugin
else I mean thereβs plenty of people that shove their configs in a database, altho I wouldnβt personally recommend that
Databases are persistent storage, not for configuration
Reconfiguring a database table just seems like a massive pain in the ass
yea lol
so :
- database for configuration= bad
- config file for confiugration = good
Basically yes :p
ah thats really painful to edit the system again π
i believe rad puts configs in a db
I can't get into specifics for obvious reasons but if it's any reassurance, Hypixel has text-based configuration files that we can deploy to all the servers - the servers just reboot
what the fuck??
that's only valid if you are doing some extreme kubernetes shit or something
so from what i understand , when ever a game server restart it will get the new confguration files from the deploy system?
Yeah. That's not an uncommon setup. Pretty much every large server I've worked for has had a similar setup
Deployment systems are a whole other bucket of worms
One server I worked on just had a script that did git pull every 30 seconds or so and the server startup scripts did a copy/paste from that dir into the server dir
I would recommend staying away from redis for public plugins
It was a bit janky but it had the same concept
Could have definitely been improved with web hooks and an actual CI/CD setup lol
I mean if you need Redis you can use Redis.
But it's just one more thing your prospective users would require to use your plugin
Itβs hard enough getting users to setup a database
any alternative?
spaces
Tbh I'd rather have 50 superusers use my plugin than 700 people who don't understand what they're doing
people that use 8 spaces for a tab have to die
Well like I said, if you need to use a message broker, you can use Redis. It depends on what you're doing though. You're just making a SkyWars plugin or something right? Or Kit PvP? What's the goal?
Born to use tabs, forced to use spaces
alr i got an updated version
i use tabs always
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
public class Main {
public static void main(String[] args) {
Predicate<Object> condition = Objects::isNull;
Function<Object, Integer> resultIfTrue = obj -> 0;
Function<List<Integer>, Integer> resultIfFalse = List::size;
Function<List<Integer>, Integer> safeListSize = ternaryOperator(condition, resultIfTrue, resultIfFalse);
List<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
System.out.println(safeListSize.apply(list) + ", " + safeListSize.apply(null)); // should return "5, 0"
}
static <T, U>Function<T, U> ternaryOperator(Predicate<? super T> condition,
Function<? super T, ? extends U> ifTrue, Function<? super T, ? extends U> ifFalse) {
// code which should return ifTrue if condition returns true and isFasle when condition returns false
}
}```
except if its yaml then i use spaces for some reason
yes a skywars plugin a really huge one
just do a ternary inside?
how tho
its hard , and sometimes i feel its impossible .. but i try to do my best ..
I guess you're wanting to add a way to transfer people from server to server via command, sign, or NPC or something? That's your justification for Redis?
what the actual fuck is this
Nuker that function cant be complete
Or what's the reason for Redis?
yes i do redis for that
I think so but you can easily test it
to send users from game-server to lobby
Okay, so what if a server doesn't use Redis to transfer players between their servers? π
and also send arena game updates to the lobby server
^ That's at least somewhat reasonable
sad
yes ofc
can't PMC do all that?
Is this for a test question or smth
what is PMC?
?pmc
A Redis server is a fine dependency then, but what if your users don't really have Redis or don't even want to know that sort of information. What if they're using something else to distribute their players? What if they just use BungeeCord messaging (which is a suitable way to transfer players).
kind of
not like it's going to change anything, i'm just trying to figure ot how to solve this
how are you going to invoke functions if you don't have an object to invoke them on
can i use BungeeCord messaging to send Arena data notification to lobby server?
yeah why not
static would like to have a word with you
that's interesting xD
you can send arbitrary data between servers and bungeecord via PMC
dont use bounds
alright thanks , this was really helpful π iam gonna make a second system for that
static abooz
well in this instance i'm talking about Predicate
the object is in the lambda that you return
look at the return type of the method
ohh
anyone help me I want spigot server.jar I need help
maybe that's what i should test on idk
distributing spigot jars is illegal. you must build it yourself
?bt
here are the instructions
i think it's the 6th time in 2 days that i'm sending this message
||nothing is illegal if you dont get caught||
can u teach me how to build it first tell me about Git Bash
you quite literally need to run a single command in a command line
all the instructions are here
all you need is java installed on your pc
Theres even an exe for it now
yes
@fluid river my solution without the generic bounds?
God i'm so confused right now.
I'm using placeholderAPI and TAB as dependencies for my plugin. (The placeholder expansions above show my plugin (vlands) to be loaded)
The command works for placeholderapi (try #1)
Then I try with TAB (bungeecord install), and it doesn't work (shown in ss)
THEN i simply just retype the command and it works...?? (also screenshotted)
no clue whats up, and my messages in the config file don't replace either.
Like it only works second try
and i have no clue why
oh and furthermore: it will only work on the second try with the EXACT same placeholder, if i change a letter, it won't work till i rerun the command again
i don like it though it takes like 3 minutes on my pc to load (maybe it's fixed but i haven't updated it in a while)
of which CMD ? or of spigot
the command line
cmd.exe
or powershell
or whatever floats your boat
maybe you're using linux
you'e rnot
probably works fine on wsl too
dude is not using wsl
but imagine being a windows user
nuh uh
return in -> condition.test(in)? ifTrue.apply(in) : ifFalse.apply(in);
that's the answer
xD
Youβe r
you are returning a function, not an U
try typing fast with only your right index finger
returned 5, 0 somehow
yez
yea that works
Itβs like a coding riddle
'git' is not recognized as an internal or external command,
operable program or batch file.
install it
im sorry but wtf am i looking at
I think git means git file
git is a program
Syntax so cursed itβs like itβs another language
what the fuck are you doing
I am pasting git bash on command line
bump because my brain hurts
Can we see the code
yeah usually I let paper run it for me π
you are exiled from this community
xD
yeah sure, the code works though as seen in the third pic i sent
i'll get the code rq
someone broke the #linux link?
I mean I like spigot and paper both but for different reasons
check DM
send screenie
just download the fucking buildtools gui
stop bothering with the cli
it's just a placeholderapi expansion, nothing special
"how to git gud"
Phone formatting π§
now what
keen observation
i'll give you one without all the other functions
after it finishes running you'll have a spigot jar
in the directory that you ran buildtools in
I feel like its pretty self explanatory ui
he's built different πͺ
wasnt there an issue with th gui build they did?
u mean compile??
surely it wouldn't be the one that would be downloadable then?
@drowsy helm https://pastes.dev/VYNi7i414v
compile w h a t
you requested a spigot jar
buildtools creates a spigot jar
what the fuck do you want
I truncated it to only include the ones i showed in the screenshots
Basically the placeholder works with placeholderapi etc, but when i try use TAB's parse command it doesnt work the first time, but does the second lol
oh nvm i am confused w someone else
select 1.21
click the build bold action button
it LITERALLY tells you what to do
dunno what people fine difficult
so yeah, its the button labeled compile
imma build spigot 1.11.1 rq
I feel like itβs a papi thing possibly?
I had a server owner put my plugin in a folder they created in their home PC directory, not in the server files.
nvm it fails gonna build 1.18 then
zoxide mentioned
Code looks fine unless getCeneteredMessage is doing something funky
nah it does that for everything
ls -l mentioned π€’
i tried a raw message of literally just returning a hardcoded string
eza better
what an idiot
and it still would only return it on the second try
Can you show the method
it's doing my head in
just these I thought I need to play with some commands
yeah
2min 25seconds, wondering if that went fast or not
it looks so good (ignore all my random secrets and shit in ~)
(all secrets are encrypted :))
you;re a secret
real
now get encrypted
whatz eza
they look hot
no
Youeβ r*
it has a eza --tree
YES
i have tree
normal tree sucks
https://pastes.dev/X9BJ2Nl2An
https://www.spigotmc.org/threads/free-code-sending-perfectly-centered-chat-message.95872/page-2
I copied it from a thread a while back, cba to make my own
It works though.
Never had a problem using it, and it works using the /papi parse command so I don't think it's my method
i only need tree and fzf
whats bad about this
i mean if you already use zoxide might as well use eza
ChatColor is deprecated so i could try change that from
message = ChatColor.translateAlternateColorCodes('&', message);```
```java
message = LegacyComponentSerializer.legacySection().serialize(Component.text(message))```
shitty colours and no icons
nerd
show neofetch
uh oh
chatcolor is not in fact deprecated
do you happen to be using paper
Are Player objects still accessible after a player left?
I'm using adventure components/minimessage
ah
This isn't completed, it's my testing plugin
pop os moment
are you using adventure platform bukkit or paper
paper deprecates chat colours
paper
yes i know
But it works that's not the problem
It works apart from when it's sent the first time which is kind of an issue
the only thing i can think of is something is like caching these placeholders idk
so , i think iam gonna go with .yml configuration file and when i edit or save the kit i will use redis to push the updated kit to the other servers
I might just like make my own tab plugin at this point
I'd rather have optimal compatibility than flashy hex colours
just wondering, i dont see any links above, they are below?
yup it works no problem on the paper server :(
might not have fully read it
at the top of the page
?bt
where that
sir are you blind
i mean i just look for a curl link and off i am
ah there, thought that was the bug tracker
i sound like a rookie now
????
it says to keep a watch on it for bug fixes and updates, sounds like a bug tracker to me lol
π
idk that site too long to read π€£
"i ain't reading allat" vibes
too much yapping, get me a damn url π€£
bud right click and copy link
can anyone hop in vc and i'll show them what's happening lmao
Actually after i eat lunch
i'm famished
lol
my main api has like hundreds of warnings
lmao
surprisingly my plugin has almost no warnings in like 16k lines
except for some "unused" files (which i do in fact use), some deprecations, and now unchecked casts
as it should
yup
Heyho, I am developing a plugin right now using the AnvilGui API. I am using johnrengelman shadow plugin. But I just cant get it to run properly does somebody have an idea? (Gradle Kotlin)
my gradle has the id for the shadow plugin
id("com.github.johnrengelman.shadow") version "8.1.1"
the maven repo for AnvilGui
maven("https://repo.codemc.io/repository/maven-snapshots/") {
name = "codemc-snapshots"
}
and the dependency
implementation("net.wesjd:anvilgui:1.9.4-SNAPSHOT")
I first executed the shadowJar gradle, then I build it.
If I reload my server now I get this exception in the Listener class which uses AnvilGui
[15:09:25 ERROR]: [QuestSystem] Failed to register events for class com.schotzgoblin.listener.EditQuestListener because net/wesjd/anvilgui/AnvilGUI$StateSnapshot does not exist.
Does anyone know how I could create a virtual server on Bungeecord?
It'd just need to be an empty, limbo server
show your code
I'm not familiar with the yaml structure.
Could someone give me an idea of how I could access the username and message of every player that's currently in the elections section?
elections:
uuid1:
username: this_is_a_username
message: "Making the world a better place!"
uuid2:
username: this_is_another_username
message: "this_is_a_username sucks"
I thought yaml would be as simple as json.
.getConfig().getConfigurationSection("elections").getValues(false).forEach
or so on
So this gets the section "elections" and then iterates over every player in there?
or just getConfig.getString("elections.uuid1.username")
ConfigSection section = config.getSection("elections")
for each string key in section.getKeys(false)
String username = section.getString(key + ".username")
String message= section.getString(key + ".message")
Alright, I think I understand what's going on there! Thanks!
I've admitted defeat and I am coding my own plugins from now on,
Talk about trying to get other people's code to work
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
Update IntelliJ
When I go to Check for updates and download latest version it shows "Current version of InteliiJ IDEA is installed. Do you wish to continue?"
what version do you have
2024.1.3 if this is what you mean
How can I check that? I just switch maven import from 1.20 to 1.21 and compiler throw some errors
try invalidating caches then maybe
make sure you're using java 21
File -> Invalidate Cache
Alright gimme sec I have indexing now after clear
Yea its working, thanks guys @pseudo hazel @blazing ocean β€οΈ
Also @young knoll (sorry ping) π
Like minestom or something
Sounds like something doable with minestom
it's java requirements are insane
I want to aim for that
as performant as possible
but since they don't use netty I have no idea how to optimize my packet hackery
Go in their discord and ask around
like sending a lot of packets
Never to late to learn something new
yeah I know
but another thing is that i'm worried about version translation
since ViaVersion doesn't support Minestom yet
That's a valid concern
me when I had to learn for exams
they'd need to use ViaBungee
I don't study in school kekw
but on Via's discord they said to not use it because translation accuracy is lesser
and if they use ViaBungee, they can't use other Vias on other spigot servers
another thing is that while minestom is fast af, it's packets still need to go through bungeecord
as a mediocre
so I thought it'd be better to just create a fake server on bungeecord itself
I'd also need to send a plugin message to and from that server, which I have no idea how to do
to inform the minestom server how to handle the player
@river oracle what do you think?
builder
Very easy to do
what about the other problems?
?pmc
minestom
gg
I had some smaller problems with versioning for clients <= 1.19.4 or something but I've just made my network 1.20.2+ anyways because of text display riding height changes
How far are you trying to support
1.8+
Could try vialoader in a proxy plugin
Someone in the minestom discord implemented it before
I guess I could do that
so you think creating an actual minestom server is better than a fake server on bungee?
Wdym fake server on bungee
What're you trying to do
Hmmm
I think it'd be more worth your time than creating a fake server on bungee
okay, my last question
where can I test this stuff for free?
do I make a bungee on my pc somehow?
You could setup a little localhost neteork
are there any good ways to do this?
Just how you would any other localhost
what's a good way to make block displays not die
If I call getDefaultSection on a configurationsection, will it turn back to the same section from the default config?
how do they die
they cannot die
despawning, Entity#remove, etc
and wdym not die
just.. not die
I have a problem with the lastest version of spigot 1.21 (it worked yesterday...):
Caused by: java.lang.IncompatibleClassChangeError: Found class org.bukkit.inventory.InventoryView, but interface was expected
do someone know why ?
...wdym not die π
yes
so Entity#remove won't work
there's an event
Any idea how to make an entity not persist? I call setPersistent(false) and override shouldBeSaved on NMS but it's still saving
that isn't cancellable
:-:
omg is that cabernetmc ceo
yes but what do I need to change in my code as I'm just using InventoryClickEvent#getView()#getTitle()
(and I am not importing InventoryView anywhere with "import")
if you make a custom entity in nms, can you override the way it gets despawned or deleted
works on my machineβ’οΈ
nuking the entity during Chunk unloads causes nasty exceptions too x)
Anything I can do by overriding save?
?
override the remove method
ok
It looks like you have compiled the plugin with a newer build of 1.21 but run it on an older build of 1.21. Updated your spigot version which you use to run the server and it should work
I'll try thx
What's the best unit of time to store? Seconds or ticks?
Seconds
Depends on the usecase
its abstract class..
instantiate your KitImpl?
ig gson simply needs to create an instance and it then sets the fields
i forgot how it works
just register an instance creator that returns a SkywarsKitImpl with default values?
can i do that?
i dont know if it will be able to set final fields
i mean you can try, i usually deserialize all that stuff manually as reflection always breaks
alright thanks
oo more streaming
fixed it π
couldnt you also like add a JsonDeserializer<SkyWarsKit> and JsonSerializer and call registerTypeAdapter?
that one does have the value of the object, and the received json object
ktx.serial + kaml β€οΈ
Hey, i'm trying to get if a player is connected to a proxy via messaging, but it didn't work...
Could someone tell me what am i doing wrong?
sending code 1s
Then i'm requesting it like this:
What do you think is the best way to do it ?
add another value called :
kit_mode: solo
or keep the current system?
me when the union gets discriminated
discriminated unions π
if only java had those
and a superclass with a restricted set of subclasses is a union type of any of those subclasses
record JsonObject
record JsonArray
record JsonNumber
record JsonNull
record JsonBoolean
record JsonString
sealed JsonElement permits ...
vs type JsonElement = (.. | .. | ..)
it is quite literally the same result, you still need to pattern match on the actual type, etc
the only difference is that the creator of those classes is the one providing the union type rather than you defining some typealias or w/e
I'm playing around with some of the new 1.21 blocks and was curious if there were any way to access the list of players that had looted a vault. I'm not seeing any way to access the player list, only to change the state of the vault.
What are some good GUI Library/Framework?
IF, triumph-gui, interfaces, your own
i love triumph-gui β€οΈ
i change java version to 16 in models, compiler why i getting this error records not supported in -source 14
Looks like they're marked as experimental, there might be some api additions not implemented yes
Take a look or make your own PR to the API if you want to help out
?stash
?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
Sounds like it's not set to 16
π
π
interfaces-kotlin β€οΈ
@icy beacon you should try it
Hi all! I'm trying to create a plugin for exploding arrows, but for some reason the arrows don't explode, I'm attaching the code below. version 1.12.2
https://pastebin.com/CUrxKBPk
i cba to migrate my guis
want a code leak
'org.bukkit.event.entity.EntityRemoveEvent' is deprecated and marked for removal what do i do?
Don't use the metadata api
this happens when i override remove in Entity (nms)
And also you're never adding the metadata which is why it's not working
and what should I use
thanks
Entity MetaData being different from ItemMeta
Doesn't exist in 1.12.2 they're on their own
