#help-development
1 messages · Page 638 of 1
if only
yeah there's no plugin.yml resource pack info
Why would they have to be compatible
but we can do code analysis :)
we want alex to convert his RP merge program to a plugin
yes but plugins don;t generally set teh RP, thats set on teh server at startup
Maybe but it works for all packs
with a keyed registry any plugin could register their RP
Catch the outgoing packet, dowload from the link it is sending, merge it, and then put the merged pack on a small internal http server and use that as the download link
perfect
can;t rely on a local http server
Why not
I wonder if uhm
Local servers are common
by having the client download a zip file from the url provided in the packet
But yes external is also an option, just costs money
servers could act maliciously and somehow upload a weird zip virus
Maybe
https://github.com/Y2K-Media-Creations/Suketto/blob/master/build.gradle > Getting errors when compiling
https://github.com/Y2K-Media-Creations/Suketto/blob/master/bukkit/build.gradle > Line 21
error
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
> Cannot resolve external dependency de.themoep:minedown:1.7.1-SNAPSHOT because no repositories are defined.
Required by:
project : > project :bukkit
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I'm literally DEPENDING ON IT
THE REPOSITORY IS THERE 😭
invalidate caches and restart
i did already 😭
Add the repo to your base build file
same error
@young knoll okay I fixed it with your method, but I'm confused
I need it in the local and the module directory
that seems redundant I feel like theirs a problem with my configuration
hmmm its because my main handles all my gradle shadowing vs each module individually
how to use BlockPhysicsEvent to determine if block is broken due to another block being broken for example redstone torch being broken when the block that the torch is attached to is broken by a player or a redstone wire being broke when the block under it is broken
Hi, how to use hex color in a message ? Just &#hex ?
ChatColor#of("#FFFFFF")
Just do
return text.replace(...);
or if you wanna add more
text = text.replace();
text = text.replace();
tho i don't recommend it, it doesn't scale well
well not much of a choice with multiple placeholders
there is actually
you can create a compiler
tokenize the string in advance
and then have a context that you can use to fill the token
return text
.replace(...)
.replace(...)
i'm getting a NoSuchMethodError and i'm not using any reflection??
relevant part:
java.lang.NoSuchMethodError: com.roughlyunderscore.listener.JoinListener.<init>(Lcom/roughlyunderscore/KitPVPPlugin;)V
at com.roughlyunderscore.KitPVPPlugin.initListeners(KitPVPPlugin.kt:345) ~[?:?]
line 345:
JoinListener(this).register(this)
// register method:
fun Listener.register(plugin: JavaPlugin) {
plugin.server.pluginManager.registerEvents(this, plugin)
}
listener itself:
class JoinListener(private val plugin: KitPVPPlugin) : Listener {
@EventHandler
fun onJoin(event: PlayerLoginEvent) {
val player = event.player
if (plugin.purgeManager.beingPurged.containsKey(player.uniqueId)) {
event.result = PlayerLoginEvent.Result.KICK_OTHER
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "&4&lYou have been purged.".formatColor())
}
}
}
i compiled this plugin with this class a couple days ago successfully
after some changes in the plugin it now throws this
what's the line 345?
Are those from two different plugins?
no
i feel like this error shouldn't happen
Did you try to compile again? I had that happen before
hm, sure, 1 sec
clean and install maybe helps
i got so flabbergasted i didn't even try recompiilng lol
nothing changed
i'm even more flabbergasted
Such an error is weird. Maybe if an exception is being thrown in a static block...
Well you are implicitly creating a static block in Kotlin with
fun Listener.register(plugin: JavaPlugin) {
plugin.server.pluginManager.registerEvents(this, plugin)
}
ah, fair, but it registers like 10 listeners before getting to the JoinListener
Make this method null safe
don't see why it could be problematic
i'll try to comment out the JoinListener and see if the problem is actually within this extension
how to use BlockPhysicsEvent to determine if block is broken due to another block being broken for example redstone torch being broken when the block that the torch is attached to is broken by a player or a redstone wire being broke when the block under it is broken
after having commented it out, the error disappeared, so it seems that there may be a problem within registering the joinlistener. i'll try to do some extra null checks
just return the replaced function
in like 107 of your VagtshopSign class make an if statement to make sure your hand isnt empty
i replaced my registration line with
server.pluginManager.registerEvents(JoinListener(this), this)
and i'm still getting the error, so the problem is not within the register function 🤔
whats the error?
^
to just add on with what 7smile7 said, just make sure your code is null safe, its a simple mistake that gets everyone
Dont you have air in your hands now?
On default
Ah wait. Can be fired by your feet as well.
And the offhand
What is your constructor of Join Listener class
Can you send it
I'm not even sure if AIR is returned for the hands
just this
lightshot
i'm trying to comment out various parts of the listener rn to rule out possible reasons
Decompile your jar and look at the constructor
Yeah I'm pretty sure constructor is problem somehow, hence missing method is <init>
yeah, i commented out everything but the constructor and the error persisted
how weird
can you send the whole thing i think theres something being missed in this. Use pastebin
Try to decompile it as smile suggested
?paste for me
huh
decompiled:
youre calling getState() which getclickedblock could still be null im presuming. so do something like java if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { // your code here }
this is of a version where i commented out everything but the constructor so conveniently there's just the constructor
Weird lol
if you call your variabes "e" you should rethink your life choices
i'm so confused
I mean they've skipped every Java tutorial we've sent them so I don't think they'll read that either
honestly its possible its just kotlin messing up? i dont use kotlin so im not too sure how well it works
fair enough
I use #of ?
it could be, but the decompiled version is fine, so why would it be so?
and this does not happen to any of my other listeners
that also have this same constructor
https://paste.md-5.net/onasivukik.java
My code almost works the only issue is that it doesn't always takes the nearby entity's, error that I get in console is index out of bounds 7 of 7.
Does someone know what is wrong?
oh well if it works for the others then there must just be something really small that you made a mistake with on that one class
did you clean before compiling?
well you have the entire class before you 😛
in my 1 st message
yeah i always do clean package
yep
why are you doing += 2?
package? You using kotlin + maven??
if index is out of bounds then there must be an error in your for loop. Can you send me the full error message
You might want to fix your method and field names to follow Java conventions also do remember that y can go below 0 in modern versions
also whats M_RANGE?
whats teh error now
oh nonnoo
put it before
you mean the i + 2? it so that there is a gap between each lightningstrike
wait ill show you hold on
Can't send a screenshot for some reason
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (event.getClickedBlock().getState() instanceof Sign) {
// your code here
}```
?img
Not verified? Upload screenshots here: https://prnt.sc/
;/
This checks if the player right clicks a block (the event is PlayerInteractEvent) and if not then just make the listener do nothing, however if they right click and block check if the instance is a Sign. If it is then run the code. You can get the sign by doing java Sign sign = (Sign) event.getClickedBlock().getState(); if anyone wants to correct me please do
i changed the constructor to an even more explicit constructor:
class JoinListener : Listener {
private val plugin: KitPVPPlugin
constructor(plugin: KitPVPPlugin) {
this.plugin = plugin
}
yet it is throwing the same error
i am actually probably missing something but i have no idea what it is
can you get me what code is on line 72
wait i think i might know. Are you importing the right Listener?
im guessing many things are also called Listener in java
yes, the code wouldn't even compile if i didn't
it would
because my register method takes org.bukkit.event.Listener
no
i'm passing this class as an argument
it must be the listener
still though, yes
public class maybe?
What's M_RANGE
are you talking to me?
The max distance that the lightning line may go.
class is by default a public class in kotlin btw, and yes, all the other listeners are public
What value is it
just in case you didnt know
15
@EventHandler
public void onInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) return;
if (e.getClickedBlock().getState() instanceof Sign) {
// we already know bs is instance of sign
// and we know bs isn't null
}```
wasn't to sure since we run the all-open-plugin for kotlin at work lol
😄
Try setting it to an even number
Just did and still same error in console
im a little confused so what do you want this code to actually do. Can you send the full class and include it in a pastebin?
?paste
if youre trying to get nearby entities then i think its built into bukkit past 1.8 aswell. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html
sure
i think i know what the problem is, there's a dependency in my plugin that has a JoinListener as well
i'll just rename it to something more specific, in my case PurgeJoinListener
@icy beacon atleast you fount it
you know for the future now
https://paste.md-5.net/ahobuzulic.java
the code makes a lightningline effect with each lightning having a delay on it so that you have a slow line that keeps traveling untill it hits it max distance. But I also want to add custom dmg to the entitys that get hit by the lightning.
execute() is a custom made event like dropping a item. (this works because a lot of other things uses this and don't give a error)
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!(event.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
if (event.getClickedBlock().getState() instanceof Sign) {
Sign sign = (Sign) event.getClickedBlock().getState();
that should be fine then
Honestly it's not worth your time to spoonfeed
They've shown 0 interest in learning Java they're just using you to write that plugin for them
i mean its not really spoonfeeding. Most programming is learned in the beginning by spoonfeeding. I dont mind
oh it just sets to to a higher priority than other events, so it gets ran first. I may be wrong tho i actually didnt read the docs and im just guessing
Higher priority means it gets run last
So it's changes takes priority
You'd know what you were doing if you had followed at least one Java tutorial we've sent you over the last few weeks
theyre not, theyre trying to learn java and are encountering a problem. Theyre asking for help and im trying to help them. It's literally what this discord channel is for
instead of asking us for every step of the way
Olivo is right
This discord channel is for spigot development help
Yup
Not java basics help
not Java help
The expectation here is that you know java. This channel is specifically for help with the API.
Makes me remember the "How do I delete a constructor" question
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
its not really java basics help theyre just encountering a problem with the API and not knowing how to properly solve it
who are you
No point we've sent that like 20 times
why aren’t you helping this unknown person
A null check is not an api problem
No, no. It most definitely is a lack of basic understanding. If you look at his message history and paste links, you'll figure that out real quick.
They were spoon feeding for a while
true true
Hello, im using Player#setInvulnerable() to set a players invincibility after death, im making a custom death system btw. The player is still not invincible. Should I delay the method like a few ticks?
but my point is im not trying to deter a young programmer thats trying and idm spoon feeding for abit. tbf all i spoonfed was like 4 lines of code aka the null check
Set it in the respawn event
oh true
alhumduillah
help them in the long run by letting them learn java properly
wait what?
respawn or death event
respawn
why tf
thats what im trying to do, i also put comments to explain why he shouldnt have done it the way he did
The player has no body when in the credits scene so it's respawned when exiting the portal
but they wont learn, they will be back later to ask for more basic java help
oh i see
im not arguing more about the way i tried to help him the way i did since hes stopped replying so im guessing hes fixed it lol
Yeah and they'll be back later today or tomorrow with the same question
we'll see
I've already seen it happen
Just look at his message history.
hello
It's not that hard.
i need help about betterranks can anyone help me?
Ask in #help-server
thx
still doesnt work ```@EventHandler
public void onRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
Location loc = new Location(Bukkit.getWorld("world"), 149, 83, 560);
player.teleport(loc);
player.setInvulnerable(true);
}```
Try delaying by a tick
can you send the updated code
Location loc = new Location(Bukkit.getWorld("world"), 149, 83, 560);
Bukkit.getScheduler().runTaskLater(NewNanca.getInstance(), () -> {
player.teleport(loc);
player.setInvulnerable(true);
}, 5);``` not the best solution tho
does the player.teleport(loc) part work?
yes
i mean if it works it works, i dont see anything too wrong with it
hm
?paste
Hi, to use hex, i need to call function or just add "&#myhex mymessagecontent"
Hi so i am making practice plugin and i am getting this error which im not usre why is happening because everything should be defined properly and nothing should return null value
in function onPlayerJoin i wrote line 30
playerDataManager.setPlayerData(player.getUniqueId(), new PlayerData(player.getUniqueId()));
then playerDataManager might be null
yes i do understand english so i can read but im not sure why is it null
manager is registered in on enable properly and the variable is initialized properly
because you probably never set it?
Can you show the full PlayerListener class?
?paste
fixed it, i didnt see in the docs, that the player can still be hit by players with creative
ah
maybe set the player to spectator?
or if you have essentials installed you can set them to god mode
nah all good, the players should be in survival anyways
just tested it with creative
or if you want invincibility then just give them like regeneration 1000
registerListeners();
registerManagers();
try swapping those lines
swaping them in onEnable ?
yes
weird but okay
how is it weird, you reference it in the listener but it's null when you create the listener
no no
weird how dumb am i
lmao
HAHAHAH
happens to the best of us. Sometimes you just gotta take a break
well ty
So I got premium plugin and would like to have some dependencies which are not compiled to plugin but will load dynamically with
libraries: feature in plugin.yml and for older version I will use dynamic loading which I got all workng code
Now premium plugins should work if machine dosn't have internet so offline
So "libraries:" feature in plugin yml will not work and for older version my dynamic loader will not eather
Can I provide all of dependencies in file uploaded to media fire as zip in description on spigot page so people can manually get it and install it?
So, #1234xy is &1&2&3&4&x&y?
Hmm sounds like something @vagrant stratus could answer
You can link external files for your uploads yes. Though, i’d suggest github releases or similar for file hosting they’re great.
From the guidelines I just read that it is not allowed
But you can also just let them know of your resources and tell them where to go get the library files 👌🏻
it has ot run at first start, after that it has be ok offline
Libraries are downloaded once and will then work offline
your implementation must do teh same for older versions
So are u saying that when first time person installs plugin they should run it with access to internet?
Because I am using Libby which will load libs for older version same as "libraries:" feature in plugin.yml and it only needs access to internet onece to work after lib jars are downloaded it is not trying to get them on every start up of server
correct
lets say theoretically I had to check idk 100 or so chunks to scan for specific blocks, how would I do that with BukkitAPI
slowly
is there a way you can do that async?
yes
:} I'm interested
slowly take chunk snapshots, pass them to a queue and process async
fun :}
you can process them as fast as you like, but you shoudl limit the speed you take them
do chunksnapshots take up a lot of the 50ms window
don't worry, no matter what you do, I doubt you'll ever get to this TPS https://cdn.discordapp.com/attachments/694661573125472256/1133164486996541440/ce646602e765ce1dd710394935d753fa.png
I did that once
I accidently ran an infinite loop which spawned in like 100s of Completeable Futures per loop every single iteration
how do I end a hover event when using a ComponentBuilder?
if I had kt val message = ComponentBuilder("test. ").append("Hover over me! ").event(Event.fromText("Woah, magic! ")).append("Don't hover over me!") how would I make Don't hover over me! not have the hover event?
normally it should only iterate a few times with one async call, but since I forgot to yk make the loop condiiton it kinda crashed my server
wtf?
how?
left too many heavy math things running synchronously, and eventually they all got VERY LARGE
overnight
oh
How do i fade in and fade out on a title?
?jd-s
declaration: package: org.bukkit.entity, interface: Player
beat me to it :(
Is it only possible to do in the newest versions? because my plugin is for 1.8 and when i use it im just getting errors
Okay fair
packets
if you don't know Java which i've seen you've struggled with in the past have fun with NMS it only gets harder if you don't know what's going on. Best part about NMS is you are on your own
granted for such a legacy version you might beable to find something
iirc it exists in 1.8
whats the error?
or maybe it doesnt and you have to do funny stuff
sec
doubt it I saw lots of threads with 1.8 in the title being not in the API
either packets or some command bullshit it looks like
sendTitle(String title, String subtitle) should exists according to some docs i found
Yeah it does but fade in and fade out dosent
You have to send packets for timings pre 1.11
iirc the api wont do that in 1.8
Okay thanks
get its type
instead of hand
getItemInHand().getType()
Thx <33
someone knows why, if i try to ban player or even kick i get
Caused by: java.lang.NoSuchMethodError: 'void org.bukkit.entity.Player.kick()'
at pl.namecraft.nccore.command.ExampleCommand.onCommand(ExampleCommand.java:35) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more```
That method doesn't exist in Spigot
Is it possible to make Client-Side Items? I mean that you can drop an Item, that is only Client-Sided?
how
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerKickEvent;
import org.jetbrains.annotations.NotNull;
public class KickCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command,
@NotNull String label, @NotNull String[] args) {
if (commandSender instanceof Player sender) {
Player playerToKick = Bukkit.getServer().getPlayerExact(args[0]);
if (playerToKick == null) {
sender.sendMessage("player not online");
return true;
}
playerToKick.kick(Component.text("kik"), PlayerKickEvent.Cause.KICK_COMMAND);
return true;
}
return true;
}
}
Yeah you can do that. It's a pain to do since you need packets
it compiles and everything
Yeah that's Paper API not Spigot API
You can't use that on Spigot
Can I get the name of the ender pearl aswell?
what should i do
you can get the display name from its item meta
but
warning
Can you show me an example how to do it?
Run a Paper server or use Spigot API
switch to paper server and go to the paper discord. If you've dev'd your entire plugin with paper why undo it all
if you want to identify a special item that way, dont
No. That's going to take a lot of time since you need a lot of packets
Is it not a single packet?
why
cuz of the possibilty of players renaming items and other stuff
You'd need to account for item movement, moving in and out of view distance etc
its just something that you should avoid
Anvils is turned off.
so its impossible. 😄
thanks
even so unless your environtment is really controlled i would not recommend it
but if you really wanna
get the display name from its itemmeta
and store some unique name in there
you really should
but I need for 1.8, please dont kill me
nbt
and if you are using 1.8 you are already dead
eah there is no command for it xD
google it I guess
bro all danish servers is 1.8
then use nbtapi
I wanted to make pdc for 1.8, but I decided to fuck it
X
Use viabackwards and a plugin for old pvp
no they are not
no they can see the little cooldown thing on their screeen, and then they flip
Almost
Viabackwards
Not when they are on 1.8 client
nowhere near
Oh
Er du dansker?
no
They're.
wut
You can imitate it by using titles, but only if you need
thats what viabackwards does
And geyser
we dont talk about geyser
HAhahaha
The best setup would be something like a 1.16 server (for optimal performance) with viaforward, viabackwards, viarewind and some plugin to return old combat mechanics. You'll get a lot of the new api features and yet people will be able to join from 1.8 and play like normal
Nope, because the ladder bugs in 1.8 with 1.16 and viabackwards
you cant go up at ladders
Ja det er seriøst rigtigt
Ja
Best is to run latest
Folk er hovedløse
this ☝️
unless your players are extremely picky and cant survive without the real 1.8 experience
Enig
The problem is world heights
Altså de ved ikke hvad de går glip af
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
fun onEntityDamage(e: EntityDamageByEntityEvent) {
// Only handle item frames, armor stands and end crystals
if (e.entity !is ItemFrame && e.entity !is ArmorStand && e.entity !is EnderCrystal) return
val location = e.entity.location
if (e.damager is Player) {
val player = e.damager as Player
// Check the break blocks flag
e.isCancelled = ListenerUtils.shouldCancel(player, location, "breakBlocks")
}
val projectile = e.damager as? Projectile ?: return
val player = projectile.shooter as? Player ?: return
// Cancel if the specified player doesn't have enough permissions
e.isCancelled = ListenerUtils.shouldCancel(player, location, "breakBlocks")
projectile.remove()
}
}
Hi,
I've got my little code snippet and have a question if it would be possible to get rid of "if" statement which is checking if e.damager is an instance of Player. I thought about creating a val player and assigning the value of e.damager (val player = e.damager as Player) to it but I'm not sure if it's gonna work as intended. Any ideas?
Mit liv ville være så lettere hvis man kunne lave en 1.19/1.20 server, og man ville kunne lave så mange fede features
From my german experience I'd guess that means something like "yeah that's actually true"
You can change the world height in the config
Wait you can?
yes
Holy shit
server.properties
Ja rigtig nok men folk bliver på 1.8 fordi pvp
Yep, desværre..
i apologize for my kotlin noobyness but doesnt kotlin already infer the castability when the "is" check succeeds?
Yep thats right
I now feel cool
Ja, das ist richtig.
Korrekt.
Super
Legit kan 70 sprog med alt det man lære i dansk skole
Uh. I just started with kotlin like 2 days ago, so I don't really know how it works therefore I'm asking here to make sure
I mean I know how it works but not everything XD
well in that case probably try it and see
Ja, det sorgerligt, tjek pb. 😄
That's a good idea
override fun execute(sender: CommandSender, args: Array<String>) {
val player = sender as? ConsoleCommandSender
player?.sendMessage("test")
val pl = sender as Player
pl.sendColoured("Hi!")
}
Possible to make it like that in the command but I can't find a way around it in the listener so I'll stick to the method I have now
a
Lol virker underligt
Don't forget that this is an English only discord
I speak emojis
I disagree.
Hi, if i good understand, un Java, hexcolor os like this
#1234xy is &1&2&3&4&x&y?
Smart casting yes
You forgot &x
At the start
Ah yes
Exist an function to translate my &# in &x ?
What do you say?
And i can §#1234# directly ?
That's not the correct format.
You can use #123423 in ChatColor.of
Ӓ# and i translate it. Is good?
Chatcolor.of is spigot lib function?
Yes, net.md_5.bungee.api.ChatColor
Yes
Ah bungee no spigot directly?
The bungee chat color is included in spigot.
Heh
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/ChatColor.html
of méthode is not here?
Wrong ChatColor
No
?jd-bcc
Idk why the bukkit chatcolor seems to be obsolete, but you can just use the bungeecord ChatColor class.
Hi, any form to generate a new end world but with not dragon and the exit portal created? i wanna avoid make random things like kill the dragon later than spawn because need wait the animation and all the things :/
Couldn't you also just change the spawnpoint in the end?
And without bungee, i cant translate ?
Correct
#of() isn't included in the bukkit ChatColor class.
Ӓ# and i basic translate it. Is good?
?chatcolor
?hex
Is there not a command that shows the general way to translate hex color codes?
sadly not
one sec tho
public final Pattern HEX_PATTERN = Pattern.compile("&(#[A-Fa-f0-9]{6})");
public final char COLOR_CHAR = ChatColor.COLOR_CHAR;
public String translateHexColorCodes(String message) {
//Sourced from this post by imDaniX: https://github.com/SpigotMC/BungeeCord/pull/2883#issuecomment-653955600
Matcher matcher = HEX_PATTERN.matcher(message);
StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
while (matcher.find()) {
String group = matcher.group(1);
matcher.appendReplacement(buffer, COLOR_CHAR + "x"
+ COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
+ COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
+ COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
);
}
return matcher.appendTail(buffer).toString();
}
it can? the issue is avoid the tick of battle spawn first dragon
There's a better one.
It won’t spawn the dragon if you don’t reset the dragon battle data
is that kotlin i see 👀
Which I think is stored in level.dat
Yes
public static final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");
public static String formatHexColorCodes(String string) {
Matcher matcher = HEX_PATTERN.matcher(string);
while (matcher.find()) {
string = string.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
}
return string;
}
buildtools failed while trying to update to 1.20 because it couldnt find some maven dep
lol
I set it static and i just can translateHexColorcodes()?
i dont use the format so just send the first i found
use shadows method but year
Shadow?
And without bungee, is not possible to translate hex with basic spigot lib?
Something bad about it? 😄 😄
[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:3.3.0 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-jar-plugin:jar:3.3.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] when running buildtools 1.20
bungeechat is a transitive depndency of spigot-api
not used to seeing it for spigot
Oh
Just build 1.20.1. It's protocol compatible.
It's much nicer to code with for me
If i have a spigot project, i need bungee project to use it ?
still failed
So what is the best between chatcolor.of and this ?
fails on Spigot-API reactor step
That uses ChatColor of
What java version are you using to run buildtools?
oh wait its telling me i should update maven or something
cant find stuff in local repo
idk it just updated
im running it from the buildtools.bat
Ah yes, what the code using it bring moreover?
??
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate. looks like i might be using outdated buildtools too
Well, it would probably help if you always had an up to date version.
Why use this code rather than just chatcolor.of ?
It does use ChatColor#of()
Just ChatColor of wouldn't do what you want
Also, I don't think that bat script is really that good. Would be better if you ran BuildTools from the command line.
ahhh i updated the batch file and now it asks for jdk versoin
hmm just says done and nothing else
and thers no file
The problem with that bat script is that it's looking for specific java versions that you may not even have installed.
The GUI will solve most of these problems once it's complete. :3
But in the mean time, gotta do it the old fashioned way.
Where is the .of méthode ?
how do i make the player burn?
Entity#setFireTicks()
?jd
If I understand correctly, doing .of does not return the hex, so you need this code to generate a hex from the result of .of?
Yes
anyone can help me out i wanne send my players from my lobby to my survival world true a gui but nothing works
and .of returns what exactly?
The translated color code.
no idea what youre talking about but in enums Foo.of(some obj) retrieves the enum val associated with the obj
so the same as translatecolor?
You know, just for fun you could try using the GUI that's in development. Not entirely sure why you are getting that error.
#1117702470139904020 message
Yes. #FFFFFF is not a valid color code that minecraft can display. Minecraft uses the section symbol (§) to denote color.
#FFFFFF would get translated into §x§f§f§f§f§f§f using ChatColor#of("#FFFFFF")
player.teleport(Bukkit.getWorld("world").getSpawnLocation();
Idk if that's what you need
can someone please help me i have a portal plugin but only the people with op have accse to enter the portal
i'm using skript
back in the day i knew it was possible but not sure now
Uh? So I guess it'd be better to ask such question on skript discord
Oh and forgot to mention - learn Java and spigot API cause it's such a great thing to know
But if it returns the color of the hexagon, what's the point of the function you've given me?
One sec
i use simpe portals
So that you can write hex color codes normally and the method will translate them for you automatically.
Do you really want to type out §x§f§f§f§f§f§f every time you want to set a color?
Can obfuscated plugins be uploaded to spigot? I've heared they must be decompilable but it's quite unsafe for devs.. is it like this?
I just do
String a = Chatcolor.of(#1234)
And
p.sendmessage(a + "hi") no?
Yes it must be decompilable and at least somewhat readable
Hi, i'm looking for customizing villager trades in spigot 1.20, but I can't find anything on the web, have you some documentation for me please ?
@EventHandler
public void onPlayerPortal(PlayerPortalEvent e) {
if(!e.getPlayer.isOp()) {
e.setCancelled(true);
}
}
Should work, if you want to have that for a specific portal then check for event cause
.
Why not using Component with NamedTextColor ?
One of these days Choco's component PR will finally get merged and then you can use components.
That wouldn't be a big deal ?
Adventures Bukkit adapter only works with sendMessage
But with ChatColor.if you can use it anywhere

anyone here know ruby, dont even think about typing ?ask
more of a bundler issue but same thing
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
ur a whore' josh
Epic
hi
im gonna smack you
fine then
wtf did i do wrong https://paste.md-5.net/ozamozeget.coffeescript
Used ruby
the loving kind or the hateful kind?
both
Tf is just the docs
just the docs
Projects that name themselves as common phrases give me mixed feelings.
Are you over engineering javadocs for epic spigot lib
no
its wiki
Just the Docs is a responsive Jekyll theme with built-in search that is easily customizable and hosted on GitHub Pages.
A wiki for what
anything you want
Okay but what are you putting on it
Or git book
could use gitbook
but why not host it myself
get shitted on
idk why you did
but yeah
anyone using intelliJ knowing why it crashes when I try to copy paste (or any type of ItemStack copy pasting): java playerHiderInventory.setItem(2, new ItemBuilder(Material.RED_DYE).setName("§cNo Players").getItem());
can someone help me, why intellj only display { /* compiled code */ } and not the right code there? Ihttps://cdn.discordapp.com/attachments/431618303212126208/1133880277698097244/image.png
you have the java bytecode decompiler plugin disabled
nopehttps://cdn.discordapp.com/attachments/431618303212126208/1133881008027082885/image.png
And in the java file there is the code right https://cdn.discordapp.com/attachments/431618303212126208/1133882384413102182/image.png
Just use the Quiltflower decompiler plugin
anyone?
Or really alternatively use Recaf
Eclipse user here: No. Sounds like a bug
perfect that worked, Thanks god. But why i need to decompiler, i got the java file in my system
What leads you to believe that IJ is aware that this file is the right one?
i added it to the source file?
The proper way?
I know that in eclipse you'll have a serious pain if you try to do that if you also use maven or gradle at the same time
Unless you use next-tier gradle scripting you'll have similar issues with IJ I assume
Bundle that sources folder in a zip file (making sure that the "org" folder is in the root of the zip file), rename it to "spigot-1.20.1-R0.1-SNAPSHOT-sources.jar" and move the file into "$USER_HOME$/.m2/repository/org/spigotmc/spigot/1.20.1-R0.1-SNAPSHOT"
It is important that you get the format right though. That is the source files may not be "src/main/java" or similar
Why are you decompiling scoreboard? The API covers everything
Ouch. not even mojmapped I now realize
indeed, except one thing, per player sidebar without a per player scoreboard
I don't know what that means but I'm sure the API can do it
And if it can't, well
?jira
?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
How do I make the plugin disable after worlds are done saving n stuff?
you can do it if each player has a different scoreboard but then you have to make teams/objectives for each scoreboard instance
Oh hi md5
hey
im setting up server donation and i want them non p2w
is a private area for their house considered p2w?
along nick chat color sign color
hello i want to make a /hub and for this, i use the "performCommand" but i see it didn't work with bungeeCord, can you help me?
Can you be more specific
Spigot or bungee plugin, and which plugin provides the command
I want to display a player's head as text via the scoreboard. But for this I need hex colors, which cannot be set in the title of the scoreboard, only via the prefix of a team. However, a limit of 64 characters is set for the prefix, which I exceed,
So I would do it with packets, to send it directly. https://cdn.discordapp.com/attachments/692821739314348032/1133808683772559381/image.png
You probably want a bungee plugin otherwise you need to use the messaging api
1.20.1 has no limit
I tried it yesterday. I'll take a quick look again.
Also components should make this more efficient should that get merged sometime soon
Wink wink nudge nudge
WINK WINK NUDGE NUDGE
it's my plugin, it look like this and i want when the player use /hub, he tp to the correct Bungee Server
`@Override
public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
Player player = (Player) sender;
if (sender instanceof Player){
if (cmd.getName().equalsIgnoreCase("hub") || cmd.getName().equalsIgnoreCase("lobby")){
player.sendMessage(main.getConfig().getString("Hub_world"));
player.sendMessage("server " + main.getConfig().getString("Hub_world"));
player.chat("/server");
player.performCommand("Gamemode 1");
}
}`
it's 3:30 in the morning and I figured out the reason for 2 of my bugs
fucking sleeplessness
Why are you having the player just do /server
Won't work from a spigot plugin that's a bungee command
[22:34:35] [Server thread/INFO]: [GameTest] [STDOUT] PREFIX length: 1032
java.lang.IllegalArgumentException: Prefix '§x§2§5§3§e§6§c§x§f§e§f§e§f§e§x§f§3§f§3§f§3§x§2§0§3§8§6§0§x§2§3§3§c§6§7§x§0§6§0§6§0§6§x§f§4§f§2§e§c§x§2§5§3§e§6§c§x§2§5§3§e§6§c§x§f§f§f§f§f§f§x§0§0§0§0§0§0§x§2§0§3§8§6§0§x§1§d§3§f§6§d§x§f§3§f§3§f§3§x§f§3§f§3§f§3§x§2§5§3§e§6§c§x§2§3§3§c§6§7§x§2§3§3§c§6§7§x§1§d§3§f§6§d§x§1§d§3§f§6§d§x§1§6§3§8§6§4§x§1§6§3§8§6§4§x§1§6§3§8§6§4§x§2§5§3§e§6§c§x§2§0§3§8§6§0§x§1§6§3§8§6§4§x§1§f§1§e§1§e§x§0§0§0§0§0§0§x§0§0§0§0§0§0§x§f§c§e§3§c§a§x§1§d§3§f§6§d§x§2§3§3§c§6§7§x§2§0§3§8§6§0§x§e§1§e§1§e§1§x§0§1§b§2§6§5§x§f§8§d§d§c§3§x§f§8§d§d§c§3§x§0§1§b§2§6§5§x§e§1§e§1§e§1§x§1§e§3§6§5§e§x§2§3§3§c§6§7§x§e§1§e§1§e§1§x§0§1§b§2§6§5§x§f§8§d§d§c§3§x§f§8§d§d§c§3§x§0§1§b§2§6§5§x§e§1§e§1§e§1§x§2§0§3§8§6§0§x§2§5§3§e§6§b§x§f§e§e§1§c§4§x§f§e§d§b§b§9§x§f§e§d§c§b§c§x§f§e§d§8§b§2§x§f§8§d§3§b§0§x§f§c§d§e§c§1§x§2§2§3§a§6§4§x§2§3§3§c§6§7§x§f§d§d§8§b§6§x§f§e§d§c§b§b§x§f§e§d§a§b§7§x§f§e§d§d§b§e§x§f§9§d§5§b§2§x§f§e§e§3§c§8§x§2§3§3§c§6§7' is longer than the limit of 64 characters (136)
Thats the error im getting :c
ye i know but how to fix that?
If the distance is less then one it'll be small
like make it work
Update
Make sure spigot is up to date
Make a bungee plugin or use plugin medsages
Messages
ok thx
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Are the locations correct?
Yeay maybe i didnt updatet it right. https://cdn.discordapp.com/attachments/431618303212126208/1133892007526412348/image.png
Thanks ❤️
is your code not working or smth
show your full class pls
or stream it
oh actually
what's your attacked location z
why is it same to x
and also why are your calculations so weird
@fast merlin
Can’t you just use location.distance
What are you trying to calculate?
if you have the players location and the location you are hitting location.distance is accurate
player.getLocation().distance(otherPlayer.getLocation())
thats the distance between two players
this is my current code
clearly packets are not better if you can;t use them correctly
Just use teh API
the math is already done for you
but i want to use packet
This output looks to have the correct distance between those locations
location1.toVector().subtract(location2.toVector()).length()
And its valid
think my ehhh
-203 -(-203) = 0
251 - 251 = 0
0 + 0 = 0
So well, both values are a bit higher than 0
And squared
So 0.2 is perfectly valid
All of your tests were actually valid, cuz locations were really close to each other
And by squaring a number which is less than 1, you get a smaller number
is this fine:
MapView view = Bukkit.createMap(world);
for (MapRenderer old : view.getRenderers()) {
view.removeRenderer(old);
}
or will there be a problem because of removing while iterating?
it will CME
what should I do instead?
Iterator
so just like this:
Iterator<MapRenderer> iterator = view.getRenderers().iterator();
while (iterator.hasNext()) {
iterator.remove();
}
or do I still need to call view.removeRenderer?
where to see the source code again?
with the implementation of the MapView?
found it
Yeah so it’s a copy
yeah
That means the original loop shouldn’t throw CME
correct
yeah true
and then should I care about it?
try it and see
If you don't want to care about CME, use an Iterator
if it's going to CME it will do it quite quickly
What is the maximum amount of food a player can have?
Without it being modified by something
20
Wonder why docs say >= 20 in 1.18
Where?
HumanEntity#getSaturatedRegenRate() and HumanEntity#setSaturatedRegenRate(int ticks)
it is for regen rate and not setting hunger or anything, but still odd
Probably just Incase it somehow gets past 0
am i need connection pool for my project dbs ? why ?
The issue with single connections is that they execute things in sequence. They can't execute things in parallel (despite most databases supporting this). So if you perform some query that takes a few seconds and another query immediately after, your second query has to wait until the first one finished
Connection pools maintain a set of connections, some which stay open for a minute or two (or longer depending on how it's configured) after they were last used so it doesn't have to constantly close and reopen connections
Though you can get more than one connection at any given time and execute queries in parallel
Libraries like HikariCP just do it all for you so you don't have to write your own pooling
If your project is large enough, connection pooling is pretty much a must. Though if you're doing infrequent queries or updates, you'll be fine without it
id just let hikari handle it
probably
which one do u prefer for 2k 3k player server?
i just let hikari handle it
I think Hikari defaults to 20 or something like that which is ample amount
btw i save player moneys in db
i hope you cache the data
wdym for cache ?
save it in a hashmap or use a caching lib like caffiene
you shouldnt ever query the db every time you need something, keep it in a hashmap update it every 15-60 min and remove on logout
why am i need this ?
otherwise you query the db every single time a placeholder is called or a money update is called
which could be multiple per second
Yeah, with money though you should be aware that money often can be updated so, y'know, update your cache occasionally
No, Hikari only just provides you with a pool
hikari can allow the querys, it wont cache it tho
Caching just means hold the result of queries in memory. A variable or something
https://paste.md-5.net/uhulabezuw.coffeescript any tips on how i could word this better
now i will add changed money to hashmap first, after i add to db after i remove money from hashmap ?
you keep it in the hashmap the entire time the player is on the server
you update the value in the db every 15-60 minutes with the new value
but if server crash ?
make sure each method has docs, ignoring private methods, that explains what it does, what it might return
id hope it wouldnt crash, but thats where you could change how often it saves
not necessarily but it can improve what an ide shows
well if i not add hasmap and i add to yml file
after add to db
thats just unnecessary
save it to a map and then update the db, otherwise your just doing double the io
What should I save to the database?
player rank ?
money?
stuff relating to the player
thx for this cache idea
I wouldn't have thought of this without you
btw i wanna tell my project
for get ideas like cache
just weird
Perfect for you then
hub datas
- special money (this money works on all games, and to be bought with real money)
- donator ranks (if player donate will get rank at all games)
game 1 datas
- money (money for game 1)
- level (level for game 1)
game 2 datas
- money (money for game 2)
- level (level for game 2)
which one am i need store in db ? so am i need store game datas ?
hi how would i reload multiple configs ?
set the variable again
getPlugin().reloadConfig(); only reloads config.yml
im guessing you have a FileConfiguration or YamlConfiguration variable for the config
yeah
YamlConfiguration.loadConfiguration from the file again
^^
alr
is it true that I should avoid JavaPlugin.getPlugin(MyPluginClass.class)?
Looks ugly and serves no purpose if you're using DI properly
my class is in a library and why should I force the user to DI my own plugin?
use singleton
ehh
or would it make sense to use the plugin that the user of my library created for the Logger?
I wouldn't advise for singletons but in this context it's whatever
Got no clue what this means
You can just pass JavaPlugin instead of the specific type
I have a plugin/library which others use.
In that plugin is a class which wants to do logging.
Should I use MyPlugin.class's or the users UserPlugin.class's #getLogger?
Depends.
Is that method unique to the API or a utility method that'd be present in most generic plugins?
Ideally you'd use the API's logger to make it more specific where it's firing from
But for configs I can see you use the other plugin's logger
yeah that was my guess as well
and based on that I got to this question:
hello, I have a problem ! I have these two files, default and default, and they are impossible to merge. What can I do, please?
I'd make some sort of platform system to allow your API to be easily shadable
but you can just DI the logger
You can manually merge them
it's just json data
wdym by that
it's impossible
Let's say that you want to shade your API directly
like make a fat jar
looks mergeable to me
So your API plugin would just impl this and you DI the platform everywhere
I can't do it, sorry: '(
So if you were to shade your API, you'd just make your plugin impl the platform too and pass your plugin as the platform
but then the user of the library would need to do it?
because the instance gets created by him
External users wouldn't care, this is literally just for shading
Illusion while ur here, any tips on how i can word this better https://paste.md-5.net/uhulabezuw.coffeescript
You don't need the platform interface if you're working with spigot exclusively, I'm saying something like
public class API {
public static void init(JavaPlugin plugin) {
MyAPI api = new MyAPIImpl(plugin);
// register this somewhere
}
}
public interface MyAPI {
void doWhatever();
int getWhatever();
}
public class MyAPIImpl implements MyAPI {
private final JavaPlugin plugin;
public MyAPIImpl(JavaPlugin plugin) {
this.plugin = plugin;
}
@Override
public void doWhatever() {
plugin.getLogger().info("whatever");
}
@Override
public int getWhatever() {
return 0; //whatever
}
}
public class MyAPIPlugin extends JavaPlugin {
@Override
public void onEnable() {
API.init(this);
}
}
I'd skip downloading the actual jar, if you're following the instructions you probably know enough
I'd explain more about your commands
hm but how to get access to MyAPIImpl/MyAPI outside?
without using stuff like singleton etc
MyAPIImpl is hidden
Everyone will just use the MyAPI interface through RegisteredServiceProvider
Same way people use vault
you just need to register it
The fun thing about this is that
Let's assume you're shading the API instead of using it as an external plugin
ah you want me to use the ServicesManager
can someone help me merge two json please?
You can just do
public class MyPluginThatShadesTheAPI extends JavaPlugin {
@Override
public void onEnable() {
API.init(this);
}
}
Ask chatgpt or something
And it'll still work
ah yeah that's right!
ah ok now I understand what you want, thanks
If you're feeling special you can make a static getter that returns your MyAPI instance
and maybe an isRegistered that just checks for null
This is how I explain my commands
im bouta blow
go for it
this did not work

if (sender.hasPermission("score.reload")) {
try {
getPlugin().reloadConfig();
YamlConfiguration.loadConfiguration(msgs);
sender.sendMessage(colorize(msgsc.getString("Reload-Success")));
} catch (Exception e) {
e.printStackTrace();
sender.sendMessage(colorize(msgsc.getString("Reload-Error")));
}
} else {
sender.sendMessage(colorize(msgsc.getString("No-Perms")));
}
You need to actually do something with the return value of loadConfiguration
ie assign it to a field
for msgs?
you have a variable for it in ur main class dont you?
ye
so make a method that sets that variable again
load config works in main class but not in my reload command class
oh ok
Mining block list: diamond, emerald, coal, netherite gold, calcite, gold, copper, diorite, granite, ancient debres, stone, netherite, end stone, am I missing anything? (The purple block in geodes, ).. I'm sure there's a list online somewhere
whats the list of
If it were an rpg mining related blocks
Completely forgot that's not stone down there
There’s also tuff and calcite
I use intellij IDEA and it usually recommends to add it after the "public void ()... It looks cleaner imo
Main.worlds.forEach(w -> {
World world = server.getWorld(w);
assert world != null;
File folder = world.getWorldFolder();
world.getPlayers().forEach(p -> {
p.kickPlayer("World is being reset");
});
server.unloadWorld(world, false);
assert folder.delete();
Main.LOGGER.info("Successfully deleted " + w);
WorldCreator wc = new WorldCreator(w);
server.createWorld(wc);
Main.LOGGER.info("Sucessfully regenerated " + w);
});
for some reason this is not resetting the worlds or deleting the folders, its as if folder.delete() is somehow quietly crashing without setting off the assert
and yes i used forEach lol
Assertions arent enabled on default. They are a debugging feature you have to enable on your jvm.
oh
This is a common problem btw. Unloading a world wont free all resources immediately.
is there a way i can make it wait for the world file to be freed?
im guessing its autosave causing problems
Only in a hacky way. You simply call folder.delete() in a loop until the folder is actually gone.
hmm
doesnt apache have a file utils or something that waits for resources to be free
what exception do i use for config reload errors
Depends on what went wrong
oh it literally does the same thing
like a path with a string but then i put an integer instead without ' '
what exception would that be
Are plugins loaded before server ticks start or during the first tick?
Alright
