#help-development
1 messages ยท Page 1653 of 1
This is what I came up with for 2Hex. Modify it to use heads instead of reading config entries. https://paste.md-5.net/akabazinix.cs
um
i just tried debugging
the debug works for the first gui
for second, it does not
i think i get this.... just not how i can implement it
What do you mean the debug doesn't work?
I personally use triumph gui library (https://mf.mattstudios.me/triumph-gui/introduction)
its pretty nice
You would only need modify the for loop to add your heads not paper.
then detect clicks on any head
I'd add it as a class and try it. See how it goes. Keep your old code until you decide
The code I posted you'd just loop bukkit.getOnlinePlayers()
and create an itemstack for each
hmm okii
public void openMenu(Player player) {
ConfigurationSection section = plugin.getConfig().getConfigurationSection("warps");
if (section == null) {
player.sendMessage(ChatColor.RED + "There are no warps.");
return;
}```
ok so on this selection
do i just add my old code?
you can scrap all that
this for (String childSection : section.getKeys(false)) { you would change to for (Player online: Bukkit.getOnlinePlayers()) {
for (Player online: Bukkit.getOnlinePlayers()) {
}```
Then the ItemStack section you create your head ItemStacks
replace that ItemStack code with your ItemStack code
worked!
but what is this here
for (String childSection : section.getKeys(false)) {
section is red
so i can remove it?
yes
change the page title. Keep the (page: %d) on the end though
So many colours
Is it preferred to make it air myself and cancel the event myself? I currently just cancel the drops and drop it naturally, but don't cancel the event so the game knows to break the block itself.
Its best to set AIR and cancel so other plugins don;t so anything with it
do I have to set it to air a tick later?
๐
?paste your whole class
You seem to have missed out a lot of the fields
wait how do I set a block at a location
Location.getBlock().setType
You pasted the class inside your other class
so all this ?
yes, but you ordered some of the code incorrectly too
Something like https://paste.md-5.net/velisuwaku.java
is p a player?
as u see
if(event.getClickedInventory() == null || event.getClickedInventory().getTitle() == null) System.out.println("1");
if (!event.getClickedInventory().getTitle().contains(ChatColor.GREEN + "Warps")) System.out.println("2");
if (!event.getCurrentItem().hasItemMeta()) System.out.println("3");
none of these were printed
yee
nothing was printed in second gui
package bangui.me.duke.Me.commands;
import bangui.me.duke.Me.Duke;
import bangui.me.duke.Me.utils.BanMenuUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class BanGUICommand implements CommandExecutor {
Duke plugin;
public BanGUICommand(Duke plugin){
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (p.hasPermission("ban-em.open")) {
BanMenuUtils.openBanMenu(p);
}else {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Noperm")));
}
}
return true;
}
}
first gui it worked fine
this is the open command
class SubOperator : Operator('-') {
override <reified T> fun operate(a: T, b: Any): T {
return null
}
}
Expecting member declaration
You are trying to statically access a non static method
well when someone runs the command it opens Banmenu
Its impossible for the first menu to operate fine but the second to not trigger events
don't use titles for vomparing inventories
but i think bc i change the thing in the util i think it just brakes the command code
use a set
then why
is it not working
lmao
how would someone, make a chance system with a gui. Saying like, when you join, there is a chance for 1 gui opening, and when you join again, another gui opens
that doesnt make it not work
This is not that case, he's getting the menu number from teh title
i dont see a difference
use a record
record WarpGui(Inventory inv, int page)
debug. Its impossible for one Inventory to trigger events but not a second
I DID
guys help with this pls
then yoru debug code is shit
WDYM
if(event.getClickedInventory() == null || event.getClickedInventory().getTitle() == null) System.out.println("1");
if (!event.getClickedInventory().getTitle().contains(ChatColor.GREEN + "Warps")) System.out.println("2");
if (!event.getCurrentItem().hasItemMeta()) System.out.println("3");
:v
this shouldved print 1 / 2 /3 if it has shit in it
if yoru debug code doesn;t trigger its not telling you crap so its not really a debug is it
ThreadLocalRandom.current().nextBoolean
Anyone know the solution to this?
then what am i supposed to do
@eternal oxide
None of those debugs shoudl have triggered, they are all for return statements
restart
Modifier 'static' not allowed here
how would someone make it work
You should use a weight system for that.
low storage, prolly
impossible.
do not use static, pass an instance to be used in yoru command class
how do i do this?
onjoin:
if random
player.openinventory(myinv)
public static void openBanMenu(Player p) {
}
use what i sent
then in there how can i open the menu ?
@eternal oxide then how do u want me to make the debugs lmao
no
this channel is shit
@quaint mantle i restarted but its still not working
channel is spammed
we need multiple
ikr
nani?
OH LMAO
we could move 2 dms?
I THINK I KNOW WHY @eternal oxide
there are 2 onclick events
may that be the case?
since 2 events cant run on the same time
maybe thats the case?
Help with this if possible please.
THen wtf do i do
have you googled it
then go to their discord
how do i do it then?!?
You create one instance of the BanMenuUtil class in your main plugin instance, then pass that to whatever classes need it
BanMenuUtils banManu = new BanMenuUtils(this);
then pass banManu to whatever classes need it
no, thats a static access
oh what should i use then??
i added this to main
now pass that to yoru command class through a constructor
WHY DOESNT IT WORK BAWUGBFAUGBEURG
bro it legit works on first gui but not on second wtf
are you registering multiple listeners and canceling the event in one?
im confused
bc this worked before
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
It worked before because you used different code and used static
yes
now i get laughed at for being a total bozo

ok so
is having 2 events of the same type in different places and one has a cancelling thing
kill the one with no cancel?
so what should i change/add?
pass the instance to your command class
just upgraded the code to 1.16
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.
doesn't work, but yea it's different TrapDoor is in package block.data instead of material and functions names changed
I did the debug again and everything is called
@eternal oxide is having 2 events of the same type in different places and one has a cancelling thing
kill the one with no cancel?
if so whats the solution
do i just chuck them into 1
set teh one that you want to listen anyway to ignoreCancelled
sorry set ignoreCancelled = false
what
so do i set both of them to ignoreCancelled true or false
false
class SubOperator : Operator('-') {
override <reified T> fun operate(a: T, b: Any): T {
return null
}
}
expected member, why isnt the generic working
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
i still dont get it
its making me make it static.......
Halp
can't be reified unless its inline
di
NO its not. We have already told you what to do and how to do it
inline <reified T> fun operate
elgarrrrrrrrrrrrrr
why do i have to do ignorecancelled false
or remove the reification
its by default like that
or add the reified type parameter to the class itself
i did this
but reified types only work on inline functions because bytecode
should be true
ive tryed this
Yes, now pass it to your command class, as I said at least twice
Ikr
i learned the entire language from just reading the docs
BanMenuUtils.banMenu.openBanMenu(p); ....
NO
Hi guys. I am getting main scoreboard and try to register a team right after server starts. I read that the scoreboardManager can be null until world is loaded but I even use delayed task in onEnable() to make sure the world is loaded but it is still null. Anyone who came across this?
im honestly confused....
?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.
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
override fun operate(a: T, b: Any): T { ^ compiler.kotlin:2:15: error: expecting member declaration
@covert valve
read that
class SubOperator : Operator('-') {
override <T> fun operate(a: T, b: Any): T {
return null
}
}
Ah
@eternal oxide SAME PROBLEM LOL
why java doesn't have operator overriding : (
i set them both to ignorecancelled true t
I'm not getting world. I am trying to use scoreboardManager and it is null
Then you have something else going on
use kotlin 12head
events will not simply be ignored
ecoskills gang
so... https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/78d5b35b82dfbb185c505e659887cb539e781b7d (just committed)
undoes https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/28d72c4bd8c22f568384560459d0d703c2d0fefe
so does generateTree not generate bee hives anymore?
nono
public class FancyLogger {
private final JavaPlugin plugin;
public FancyLogger(JavaPlugin plugin) {
this.plugin = plugin;
}
so i need to add soemthing like this
in the command class?
cpp operator overloading : )
i thought it would make everything easier
its 10x harder
if its a logger you'd want FancyLogger implements Logger
nah
thats the example
kotlin is so much easier and faster once you get the hang of it
so i just change it
ill learn java further
learn kotlin
@quaint mantle uh do u have an idea
or learn both like a 
yes
make a proper gui library or use an existing one
yes i did
gui coding using just the spigot api will make you want to shoot yourself
i dont like using dependancies
do i use it
make your own
bruh if i dont get my head around di ima shoot myself , It looks easy but i cant get my fucking head arround it
IS MY LIFE LIKE THAT
di is so easy what
Is there a Tag for concrete? (Tag as in Tag.BANNERS, etc.)
probably
or just material.name().lowercase().contains("concrete")
I'd like to avoid string concatenations, can't find anything under tag
me brain dead
DO I ACTUALLY HAVE TO MAKE A LIBRARY
loll
JUST TO USE GUIS
i just sent you kotlin code
...
AWGUAWUEGBAWEUOGBAWEIUGFAEGUAEWJGAEG
it wont work in a java class
yes
bro
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Go read
i did it to u before bro
no you don;t
I HAVE LIKE 20 TIMES
And what part don't you understand
because you haven't properly debugged your code
legit all of it........
i dont get what i need to put
how do i 'properly' do it then
add actual debugs to see what code is running and what isn't
i did
sysout before each line. see whats not working
ok
no, you did sysouts on the actual conditions is all
if(event.getClickedInventory() == null || event.getClickedInventory().getTitle() == null){
System.out.println("inv / title is null");
return;
}
if (!event.getClickedInventory().getTitle().contains(ChatColor.GREEN + "Warps")) {
System.out.println("title does not contain warps");
return;
}
if (!event.getCurrentItem().hasItemMeta()) {
System.out.println("item no meta");
return;
}
if (event.getCurrentItem().getType() == Material.PAPER) {
System.out.println("material is paper");
like dis or what
yes, and add one after to see if it gets passed fine
after what
elgarl can u reply to the message u sent that tells me what 2 do?
after all your test. You wan tto know if it even entered your code
?paste your command class
Line 16 is yoru constructor
change it to java public BanGUICommand(Duke plugin, BanMenuUtils banMenu){ this.plugin = plugin; this.banMenu = banManu;
i get 24errors
It will ask to create a Field.
oh yea
then in your main class where you do new BanGUICommand(this) you have to change it to pass your ban util too new BanGUICommand(this, banUtil)
or whatever you called it
ENTITY_GENERIC_EXPLODE plays a random explosion sound but is there a sound effect for when a tnt explodes?
its now asking for another field
what?
How do I set up mixins for spigot?
oh my. NO, don;t pass it the class. Pass it the field you created at teh beginning
Please read what I write and not guess
afaik no
command class
I clearly said banUtil which is camel case. Lower case first letter, so its a variable
main class
and with my gui lib:
builder.onLeftClick((player, slot, menu) -> doShit())

hi guys wat time dose th โด๏ธ dose th ferry come 2day
12pm GMT
what's your gui lib called
wtf is gmt
wtf r we in euro
This is not an Object its a BanMenuUtils
greenwich mean time or whatever
can we ban this guy
someone asked what it was
itโs overwhelming
ITS A FREE LIBRARY JEFF WHAT WOULD I PLUG FOR
yes

oki
now fix yoru main
sellout aux
@eternal oxide guess what
sellout aux
banUtil? what is this
see what you've done bingie is just promote my shit for me
thanks
Sod off with the spam. It makes it very difficult to talk in here
now use code auxilor
i have also something like that
help
then it is getting to teh rest of yoru code
I assume by the lack of a response that mixins are yet another thing spigot's not capable of. So how am I supposed to access variables defined in a nms method
reflect your shit around
getCommand("banem").setExecutor(new BanGUICommand(this, banUtil)); <<< What sould the banUtil be?
or use kotlin
idk if i even have a var with that name
you should learn java
class
it shoudl be whatever you named the field you added to main
then why is it not working
all that errors ๐ณ
where you used new BanMenuUtils(this)
I don;t have yourt code to see
u do now
lol
AMOGUS
yes
i called it banMenu
God, this place is more shitpost than anything, isn't it
then use that
but i get the error...
BanMenuUtils banMenu = new BanMenuUtils(this);
thsi?
you shoudl have no error in main
add more debug. If its getting past teh paper test
red
see where its failing
errors?
That's not how you make a command
If you find useful applications within nms you are free to PR and expose those in the API. Spigot was never designed with direct access of the nms classes in mind.
^^ see
fix your shit
Yeah, I can tell
wdym why all that errors
How anything usable comes out of this is beyond me
You put all yoru code in the constructor
close teh constructor
I can't even properly debug path generation because I am unable to access the process
Thats the whole point of spigot. If you want to directly modify nms then go build a fabric mod,
public BanGUICommand(Duke plugin, BanMenuUtils banMenu){
this.plugin = plugin;
this.banMenu = banManu;
}```
Just telling people to use something superior instead of trying to provide options is one way to run a community, I guess
not really
@eternal oxidebtw
i have one after my paper test
and the one after the paper test is the only one working
thats like telling somone to run tcpshield instead of cloudflare spectrum to proxy minecraft
If you want to improve this open source project you are free to pr.
so how far does it get?
until the end
What even is the point if I am unable to change pathfinding or properly debug it
it skips the whole event basically
look at yoru code and see if you can see whats wrong
close constructor
Want to debug the A* algo and properly display it to render? Can't do that
Want to modify vanilla pathfinding for vanilla entities? Can't do that
Without going through your code line by line no. Debug everything and see whats not working. The code is running so its a logic issue
@EventHandler(ignoreCancelled = true)
public void onClick(InventoryClickEvent event) {
all the event shit {
}
System.out.println("did it pass all, yes");
}
and the sout ran
bruh
ok
There are workarounds. You can display the path with particles for example.
IT IS NOT A LOGIC ISSUE @eternal oxide
if (event.isLeftClick()) {
System.out.println("left");
Can I now
Then please tell me how I access the closed and open node set and target node list
GHUORGHAUORGHAUROGAURGAHEGHAUEROGAHUORGAHEURGHAUEROGAHERGUAERHGUAERGAERG
Which are solely located in a method inside Path and not written to a local field
Reflections or ASM. There is a way.
why this fuckery is happening
basically, an event is working for a gui but not the other ones
and theyre the exact same
I thought ASM is out of scope for spigot?
So that's not a valid option, init
put a debug in your onDrag event
its 100% not the thing though
And to my knowledge, there is no way to access fields inside a method
Through reflection anyway
how can it even do smth
With asm you can inject bytecode into already loaded classes.
pls help
You mean the literal thing mixins are doing?
The thing not supposed to be used with spigot?
Hi! I'm trying to create an AntiCheats in Intellij IDEA in Maven, but I'm having trouble importing Spigot-API version "1.8.8-R0.1-SNAPSHOT".
Write a more object oriented approach and stop tinkering with configuration files on runtime. Load your data when the server starts and save it when the server stops again.
Same goes for your GUIs. More Objects + separation of concerns. Make your code clean and debuggable.
1.8 support was dropped half a decade ago.
how am i supposed to do that
and that's not why
its not working
There's nothing I can do?
@eternal oxide ru there
Not to mention that ASM injection needs applying on a much earlier state than plugins are initialized
So how does that work with spigot
if your left/right/shift click tests are not passing then they could well be broken
I don;t use 1.8 so no idea
how r they broken only for 1 gui??????
Clean up your code. Create new classes and new methods with meaningful names. Your listener methods should have 5 lines max.
So, is it impossible I managed to create a plugin for 1.8.8 now?
Yes but you shouldnt. 1.8 is unsupported and full of bugs that will never be resolved.
You shouldn't create plugins targeted for 1.8
The most you should do is make plugins that target latest but are compatible with 1.8
Which isn't always easy either
So can you point me to some spigot specific asm resources then?
what
most mc servers are 1.8
yea
almost all pvp servers are 1.8
https://asm.ow2.io/ is the library craftbukkit uses
Try closing the old inventory before opening the new
hmm ok
Thats only a guess due to it being 1.8
This is literally not true
yea that is
oh I rewrote the menu opening code```java
/**
* Deal with clicking the next button.
*
* @param event
*/
@EventHandler
public void onClick(InventoryClickEvent event) {
if (!pages.contains(event.getClickedInventory())) return;
event.setCancelled(true);
if (!next.isSimilar(event.getCurrentItem())) return;
int index = pages.indexOf(event.getClickedInventory());
// Make sure we have a new menu to display.
if (pages.size() > index) {
event.getWhoClicked().openInventory(pages.get(index + 1));
}
}```
No it's literally not
lol
People need to fucking move on from 1.8
And stop acting like it's the end all be all
1.8 is a shrinking minority
8.2%
Yeah you can emulate 1.8 pvp with 1.17
if (m.find()) {
event.getWhoClicked().closeInventory();
event.getWhoClicked().openInventory(pages.get(Integer.parseInt(m.group())));
so like this
Elgar, ^
?
o
No need for regex or anything.
no
How does one use hex color codes? for example - lore.add(ChatColor.GRAY + "An enhanced version of the survival");
@lost matrix That requires initialization on a much earlier spot than possible with plugins
Use the bungee chat color class
ok
You can do ChatColor.of(Color) I believe
And pass it new Color(r, g, b)
Alternatively you can do new Color(0xFF0000) or something
We should convert more people to adventure
Building a custom server jar is not really viable, is it?
What is it
good chat component lib
Paper only
it isn't paper only
well spigot can use it too
who made the inventoryclickevent
If only the desktop market share graph looked like this too lol
i hope he gets diarrhea
ngl, linux on desktop feels pretty good since protondb
It really does
I use arch btw
With steam deck coming out more and more games may start working on linux
Why
Nope
the event is fine
Just a linux enthusiast
You can fork spigot and modify it to your liking. Its not too hard. Some people do it.
When do you need initialisation? Because the onLoad method of JavaPlugin gets called quite early.
linux on desktop always feels like a hack to me
Why
nvm its my fault
personal choice im not a fan
I've been using it for years and it's amazing for development
i hate windows
prob my code that is shit
but i'm not huge on using linux
Before anything is done on the vanilla server
What did you try that made you feel that way?
macos is my personal favourite rn but i'm not gonna run a hackintosh lmao
i've used ubuntu, arch, and manjaro
bc its great
It's a middle ground between linux and windows
Unix-based
But still has more compatibility
onLoad is called way before any game object (eg worlds) is loaded.
And ease of use
but with other stuff the majority of people dislike
The world is not the earliest interaction
i might be technical but i still want it to be nice and easy to use
Everything I need runs on linux though
Very, very far from it
like the stupid security things it does
windows best
not for me and im not going to run everything under proton
Why not?
because no
Proton has near-native performance
i rather run native
Why lol
personal choice
Hope you don't try to play anything with anticheat
With proton you literally can't tell the difference most of the time
Then dig into the implementation and figure out if onLoad is called early enough for you.
Almost like I already did
Valve has said they're working with BattlEye and EAC to get anticheats working on linux
And it doesn't
unless it's completely transparent and doesn't exist to the end user then it's too hacky
oh god
fortnite god no
please dont bring that over
With proton you click a few buttons and it's done
Most games don't even require any extra steps
Then fork spigot or paper and modify nms as you like.
i dont want to have to click any buttons at all
I keep getting this error when loading a world, I believe I'm loading it correctly as it does load and I get teleported to it but I still get this error https://paste.md-5.net/mazajivoha.sql
Yeah all I have to click is "continue" when it says "this game is running through a compatibility tool"
I don't see the problem
So then don't suggest stuff as a possibility that is straight up not viable
what if i want to run creative cloud apps
Other than that I just click play and it runs through proton
Say "you can't" instead and be done with it
Proton can be used on non-steam games
does it need extra steps?
You mean "thank you for giving me your time to provide me with thoughts and suggestions"
You are welcome
With lutris, not really
I most certainly do not mean that
You search for the game, get the script, and launch
why hasn't anyone decided to make a company with an operating system that's both stable, unix-based, and easy to use
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
IM HAVING A FUCKING SEIZURE IT FUCKING FINALLYL WORKED
The conversation with you was a borderline insulting waste of time
๐
OSX?
HOLY SHIT IM DONE WITH THIS CYA
your attitude is fun
RedHat?
mac is the only example of that but it's proprietary and you can't just run it on whatever you want
redhat doesn't run everything
.-.
anyway ciao
Compatibility is a problem that is solved by more people using linux
The more people use linux, the more incentive there is for companies to make sure their shit works on it
Was it closing the inventory?
can anyone help please,
i wrote method that spawns armor stand via protocollib
and i call it 3 times and it work 3 times
but only 1 armor stand beign spawned
i debugged but i didnt found nothing weird
no errors just dont work
here is method code: https://paste.md-5.net/ecibacaqej.cs
(I AM 100% SURE THAT ITS BEIGN EXECUTED MORE THAN ONCE!)
prob
i changed other stuff too
but it worked
k
Very kind. Ask your parent for some more manner lessons.
My parents have been dead for a while, but I'll be sure to send a message in a bottle down to hell
Thanks for the suggestion though
tbh vatuu i feel bad but i also dont cuz ur a toxic little fuck
Toxic isn't the word I would use
Also, don't feel bad
I know better than to be insulted by some kids that think they are hot shit while not even grasping basic computer science
hey can anyone help me?????????????
What does that make you asking us little kids for help...
Sure. Whats the issue.
The fact that this is the official spigot server
Though I seem to have been severely mistaken in my expectations
i wrote method that spawns armor stand via protocollib
and i call it 3 times and it work 3 times
but only 1 armor stand beign spawned
i debugged but i didnt found nothing weird
no errors just dont work
here is method code: https://paste.md-5.net/ecibacaqej.cs
(I AM 100% SURE THAT ITS BEIGN EXECUTED MORE THAN ONCE!)
Go ahead and found your own community then.
No need, there is plenty of alternatives
Do you make sure that every spawned armorstand has a different id?
Besides, I seem to have found a alternative that works just fine
Then stop bothering us and go there.
yea i checked via debug its completly different
This should fix this issue you had rather than closing the inventory (should not use those in the eventjava if (pages.size() > index) { plugin.getServer().getScheduler().runTask(plugin, ()-> event.getWhoClicked().openInventory(pages.get(index + 1))); }
I'm quite comfortable here
While this place might not be helpful, it's still interesting to watch what people come up with with such severe limitations
Anyone able to help me out here?
You are trying to create/deserialize a Location for a world that does not exist
So you get your debug message displayed 3 times? Did you check if the locations are different?
How would I use the Color I've just created in an item's lore? ```java
Color light_brown = new Color(196, 164, 132);
...
lore.add(ChatColor.???? + "An enhanced version of the survival");
yes
But it should. I do load the world in
location different, id different code is executed but just dont work event without second packet
It quite clearly says it does not know that world
I'm pretty sure that's not how you do this
Lemme check
i'm pretty new to this so anything helps. ๐
The thing is, when I stop the server and load it in for the first time, it doesnt work but when I do /rl, it works fine. It finds the world after I do /rl?
lore.add(ChatColor.getByChar("#000000") + "An enhanced version of the survival");
Always check the docs
declaration: package: org.bukkit, enum: ChatColor
World loading (if you are doing it) could take a while. You may be trying to load your locations before loading has finished
public Timer(boolean running, int seconds) {
this.running = running;
this.seconds = seconds;
this.mode = TimerMode.UP;
Bukkit.getScheduler().scheduleSyncDelayedTask(Deathrun.getPlugin(), () -> {}, 1 );
playerManager = Deathrun.getPlugin().getPlayerManager();
}
hey, does anyone know how to make one tick delay, this is not working, playerManager is null
[15:20:19 INFO]: deleting .\world_the_end_custom\DIM1\region\r.-441.73.mca (exist: true)
[15:20:19 INFO]: deleting .\world_the_end_custom\DIM1\region\r.407.-579.mca (exist: true)
[15:20:19 INFO]: deleting .\world_the_end_custom\DIM1\region\r.-311.198.mca (exist: true)
[15:20:19 INFO]: deleting .\world_the_end_custom\DIM1\region\r.-274.-286.mca (exist: true)
[15:20:19 INFO]: deleting .\world_the_end_custom\DIM1\region\r.288.184.mca (exist: true)
[15:20:19 INFO]: deleting .\world_the_end_custom\DIM1\region\r.-447.-443.mca (exist: true)
...
public static void deleteUselessRegionFiles() {
for (UUID world : uselessRegionFiles.keySet()) {
Bukkit.getWorld(world).setAutoSave(false);
for (File regionFile : uselessRegionFiles.get(world)) {
if (!regionFilesSnapshot.get(world).contains(regionFile)) {
System.out.println("deleting " + regionFile + " (exist: " + regionFile.isFile() + ")");
try {
java.nio.file.Files.delete(regionFile.toPath());
} catch (java.io.IOException e) {
e.printStackTrace();
}
}
}
}
}
the files are not being deleted, but i dont get any error
i also tried with just regionFile.delete() and it doesnt work either, and it returns true, like if it really was deleted, but it wasnt
im even turning off the autosave, just in case, and still the same
i even tried calling that method from a command, after waiting a few minutes, and nothing, the files are still not deleted, why???
I dont see the UUID field being written
does entity rly need UUID? i though entityID is enough
entityId is dynamic through the server runtime
well, consistent through the runtime
but beyond that, post restarts, dynamic
How would I even go on about fixing that?
Provide a random UUID with your packet.
which field is uuid?
o
There is only one field. Just get the StructureModifier<UUID> and write a random UUID in the first index.
can anyone help me with this?
packetContainer.getUUIDs().write(0, UUID.randomUUID());
only for first packet (entity spawn)?
For every packet
The runnable you pass is empty. So 1 tick later an empty method is called and nothing happens
yes i just want the next statement to run later
that is not how the scheduler works tho
You should wrap your custom armorstands in a class that keeps track of their UUID and entityID.
Then construct a spawn, despawn and metadata packet once and send it to the players you want.
only the passed runnable is executed after the delay
your method progresses as normal
found out already ๐
adding random uuid to spawn packet worked!!!!!!!!!!!!!!!!!!!!!!!!!!!! THANKS A LOT UR BEST!!!!!!!!!!!!!1
how to do it otherwise?
Example from one of my older plugins:
public class ProtocolArmorStand implements IPacketArmorStand {
// Pls dont judge
private final int entityID = ThreadLocalRandom.current().nextInt();
private final UUID entityUID = UUID.randomUUID();
private final PacketContainer showPacket;
private final PacketContainer hidePacket;
private PacketContainer metaDataPacket;
private PacketContainer equipmentPacket;
private PacketContainer movePacket;
private LineRepresentation currentRepresentation;
private Location currentLocation;
public ProtocolArmorStand(final Location location, final LineRepresentation representation) {
this.currentRepresentation = representation;
this.currentLocation = location;
this.showPacket = this.createSpawnPacket();
this.hidePacket = this.createDeSpawnPacket();
this.metaDataPacket = this.createMetaDataPacket();
this.equipmentPacket = this.createEquipmentPacket();
this.movePacket = this.createMovePacket();
}
... a ton of stuff
playerManager is final, can not be done in a lamda
useful ty
Final?
Why would that matter
yeah
You need it to be effectively final
You mean the method has the final keyword, right?
cant set in a lamda
Oh
I thought you meant a method lol
You can put it in a 1-length array
But you can also just move it to be a field
I don't see that variable being defined in the method
Doesnt some spigot provided library have a Unit<T> class?
So where is it defined?
Not sure, haven't tried it
I usually just try to rescope the variable if it makes sense, otherwise use atomic for primitives or a 1-length array otherwise
youre right, thanks
@covert valve do u use kotlin dsl?
hey, shud entityid and uuid be unique only for one player or on server overall?
i would but my groovy dsl works and i'm not about to rewrite 20-30 build scrips
I'm trying to compile my plugin, but I get this error:
cannot access net.minecraft.network.chat.ChatComponentText
They should be consistent. Imagine if you want to send a destroy packet.
so shud i make sure that i dont send packet with same id to 2 diff players?
At compiletime, right?
Yeah, using maven install
Right
You're probably adding the spigot api as a dependency
You need the full server jar
Did you use BuildTools to build spigot 1.17.1?
The id should be the same for one instance of your armorstand. And everyone should know the same id for this entity.
Yes
So it should be in your cache
Pretty sure it is
Not sure what the problem is, then
I can access other nms components
Whats the scope of your dependency?
Should be provided
What is your projects java version?
13
That should be 16
Make it 16 just to be safe
The newer versions are compiled for java 16 so you can't access nms without targeting java 16
compile spigot 
hey, why
destroyPacket = manager.createPacket(PacketType.Play.Server.ENTITY_DESTROY);
destroyPacket.getModifier().writeDefaults();
destroyPacket.getIntegerArrays().write(0, new int[] {entityID});
giving Caused by: com.comphenix.protocol.reflect.FieldAccessException: No field with type [I exists in class PacketPlayOutEntityDestroy.
exception?
Its weird error i also had to face. The PacketPlayOutDestroy packet doesnt use an int[] internally anymore.
Its now using an IntList instead.
worked, thanks
Fair
Am I able to set an entity's target player/entity?
AI?
Yeah
Tho itโs probably not efficient since it might get overridden by target goals I suppose
Mob#setTarget()
Can I cast event.getEntity() to (Mob)?
if the entity is a mob yeah
you're going to want to make sure the entity is instanceof mob first
im confused again

ok i get that i use a dubble constructor, but when i remove one i still get the errors
show your new code
?paste the whole class
You don;t even have a class now

nor Fields
?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.
@plain scroll you should learn java before attempting to make a plugin
tyy
so? if you don't know you need a class you def don't know enough, I am not being toxic or rude I am just saying that you will not be able to make a plugin if you don't even know you need a class.
oh yea ik
๐ณ
it should be full sphear
but I am getting only like 1/4
of it and it is rotating in circle
to finish full sphear
is it maybe because 1.8 limits particals which are sent to client I am on 1.17
thru viaversion
server is 1.8
so just from curiosity
?paste
can someone help me on why this is not working
i thinkj it may be my main so ill send that as well
did u register
event
What isn;t working?
I see the code, what isn't working?
i think the thing is not registering but i cannot find out why
idk
"not working" doesn't say anything
you do
i dont get a eroor message or anything
do you get ANY messages?
no
show where you register teh event
on my main class
ok so when i click on a head all its doing is picking the head up and not opening the new banmenu?
"you died bad. L get gud full bm bad get a life. you play this game 24/7 and you still died so bad omg go outside and touch grass" 
i found out why
Is your plugin even enabled?
I also recommend separating events and not having every single one in 1 class
Correct. You have to write some code
I gave you the UI code is all
in an InventoryClickEvent
if (e.getView().getTitle().equalsIgnoreCase(ChatColor.WHITE + "[" + ChatColor.RED + "Player List" + ChatColor.WHITE + "]")) {```
dont i need to change this
on my liseneer
java.util.MissingFormatArgumentException: Format specifier '%d'
if (e.getView().getTitle().equalsIgnoreCase(ChatColor.GREEN + String.format("Players: (Page %d)"))) {
o get that error when i change it to this
Your not even specifying what %d is
Noooooooo dont use this
dont check inventories using the view title 
You should use a custom inventory holder
and also - instead of using the chatcolor enums in your name in teh if statement, iirc you can use ChatColour.stripColor
add a method to your utils class java public boolean isBanGUI(Inventory inv) { return pages.contains(inv); }

not inside any other method, but inside the class
Elgarl i think you deserve a medal - i have seen you helping duke all day ๐
lmao sry for this
its not a problem
just as long as elgarl wants to help that is
You do whatever you want but it will be way easier if you feel your time too learn Java first just saying.
otherwise you may end up in a not so fun pit
oh then do i verify this in the Listener
yes
if (e.getView().getTitle().equalsIgnoreCase(isBanGUI == true)
if (banMenu.isBanGUI(e.getClickedInventory()))
getClickedInventory is red
Cannot resolve method 'getClickedInventory' in 'InventoryView'
noice
that worked
java.lang.NullPointerException: Cannot invoke "bangui.me.duke.Me.utils.BanMenuUtils.isBanGUI(org.bukkit.inventory.Inventory)" because "this.banMenu" is null
have you passed the instance to your listener class, the same as you did for the other?
developer screaming over easily debuggable error