#help-development
1 messages · Page 1549 of 1
where are you creating it?
cook
Anyway that error comes from an invalid NBT tag
no console error found
hmmm
Why would there be one
The tag is invalid so the client has no idea what to do with it
ahhh
the problem is probably in your initialization/setup of the book
ahh Do you know which one(method) is related to nbt tag?
So you don't know what your code does?
It's where you set what the book displays the code you posted is fine
Can you open your book in the first place without forcing it
the problem lies in a wrong setup of the book information, not the book opening itself
hmm, it seems not 😦
when I give player a book, and open it, it doesn't have Invalid tag
its ok thanks you
If i might aska a question mysyelf...
did java -jar BuildTools.jar --rev 1.17 --generate-docs but i cant find the javadoc
Yea it's for my hardcore plugin when player lost all lives. Would like to make it completely black
tell the player they're surrounded by black concrete
That would work ^^^
Send block change packets
So that they think they are surrounded
Ah I'll look into that one thanks for that!
The only thing is that if they interact with the blocks they get removed - I think there is an event listener you can cancel though
any example of config with saving all comments (custom)?
Yea it's already been disabled no biggy :d
Just have the config.yml in the resources folder and then save it onEnable
back to my question where does buildtools.jar generate javadocs (I have the flag enabled?)
but once I access the config the comments are out
you could do that with packets
I save it -> access to store things from it -> comments kept only first header, not whole file, which is my issue
Which packet are you talking about
PacketPlayOutGameStateChange
Yeah, are you then talking about the sky colour one?
Or like the weather field
Or some shit like that
not sure which one he used https://www.youtube.com/watch?v=8kwbmozszY4
[-----] ÖFFNEN! :P / Open for more Information [----]
| GERMAN:
| War ja klar, dass irgendwann ein Troll Plugin kommen wird:P
| Heut zeige ich euch wie ihr einem Spieler
| für eine bestimmte Zeit einen schwarzen Screen geben könnt!
|
| Schau dir doch mal meine selbst
| gesc...
just googled and it was the first result
The problem I have had with that packet is that if you put a high number in it it gets unplayable
It gets really laggy
Looks like they are using the same packets
Oh he just triggered the game end screen
yeah obv. but idk what state he changed
Lmao
never did anything with this packet
get set get set get set get set this is my life now
Ayyyyy
just hundreds of files of getters and setters
Those are rookie numbers, you should go for thousands of getter and setter files
ohhh i didn't watched the end lol
You can change the sky state which produces some nice effects
well there's 729 class files in the project rn so I guess we're not that far off from thousands
who?
any example of config with saving all comments and not keeping only first header (custom)?
you could use the PrintWriter to load your config from your resources
and how to handle reading? because once I read from it, the problem is here again, lost comments
PrintWriter pw = new PrintWriter(file);
pw.print(IOUtils.toString(Objects.requireNonNull(Core.getInstance().getResource("messages.yml"))));
pw.flush();
pw.close();
its not reading. you print the received contents of the requested resource to the given file.
afterwards you flush it to close the stream so there will be no memory lying around
yes, but I need to access things from it afterwards
and then the comments are lost again, once I do it
yeah so just get the FileConfiguration from the file
will try, thanks
Hi, is there any simple way to open additional port to the server, let's say, 127.0.0.1:1111, and be able to determine, if the player joined via main port 127.0.0.1:25565 or 127.0.0.1:1111?
Eh, thank for the link, but it isn't particularly what I meant. I was talking about Spigot plugin, where the behaviour will depend on the port the user uses to connect.
And I was wondering if there's a way to handle this using Bukkit/Spigot API only
you have to state your needs clearly
you could use the PlayerLoginEvent and check for the hostname
Hello,
Is someone knows how to use Maven Shade Plugin with Eclipse, it's my first time and I look a few dozen of forum discussions, but I still have the same exception on my plugin: ClassNotFoundException
I give my pom.xml file: https://pastebin.com/ygi6HNnM
thank you in advance 🙂
?paste
Sorry, but this website isn't working
oh damn, it is actually down 😱
Can I use pastebin ?
yea
any bin website is good, just pasting huge codeblocks is clearing every other problem from the chat
Yes I understand, sorry for the inconvenience
Here is my pastebin: https://pastebin.com/ygi6HNnM
Hmm why are you depending on yourself tho ? What class is not found when running ?
I've created an API that give an access to my databases so I use on my plugin many classes to get some datas from tables. Classes are GeneralPlayer and CharacterInformations, there are each used to access to a table
oh, right I see your artifact is called mmoDatasaved
your groupId is wrong btw
<groupId>mmoDatasaved</groupId>
<artifactId>mmoDatasaved</artifactId>
👀
It's my plugin so I need to use my package for the groupId ?
Oh ok, I'll try it
can you paste the output of your mvn package run ? the maven shade plugin seems fine to me, so the log should show more
I installed it only on my eclipse IDE 😦
No, I compile like another plugin (JAR file)
well then obviously your maven configuration isn't going to get you anywhere 😅
Has I understand, when I compile like another plugin, I already checked maven files so it compiles with
Maybe a version problem
I am not sure that eclipse actually uses maven under the hood to compile your plugin
Does anyone know why with the InventoryClickEvent when I change the itemMeta of the "currentItem" it works only in survival or also in creative if I delay the task by 1 tick?
My plugin is running on my server, only with ClassNotFoundException exceptions, and I used spigot in maven dependencies. I think if Java had compiled without maven, the plugin didn't load on my server
are you saying it doesn't work in creative?
do you have maven installed ?
It works if I delay the instruction by 1 tick
Only on my Eclipse IDE
creative is clientside
try to run it as a maven build
Hem, what? Are you sure? If I delay by 1 tick it works as it should
I have a build failure: No goals have been specified for this build.
you are missing package as a goal
It works, but I think I used a wrong compiler plugin version: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5:compile
I think the newest would be 3.8.1 ?
Yes sounds good, the build was completed, I'll try this jar file
Ok, I get it, creative is client side but why it works only if I delay?
Haha, it's a bad joke I think, but my console tells that my plugin.yml is invalid 😦
sounds like an easy fix tho
ohhh, I put it in the same root as src folder
it goes in src/main/resources
like src/fr/MrUrica/mmoDatasaved/resources ?
oh
you aren't even following maven project structure
did you just throw in a pom.xml ? xD
I converted my project into a maven project, then I edited pom.xml but I didn't change anything else 😅
yeah maven projects have a set layout you gotta follow
an example maven repo
ok so I have to put before my package a main folder
yea basically goes src/main/java/my/package/name
Okay then, I create a src/main/resources
Again an error on compilation: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
Don't I need to edit this line on my pom.xml ? <sourceDirectory>src</sourceDirectory>
Ok, I changed my sourceDirectory to src.main and the plugin works !
Thank you @eternal night
np
?paste
https://paste.md-5.net/iduhibiqog.java is this why we're here? just to suffer?
not quite sure what you wanna say
It's a 500 line long set of glorified getters and setters
If I use #hideplayer, how can I show the player again?
should stuff in a DatabaseHandler class be static?
not really a reason to
No
ty
Of course this depends more exactly on how you’re designing it but when it comes to storage types you probably want to take advantage of polymorphism and abstraction which static isn’t the best at.
im not making anything complicated
the most complicated thing I need rn is just checking whether something exists in a mongo collection lol
An interface abstraction might still be pretty useful for you
String code = "public class Test {"
+ " public static met() {"
+ " System.out.println(\"hi\");"
+ " }"
+ "}";```
I'm trying to compile this string
And to have access to run the method from anywhere
Does anyone know a way to do that?
I think compiler API is only part of the oracle JDK iirc
so you are probably fucked
Does Bukkit#BanList#addBan work for offline players?
(It takes the username rather than the UUID)
you can use a uuid too I think
Then I'd expect it to take a UUID object
okay
Bans by name are no longer supported and this method will return null when trying to request them. The replacement is bans by UUID.
it seems if you provide username it will just use their uuid
imagine if the documentation actually described what form 'target' is in
does this returns the args with a space between them?
public static String getFinalArg(String[] args) {
StringBuilder message = new StringBuilder();
for (String arg : args) {
message.append(arg).append(" ");
}
return message.toString();
}
or something like this
yes it do
And a space after
ok
why loop when you can just return String.join(" ", args);
No trailing space
does that also work for an array?
args is an array, do you mean a List?
nah i meant does that return the args with a space between them? thats what i need
yes
oh lemme try then
but how can i remove the lore from an item?
i did meta.setLore(null);
Once you modified the meta of the item, you need to set the item's meta to the new ItemMeta object you modified
(don't know if it's clear lol)
np
Is there a way to show multiple tab complete options for a command, but prevent players from being able to use them?
Like when they press tab and it copies the text into their chatbox.
No
anything you put in the list will be shown on the client. Whether they can use that option is up to your command code.
How to you add tab complete options ?
Is it in plugin.yml that i need to add something ?
no, in code in teh tabcompleter method
No, it's just that I don't want them to be able to automatically use them from the box rather than manually typing it themselves
You have to set tabCompleter class the same as you do CommandExecutor
You choose what they can see in the tab complete by building the list
like extend the class ?
I'm trying to colorize tab completes for showing error messages and colorized info in general, but it kicks the player if they tab complete that message and send it
Implement, yes
Okay, thanks
Look at some tutorial
public class BaseCommand implements TabExecutor
Yeah, the TabExecutor is better
that does both CommandExecutor and TabCompleter
Okay thanks
If you add it to the tab completer they can try and use it
?javadoc
hey, I use for my plugin Ageable ageable = (Ageable) b.getBlockData(); on Sweet Berries and Glow Berries (1.17), for the Sweet Berries it works, but for the glow berries they are not ageable, how can i get if they are grown or not ?
If the block is a Cave vine it can grow berries
Its not ageable as its a random chance for growing a berry
Like a vine
well, it is actually agable, but the age does not affect when/if it has fruit
Okay but how can I check if the player is harvesting a grown glow berry (if it has fruit) ?
PlayerInteractEvent ?
I would guess watch teh PlayerHarvestBlockEvent
Yeah that's better
Ok thx ;)
Is there an easy way to turn a java https://docs.oracle.com/javase/8/docs/api/java/awt/Color.html into a the closest https://hub.spigotmc.org/javadocs/spigot/org/bukkit/ChatColor.html ?
declaration: package: org.bukkit, enum: ChatColor
(Or just specify an rgb value for a ChatColor)
For chatcolor there's only the specified color available
But I guess you can try to add an if close with the hex tag to find the closest one
I don't know if there's any easier way to do this
hmm okay I'll keep searching
good luck
^ using vectors and shortest distance is the only way really.
I mean does this support rgb? https://minecraft.fandom.com/wiki/Formatting_codes
Formatting codes (also known as color codes) add color and modifications to text in-game.
Text in Minecraft can be formatted with the section sign (§). In Bedrock Edition, the section sign can be entered into signs, world names, books, renaming items and in the chat. In Java Edition, section signs may be used in server.properties, pack.mcmeta, s...
Well, my aim is to send a message closest to a specified rgb value
actual maths, damn
actual maths be like
Launches Unity3D
If books support json then yes
There is a libs from like 2013 to get closest ChatColor from Color.
we found out thats not what he actually wants
So yes you can use rgb colors in books but only using unsafe
to access the json
Yeah, but I'm not talking about books 😔
Eff man, you just showed us a BOOK and asked for that
that's just a preview
it's what ChatColor's constants are
ask yoru ACTAUAL question, not around the bloody houses
right?
ask an actual question. As we have answered every one you asked and you keep telling us thats not it
bukkit does have an implementation for a rgb supporting § colorcode, but it is super gay and nobody uses it
various plugins have their own implementations
Sorry
Is that a thing?
Where can I find all the commands?
Well with the help command but use something like #spigotcraft for it I guess
Or #text maybe
Yes that color code is a thing but idk why mojang decided to use that
I think at least
I mean: https://www.spigotmc.org/threads/full-rgb-chat-color-support-in-1-16-snapshot.432828/ would be nice, but we're not there yet ig
yes, that one conclure
When premium plugins are approved do they get listed right away?
im not sure why my bossbar isn't working (it just is completely empty every tick until i update then the next tick it is empty again), this is the code that is updating the bossbar:
bar.setProgress(val/max);
``` is there something wrong with that?
do i need to do that every tick?
btw val is a num between 0 and 120, and max is 120
do i need to like round that to the nearest 100th?
cuz sometimes i can get numbers like 8.(3 repeating)
you'll be notified and the plugin will be listed under premium resources, yes
Sometimes you need to be patient too xd, I've been waiting for almost 2 weeks and haven't got approved yet.
if you just update it once it will just update once.
yeah but for some reason it doesnt stay
show us the code
ok
Ok so Im trying to check if the location in the configuration file equals to the location of the STONE_BUTTON clicked in the PlayerInteract event with this: https://paste.md-5.net/ecazuwipig.cs
It does get the location but it does not go through if (event.getClickedBlock().getLocation() == loc) {
I tried equals as well, doesnt work
== checks if the adress of the object in the heap are the same so the vars are refering to the same object or not
?paste
@hybrid spoke there u go
?paste
oh shoot
and delete your codeblocks
yeah sorry forgot about that
both == and equals don't work so i dont know
have to, if you get the correct location from your file
at least equals
gimme a sec
Bar class code:
https://paste.md-5.net/nomasogufe.java
Editing code:
https://paste.md-5.net/tetabotame.java
does Statistic.PLAYER_KILLS returns a value? or do i need to use Statistic.PLAYER_KILLS.name() ?
I doubt it would be .name, considering it seems to be an enum you prob need to pass it in a method
and what exactly isnt working? where is your scheduler setting the val every time?
?jd
this doesn't return anything than the enum itself
you need to get the value by that enum with the #getStatisticmethod
declaration: package: org.bukkit, interface: OfflinePlayer
the scheduler runs every second and is in the main class
so like this
meta.setDisplayName(p.getStatistic(Statistic.PLAYER_KILLS) + " kills");
also what isn't working is that the tick after i set it it just goes back to empty, the val stays it just displays empty
most likely
Location{world=CraftWorld{name=Skylands},x=-166.0,y=131.0,z=95.0,pitch=0.0,yaw=0.0} is what loc returns and this is how it looks in the config:
Skylands:
traitorTester:
testerButton:
==: org.bukkit.Location
world: Skylands
x: -166.0
y: 131.0
z: 95.0
pitch: 0.0
yaw: 0.0```
oki
so something with your calculation is wrong
yay it works
and what if you don't create the location right out of config? you could create a new location object by yourself with getting the values from the config
there we go! it works! tysm!
np^^
I tried doing this: https://pastebin.com/iFddBjFN (the get map thing returns Skylands)
uhm. you are getting the configuration section
not the value
ah wait nvm
pastebin is just eyecancer
why do you have different casings?
for the traitorTester?
yeha already saw that and fixed it but wasnt the issue
ok I got an error here for the location https://paste.md-5.net/caguhegero.cs
Caused by: java.lang.IllegalArgumentException: Name cannot be null
your world name is null
why do i get that * or **?
because they are valid arguments
isn't * everyone?
as for what they do, I don't remember; * probably heals everyone and ** might heal yourself
yea it is * everyone but when i try its null
what is null
Yea what Mr Skull Head said
mr chaplin
i have something that checks is the argument is valid and it says * is null
maybe because you check for a player and "*" is not online?
* is *, not null
and you wonder why its null?
How can I get an Advancement from it's key?
nah it looks for the player called * or something
null

and you are wondering why it is null
?javadoc
more like learnjava
no i understand
after we said that yep
i was wondering what * and ** meant 🤔
yessir
But when I do System.out.println(mapManager.getMap()); it prints out the world name correctly? Why would world be null then?
uh, I'm trying to install the remapped mojang jar and I keep getting this error when using --remapped
https://paste.gg/p/anonymous/c842f7b0372949588a7f6b8966aef54d
does anyone know how 2 fix this?
?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.
The vibration particle, its asking for data whats the best way of finding out what data it wants as the javadocs dont seem to help
Google is your best bet if javadocs aren't helping
What's the best way to lock items into a custom GUI so they can't be removed?
RE: the * vs **, Essentials distinguishes the two by * = everyone, ** = everyone including every offline player
If you have a large playerbase, ** will easily crash the shit out of your server
Cancel InventoryClickEvent works fine
Yes, but what do you use to cancel the click event? I tried using title and it didn't work
event.cancelled
I have
event.setCancelled(true);```
but it doesn't work
I use InventoryHolder but arguably InventoryView is better
I do have an inventoryHolder, how would I use it to cancel an inventory click event?
what does the statistic BOAT_ONE_CM returns? the distance travelled by boat in cm?
yh
in cm 🤔
1 block = 1 metre
uhu
inventory best
test if the holder of inventory is the intended inventory holder lol
what should this return? v @EventHandler public Object onAppleEat(PlayerInteractEvent event) { Action action = event.getAction(); Player player = event.getPlayer(); if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) { if (event.getItem().equals(Material.APPLE)) { if (event.getItem() != null) { player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 600, 5)); } } } return true; }
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.
like this
if (event.getInventory().getHolder() instanceof TrailsGui) {
event.setCancelled(true);
oh mb i was testing something and i put public potioneffect and was confused on why i was missing a return statement for a void function
hey, im wondering how to edit block type without editing the direction/shape, i want to edit stair/slab types (from stone_brick to end_stone) without changing their shape. how do you do that? whenever i use block.setType() it also sets the shape
Hi, I'm developing a simple economy plugin. Each player has a file to define their balance.
uhhhhh, prob wanna do a json file rather than a file for every player
So I developed a richer server system. It pulls all files to make a list, over time it would get heavy?
declaration: package: org.bukkit.material, interface: Directional
i'm using yml
ok but a file for every player is a lot
it's fine
how would i use that?
What do you recommend?
@EventHandler
public void onAppleEat(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
if (event.getItem().equals(ItemManager.invertedApple())) {
if (event.getItem() != null) {
player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 600, 5));
}
}
}
}``` Why am i not getting the potion effect applied?
sent thr wrong one
declaration: package: org.bukkit.block.data, interface: Directional
that's what you want
the other one is deprecated
ItemManager.invertedApple()``` is a public itemstack
for this
json:
{
"balances": {
"USERNAME1": {
"amount": 20
},
"USERNAME2": {
"amount": 102947
}
}
}
seems pointless to have another map after username
How would I go about generating a rank based on values?
I currently use this.
maybe he wanted to store other information like transaction history or sth idk
im not entirely sure how to use json in java (im used to py), but i know that many plugins use it so you could probably find how online
in case u need more info
This doesn't work for some reason...
Player player = (Player) event.getWhoClicked();
if (event.getInventory().getHolder() instanceof menuGUI) {
event.setCancelled(true);
}
}
not sure what other info you would need except a number under "balances"
but it does make sense design wise
like a max bal
i would keep transactions under a separate key
different economy balances
Did your menuGui extend InventoryHolder? Or implements idk
Files per player?
menuGUI impliments InventoryHolder
ideally sql db lol
I don't know how to use sql db
hmm... learn?
then learn
can start from sqlite, the easiest & serverless one
this is exactly what sql is for
Oh ok
is menuGUI an instance or a class?
I'm going to look for some tutorials on spigot
if former, instanceof isn't correct, if latter, your naming isn't correct
whatever you do i wouldnt keep all playerdata in a single file unless you plan on reading the entire thing into memory one time
A class I believe
ok, i got it working for stairs, but how would i for stuff like slabs or walls?
Yeah, menuGUI is a public class. Do I just have to change the name?
It is a convention for java classes to be in PascalCase
actually no this for fences https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/data/MultipleFacing.html
/ walls
although, it then shouldn't be the cause of the problem
interestingly I have seen Towny done otherwise
don't really know anything about towny
but it generally doesn't sound like a good idea if you're gonna have a shit ton of playerdata
because you're going to be reading and writing to that single file constantly and you're going to have a nightmare synchronising it if you don't want to lock up the main thread
So I'm attempting to use https://github.com/lucko/commodore, and CommodoreProvider#isSupported seems to be returning false even after following all the steps to implement it
have you tried opening up or search through the issues?
I'll take a look
when you say implement it, what do you mean
use it in my plugin
then returning false is a sign that it is implemented
else it would throw classnotfound
It should be returning true, if it's false Commodore can't work
The problem is Brigadier not being supported for some reason as far as I can tell
I haven't found any issues related to this in the github repo
hm you can consider opening an issue regarding that
I asked in the lucko discord, if nobody is able to help there I'll open an issue
ty for trying to help tho :)
yea... it is weird
insert into if not exists
also you should lookup how to use prepared stmts properly
Also a note it may be good to make that a util to execute querys so you do not re type everything every time.
in most situations you dun even need to create the player
And also you should store it by uuid not by name
world#getWorldType is deprecated, what replaced it?
You seem to be trying to do something that you don't have enough experience to do.
world environment something something?
?jd
@wraith rapids yeah that's it thanks
why need check if player has account?
if it is to check before creating an account, then the "account creation" might not even be needed
i`m using this tutorial
Do you think it is necessary to check?

doesn't look like a how-to, but more like "here's a shit ton of code for you to shove into your plugin with no explanation"
the tutorial didn't say anything about checking
but
it did mention replace
REPLACE INTO inserts if not already exists in sqlite
don't copy-paste code unless you actually understand what you're doing, it'll just lead to you having headaches later
^^ that's a huge thing, as your code could be heavily improved with a better understanding
I would say otherwise tho 🤔 to copy first then understand it. Cuz you can mess with it and find out what it actually does
copying is ok as long as you understand what it does
i'm definitely not saying don't copy, but it's worthless if you fail to understand what you're actually copying
all you end up learning then is how to press ctrl+c and ctrl+v repeatedly
yes
Yea definitely must understand it nonetheless
Having an hard choice here, need to freeze player, currently I disable movement which is crap due to looking like massive lagg, what would be an better option ? Was thinking to teleport player each x ticks but think that would not be to great of an option either, anyone got an better way to handle player freeze ?
just teleport them to the centre of the block if they leave the block if you don't want it to look too laggy
or stick them on an arrow and don't let them dismount it
What is that thing whereby slab bugs the hell up players and traps them in place
Never heard of that one before :p
woudl probably work
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/mashape/unirest/http/async/Callback
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:384) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:232) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:987) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NoClassDefFoundError: com/mashape/unirest/http/async/Callback
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
... 7 more
Caused by: java.lang.ClassNotFoundException: com.mashape.unirest.http.async.Callback
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
... 7 more
Hi when i tryin' send post request to api i have an error i don't know why
whatever library you're depending on is not shaded
Chunk bigger than minecraft chunk
Hi there,
I'm just getting into the 1.17 and I already have a issue. Here is the context: I used to spawn an ArmorStand using nms in 1.16.5 (and lower). So I tried just to "translate" all the class to the new mapping. Result: no error but armorstands are not spawning.
Is there anything new in the involved packets?
Nms yes, package changed
Yep I noticed, so I moved all the class, but it doesn't work
How do I spawn an armorstand?
- Create EntityArmorStand instance with parameters: CraftWorld, x, y, z
- Invoke setInvisible(true) to the instance
- Invoke setCustomNameVisible(true) to the instance
- Invoke setMarker(true) to the instance
- Invoke setCustomName(IChatBaseComponent) to the instance
- Send PacketPlayOutSpawnEntityLivingConstructor(instance)
- Send PacketPlayOutEntityMetadataConstructor(getdataWatcher)
Sorry but the code is horrible so here is the step I do ^^
I'm in the server thread
I believe you dun have to spawn armor stand this way
In fact no need nms at all
There is a method in World
I'm doing a plugin which is compatible with 1.8-1.17 and which require to use NMS with reflection
Even the spawning part?
Does anyone have a good sqlite tutorial?
I want to implement a local database in my economy plugin
Especially the spawning part because it's an ArmorStand visible by only one player
https://www.sqlitetutorial.net/ for sqlite
but you will need to look for jdbc docs for implementing in java too
This SQLite tutorial teaches you everything you need to know to start using SQLite effectively. You will learn SQLite via extensive hands-on practices.
Ohhhh
the official sqlite docs are p good
Then i dont know lol, weird to have no error
Yep 😢 Thanks anyway! I'll try to figure it out
Guys just wondering, is it possible create a new file inside a jar or is it blocked for security purpose?
Create while running ? Like storing data inside the jar?
Yes
actually yes you can write into a jar file
maybe you shouldn't, but you can
I have a new hobby and it's giving emotional support to people who ask for support and provide literally no details
the great thing about my hobby is that I get to do it for 4 hours every day
I was just wondering on how an updater of a java application works. I'm not talking about the plugin that you put the jar inside the update folder and spigot take care. What I don't get is how the java application is able to replace itself with the updated one
it doesn't, not really
it creates a new copy and self-destructs
but since the end result is seamless you end up with a ship of theseus or a teleportation philosophical question
Is it able to delete itself?
theres two ways to do it
pretty sure it's possible yeah
hell back in the day I believe it was myth 2 that had an uninstaller which uninstalled your entire OS
the good old days of gaming
I still have that sucker installed somewhere
you either execute an updater which then replaces teh original, or it places teh new one in an update location. Then next startup it copies anything from teh update location to teh new
When you execute a "Launcher" its just a wrapper that checks for a new version, replaces the old version and then executes it.
That was what I was thinking to do. And that is because I asked if I can save stuff inside my jar
Thank you
is this correct????
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
ArrayList<String> list = new ArrayList<>();
if (args.length > 0) {
list.add("set");
}
return null;
}```
should be
there might be spacing errors but nothing I can see
are you programming a datapack or a plugin
plugin
yeah idk what would be the problem
ok i go try this (because im trying to make a tab complete)
you're not returning the list
ok how?
?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.
if i add this.. it is correct????
return list.stream()
no
learn java
return list.stream()
.filter(arg -> arg.startsWith(args[0].toLowerCase()))
.collect(Collectors.toList());
ok
Y'all know how to connect my discord bot to my minecraft plugin ?
like could y'all give me the method for getting the jda variable
cuz when I try doing Bot.jda= JDABuilder.createDefault(Bot.botToken).build();
it says java.lang.NoClassDefFoundError: net/dv8tion/jda/core/JDABuilder
shade jda
though you should be aware that jda is massive and you won't be able to post it to spigot
by releasing on github
depends what you're using to build the plugin
I'm exporting the jar to my plugins folder
then add the contents of the jda jar to your own
how you do that with your ide is something you're gonna google yourself
I've downloaded jda
i gathered
I've added the build path to the plugin
like I did with spigot
so im not sure why thats wrong
because that is only available at compile time
at run time spigot is provided (for obvious reasons), but jda is not
so to fix that, you shade it in yourself
how may I "provide" it to the plugin
and once again how you do that depends on your build system and unfortunately i can't read your mind
i don't use eclipse so i have no idea
i am sure a simple google search will solve your issue
all I've seen so far are tutorials for how to shade a jar file using a maven project
but my project isn't maven
so
help?

