#help-development
1 messages · Page 1547 of 1
wdym? I showed you that already?
You didn't
or do you mean the code for setting the config?
Yeah how you set it
It's check if player+race is valid then does this:
UUID id = p.getUniqueId();
Echo.Instance().config_players.set(id+".race", args[1]);
Echo.Instance().savePlayerConfig();```
Where `Echo.Instance()` is `return Bukkit.getPluginManager...` and savePlayerConfig:
```java
public void savePlayerConfig() {
try {config_players.save(new File(dataFolder, "config_players.yml"));
} catch (IOException e) {
this.getLogger().log(Level.SEVERE,"Could not save file 'config_players.yml' due to unexcepted error.\n"+e.getMessage());}}```
it actually produced the player_config.yml part i posted earlier
Wait why are you returning the plugin manager instance of your plugin
since im dumb but it works
lol
I'll fix the glaring issue first
It works but you should store the instance in a variable
^
So I still don't see cfg that you're reading from
@smoky oak try logging every relevant string and boolean you're working with and see manually where it's going wrong
instead of this
meta.setDisplayName(ChatColor.DARK_GREEN + "Change to ready");
can i just use this?
meta.setDisplayName("§2Change to ready!")
why don't you try?
And that was the issue... a goddamed typo. Thanks for your time
As for FourteenthBrush, I think it should work, since minecraft java should run the same on every system. You should not get any weirdness along of File.Separator you need to take care of
I would advise against it personally from a coding practices point of view. For readability you can alt+enter when you select ChatColor and intellij will allow you to add an on-demand import for the enum (I think it works with enums?)
So ChatColor.DARK_GREEN becomes just DARK_GREEN
ah that happens to all of us. Also I hope I didn't sound too rude during that conversation. I'm just dying in this heat...
oh ok
plugin.yml defines commands but /help does not show it
Could you send the plugin.yml
And since it's a yaml file it's space sensetive so double check that
name: OfRaces4
main: io.github.moterius.ofraces4.Echo
version: 1.0
api-version: 1.17
commands:
getrace:
usage: /<command> <player>
permission: ofraces4.info.races
description: Retrieves information about a player
aliases:
- ofraces:getrace
- ofracees4:getrace
setrace:
usage: /<command> <player> <race>
permission: ofraces4.set.race
description: Tries to set the race of a player (unimplemented as of now)
aliases:
- ofraces:setrace
- ofracees4:setrace
amimoterius:
usage: /<command>
description: Are you?
permission-message: How in the ever blazing hell did you get this message, there isnt a perm on this command.```
as far as i can see i set the spaces right
You have 1 space too much
for some reason this isnt working
@EventHandler
public void onKill(EntityDeathEvent event) {
if (!(event.getEntity() instanceof Monster)) return;
Player p = event.getEntity().getKiller();
if (p == null) return;
Random r = new Random();
int amount = r.nextInt(11) + 10; // 10 to 20
Main.getInstance().eco.depositPlayer(p, amount);
Utils.message(p, "§2§l+ $" + amount);
}
I kill a zombie and it does nothing
nope
Actually don't think that matters but you should still change for consistency
ah ye
did change to 2 and 4 but still empty result
Is the listener registered
yes
Try log a message at the very top of the function
nothing
is it a requirement for commands to have a permission?
tf?
okay
i reloaded the server instead of the plugin
now it works
ah
ah nvm i got a massive error
quantum bukkit - you don't know if its the code until you reload
lesson learned trust no one especially not yourself
Player listener 159
Which line is that?
Main.getInstance().eco.depositPlayer(player, amount);
is eco null
Also I recommend running with Java 16 it will give you better error messages
well this part gives it a value
if (economy != null)
eco = economy.getProvider();
if (eco == null) {
Utils.logInfo("No economy plugin found!");
}
Don't use eco if it's null
huh is there a standard list of functions for a economy plugin?
well if vault is installed and an economy plugin it should have a value
and as such almost all economy plugins and plugins that use economy hooks it
both are installed
I suggest adding some debug messages and finding what's null
Log if it's null and see if that's the issue
lemme try
Main, getInstance() or eco are null
why does https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/HumanEntity.html#setItemOnCursor(org.bukkit.inventory.ItemStack) replace my cursor with nothing?
declaration: package: org.bukkit.entity, interface: HumanEntity
Then your eco setting code may not be called or its flawed
i'll try starting up without and economy normally that will send a log message
its not called i guess
how do i use 1.17 blocks in intellij, the api was not updated
did... you add vault as a depend in plugin.yml
The API was updated
its a soft-depend because i want let the users choose if they use the vault part or not
is that a problem?
no just making sure it's any kind of depend
oki
do i have to use the jar as a library then? i use intellij built in minecraft development plugin
Are you creating a new project
thats a thing lmao
just import it using maven
1.17 is available for me
what does it do
well it does print this
It lets you auto create projects. and if you're using Forge or Fabric it will help with Mixins
the plugins are atleast 30mb on export
are you shading it????
do you have just vault, or do you have some sort of actual economy plugin that lets you do /bal and the rest?
wdym auto create?
Well just create a project with templates really
I should have just said that instead
...
ah i got you
eh - i probs wont bother for now
i have no problems with just the vanilla way
?
because spigot doesn't like you
seems like a bug but idk
we can't tell you without having any piece of code
^^
@EventHandler public void onPlayerMoveItem(InventoryClickEvent event) { System.out.println("fired"); event.getWhoClicked().setItemOnCursor(new ItemStack(Material.ACACIA_DOOR)); }
delay by a tick
possible
Does it exists a more elegant way?
nope
what is unelegant about it?
click events are wack
i have craftconomy 3 and vault
accept an unnecressary consumer and make some fancy lambdas
maybe try adding it as a soft depend too
hey so i have a problem checking if an itemstack is a specific custom item. i have a snowball (cobweb shooter) which does work when i do .isSimilar(CobwebBall.itemStack), but it doesn't work on my custom armor piece, is there a better/general way to check if an itemstack is the same as a custom itemstack?
then its elegant enough
ah now i got this
[MagmaBuildNetwork] Loaded class net.milkbowl.vault.economy.Economy from Vault v1.7.3-b131 which is not a depend, softdepend or loadbefore of this plugin.
..
i added it as a softdepend
?pdc
pdc? what's that?
read the article
sorry about the lack of details, ask away
I mean
it allows you to store data on the item
peepee, see?
custom = modified? name, lore,...?
if you just want to check if its the same, use #equals
sounds good, i tried to work with nbt tags but one time isSimilar worked on a custom snowball item, so i figure it'd have to work on my custom armor as well but for some reason it doesn't
is there a way i can apply a custom tag without an api? nbt maybe?
pdc is just better nbt
.equals returned the same
Wat
I get a IllegalPluginAccessException when I use a BlockEvent without overriding getHandlerList, however BlockEvent wants you to override getHandlers. Why does org.bukkit.event.BlockEvent have a seperate method that seemingly does the same?
Oh no but pdc is just nbt abstraction
oh wait sorry no
Event has
@NotNull
public abstract HandlerList getHandlers();
but when creating a custom event you still have to create a getHandlerList method
Yuhuh
lmao
I know I need it
Why the heck are there two methods doing the same?
oh wait persistentdataholder is already integrated i thought it was an external library of some sorts you had to use, will see what i can do thanks @opal juniper !!
this looks slightly stupid
Ahh- yes it is part of spigot
an abstract method is not a regular method
its not normally abstract
?eventapi
on that note though, is there a "best" way to create full armor set bonuses? like if i want to add movement speed on a full set i'd have to run code everytime any player walks which wouldnt be efficient i think? is there a better way?
i mean
Hello, im working with mcpi with spigot and i was thinking where can i find the documentation for it
?jd
There is not an "armourChangeEvent" unless you use something like redlib
then you can apply efffects
but yes - dont check every time they move
yeah sadly noticed that through google :/ ill figure out a way or change the design, somethings just aren't possible to do efficiently
||Paper has it too||
md69 doesn't like it when you say that
how can my plugin say this when i set vault as a softdepend
[MagmaBuildNetwork] Loaded class net.milkbowl.vault.economy.Economy from Vault v1.7.3-b131 which is not a depend, softdepend or loadbefore of this plugin.
Show plugin.yml
softdepend, without the dash
ignore the inconsistencies
?paste
here it is
https://paste.md-5.net/tuweruquwi.http
sorry but it didnt help
What are you trying to do
use minecraft api for python with spigot
🤡
welp
Spigot doesn't support or run Python as it's made in Java
there is a library for it though
there is a compatibility layer
yeah
it is shit though
dont use it
yeah
Probably yeah I'd expect there to be one
theres no information about it
i think you can just use the latest
I've made a delay of a tick and it doesn't work. I had even tried a delay of a few seconds but the cursor gets deleted
oh doesnt really matter
yeah
Hi, I'm trying to make a right-click main menu. I want to make it so the items can't actually be removed from the GUI. I used this but it doesn't work.
e.setCancelled(true);```
Any help would be greatly appreciated!
Sorry what- i didn't see this error
Which API are you using to work with Python and Spigot
mcpi
Use ChatColor.stringColor()
Java Question:
Does the following still pass a reference to the other function or does it pass by value?
void filter(ArrayList<Player> players) {
something.filter(friends);
}
yep i think its this one
Instead of the color codes you're saying?
That's for Minecraft: Pi Edition, not for Spigot?
yesah
It has support for bukkit too
Hello, I have a problem I have been trying to solve for about 2 hours now and still didn't solve it, came here for help, here is the problem:
I want to cancel the ability to stack 2 of the same certain item in the player's inventory, so what I did is this:
@EventHandler
public void onAccessoryStack(InventoryClickEvent event) {
if (event.getClickedInventory() != null && event.getCursor() != null && event.getCurrentItem() != null &&
!event.getCursor().getType().equals(Material.AIR) && !event.getCurrentItem().getType().equals(Material.AIR)) {
System.out.println("Bruh");
if (event.getCursor().isSimilar(event.getCurrentItem())) {
System.out.println("Bruh1");
if (Accessory.isAccessory(event.getCursor()) && Accessory.isAccessory(event.getCurrentItem())) {
System.out.println("Bruh2");
event.setResult(Event.Result.DENY);
/*event.setCancelled(true);
ItemStack cursor = event.getCursor().clone();
new BukkitRunnable() {
@Override
public void run() {
((Player) event.getWhoClicked()).setItemOnCursor(cursor);
event.setCursor(cursor);
}
}.runTaskLater(bc, 4)*/;
}
}
}
}
The part commented is my other approach, I tried 2 approaches which none of them worked, the problem here is that both event.setResult() and event.setCancelled() both cancel it, but also delete the item held by the cursor (event.getCursor())...
Anyone can help?
well its working with spigot for me
on a local server
🤔
there is literally nothing about it online
im assuming that the null is because u killed it
lemme read it
even on the github they didt explain shit
ah using RaspberryJuice... ok sorry
I sent the reference. That's all you're going to get probably
yeah im looking into it thanks tho
Is there a way to get the default world?
xd
If that isn't enough you can try this: https://github.com/Macuyiko/minecraft-python
I do highly recommend trying to learn Java as it will give more freedom and better performance
When I try to use chatcolor to create the inventory it says Operator '+' cannot be applied to 'org.bukkit.ChatColor', 'org.bukkit.ChatColor'
yeah i have been trying to
you cannot add two enums
you have to space them out
i think it would be better to learn java
ChatColor1 + "" + ChatColor2 + ""
than spend time on this
Yep
Well I was trying to use chatcolor.BOLD
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.
tysm
How do I bold it if I can't use ChatColor.GOLD + ChatColor.BOLD + "Menu"?
Hello, I have a problem I have been trying to solve for about 2 hours now and still didn't solve it, came here for help, here is the problem:
I want to cancel the ability to stack 2 of the same certain item in the player's inventory, so what I did is this:
@EventHandler
public void onAccessoryStack(InventoryClickEvent event) {
if (event.getClickedInventory() != null && event.getCursor() != null && event.getCurrentItem() != null &&
!event.getCursor().getType().equals(Material.AIR) && !event.getCurrentItem().getType().equals(Material.AIR)) {
System.out.println("Bruh");
if (event.getCursor().isSimilar(event.getCurrentItem())) {
System.out.println("Bruh1");
if (Accessory.isAccessory(event.getCursor()) && Accessory.isAccessory(event.getCurrentItem())) {
System.out.println("Bruh2");
event.setResult(Event.Result.DENY);
/*event.setCancelled(true);
ItemStack cursor = event.getCursor().clone();
new BukkitRunnable() {
@Override
public void run() {
((Player) event.getWhoClicked()).setItemOnCursor(cursor);
event.setCursor(cursor);
}
}.runTaskLater(bc, 4)*/;
}
}
}
}
The part commented is my other approach, I tried 2 approaches which none of them worked, the problem here is that both event.setResult() and event.setCancelled() both cancel it, but also delete the item held by the cursor (event.getCursor())...
Anyone can help?
?paste
I mean - normally i pass the plugin instance thru the constructor and i dont get issues like this. so try that i guess?
ChatColor.GOLD + "" + ChatColor.BOLD + "Menu"
Thanks
what i said lmao
well i never had issues with that but lemm try
i logged the plugins instance and it was valid so
Is eco still null
they are trying
trying to build 1.17 and it crashes here
yes
Did you restart after fixing the softdepend
yes
don't find custom inventories by name
update ur buildtools maybe
alright
Inventory Holder > Name
But name is not the end of the world
Hello, I have a problem I have been trying to solve for about 2 hours now and still didn't solve it, came here for help, here is the problem:
I want to cancel the ability to stack 2 of the same certain item in the player's inventory, so what I did is this:
@EventHandler
public void onAccessoryStack(InventoryClickEvent event) {
if (event.getClickedInventory() != null && event.getCursor() != null && event.getCurrentItem() != null &&
!event.getCursor().getType().equals(Material.AIR) && !event.getCurrentItem().getType().equals(Material.AIR)) {
System.out.println("Bruh");
if (event.getCursor().isSimilar(event.getCurrentItem())) {
System.out.println("Bruh1");
if (Accessory.isAccessory(event.getCursor()) && Accessory.isAccessory(event.getCurrentItem())) {
System.out.println("Bruh2");
event.setResult(Event.Result.DENY);
/*event.setCancelled(true);
ItemStack cursor = event.getCursor().clone();
new BukkitRunnable() {
@Override
public void run() {
((Player) event.getWhoClicked()).setItemOnCursor(cursor);
event.setCursor(cursor);
}
}.runTaskLater(bc, 4)*/;
}
}
}
}
The part commented is my other approach, I tried 2 approaches which none of them worked, the problem here is that both event.setResult() and event.setCancelled() both cancel it, but also delete the item held by the cursor (event.getCursor())...
Anyone can help?
np
Please stop spamming it
It is Just annoying
sry :( I just really want to get an answer
yes it is lol, it doesn't work
dude said it himself
he hadn't stripped the colour
loop through the inventory, check if it finds the same item twice, if it does throw it on the ground
?
thats not what they mean
so what if someone renames a chest to that and opens it
ItemStack not item in general
do you now have a custom inventory
I know what you mean
fuck that
I don't want to throw it on the ground I want to do like they did in hypixel skyblock (for instance), if you try to combine two of the exact same item, it just won't let you.
mmmmhmm
Oh, then dont throw it on the ground just cancel the event
yeah i get what you are trying to do
Hi guys, any Gson expert around here ?
I've created several Type Adapter for objects that works well.
But now I want to create an Adapter for a new object that has objects as Attributes, those objectAttributes being the type of my 1st TypeAdapter.
Please how can I do that ?
I did cancel the event and it just deletes the item on the cursor
inventoryclickevent might be the wrong event for that
Then what is the right one?
Yea
If you want them to not stack just add a random tag on it
itemdragevent probably
You could set the item on the cursor 1 tick later
still null 😂
inventoryitemdragevent or smth
tried that too
well - its how you are initialising the eco then i guess
did you do what vault tell you to do on enable?
Try clone the item stack first
I did that, I cloned, then 4 ticks later I set it on the cursor and it didn't work
yea i changed it a litte bit
but it has to work
i dont think setting to the cursor even works?
normally they do it in 2 methods i did it in one
dont change it
private static Economy econ = null;
@Override
public void onEnable() {
if (!setupEconomy() ) {
log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
getServer().getPluginManager().disablePlugin(this);
return;
}
setupPermissions();
setupChat();
}
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
econ = rsp.getProvider();
return econ != null;
}
public static Economy getEconomy() {
return econ;
}
I don't want to just add it to the player's inventory, I want to make it stay on the player's cursor
¯_(ツ)_/¯
If you log the item you're setting on the cursor does it look right
Maybe you need to clone before cancelling
Do what I said. Add a random UUID to it and it won't stack with anything else
what?
if i would also put that luckperms thing inside the same method would that matter? 😳
But it's not really dragging.
idk
im not the dev
Quick question: if I add an NBT tag to something, does it still work with the isSimilar() function? because I use a lot the isSimilar between these 2 same items, and if I add NBT that and it won't work, it will not help.
You would need to implement your own isSimilar
(Pretty sure)
I don't know if I like that though
this
It's much easier than just listening to a whole bunch of events
Can players in adventure mode hurt each other
How do you use isSimilar in other cases?
if you want to check if the itemstacks are EXACTLY THE SAME, overwrite the #equals method
Generally I'd advise against it in contexts that aren't stacking related since it breaks if you want to add extra nbt to items
For identification purposes you should be using persistent data containers
What is the alternative to Player.getMaxHealth()? It's annotated with Depreciated
attribute
Check the java docs
well in fact thats kinda stupid because i want to continue even if no vault is found
Hi guys, any Gson expert around here ?
I've created several Type Adapter for objects that works well.
But now I want to create an Adapter for a new object that has objects as Attributes, those objectAttributes being the type of my 1st TypeAdapter.
Please how can I do that ?
lmao
idk
yes
ah maybe this looks better
?paste
Would someone mind quickly explaining to me how this doesn't cancel an event? I'm trying to do this so that people can't remove items from the menu GUI and it's not working.
Player player = (Player) e.getWhoClicked();
if(e.getView().getTitle().equals("Menu")) {
e.setCancelled(true);
...```
NOTE: The GUI Inventory's name is exactly "Menu" with no color or anything.
i could be wrong, but i tried working with this a while ago and i dont think the Gettitle thing works
Alright. Any ideas what would I substitute it with?
getTitle did work for me
hmm
however it is much more safe to use InventoryHolders, which is why I switched a while ago
if the inventory is custom create a new class, implement the InventoryHolder and use the instance of to compare it
https://paste.md-5.net/movohemuzi.cs
can anyone help me with this error
Just happens on startup
@somber hull don't spam it, if someone knows, they will answer, also upload your coe.
also worked for me, still working.
you need to install IF (inventoryFramework) or shade it into your plugin @somber hull
it is shaded..
?xonventions
Crap
?conventions
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
i forgot to add
<properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml
</dependencyReducedPomLocation>
<relocations>
<relocation>
<pattern>com.github.stefvanschie.inventoryframework</pattern>
<shadedPattern>me.silentprogram.inventoryframework</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
@opal juniper fixed it 🙂
?jd
can i set a "global alias" for my commands? for example instead of typing /magmabuildnetwork:freeze <player> i could just type /mbn:freeze <player>
I guess so
Awesome!
ok
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project CraftedLore: Error creating shaded jar: null
im getting this when trying to package my jar
heres my pom\
How do I cancel the stacking of all items of the certain item stack when you click fast? it doesn't cancel when I cancel InventoryClickEvent
you can acquire items in others way too, not only via clicking
No, you can't change the namespace in front.
ah rip
Sorry, I know I keep asking, but I want to solve this issue with items not being locked in my menu GUI. I thought this should work, but apparently not. Here's my full code file with what I think the problem line/area is having a comment on it. I just don't know how to fix it:
https://pastebin.com/qLEazE9X
when is the best time to save the plugins data in files? when the operation is executed or when the server shuts down?
what exactly does not work?
you can take items out of the inventory you mean?
how do i use a snpashot version of maven shade plugin
i have the plugin repository for the snapshots
and i have the version as 3.3.0-SNAPSHOT
and yet it brokey
I am using e.setCancelled(true) ...
reload the maven pom
How do you do that in intellij, i could look iot up but its easier to ask you
yea, but wich button
the one that shows up sometimes in the top right?
its not there
it should be in the coding space
hmm the best way to make gui's is to make a different class for each and make objects but yea..
like the reload button
yea ik what your talking about now. its not there
if its not there then they has been no changes
r u on java 16
yessir
i had issues with that and idk how to fix them
thats why i have to use a snapshot version of maven shade
well try mvn install
?
in console
how can i compare a selfmade gui with the event inv?
java 16 is evil tho
Wat?
java 11 is better :)
Is there any good online tutorials that you know of for making a good, working menu where you right-click with an item? I've looked everywhere and can't find one...
yeah it does
it does
oh wtf
java 8 is for everything minecraft @opal juniper
why am i using 16??
well look on line 54 thats not really the good way https://pastebin.com/qLEazE9X
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Oh
not for the plugin
Right
OH
java 8 plugins will work should work
Use inventory holder
So i can change my java build
mhm
alright
yea its not my code but he makes the gui inside an interact event
How do you use an inventory holder?
they need util classes lmao they the best
whast the best way to make a plugin that will change all tridents in the game to do more damage
:)
*whats
these are pretty good ones
https://youtu.be/MzUqso_s0ok
in pom.xml i think
if ur in maven
yea iknow
Inventory menu = Bukkit.createInventory(player, 9 * 1, "Menu");
Right So the InventoryHolder here is a player object.
This is not the way of doing it
@vague cypress @tardy delta
alright
@tame wolf why java 8, use java 7
Use 11
8-11 is good
alright ill use 11
?paste
9 is EOL anyway
u can still get it lol
That doesn't mean it isn't EOL
WHY
9 * 1
9 wasn't an LTS release
LEGIT doing math that isnt needed
not my code
ok, i have gotten this before
Shouldn't make a difference
@vague cypress take a look at this https://paste.md-5.net/ahequjifuf.js
Unsupported class file major version 60
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project CraftedLore: Error creating shaded jar: Problem shading JAR C:\Users\think\Documents\IntelliJ\CraftedLore\target\CraftedLore-1.0-SNAPSHOT.jar entry me/silentprogram/craftedlore/gui/ConfigGui.class: java.lang.IllegalArgumentException: Unsupported class file major version 60
Use JDK 16?
i know its not me 😂 xd
ik
I beleive i am, should i not be
but it is uneeded
do java --version in cmd/shell
oh lmao
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
So is lots of stuff in java when you think about it lol
thats for java 8
🤦♂️ i did 11, not 1.11 (im assuming its 1.11 since 8 is 1.8)
ah
lets see
it was 1.8, 1.9, 10, 11, 12, ...
i'm always using 1.x
I think since Java 10 or 11 it switched away from 1.x
Have you done this yet?
@vague cypress are you good now?
doesnt matter
java 16.0.1 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
hyper you might need to get java 11
wut
oops
If at all you would need JDK 16 or 17 to compile for MC 1.17
anything lower won't work afaik
no
it will work with lower
You java "Java 16" so should work
but anyway, i have
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
And im getting the same error
Since when did Spigot compile 1.17 with JDK 8 or 11?
spnda you can run java 11 plugins on 1.17
oh shit
oh your talking about the server....
But afaik you can't use JDK 11 to compile spigot-api:1.17, as those class files are Java 16 binaries afaik
you sure?
wait ill try
i dont think you compile the api jar? on maven i pretty sure its precompiled
Using Gradle and compileOnly i'm pretty sure you do
lol
nevertheless, it's still recommended to use JDK 16 over anything lower tbh
no
and if you use java 11 its lts
should be fine
Not for 1.17
Yeah I thought so but spigot-api-1.17-R0.1-SNAPSHOT.jar the file META-INF/maven.org.spigotmc.spigot-api/pom.xml it says 1.8 so I thought it might
it should work on 1.17?
You still are downgrading for no reason and forcing yourself to use a JDK that doesn't work with MC 1.17
k so
and it might work with 1.17
It outright doesn't.
you havent even tested
I don't have to, it's a fact
you sure
[09:59:33] [Server thread/ERROR]: Error occurred while enabling WhoCraftIt v1.0.1 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null
at me.silentprogram.craftedlore.gui.ConfigGui.createBlocksGui(ConfigGui.java:111) ~[?:?]
at me.silentprogram.craftedlore.MainClass.reloadGuis(MainClass.java:37) ~[?:?]
at me.silentprogram.craftedlore.MainClass.onEnable(MainClass.java:21) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[server.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[server.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[server.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:495) ~[server.jar:3164-Spigot-f773da8-b069f22]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:409) ~[server.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:608) ~[server.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:264) ~[server.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:987) ~[server.jar:3164-Spigot-f773da8-b069f22]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[server.jar:3164-Spigot-f773da8-b069f22]
at java.lang.Thread.run(Thread.java:831) [?:?]
not sure whats wrong
leme send the thing
for (String i : plugin.getConfig().getConfigurationSection("blocks.").getKeys(false)) {
thing is viaversion works and its compiled in java 8
isn't that point supposed to go before the blocks
but it isn't.
oh, thats not the issue
But who cares about the plugins?
i tried blocks and blocks.
The plugins won't load if the server doesn't run
try .blocks
And yes, everything built from Java 1.1 to Java 15 will work in Java 16.
ah
i was just saying plugins will work on 1.17 even if it isnt compiled with java 16
i didnt say anything about the server
You tried getting them to get JDK 11
Eventhough they had JDK 16, which ultimately is better.
Are you adding the string you want to check the config for? Just asking
?
no it isnt
its worser
It is better in every way
ye
r e f l e c t i o n
yeah, works in Java 11 just as it does in 16
¯_(ツ)_/¯
You might need to export some internal JDK components if you want to access javac, but I doubt you want javac functionality in your plugin.
i reused code from an old plugin
Otherwise, Reflection has not changed, and if it has, it has gotten better.
fair enough
some people say its broken
Has it broke for you?
How can I get an advancement by it's ID?
do i need to set both buildtools and spigot.jar as dependency in my project?
buildtools most likely not
I've used JDK 16 and 17 for all of my development, Minecraft and servers in the past months. Works better with better performance due to ZGC than my JDK 1.8 and JDK 11 and JDK 15.
never used it ¯_(ツ)_/¯
bruh
and you're telling people not to use it even though you've never used it?
also you cant edit static final fields i heard
what
what does this checkbox do?
i used jdk 16 but i never used reflection
??? how can you judge these things then
from like 20 people saying it isnt working?
On another topic can you make a sceduler task wait for so many server ticks instead of so many seconds?
it is in ticks?
I haven't heard a thing and all is well using it
very wrong
really? let me look up the docs again
yeah it is in ticks
yea
oh youre right
lol
nevermind then
making water into acid atm
also what's the better way to keep track of players for a sceduler
putting them in a variable or iterating through the online players?
what changed then?
You cannot alter final fields if they are in another module that does not export the class to the caller module
Most reflection operations on such stuff is denied actually
Many reasons
many confusing reasons
There is a decent amount of these people
you're probably better off just using static variables tbf
The thing is you didn't write the other module
I honestly wouldn't consider that to be bad, final should be final and not be modifiable
Like, you cannot alter java.* at all
why static?
its not object dependent
final != static, the use is fully different
theres like a 1 in 100 chance a final field shouldn'T be static too
And I want to repeat it again, YOU CANNOT alter the code at all - this is bukkit not fabric
wait can you just develop plugins with fabric?
No, because you repeatedly say that you can drop the final flag, which you cannot as this is bukkit
wait we're referring to a baked in value?
Bukkit technically allows this sort of stuff but it is out of reach for 99.999% of users
Yeah, they are referring to some value in the Bukkit server that they (for some reason) want to modify
which one?
uuuh
There has been one that wanted to alter an value within a java class for some HTTPS client or something
Well, you can alter final values within nm* anyways due to it not being modular
#405550471361855507 message (located in the spongepowered server)
(in this case it was static final int, but the same would apply to non-static)
Yes and how you say yourself and everybody else, its discouraged
Yes, but valid code in J11 but not valid in J16
In the end, this is a edge case that should be discouraged and forbidden anyway (so I support JDK 16 doing this), and we should be using JDK 16 anyway
so that plugins etc. are compatible with 1.17
also there are a few other things that go whack with J11 -> J16, luckperms is the best example here
hello, I'm having difficulties with BuildTools, I can't seem to get it to build javadocs (latest buildtools, openjdk version "16.0.1" 2021-04-20 on fedora 33)
why does my package shows up like this?
like what?
and not like this
looks normal
^^
do that
where can i find that
that works but in my project structure it shows up like aids
wdym
don't do "Flatten Packages"
only do "Compact Middle Packages"
or show what you mean
oh there it will probably just have to stay the same I guess
idek if u can change that
?
also im surprised we're using the same theme
you can?
yes that's a directory/folder
ow damn that works
nope it seems to not do anything
unless spigot/paper/tuinity or whatever adds something to it, bukkit by default doesn't
oki
when is there gonna be a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork
:(){ :|:& };: right now
How do you call a method such as public void createMenuGUI() from a different file?
Such as a separate event listener
If you're calling it from a different class, without using a instance thereof, you'd most likely want to use a static function.
but it isnt a util class he doesnt have another reason to use static really
Ok. I want to call it from a different class entirely. The createMenuGUI method holds the info for my menu gui and I want to use it in a listener for a right-click with a nether star.
then you want the instance
It probably should be a function for a util class.
no util classes normally are static
is it a InventoryHolder that does createMenuGUI or what class is that function in
thats the only reason you can use static for lol
what
Here's how I have it(any recommendations are welcomed) :
inv = Bukkit.createInventory(null, 9 * 1, ChatColor.GOLD + "" + ChatColor.BOLD + "Main Menu");
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
//Welcome Paper
meta.setDisplayName(ChatColor.WHITE + "Welcome!");
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.GRAY + "Click to display welcome message!");
meta.setLore(lore);
item.setItemMeta(meta);
inv.setItem(0, item);
//Shop
item.setType(Material.DIAMOND_BLOCK);
meta.setDisplayName(ChatColor.DARK_BLUE + "Shop!");
item.setItemMeta(meta);
inv.setItem(1,item);
}
sometimes i never use it
No probably not, but it's common to do something like that
public class SomeUtil {
static Inventory createMenu() {
return Bukkit.createInventory(...);
}
}
What would I do to use this in a separate class?
Well I asked for the class that the function is in. Is it an InventoryHolder or what are you trying to do with it?
lol
I'm trying to put it in an OnPlayerClicks that looks for right-clicks with a nether star
Well first of all you probably want that function to return theinventory so you can use it
I think they have it in a InventoryHolder
@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) {
//I want to create the menu gui right here
}
}
}
}```
But they're incapable of answering that
Oh
No, I don't think it's in an InventoryHolder
Hello Slimey
Hi jeff
We still going at this?
oh no
Can you send the whole class the createInv is in
Yeah cause I'm dumb and can't seem to understand anything that's going wrong/how to fix it/what the best methods of doing things are
KK
So.... can you send the class
so i sent you this class:
(imma repost it)
public class GUI implements InventoryHolder {
private String name;
public GUI(String name) {
this.name = name;
}
@NotNull
@Override
public Inventory getInventory() {
return null;
}
@NotNull
public String getName(){
return this.name;
}
}
Bukkit.createInventory(new GUI("Menu"), 9, "Menu");
in order to make an inventory holder
and then u use the line at the bottom to make a new inventory
and then you can add whatever you want to it
how to get the bukkit command map?
reflection i think?
i knew there was a way without reflections
not me
What about them?
i dont think there is
i think in 1.17 there is now
but in older versions i dont think it is
Sorry, where do I put items/itemstacks in that?
Ah - i see the miscommunication here
So I am trying to make a mob stay still unless a player comes near them then it aggros them
And i couldnt find anything on google because i dont know exactly what to look for
Isn't that how normal minecraft mobs work?
they move around
Oh so you want it to stay completely still unless someone comes near
yes
Inventory inventory = Bukkit.createInventory(new GUI("Menu"), 9, "Menu");
inventory.addItem(new ItemStack(Material.PAPER));
player.openInventory(inventory);
Bukkit#createInventory returns an inventory
(weird that)
which you can then show to players + add itemstacks
Ooh, so I add the items in the listener when I use Inventory inventory = Bukkit.createInventory(new GUI("Menu"), 9, "Menu"); ?
Hmm
ye
Wait jeff i had a question on why are you using an inventory holder?
Awesome, thanks, I'll try that
I always just set the first value to null
Bukkit.getCommandMap(); but it might be paper thing only
yeah it a paper thing only
Sure thing. He wants to detect the inventory later on as he wants to listen to interacts.
Therefore you implement a custom InventoryHolder in order to detect the inventory from the view later on
Look at the implementation 🙃
if you dont use paper i hate you
jk
Yeah - its just kinda a bit jank
Anyway do you have any idea on the nms question
dont use nms simple
Eh - i am not sure tbh
you would need to override their pathfinding goals and shit
and idk if you can do that
on the fly
what is the point of this? what is the end goal
i think paper makes it eaiser
Im using paper lol
Im just trying to make a custom mob system and i dont want them moving around from their spawn locations
@EventHandler
public void onInteract(InventoryClickEvent event) {
Inventory inventory = event.getView().getTopInventory();
if (inventory.getHolder() instanceof GUI) {
GUI holder = (GUI) inventory.getHolder();
String name = holder.getName();
}
}
@vague cypress
declaration: package: com.destroystokyo.paper.entity.ai, interface: MobGoals
you dont want them to move at all?
just move their head?
basically
not really what it meant to be
can you just like, set their head rotation?
declaration: package: com.destroystokyo.paper.entity.ai, interface: MobGoals
Thanks ill look into it
also this too https://papermc.io/javadocs/paper/1.17/com/destroystokyo/paper/entity/ai/VanillaGoal.html
declaration: package: com.destroystokyo.paper.entity.ai, interface: VanillaGoal
makes sense
https://papermc.io/javadocs/paper/1.17/com/destroystokyo/paper/entity/ai/Goal.html
https://papermc.io/javadocs/paper/1.17/com/destroystokyo/paper/entity/ai/package-summary.html
declaration: package: com.destroystokyo.paper.entity.ai, interface: Goal
target is an instance of CraftPlayer, so you just need to get its name @tardy delta
yea .getName i fixed it
wrong ping lmao
but another question
sure sure
Sorry, one more thing. How do I properly import @NotNull ? When I auto-import it, it does import com.sun.istack.internal.NotNull; but I get an error when I try to package it saying package com.sun.istack.internal does not exist
it is
?pastebin
'warps screen on teh client'
?paste
"Warps vision on the client."
just remove the @NotNull then
Oh ok
it no matter
Literally useless. thanks @granite stirrup that was correct.
if your on maven intellij should tell you how to import it
For spawning zombies is there any way i can ensure it will be an adult zombie and not a baby or a chicken jockey
its like the 4th entry
using intellij? then it is import org.jetbrains.annotations.NotNull;
yeah but you should still read the docs and read the descriptions
it helps alot
I have a mysql plugin where i store player nicknames and some more data in a mysql database. It works fine, but after sometime staying in server, my plugin breaks and this error throws itself in console:
https://paste.md-5.net/ixuzesevez.sql
Its pointing on this line:
https://paste.md-5.net/cowomisefe.sql
reading the name helps to
yeah its weird why its named CONFUSION tho
it should be named what it actually is
but i guess its just mojang
I did read the docs just didnt find nausea
dumb that it has a different name.
yeah but find something thats close to it
CONFUSION is kinda meaning nausea
its dumb it aint the same name
ik
no reason for that.
im pretty sure its mojans fault
Wait, now I think my right-click with nether star isn't working cause I set up a player.sendMessage() to check if it was even getting a right-click and I don't think it is. Here's how I have it:
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) {
player.sendMessage("This works");
gui stuff...
I swear this same thing was working just a few hours ago...
wrong event listener
Of course
xD
🤦♂️
don't worry mate it happens to everyone
🙂
declaration: package: org.bukkit.entity, interface: Entity
idrk
Sets the entity's current fire ticks (ticks before the entity stops being on fire).
In all honestly though I just realized I have no idea how I used the wrong event listener
I thought I did
What are you creating btw 😄
Just trying to make a menu where you right-click a nether star and it brings up a GUI
Seriously though, what listener event do I use
wrong order, but it's acceptable
you want to have an INVENTORY to CLICK in an EVENT?
I have a mysql plugin where i store player nicknames and some more data in a mysql database. It works fine, but after sometime staying in server, my plugin breaks and this error throws itself in console:
https://paste.md-5.net/ixuzesevez.sql
Its pointing on this line:
https://paste.md-5.net/cowomisefe.sql
no need to spam tho
does cmd.getPermission() gets the permission from the plugin.yml file?
@hybrid spoke you're gold 😄
no i don't want that I want an event for right-clicking
A player right-clicking with a nether star
how im spamming my g?
lets event in the click
but.. you just said you want to click within a menu to open a gui
No, sorry for the misunderstanding I worded it wrong. I want it to right-click with a nether star in hand and open a gui
oh ya, that event
just make a netherstar with a custom model id or how its called and check for that
not every netherstar
I was using PlayerInteractEvent but apparently that doesn't work
🤡
???
EventPlayerInteract 🤡
its not
Hmm
what does the jd say?
Actually, that would be even better. How do I check for that instead of just the nether star?
probably plugin.yml
?paste
It would have to be by the plugin description file as it won't look inside your method.
if (event.getCurrentItem().getItemMeta().getCustomModelData() == 12345 // model data you set before
@vague cypress
you could test that by printing the perms
wdym?
you add permissions to a command and print them out while executing that command
Is there anyway to stop MySQL connection from just randomly closing?
I have a plugin where my mysql connection just disconnects randomly after like 20 mins of usage or smthing like that.
it should
just send your code i'll take a look at it tomorrow if you havent finished it then
got small problem
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
how would I check if runnable is running on 1.8
like on current older version u have method isCanceled
but my plugin provides support from 1.8 +
problems is now I noticed there is an error
with missing method in old api
java.lang.NoSuchMethodError: 'boolean me.mraxetv.beasttokens.utils.shop.ShopRotatingData.isCancelled()'
You'll problaly have to work it out with booleans.
