#help-development
1 messages · Page 304 of 1
Where is it saying the exception happens etc.
I know there is stacktrace, but i do not know it correlates to the screenshot.,
I sent you the piece of code where the error occurs
Could not load 'plugins\Pawiu-plugins.jar' in folder 'plugins': uses the space-character (0x20) in its name
it has very specific lines in the stacktrace.
What do I have to send you?
Which line it is
causegui line 44
44
The line 44 is the for each loop
It's possible to add multiple chat clickable buttons on one line?
Example:
[SUPPORT] [WEBSITE] [SHOP]
I can't do it, I'm getting kicked for "don't know how to turn clickevent into component"
Do you do async stuff?
Basecomponents
no
Any code example?
We need more information about your plugin then.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I'm trying, but i get kicked for this reason
well then
what does the causetranslator do
It's autopsy plugin
actually I thought that it changes the list, but it doesn't
Clicking with an item on a corpse (I'm using Corpse) you get the damage causes of that corpse
translates causes of damage before the corpse spawned
using a causes translator (switch)
can you show that part?
The constructor?
yeah
but actually it doesnt really matter
just comment out parts of the function until its fixed
and then you know what part causes the issue
static method where
There is no static method
You have to instantiate a translator based on a case, and then you can translate it
sounds... consuming
getTranslated() gives you a ItemDescription object, that has the infos of the translation
wdym
whats the point of that class if it only has one field thats used in one place?
I mean is that the only thing this class will have?
could be made into a static method :p
just create an utiltity method somewhere
or do you still wanna add more stuff
I prefer to avoid static, so I don't get into abuses
in this case its fine
This is example of not abusing static
btw back on my problem
what's the list changed stuff
I mean sometimes it even works, sometimes not
he can try factory pattern
or how was it called
same as in Calendar
which has getInstance() based on things you give as parameter
I'm actually confused
hey, someone can help we with closing ironDoors by rightclick=?
I don't get the sense of the exception
like i cant close if i click the upper block or the hinge is left, it just stuck
cast the blockdata to Door class
not the material
im already doing
This would not be factory pattern
i can open it without any problems
Maybe @dry yacht you could help me
Chunk#getBlock#setType isn't setting types
Hello i have an error with the koth plugin. Logs are normal but doesn’t works says in a bossbar when I start a koth koth percentage capped . Can you help me please?
Door iDoor = (Door) e.getClickedBlock().getState().getData();
Block door = e.getClickedBlock();
BlockData doorData = door.getBlockData();
if (!iDoor.isOpen()) {
((Openable) doorData).setOpen(true);
door.setBlockData(doorData);
p.playSound(p.getLocation(), Sound.BLOCK_IRON_DOOR_OPEN, 10, 10);
}
thats the way i open it, and that just works
Well it wouldn't close since you don't have any code that makes it close
ah mb
else {
((Openable) doorData).setOpen(false);
door.setBlockData(doorData);
p.playSound(p.getLocation(), Sound.BLOCK_IRON_DOOR_CLOSE, 10, 10);
}
setOpen(!isOpen()) ig
oh god the formatation just gone bad
Use this
Still less code if you use it
Already used for the block
apples new no-windows door
its just for requesting if the door is open or not
Only 9999$
well still not working
apple door
Hard to tell without line-numbers in the code.
and where are you sending it
in another class that simply picks up the component using getter
player#sendmessage(ButtonUtil.getComponent());
And what's the player object
Player player = event.getPlayer;
That method doesn't exist in the spigot api
Are you sure you're using the Spigot api
obv
Could you show your pom
Man that's spigot api
declaration: package: org.bukkit.event.player, class: PlayerJoinEvent
the 44 line is the for loop
read under that
I bet you're not using Spigot API. Show your pom
I can't, private purposes
How am I not using spigot api then?
nothing private in a pom
That method doesn't exist in Spigot
wtf
It only exists in Paper
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerJoinEvent.html
this is spigot
declaration: package: org.bukkit.event.player, class: PlayerJoinEvent
see
"hub.spigotmc"
The sendMessage
what doesn't exist
hes trying to say that there is no sendMessage that takes a textcomponent
^ it doesn't exist on the player object
Sorry, but I'm not in the mood for having to mentally crunch through many open possibilities due to insufficient information. If you want any serious help, you post the full stacktrace (which you already have), as well as the full containing class.
nice
not gonna use minimessage or other things
Also make sure you're testing on Spigot and not Paper
If you were testing with normal spigot the method in your code would have thrown an error
(no errors in console)
Since it doesn't exist
switched to player.spigot.sendmessage, without spigot it needs a string
but i need to send all clickable messages, so string isn't the case
Yeah I was talking about earlier
And your statement that you always test with normal spigot
i am still getting the error, using the addExtra method provides an exception when joining to the player (which is exoected because aparently a JsonParseException is happening)
which is returning this error as already stated
using the Player#spigot#sendMessage(BaseComponent) doesn't work. it produces that error
i have the spigot-api dependency of 1.8 to my pom, everything is correct.
<dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.8.8-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
no i am not
you have great problem solving skills i see
Is the client also at 1.8.8?
i can agree on this one
Yes being on the latest version is step 1
yep
everyone would be in latest if it wasn't for other servers running legacy
Could you show me the code for where you send that component real quick?
not a developer issue, everyone can run any version of choice, if that wasn't the case, they shouldn't be downloadable
(rest of the code is just for handling the join and luckperms things that aren't influencing the final sendmessage code)
I meant where you're constructing the component. It looks like it maybe lets something unescaped pass through, don't really understand where the client trips up. I thought that you maybe could simplify it a bit and check if that exception still occurs. If so, it's easier to debug, if not, we know where it tripped up.
Sorry for the delay, I've been grepping through the minecraft client source, and I think I may have an idea, but I'm not 100% certain
okay, go ahead
It looks to me as if you need to have a root text property in your component JSON, without which the client cannot decide if it's a chat message or some other control sequence. And you're missing that text property. You just have some extra and a clickEvent.
mh, i'm not using json as file in any case, but what do you mean?
Try doing new TextComponent(" ") instread of the empty constructor, with a space in the string. Just for testing purposes.
Components are sent as json
I think that you're building your component in a way it's not supposed to. The first text has to always be the head, not an extra. What are you trying to do? Just send a clickable message?
Yeah, because of what I previously said about the JSON layout. You fixed it by forcing the serializer to no longer omit the text property.
It’s not mandatory to be on latest version… there is still big playerbases on versions as low as 1.7.10/1.8
Don't worry, that's just what people say if they don't want to look into the problem at any depth and make "legacy" versions responsible for user-error.
Ahh ahha i see
fixed everything thank u
I mean, it's still not done properly, but I guess if you're fine with that... then it's fixed! :)
No but if it works on a modern version. Then it narrows down the problem a bit. And if something is completely broken it's up to you to fix it yourself since those versions aren't maintained
Also there's no real need for them. You can run a modern server with viabackwards and old combat mechanics
It's dwindling though, and it's awesome
< 6% or so
Almost 75% are 1.18 or higher
Yeah I prefer newer versions for development and most gamemodes but pvp related gamemodes like factions or practice 1.7.10/1.8 is a no brainer.
Yop, I use the ChatColor.of(hexValue) but in game the colours are not the right ones. Could this be a concatenation problem? Should I use TextCompenent?
Depends on what you mean by not the right ones
What happens?
Worst case you'll need to convert that hex value to legacy colors. The format is §x§f§f§f§f§f§f for #ffffff
and what hex value are you putting in? It's possible you're misrepresenting the value and it's slightly altering the colour as a result
Appending ChatColor#of() to a String does that already. No worries
Alr
Lol, I've never ever seen this beauty of a format, xD. Didn't even know that would work
Hey, I'm trying to use NMS but for some reason org.spigotmc.spigot does not exist on the maven repository
Yeah Mojangs code is copyrighted
You can't share it publicly
So run BuildTools to get it added to your local maven repo
?bt
Hello how can i know if a mob spawner is empty ? because by default it looks empty but on the code using the following code it returns me EntityType.PIG by default
BlockState blockState = block.getState();
EntityType entityType = ((CreatureSpawner) blockState).getSpawnedType();```
^^
?stash
Yes but if the spawner has a real PIG in it ? 🤔
typename should return pig if it's a pig
use that
Alright thanks !
i dont understand github code spaces
small brain
It's a little hard to understand but in principle they're rather simple
You know how the meme always goes "well it works on my computer"?
Codespaces is that computer that everyone has access to. It's an environment of predefined dependencies and whatnot
yeah but how am I even supposed to install java on this codespace thing?
I mean I need java 8 and java 17 to run buildtools
No clue 😄
I can only choose one java version there
choose highest, build for lower.
buildtools 1.16 doesnt run on java 17
But 1.8 bullshit !111!!!111
buildtools will complain if you try to build 1.16.5 with java 17 so this won't work
Why is that even the case? Doesn't spigot use eclipse for that exact reason?
sad
i dont know why, still i dont get the whole point of codespaces
Codespaces are just a gimmick
You are just trying to apply it to a usecase that it doesn't fit.
they are a pain. E.g. I could use debian as image, then install java 8 and java 17, but the container gets rebuilt, everything is gone again lol
Why would you need something to run java 11, 13, 14, 15, 16, 17, 18 when it can just run 18
ubt what exactly is it for?
because I need to have the appropriate spigot dependencies in my project to build it since it uses different NMS modules
and as I already explained, buildtools needs different java versions for different spigot builds
Yeah, the usecase is niche.
I don't understand any use case. why would anything "work on my pc" but not on another, if all that codespaces can do for me is to install exactly one java version and nothing else?
I dont understand what codespaces are for in general
"What is a codespace? A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (often known as Configuration-as-Code), which creates a repeatable codespace configuration for all users of your project."
yeah but all you can use is their prebuilt containers. I mean, one could rather setup one's own docker-compose file, then at least you can customize everything
it's like an "online docker container" without the usual custom configuration options
no idea what you mean
Here is what chatgpt says about it with your responses:
Yes, that's correct. With GitHub Codespaces, you are able to use pre-built containers that are provided by GitHub. These containers have a set of tools and runtimes already installed and configured, which can help developers to get started quickly without needing to set up their own development environment. However, you may have less flexibility in customizing the environment to your specific needs.
You can use a dev container configuration to set up custom tools and runtimes in the codespace, but the customization is limited to what the dev container configurations allows.
Alternatively, if you set up your own development environment using something like docker-compose, you would have more control over the specific tools and configurations that are used. This would give you greater flexibility in customizing the environment to your specific needs. But keep in mind that this would also require more setup work on your end and you would be responsible for the management of the environment.
GitHub Codespaces is a preconfigured environment for the user, for users who wants to have a quick start on their development this is an good option, but for those who wants to have more fine-grained control over the environment would prefer setting their own using something like Docker.
well yeah that is exactly what I said. codespaces can't do more than provide a container with java and maven installed. that's it. One can also get it by just running docker-compose up and have a docker-compose file in the repo. oh and that'd even be free instead of only allowing one to use it for 2 hours per day
GitHub Codespaces is a preconfigured environment for the user, for users who wants to have a quick start on their development this is an good option, but for those who wants to have more fine-grained control over the environment would prefer setting their own using something like Docker.
It's not made for your usecase.
it seems to be very useless to me
jetbrains spaces are actually useful, you can just provide your custom dockerfile
weird that github doesn't allow it, but jetbrains does besides they are free / don't have any "only 2 hours per day" limit
gitpod better
idk why github thinks my codespace used 20 gigs
when it was 100megs at best
btw that's not the only usecase. Imagine you need java 17 and a running mysql server. Then you'd also need 2 docker images
gh codespaces are a joke compared to the alternatives
could always recommend some changes to them somehow
whenever I message their support, they just tell me to post it again in the "community forums" where obv no staff ever answers, so basically they don't have any staff that you can reach at all
real
takes 10 minutes to just add java
one would imagine that at least GH pro users are able to SOMEHOW message staff, but nope
"support via email" ...
only took them 7 days to reply to me that I shall ask the community. And that's what they call "support via email". Oh btw ofc I did ask the community, all I got was replies like "I have the same problem"
Then hopefulyl they add it when they get around to it
jetbrains also allows selfhosting the spaces for free for up to 10 users
i have github pro and didnt even know it had them features
What is github packages?
you can host like a jar package on thei
like i could host my lib on their if i could be bothered
Apparently there is a bug in pre-1.19 which doesn't send an inventory close packet when closing an inventory while having touchscreen mode enabled, is there a way to fix that?
unless they arent gonna do anything even looking somewhere or moving, you can listen to the move event and check if the inv close hasnt been called from your open
Who coding in php, css, html, mysql write in pm thanks
What is the use of "sender" in the Player.sendMessage() function?
I know I don't have to use that parameter but am just interested as to the use case
i saw ij ide had real time debug for spigot?
that signed shit stuff
Why doesn't these have any?
config.getConfigurationSection("server-selector.items")?.getKeys(false)?.forEach {
val section = config.getConfigurationSection(it)
val slot = section?.getInt("slot")!!
val material = section.getString("material")
val name = section.getString("name")
val texture = section.getString("texture")
val lore = section.getStringList("lore")
val commands = section.getStringList("commands")
buttons[slot] = ServerSelectorButton(material!!, name!!, texture!!, lore, commands)
}
server-selector:
size: 27
items:
- slot: 11
material: DIAMOND_SWORD
name: "&e&lPvP"
texture: ""
lore:
- "&7Click to join the PvP server."
commands:
- "server pvp"
- slot: 13
material: DIAMOND_PICKAXE
name: "&e&lSkyblock"
texture: ""
lore:
- "&7Click to join the Skyblock server."
commands:
- "server skyblock"
- slot: 15
material: DIAMOND_AXE
name: "&e&lFactions"
texture: ""
lore:
- "&7Click to join the Factions server."
commands:
- "server factions"
None of the items appear its like they arent there
if it is config yml
the selection paths is the same
that will cause issuess
yeah
you would need to loop over the list and create items from the sections in thelist
val section = config.getMapList("server-selector.items.$it")
like that?
jsut getList
List<ConfiguratonSection> list = config.getList("server-selector.items")
the path needs to be unique
ahh
the - makes it a list of config sections so it doesnt care
wait until you hear about yaml anchors
tell me boi
items:
elytra: &elytraitem
Enchants:
MENDING: 1
DURABILITY: 3
Lore:
- Lore Line 1
- Lore Line 2
# DO NOT PUT COST HERE!!!!!!!!!!
Name: Epic Elytra name
Material: elytra
Cost: 150
vote-gui:
1: *elytraitem
this is valid yaml
you can define something elsewhere and call on it
omg i hate it
i love it
config.getConfigurationSection("server-selector.items")?.getKeys(false)?.forEach {
val section = config.getList("server-selector.items.$it")
val slot = section[0] as Int
val material = section[1] as String
val name = section[2] as String
val texture = section[3] as String
val lore = section[4] as List<String>
val commands = section[5] as List<String>
buttons[slot] = ServerSelectorButton(material!!, name!!, texture!!, lore, commands)
}
``` ?
its so cool
Assuming its not like this cause it didnt work
no clue
its kotlin
also that would loop over it as if its a config section
not as a list of config sections
try
No.
kotlin guy is here
Well whatever he is trying to do is wrong
yeah i thought so
items:
- slot: 11
material: DIAMOND_SWORD
name: "&e&lPvP"
texture: ""
lore:
- "&7Click to join the PvP server."
commands:
- "server pvp"
- slot: 13
material: DIAMOND_PICKAXE
name: "&e&lSkyblock"
texture: ""
lore:
- "&7Click to join the Skyblock server."
commands:
- "server skyblock"
- slot: 15
material: DIAMOND_AXE
name: "&e&lFactions"
texture: ""
lore:
- "&7Click to join the Factions server."
commands:
- "server factions"
this is a list
ye
not whatever you are trying to get.
he started as looping over it as a config section of sections
well tbf, this might be closer to the answer.
How are you saving this though.
how are you supposed to override the hashCode method I've never understood this
Don't.
funnily enough i made a better config items lib yesterday
it just doesnt have click features
You can get intellij etc to just autogenerate it for you.
that wouldbe up to end user to handle
sounds great!
stil need to add pdc to it
You can just tell him ho wto do it properly in java, if he can't do that in kotlin he dumb.
its on my github if you wanna take a look
i was gonna say, i can tell you how to do it in java but not kotlin
Most kotlin can be transcribed either way, though ij will only transcribe java to kotlin.
I wouldn't write kotlin when i can't do it in java.
thanks I'm frantically looking for the hotkey so I can map it in vscode lol
i had to do config items for one of my projects and i never want to do it again
so i made it a lib
??
I don't use intellij I use vscode, but theres an equivalent feature so I'm just looking for the hotkey so I can map it to be easier
Ah
IJ is just like "convert to kotlin" whenever u paste java code in a kotlin clas
lol it generated, but damn does sonar lint go off at me damn vscode coding convetions aren't quite it lol
what would you say the best form for writing pdc would be
huh?
like ```yaml
pdc:
pluginName:key:
type: STRING
value: value1
like that in a condig
really bad tbh.
config
depends on what the value needs t obe
i think this would work
you can omit the "plugin:key" to just "key"
what if they need pdc to be assigned to a different plugin
why would you need that
if its used in some custom crafting gui situation
meh nah
just provide an API for your plugin
and make other devs impl if their users request
yes you do :P
can i get a plugin from its main class?
PDC:
PluginName:
Key1: value
Key2: value
PluginName2:
Key1: Value
Key2: Value
i call an init method so i could get the class from the call
ah true
that looks better
I just take the biggest easiest least complicated short cut and for my lib do this
@Getter
private static Plugin instance;
private Megumi() {
}
public static void enable(final Plugin plugin) {
instance = plugin;
plugin.getServer().getPluginManager().registerEvents(new MenuListener(), plugin);
}```
but without specifying type it might bet a bit weird
yaml always specifies type
ah true
thats my main issue
if i make them specify a plugin it might get a bit weird if they want to put this into another lib

i cant get myself to make the switch to VSC for dev
besides webdev
I use it for everything
ill probably use this
but it appears i need to learn to make exceptions
so i can just throw a plugin not found exception if its wrong
Why can't you just make the lib shaded
in provide the plugin instance through the static setter I showed
yeah it slightly inflates file sizes, but who cres
so people can specify other plugins as keys or this could be shaded into other libs
mainly just for compat
if this is used in aplugin that connects to other plugins
and it requires a different namespacekey
in a config?
Its for a server selector
is there a way to use translateAlternateColorCodes with the String.split() function?
like split at where it translates?
im trying to make this :
"&7this is some kind of test@i guess :/ im not@sure."
both use the colors and split
the @ is split and & is color code
translate it and split the result
Asking how you are saving it, like codewise mister.
Control + S (I already fixed it)
mergeString(color("&7this is some kind of test@i guess :/ im not@sure."))
this happens
only the first line get colored
ah
I've got some nasty code for fixing that
thats a minecraft thing i think
Bc split makes it 2 lines, and lore is a list of strings
So you have
&7blah blah
New line stuff
Basically you gotta get the last color and add it to the new line
yea
?jd-s
?jd-bc
Can use smth like this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/ChatColor.html#getLastColors(java.lang.String)
declaration: package: org.bukkit, enum: ChatColor
hmmm ye
I've got some gross code for doing it, but it's for paper so it uses paper components
I could clean it up, but since it works I don't touch it
reasonable
ye
i ought to make my lib multi module or just impl paper lib and change methods
Meg
Meh
i wonder if i could use Objects instead of strings or components to do it
i already impl minimessages so its just the case of changing methods that return strings
Eh
that would probably just cause unnecessary casting
Idk if I am being dumb but what method do I use to send hex color messages to players?
I know about MineDown and MiniMessage etc. but what is the default method?
iirc theres a method on the bungeechatcolor for that
you might need to convert the hex to Color and then add the format
that is smelly but alright haha, thank you
yeah
you could probably impl the adventure legacy serializer and use that to conver it
its what i use
how would i go about doing that?
let me give that a whirl :)
the Minimessage.minimessage.deserializer part isnt nessecary
does that method just mean that MiniMessage works on it too?
yeahh
i literally just spent ages making something like 10 times more complicated than that and it does the exact same thing :D
going insane
LOL
lol
I was making it work out if the user was using MineDown or MiniMessage
ah lol
Oh well you just solved all my problems so thanks ahaha
it yelled at me 😨
works on pretty much all clients, works on all forks and shouldnt have too many issues in some cases
intellij?
ah
it's not actually that symbol in my config though aha
i was accidentally formatting something that was getting formatted again
?paste how your methods setup
translateAlt codes with the string of minimessage
Shouldn't be using the funny symbol imo anyways
i'm ngl i just copied yours
im so confused
idk how that adds up
check you arent formatting it again or passing in a already formatted string
ChatColor.translateAlternateColorCodes('&', SERIALIZER.serialize(MiniMessage.miniMessage().deserialize(ActivityRewarder.configManager.getReloadMessage())));
does the .getReloadMessage format it
🤡
thats the only way i can think of that happening
I'll just ask my question ig
this didn't seem to work how i expected it
well
more like it didn't work LOL
no errors this time though ahah
you might need to use the minimessage format for hex
havent had a chance to test it lol
&#fba4d1&l✿ this is the format i am attempting to use
Real chads use ChatColor.of()
yeahh i'm sure the minimessage version will work
but my problem is that a friend wants to use https://rgb.birdflop.com/ this website to produce gradients and is against using MiniMessage so I am trying to use the &#rrggbb format
ah
ChatColor.of("#123456")
that would require you to find where the hexs are
but would work
could probably use regex or something
Anyone know how a this.plugin in the "main" class of my plugin is null?
?paste the class and paste main class
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Logger;
public class TimeBoundItems extends JavaPlugin {
private Plugin plugin;
public static final Logger log = Logger.getLogger("Minecraft");
public TimeBoundItems() { this.plugin = this.plugin; }
@Override
public void onLoad() {
}
@Override
public void onEnable() {
this.plugin.saveDefaultConfig();
// Plugin startup logic
this.getCommand("items").setExecutor(new CommandItem(this));
getLogger().info("Plugin Enabled");
getServer().getPluginManager().registerEvents(new darkMist(this), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
getLogger().info("Plugin Disabled");
super.onDisable();
}
public void msg(CommandSender sender, String msg) {
if (msg.length() == 0) {
return;
}
sender.sendMessage("§e§lTime§c§lBound:" + msg);
}
}```
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.Plugin.saveDefaultConfig()" because "this.plugin" is null
at us.newrealms.timebounditems.TimeBoundItems.onEnable(TimeBoundItems.java:27) ~[TimeBoundItems-0.059Snapshot.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[paper-1.19.jar:git-Paper-31]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-31]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-31]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
you never set it
why do you have a constructor that just sets the plugin instance to the plugin instance
you dont need that in your main class
and that constructor would never get called unless you call it
also why are you using "Minecraft" logger, your plugin comes with one you should use instead
^^
Anything else?
you dont really need to call super.onDisable
and instead of using this.plugin just type saveDefaultConfig()
you already in a pluing instance
ok
that is literally the same?
Do you know why the EntitiesLoadEvent event doesn't load the armor stands? in version 1.19.3?
Anyone know anything about how to fix this? Connection failed: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
AAAAAA
i hate nms
guys
is it possible to make a mob follow your orders when you type them in chat with mythic mobs?
cuz idk lol
if they have an api maybe
I had posted this in #help-server but i think that was the wrong chat 😓
Could someone help me out with this please?
https://www.spigotmc.org/threads/what-is-better-in-performance.585378/
you'll probably want to learn java first then
?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.
i would say its preference, and you cant extend itemstack you could make a static getters or a method to check what item it was and just check the result on the event
hi , i tested this code , its working fine ..
is there a better way of doing it .
🤔🤔
Looks like maybe you exhausted the allowable connections from the server. Either use less connections or increase in mysql config the amount of allowed connections
anyone know if a potions effect, not custom, is on its nbt or its metadata
Should be metadata
The key should be the name of the effect if i recall
so would i have to loop over the values and check if any matches the potion effect enum
That is one way to do it if you wanted to check if any potion effects are there
But if you were just checking for a specific one you would just check if the metadata returns anything for it
sadly i have to check if its any effect so i can store that
Yeah then you would just grab all the metadata use a loop to see if any enums matches
mk
i just thought of an issue
ah wait i just fixed it
arent all potion effects length reliant on their effect level
like a poision 2 potion is a different legnth to poision 1
Length as in time? No time is separate from their level
Well have no idea if a poison 2 is longer duration then 1
im just thinking how i could save this in the same area as custom effects but have a way to check what it is
But you can always get the duration for a given effect using the api
yeah
i could probably check if theres only 1 effect, and if that effect level matches an existing potions level
does the api have some way to get existing potions
so i just found PotionData.getType and that method has a getMaxLevel
so ig i can just check if that max level equals the effect level
i wonder if minecraft would automatically know if it matches
or because im adding custom effect it wouldnt
guess we find out
would i just cast materialData ot potionData
oh wait im dumb
theres a getBasePotionData
frick
i dont think theres a way to get current level of a potion thats built in
Good morning guys, i am trying to do a little stuff with player location and setblocks ext... this is my code for the moment
https://paste.md-5.net/udabinumer.java
At the moment there is just the event traps the player was hit by arrow entity, and everything is correct, I tested it and it's ok
But now i want to remove blocks placed when a player sneak so, I did when a player is hit by an arrow, this code places some webs around the player, now i want to remove it with a toggle sneak but i can't insert an event inside another event
I am trying to call the variables of the first method i did there in another method, if necessary in another class but maybe is better taking a player radius and do a check of the plocks are webs and not
hey i have got the key stokes working for a chat bot but how do i make it stay smth or type it in. I am doing this in java
create another listener and set variable that are outside of the first event
so i create another listener i suppose with a PlayerToggleSneak but how can i call the position in the new method from the EntityDamagedByEntity i did now in another class? I tried calling the event trying to have access at variables inside it
iirc append it to a base component
make the variables something outside of the method
or better use a map
so it works for multiple players at once
Yeah, i don't know if you can see i have just little basics of java for the moment and i am studying other things but i am trying to practice stuff i studied for the moment, i think i have to google just to create a map and then let you know but i think i can't do it for the moment but thanks as same
I know there is no spigot without java lol
public class ClassName implements Listener {
private Map<UUID, List<Block>> playerBlockMap = new HashMap<>();
@EventHandler
public void onProjectileDamage(EntityDamageByEntityEvent event) {
if (!(event.getEntity() instanceof Player player)) return;
Location playerLocation = event.getEntity().getLocation();
Material web = Material.WEB;
Block playerFront = playerLocation.add(1, 0 ,0).getBlock();
Block playerBack = playerLocation.subtract(1, 0, 0).getBlock();
Block playerHead = playerLocation.add(0, 1, 0).getBlock();
Block playerLeft = playerLocation.add(0, 0, 1).getBlock();
Block playerRight = playerLocation.subtract(0,0,1).getBlock();
List<Block> blocks= new ArrayList<>();
blocks.add(playerFront);
blocks.add(playerBack);
blocks.add(playerHead);
blocks.add(playerLeft);
blocks.add(playerRight);
playerBlockMap.put(player.getUniqueId(), blocks);
if (event.getDamager() instanceof Arrow) {
for (Block playerTrap : playerLocations) {
if (playerLocations.equals(Material.AIR))
playerFront.setType(web);
playerLeft.setType(web);
playerRight.setType(web);
playerBack.setType(web);
playerHead.setType(web);
}
}
}
}
thats the concept for the damage
just create the sneak toggle listener and get the list for the players uuid then set the blocks to air
thank you soo much bro, you have hearth on the right way everytime you help me thank you!
How to write stuff like this without going on md5paste?
@vagrant stratus
@worldly ingot @ancient plank
💀
all the staff are dead confirmed
do you think when i check if the material is air (bottom part of the code) i can just do playerTrap.setType(web) or playerLocations.setType(web) ? just to write less things?
you could probably write another for loop for it
for (Block block : blocks) block.setType(web);
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
thank you soo much <3
I'd use BlockVector instead of Block
calling getBlock returns a new instance every time
I am trying to cancel CreatureSpawnEvent.
but seems like its not working
"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.
There is no error in console. and I did added some test log. all that is working. but only event isn't canceling.
checked many bukkit, spigot threads. and found many people got same problem. but no solution
Hey so how do I use getConfig() in different classes?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
JavaPlugin.getConfig
I know how to use it in main class
but not in other classes
use di
use di
whats di
?di
this
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
read
i using singleton
i want them to lose a specific amount of hearts set in config.yml
public class YourClassName implements Listener {
private final MainClassName plugin;
public YourClassName(MainClassName plugin) {
this.plugin = plugin;
}
@EventHandler
public void onEvent() {
stuff
}
}
i would put that in the class i have where i want to getConfig() correct?
ah ok
or YourClassName to your class name
Ok
Like this?
I added the code at the top
that would be correct
make sure to add the constructor in main class
instead of new ClassName() it would be new ClassName(this)
i wonder what this is
Ah okay
now the event register doesnt work
you have to pass in your main class since the default constructor now requires that
?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.
and since you are in your mainclass (the statement), you can just pass in an this
the example is right here
ah ok
and once that works you can use the new plugin variable, which you just passed in, in your listener class to call getConfig() on it
alright i already did that would this be good?
XD
Also how would I make a reload config command?
I can make the command but what is the method
@remote swallow
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
How would i put the reloadconfig method in a other class?
you just did?
I'm not sure how you're a developer on 3 servers
I dont do plugin development in them
I do configuration but I wanted to start plugin developmet
apparantely nothing in java too
for an events class
It's not a plugin development specific thing
its the same
are you here to help or to judge my abilities?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
both
Guess you'll need to read this again
LifestealMain is the class i want to have reloadconfig
and?
you just did exactly that?
its nothing different
its the same java thing
Do you want me to spoon feed you code like Epic did?
doesnt matter if its a command or listener class
but do i do it in the getCommand()?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Oh shut your hole I'm just trying to ask for help
Read it
I dont have to listen to your bullshit
and now's your help gone
I was being nice
no you are being stupid
we gave you everything
and still you complain
and are not listening to us
we were being nice, but respect requires respect
I respect if you respect me
I started yesterday
so like
no ned to be agressive
?learnjava first
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.
^^ You shouldn't be using the Spigot API on your second day of programming
if thats what you call aggressive i cant help you anyways
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
whats wrong with deepslate_copper_ore?
nothing?
with inventory click event i pick up deepslate_copper_ore but its always seen as nothing
every other item works
Make server is up to date
both server and plugin are 1.19.2
Is API version set to 1.19 in your plugin.yml
yes?
yes
check if it works for other deepslate stuff
Ouch those names
sorry
oh god
Just camelCase methods and give variables a resonable name
For what they are
Like b??? What is b
I could probably figure it out but the name should tell me
line 15
did someone say obsfucated mojang code
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
@warm spire

i just didn't care about the name 🤡
Give up they've been sent that 6 times or so
guy asked what's di
i answered
he already has it in his code
Yes because Epic spoon fed him after the 2nd or 3rd command
soo is it optimal ? is there a better way ? my plugin size increased 500kb bcz of the library ..
its working btw no bugs ..
couldnt you minimize it
Okay so about server bound packets.
How to send them (to the server)?
Do they have to be sent FROM a player ?
Or can I send a fake one
They have to be sent from a player
What are you trying to do
You can probably create a fake packet and send it for a player but why...
I dislike how plugin messaging works, I am trying to send my own plugin messages without requiring a player as sender AND/OR another player as receiver.
Then you will need to use something else
Hello
Do you guys know why I can't search using intelij in the remapped mojang lib ? I'm having an issue with search with external libraries.
It's probably not named PlayerAdvancements in mojmaps
I believe it's just Advancements
@chrome beacon do you know if I can retrieve the Netty channel or socket that is used my plugin messaging? (At least so I don't use another port)
Also I know about reddis but I find it overkill.
You can use screamingsandals to look up old Spigot mappings to Mojamps
Plugin messaging uses the player connection
Which is why it requires a player
If no player is online then there is no connection for you to send data with
it was for the exemple, it doesn't work for everything. Bytheway i would like to search in mapped lib
There must be a server socket though
No trust me I wanna mess with that.
or setup your own socket you can send data to
@sterile token had the same project than me but I haven't heard about him for a long time 😄
I know but that's what I like doing. Exploiting and messing around with what's already done
😄
Then start digging through NMS and Bungee source
and see how data is handled and try to figure it out
Aha, why bungee though?
So you can see how it sends data
Okay do you know where I can find NMS source
?bt
there's no socket between a backend server and the proxy server if thats what u're asking about, it relies on a player's connection
I have to compile it on my computer due to the DMCA takedown correct
Yeah I told them that
ah alr
Mojangs code is copyrighted. You can't distribute it
How do each backend servers synchronise their data then (when listening to a channel)
They don't
what kind of data
No data is synced between the servers
if u're talking about plugins like LP they do use either mysql, reddis, or rabbitmq to achieve data syncs across multiple server instances
but anyway, a more unsophisticated solution is to use sth like https://github.com/Ivan8or/RadioScanner
A backhand server A listens to a channel named C
Plugin message is sent from server B on channel C thanks to Player
Backhand server A retrieves it.
How did server B sync that to server A.
wdym sync?
he's asking about bungee's plugin message channel
Okay I rephrase, how did server A retrieved the plugin message sent from server B
alexis it uses the player's connection
but yeah it just uses the player's socket
^
the server sends a special plugin message packet to the player's client
which naturally goes through bungeecord first
like it just chops it in a packet and sends the message for a ride using the player
Ahaa
bungeecord will then handle it from the player's connection, and then to the client or more info is send back through the socket as if it came from the client
Wait I'm a bit confused. The players socket is on players client right?
client -> bungee proxy -> server
the proxy hijacks the socket and uses it for other info, it doesn't require the client to actually send something to pretend it did
in this case they're
its like how viaversion works at the proxy level, it'll just change the packet content before being received by the server
mate do you have any idea what you're talking about]
a websocket and socket !=
and this is not a websocket
a websocket is a socket, but it has extra information packed ontop (completely unrelated to Minecraft or anything Netty requires)
ye
Although a specific backhand server needs a player to retrieve the message (else there is no connection to receive the data from)
correct
yep
that's why you use the player instance to invoke sendPluginMessage
Ok thx
even when using Server::sendPluginMessage it just grabs a random player
I mean I guess you're able to create a fake connection to the proxy, but that's just way too hacky
I thought a websocket had the attribute to be bidirectional, among other things
HM okay
websockets have TLS support, something you need to manually implement in regular bare sockets (not specifically TLS, but any alternative)
it's just a protocol for regular sockets, nothing special
Alexis its just in some rare occasions sockets aren’t used in a bidirectional manner
Ha alright
(if you are curious for the alternative I mentioned that Minecraft uses, that would be this entire encryption process https://wiki.vg/Protocol#Login)
Okay so now my question is, can I hijack bungee's socket from a backhand server? (The proxy does have a socket which synchronises some data over the backhand servers, right)
No
the proxy and server never communicate
to hijack the bungee socket, you just insert into the Netty pipline for the player connection
(on both proxy and player), or use the built-in solution of plugin messaging
my recommendation is to just use a proper messaging service
NGL it's a bit a weird design.
well proxy & server are not really meant to communicate in any situation
backend servers don't directly talk to the loadbalancer servicing it, it just doesn't make sense
Also mojang hasn't ever thought about how multiplayer servers would evolve
People who have been messing around with what they could made it normal nowadays to have a network of servers rather than a single server
Most ridiculous thing is how they designed Minecraft server to be single threaded for the most part
well, regardless, I still don't agree with a proxy -> server communicate
the proxy is just meant to service any incoming connections and funnel them appropriately
I mean most games are written that way
Yeah I won't do that
don't know why your proxy is magically handling things unrelated to a player connection
(but highly situational and perhaps its a good reason)
Thanks for your explanation btw
I think I will use my own sockets
Redis is too much of bandwidth usage imo for what I'm trying to do
can use rabbitmq or similar
or you can also add an extension to the proxy and make the socket conncetion to the backend servers yourself
to do that you'd need to go before basically anything else in the Netty pipeline for incoming connections
I'd add a special few bytes at the beginning to say "hey I'm a bungeecord proxy" and passthrough if it doesnt have those bytes
How so?
^ but yeah redis messaging, I highly doubt that's any type of heavyweight
Redis doesn't take much bandwidth
It won't be sending a whole lot of extra data
It's designed to be used as a messaging service, which is what you want
well kekw
it's got that whole key value nonsense as well
but we'll ignore, because that doesn't affect the messaging bandwidth
You don't really need to care about that for messaging
(was talking about the "designed to be used as a message service")
anyways Alexis, you have plenty of solutions to this problem
Yeah I know that but I'm happy about my structure "every backhand server has my plugin" rather "proxy has the plugin for them all"
You will probably think it's surprising. But it's a lot of context to zxplain my decisions
well if you're messaging the proxy then the proxy needs to have a plugin to handle the message
otherwise you're speaking to thin air
so I don't understand the logic here
Good to know
Thank you guys for talking to me. It's clearer now for all this messaging madness
am I wrong though? if you're messaging the proxy, then the backend server needs something to handle it anyways kekw
^^
Data won't get sent from server A to Server B without a plugin on the proxy passing that data
Rn I use plugin messages, which work most of the time except when there is no receiver player ofc
my god lol, if that's the attempt then just use a messaging service between the two servers, because the proxy shouldn't be handling that
Yeah I agree, you guys convinced me
That's what I will be looking into
seems to me as if poor design, but I understand that hosting redis/rabbit requires a cloud instance and not MC hosting
alright mate, best of luck
Thank you!
There's a find in files button in the edit menu
Ctrl + Shift + F
thx
How do i get rid of this slight rotation to the left about the y-axis?
Hello
how can I rotate a vector around a location?
idk if its server question or development so ima ask it here too:
When I make a nether portal, it doesn't look for empty spaces to spawn it like it should. It just spawns it inside walls, and at overworld location / 8.
What have I done in the server that could be causing this
Well, how did you create the armor-stand? Is this default behaviour?
A euler angle rotation matrix rotates around (0|0|0), so you shift the vector before applying the matrix and undo that shift again afterwards. This way, you effectively moved the manipulation origin.
Yes it is the default behavior. The value of x in EulerAngle is set to 0.
armorStand.setRightArmPose(new EulerAngle(0, Math.toRadians(location.getPitch()), 1.5 * Math.PI));
Well, I think that since the sword is upright by default and has a upwards tendency, you inherited that by the nature of euler angles when rotating it on the y and z axies.
the 1.5 * PI is there because i want it to be horizontal. so how can i compensate for that upward tendency
Btw, is that arm rotated at all, or is it parallel to the body?
wdym?
Well, you apply all of your transforms to the arm of the armorstand, not to the item itself. So if it has this left-tendency, I'd guess that the arm cuboid (the vertical stick) itself has also got to be rotated. Looks like you have hidden these arms tho, right?
Then update to a modern version