might be time to learn maven, but i have no idea how to use eclipse sorry maybe someone else does
you probably tried to insert a duplicate key into your table
So every project I make I should make it a maven project?
if you want to use maven
but is that the only way to shade a jar?
how to put the players to completion????
cuz every tutorial I've seen uses maven
well at some point you'll eventually use a build system like maven
there are alternatives to maven that perform the same functions
maven is just popular in the bukkit ecosystem
ok so there's no way to use maven to shade a jar into my plugin for my existing project ?
I have to make a new maven project?
maven has a file called pom.xml which contains details about the project, you add one of those to your project and you have a maven project
@silver cove how to put the players to completion????
what?
like /hat set PLAYER
tab completion
yes
you literally don't need to do anything to add player tab completion
the server does that by default
x) ok
Guys how kick player in RedisBungee i need help.
I search method and not found.
I found this method from api and don't understand what to do next...
I think you wanna use sendProxyCommand assuming you have a kick plugin installed on your bungee proxies
No kick not installed in proxy :c
Oh yeah well then use the sendData
Google plugin message channels or something
You should probably find a wiki page
So, I tried to use this to stop people from removing items from my custom GUI, and it's telling me expression expected on "Inventory". Why doesn't this work?
if(event.getInventory() != Inventory) return;
event.setCancelled(true);
}```
no :/
it juste set nothing
change args.length > 0 to args.length == 1
Well I want to reference the inventory, here's the line where it's created the inventory in that file. What would I put in? Inventory inventory = Bukkit.createInventory(new menuGUI("Menu"), 9, "Menu");
put(0, ItemManager.compressAmethyst());
put(1, ItemManager.compressAmethyst());
put(2, ItemManager.compressAmethyst());
put(3, ItemManager.compressAmethyst());
put(4, new ItemStack(Material.GOLDEN_APPLE));
put(5, ItemManager.compressAmethyst());
put(6, ItemManager.compressAmethyst());
put(7, ItemManager.compressAmethyst());
put(8, ItemManager.compressAmethyst());
}});
}
public void checkCraft(ItemStack result, CraftingInventory inv, HashMap<Integer, ItemStack> ingredients){
ItemStack[] matrix = inv.getMatrix();
for(int i = 0; i < 9; i++){
if(ingredients.containsKey(i)){
if(matrix[i] == null || !matrix[i].equals(ingredients.get(i))){
return;
}
} else {
if(matrix[i] != null){
return;
}
}
}
inv.setResult(result);
}```
the crafting works but when i fill all 9 slots with compressAmethyst() i get 1 compressAmethyst()?
yes i know and i do it x) but...
Bukkit#EnablePlugin gives the error
Enabled plugin with unregistered PluginClassLoader PluginName PluginVersion
Press TAB
yes i do and nothing
It maybe overridden by your plugin
maybe???
Send entire error
so i was searching for 3 weeks now ..
and no one here helpful enought to answer me ..
@keen kelp are you using plugman or doing something else which isn’t normal
I have literally no clue what your actual issue is, but be patient
I just wrote my own thing
PluginManager pluginManager = Bukkit.getPluginManager();
Plugin game = pluginManager.getPlugin("Game");
if(pluginManager.isPluginEnabled("Game"))
{
pluginManager.disablePlugin(game);
}
pluginManager.enablePlugin(game);
That's it
Is this within your game plugin?
Not true but ok
You can do some extremely hacky stuff to self restart
Yeah but no thanks :D
Anyways need to eat ttyl
Italy wins everything
Read the rules, if it isn't there, then you probably can
@hardy swan Just for information I found the issue (about NMS) : The problem was during the packet sending, I use reflection to fetch sendPacket method but the "playerConnection" stuff was also changed... So I finally succeed !
Best feeling
I've seen developers printing the consoles messages like that, probably it's safe
I think so as well
Its frowned upon. It can be classed as advertising which is not permitted
paperlib provides a method which does exactly that, i'm fairly certain that it was already agreed on that it was allowed
it's only frowned upon by those who don't know better
paperlib isn't distributed on the spigot platform
namely the majority of spigot's userbase
people not knowing better is literally the last thing keeping spigot going
well, that and people getting banned for no reason from the paper discord and refusing to use it out of spite
cc tan juck
quick question quick answer, is the saveConfig() function working even if the directory Plugins/<Pluginname here> is not yet created?
it'll most likely throw a file not found exception
I know saveDefaultConfig creates the directory. No idea on just save
wait i have a ide just look up the function
imagine not developing with ms notepad and javac
my keyboard only has 2 buttons
a 1 and a 0
abacus or bust
i use small stones instead of pen and paper
That's 100% true
I have no idea if you're referring to me or not
i will eventually build myself a pneumatic computer
it's probably going to sound great
Oh try to rebuild the gear computer! Might be a good stepping stone to calculate how to preassurize everything
gears are more annoying to work with than pneumatic tubes
tubes are kind of like wiring, just thicker
...i just realized i just thought 'steampunk' and had the completely wrong idea lol
what about a water powered computer tho?
we already have the logic gates for that
water is kind of messy and corrodes components
the thing with air is that it's easily available and disposable
no need to route everything back into a tank
the advantage of hydraulics is that liquids don't compress, so you get accurate and strong movement
but neither of those are really necessary i wouldn't think
overpressurized is better as vacuum pumps are slow and the tubes would probably collapse and get stuck
i see. maybe hydraulics would be a good idea to shift what the main bus is connected to atm?
perhaps
Bump, need help on this one
though, i really don't look forward to hydraulics
i need to deal with hydraulics just enough irl
it's cancer
everything needs to be perfectly sealed and withstand high pressures
it's like being a plumber but on steroids
hydraulics are cringe
ouch, but how else to shift the bus?
air pressure will probably be enough
Good luck with your ram tho
no how do you want to address stuff?
This is excellent 😂😂
Condition: config.getInt("info.version") == 3 is FALSE ==> All Commands shouldn't be enabled
Does anyone know why CommandA is disabled and the other two are enabled?
Server: 1.8.8
if (config.getInt("info.version") == 3) {
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "Supported Version found!");
this.getCommand("cmda").setExecutor(new CommandA());
this.getCommand("cmdb").setExecutor(new CommandB());
this.getCommand("cmdc").setExecutor(new CommandC());
} else {
Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "Unsupported Version found!");
}
i'll either look at some schematics of some simple old chips or just come up with something on my own
probably the latter
I think intels 4004 is a good starting point
i'd write that down but I'll probably forget about having written it down before I get around to doing it
eh just remember it's the first fully functional cpu
@dry meadow is that the actual code in your onEnable() ?
yes this is in my onEnable()
can u pm me your plugin.yml?
eh fair i just dont want a big file here cluttering things up
?paste
lmao
or that
Is the issue that the first command does not get registered?
In your main do getDescription().getVersion()
Rather
name: TempPlugin
main: io.github.tempplugin.TempPlugin
author: Temp
description: Temp
version: 1.3.2
commands:
cmda:
description: cmda
cmdb:
description: cmdb
cmdc:
description: cmdc
To get your plugin's version
okay that makes no sense. Your commands should still show up in the /help but shouldn't be executable
If the if statement is false i see no reason why they should run
ohh what si that
????????
does that work?
that plugin.yml
why wouldnt it
Yes it works
It's not the plugin version...
although - you should specify the api-version
Ok
so that your plugin is not in backwards compatibility hell
I should note, that the actual version should be for a 1.8 server for my friend. So i haven't added the api-version
oh ok
and so, the list grows

xd
arrows lose custom model data when they are shot and picked up
is there a way around it
I mean it would be a pain
you would have to track it from ItemStack -> Entity -> ItemStack
Idrk if there are enough event listeners for that
lemme have a look
file = new File(Bukkit.getServer().getPluginManager().getPlugin("PureMail").getDataFolder(),"lang.yml");
if(!file.exists()) {
try{
file.createNewFile();
} catch(IOException e){
//owww
}
}```
This is throwing an error
```[13:43:49 ERROR]: Error occurred while enabling PureHomes v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.Plugin.getDataFolder()" because the return value of "org.bukkit.plugin.PluginManager.getPlugin(String)" is null```
Yeah
is this the main class?
on projectile hit, save the location of the arrow entity, give the player a custom arrow when picked up
also is it possible to make a shapeless recipe with a item with custom model data
Dont do it this way though
thanks for pointing that out it would have taken me an hour to figure that out
.addItem(Material)
you should use the plugin instance
Oh whats a better way to do it?
not itemstack
ohh
:<
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/ProjectileHitEvent.html
Store a reference to the EID or something from this^^
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerPickupArrowEvent.html
Then listen to this ^^
Make sense?
Just do getDataFolder()
I wouldn't use the location cause that is not a super persistent way of doing it
they may not be in a class that extends JavaPlugin so this is not great advice
Yeah I know, but it is easier for me to make them try that, than to explain them what a main class is
eh
Do you know what is main class?
I name my main class Main
Ew
Yeah, I started doing that recently as well
Main should be reserved for the application's bootstrap and main class
then the class extends JavaPlugin
How do I make the output/build jar to just be
PluginName.jar
instead of
PluginName-vPluginVersion.jar
maven?
and your plugin is not an application; it's a plug-in
gradle
oh idk
your plugin's main class is the class that represents your plugin
and as names should be descriptive, your main class name should probably take after your plugin
gradle have good docs
you should read them
build runs jar
oh ok
how 2 make a shapeless recipe with a item with custom model data
use ExactChoice
pretty sure shapeless recipes still let you use ExactChoice over MateriaChoice
thx
Hello !
Have you ever made a GUI manager system?
I am trying to make a proper one but I have no idea how to do it .. I would like, if possible, to have examples
what does
GUI manager system
mean
Look at one from Kody Simpsons
Mmh...
Something to manager your GUI from your plugins
Create, use etc ...
I've made my own based on Kody Simpsons's YT channel
Ty, i'm gonna look at this
is there a better way to get main other than DI?
depends on your definition of better
I mean if I can not use it at all...
Also another thing, is there a way to get another Plugin's file name?
What do you mean file name? Like the jar?
Yes
I doubt there is a method for it, you may be able to scan the plugins directory but not sure how easy it'd be to get a plugin name from that
I'm not sure if that, others may. For your DI thing, if you can't use DI that may mean you need to use a singleton, or you need to rework your objects to use DI in some way
Is it for any plugin or a specific one
how do i play a sound when the player crafts something
well the purpose of it is for a specific
But I would like it to work with any
I dont want to hard-code it
especially file names
Yeah I can't help you with that then, my only idea was to hard code it
imma hard code it for now... How do I get the plugins directory
Only other idea I could think of but no clue if it exists is looping through all plugins and try to get their main class, if you can pass it through the I think it's JavaPlugin#getPlugin https://hub.spigotmc.org/javadocs/spigot/org/bukkit/plugin/java/JavaPlugin.html#getPlugin(java.lang.Class) and get that with a Class.forName I believe and then get the file with the method
declaration: package: org.bukkit.plugin.java, class: JavaPlugin
But I can't do getFile
Why can't you?
Oh damn
Check that out
That's the only way I could think of doing it
Honestly don't know why that's protected
Maybe a PR making it public would be accepted but who knows
tbh the post you send is probably an exploit/security concern and most likely already got patched
I didn't look into it
I just think so
since protected means the only way to use it is to extend it
It's reflection so doubtful
Still using Kody Simpsons's ways?
I just looked at its code and there are a lot of mistakes in my opinion...
Already, there is no object-oriented code (too bad for Java), no division of tasks and, must of all, no protection:
Not everyone knows this, but there are some hacked clients who can dupe the names of inventories (or even add § signs) to get inventories of the same type as these, so these players can use them to bypass your plugin. To avoid this, I personally add the player to a list when I open the inventory to them and remove them from the list when the inventory closes. So I know who is authorized to use the GUI.
By the way, the things he shows in his videos, I already know them ...
I'm looking for something much more sofficial, which allows to manage GUIs in a very clean way with object oriented code.
declaration: package: org.bukkit.event.inventory, class: CraftItemEvent
Listen for the event, then player.playSound(player.getLocation(), Sound.wahtever, 500.0f, 1.0f);
@torn shuttle Hello !
Some months ago you gave me a configuration engine and I was looking for your others classes.
If your still a bit available for some questions about them, can you come on my PM please ? 🙂
gettomg this error ant one can help
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'last_seen'
trying to rename it
Alright, so I have the below code trying to make a menu. Near the bottom is code trying to lock the menu items from being removed. I'm not sure what to put after event.getInventory() != to reference the custom inventory, or if I'm doing it entirely wrong.
@EventHandler
public void onPlayerClicks(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
if (player.getItemInHand().getType() == Material.NETHER_STAR) {
Inventory inventory;
inventory = Bukkit.createInventory(new menuGUI("Menu"), 9, "Menu");
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
//Paper
meta.setDisplayName("§f§lWelcome Message!");
List<String> lore = new ArrayList<String>();
item.setItemMeta(meta);
inventory.setItem(0, item);
//Diamond
item.setType(Material.DIAMOND_BLOCK);
meta.setDisplayName("§1§lShop");
item.setItemMeta(meta);
inventory.setItem(1, item);
player.openInventory(inventory);
}
}
}
public void onClick(InventoryClickEvent event) {
if(event.getInventory() != ) return;
event.setCancelled(true);
}```
I am available for the next 3 minutes and then I'll be sleeping
Also that was what 3-4 weeks ago, surely not "months"
Thanks!
I do have one more question - How would I go about only opening the inventory if the object that was right-clicked with had a certain custom model data? I already have the below in place:
if (player.getItemInHand().getType() == Material.NETHER_STAR) {
How do you add a custom patch to Spigot?
or rather, where do I find instructions for it?
nevermind, just found this awesome forum post https://www.spigotmc.org/threads/tutorial-adding-custom-patches-to-spigot.158694/
Thanks again! Really sorry, but where would I implement that in what I have? I tried a couple of things but they didn't work.
get the item meta
also you should probably do a null/air check before getting type or the like, as the player could be holding nothing
Wait sorry, is there a way to check for specific custom model data rather than just having custom model data in general?
is the code the same for adding an item to a players inventory the same as for the latest version
It appears that when I try to use any of the three custom model data-related methods and put an integer into the parameter, it says that it can't be applied to type int
what "three methods" are you trying
do you want to set it, or check for a certain value?
I want to check if the item has a specific custom model data
and you are putting a specific number into the method
But not if it has custom model data in general, but if it has a specific number combination as the custom model data
Yes
?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.
?
learn java
Uhh... alright
everything you need has already been told to you
Is there any one of those links that you would specifically recommend?
codeacademy is supposedly passable, but I don't have first hand experience on any of them
Full Java Course: https://course.alexlorenlee.com/courses/learn-java-fast
I recommend installing Tabnine autocomplete on your IDE (free):
https://www.tabnine.com/get?lang=java&utm_source=youtube.com&utm_medium=Ins&utm_campaign=AlexLee
If you're new to programming, I recommend you use Edabit: https://edabit.com/?ref=alexlee
Disclosure: Tabnin...
Thanks
Also heres a playlist for plugin development
https://youtube.com/playlist?list=PL65-DKRLvp3Yn7iglPfxKoc7bl0N80XgG
@vague cypress
This is more of a SQL thing, but how should I implement a table prefix?
PreparedStatement preparedStatement3 = this.connection.prepareStatement("CREATE TABLE IF NOT EXISTS ? (seed VARCHAR(255) UNIQUE, border INT NOT NULL default 60000000, PRIMARY KEY seed);");
preparedStatement3.setString(1, this.getConfig().getString("db.prefix") + "worlds");
preparedStatement3.execute();```
setString isn't the right method
format the string separately with a placeholder
good morning
good morning
how i can stop the giant head moving (it only happend when its spawn)
teleport(pitch) didnt work tho
head?
How would I get rid of all a player's advancement progresses?
yep
I ended up doing that, I sure hope nobody sets db.prefix to ; DROP TABLE worlds; --
Hi. I am trying to make a teams system and it doesnt seem to work
Maybe because I have another scoreboard running at the same time?
ohh that head movement
well why bother its not too bad
also i dunno how 2 fix it
they spin
maybe tell us what is not working?
Sorry. The teams arent showing when I hit tab or when i check for teams with /teammsg
No code errors
Just wondering if everything in the code looks ok
And where you guys would recommend I call the function
(I currently have it in onJoin)
How would I do this? Would I need to iterate through all advancements and remove advancementprogress this way?
I have a custom YML file, I want to take all the Keys in a YML file into a List in Java. Any idea how I can do this efficiently?
