#help-development
1 messages · Page 23 of 1
Yo
yo
Smart
Thatd be truly awesome
if you send me a list, I'll write it, takes like 10 minutes
I know about
?pdc
?learnjava
?learnjava!
?eventapi
?configs
?notworking
?interactevent
So I have a team system that randomly assigns people to it, I need to somehow limit each team to five players only, any ideas?
check if there's already 5 people in thjat team, if no, send error message?
if yes*
Would that not be super inefficient though?
the biomes.remove is throwing a null unsupportedoperationexception any idea why? https://paste.md-5.net/nexakujala.java
Id have to run that whole thing for each team no?
Tbf 5 isss a super big number I'd never loop over that
making biome provider btw
its more than twice as big as 2, after all
ye, we have to do that for 10 teams lol
you cannot remove biomes from the biome provider, on purpose
That's getting crazy
very
have you ever checked how entities work?
but it says i cant use Biome.CUSTOM when i use the full list
I think you'll be fine just don't loop over 2 or 3 million times
they call like a thousand things for every entity, every tick
oh wait that might be the other function
Making a plugin for a big YT/Twitch event so I need it to be as efficient as possible
Seeing spigot and nms code made me a lot less cautious lmao
Than I joined a server dev team now i care even less about ticking events
not necessarily
yeah
people also do stuff like "uuugh use an EnumSet<> instead of Set<Material>, its way faster"
bullshit
I mean, yeah, it's faster
maybe like 0.03 milliseconds faster
noone cares about that
I just use set because it's faster to type
nope its from getBiomes()
premature optimization is not good
that returns an immutable collection
if you wanna get rid of certain biomes, you gotta do so while/prior to generating the world
removing the biomes of already generated worlds makes no sense anyway
oh
how do I limit that 💀
how do you remove them?
do you have like 3 million players?
with your custom world generator / chunk populator / whatever
im just trying to get rid of Biome.CUSTOM so it doesnt throw that error
what error?
Is it okay to have at the same time ~300 tasks that were created using runTaskLater? The code inside the run() methods doesn't do anything crazy.
The context is that my plugin allows players to create their own timers, and the timers should notify once they're done.
illegalargumentexception when creating world
ill go paste it rq
I would roll with it unless it starts lagging your test server
If you see even a slight tps drop probably best to reformat
Also you should dynamically create the timers rather than have all 300 at once
Sorry for the stupid question but how can I measure my server's TPS?
/tps
yeah I only create them when I need them, but potentially there could be hunderds of them "sleeping"
yea should be fine as long as the task isn't super intensive
I'd also try to run some async if they don't require the api
The only other solution I can think of is to have a single runnable that runs every second and loops through all of the timers and checks which is done
that way you can call your plugin UltraSuperAsyncTimerCreator
@tender shard this is the error btw
is there a way to compile .jar files with maven like add them together on compile
You have multiple jar files which you want to combine into 1?
no I use maven for the normal stuff but now I needed packets wich were only possible to get with a .jar file but now I cant compile in maven because then it says package net.minecraft.server.v1_8_R3 does not exist
what's your code in WorldsManager line 43?
Which jar file are you talking about?
wdym?
wc.createWorld() (wc being a worldcreator ofc)
"adding .jar files together"? you probbaly mean "shading stuff"
then where does the CUSTOM biome come from though?
ofc the default world generator doesnt know on how to generate CUSTOM biomes
NEVER EVER should you add any libraries manually
if you use maven, USE MAVEN
idk the biomeProvider throws an error in getBiomes when making an arraylist and removing the Biome.CUSTOM, but it throws that when i just use a list of the biomes
throws an error either way
yeah but thats the onlyway of getting the packets
you should use maven to add the spigot 1.8.8 instead of adding it manually
no
just add spigot 1.8.8 as <dependency> in your pom
maven doesn't know when you add stuff manually to your intelliJ project
@eternal night is totally right. He did NOT tell you to add spigot 1.8.8 manually to your project. He told you to run buildtools for 1.8.8 and then add the dependency to your pom
oh shit
didnt mean to ping you
I did that out of habit
sorry lol
lol no worries 😅
idk why but I always add @ before any username lmao
easier to type it in bc you can just tab complete
true lol
balls
data science or smth?
snd then going to classes
nope, tensor flow and keras lol
oh
I prefer suspicous stews
discord has a very weird AI
discord has an ai?
whenever I send a video of myself where my nipples are visible, it blocks it
lmao
it's very strange because normally male nipples arent considered "nsfw"
lemme try sth quickly
ur not a male
lmao
pervert
nice pedo stache
lol
What is going on in help lmao
try gif
Lmao well i need some help xD
discord blocks videos with visible nipples
but doesnt block pics with visible nipples
testing very important discord features
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
if any actual spigot coding question arrives, we'll immediately stop talking about AI nipple detection, I promise
still dont know what to do, if i remove Biome.CUSTOM from getBiomes() i get an error, but if i keep it, i get an error
um
So i have this code that when i place a custom block i made it spawns a strucute. The point of this structe is that its a generator that automaticly mines money for you. In the middle of this structure i spawn a chest. I already made som gui, that i can also see using /gui for test purpose. How can i make it so when i click on the chest, it shows the ui? Not just any chest in the world, but the specific chest the structure just made
why cant you spell structure
e.getBlock().getLocation().add(0,0,-1).getBlock().setType(Material.CHEST);
thats how i spawn the chest
pdc?
?pdc
Sorry I'm from Denmark, English is not my native language
wdym "spawn the chest"
oh thats how
create the chest
i thought you were asking how lol

what
its from minehut
I have this block that when i place it spawns my generator. How do i make it so when i click the chest that just spawned, it opens some gui i have already made?
listen for player interact event
listen for the event and send the player a gui
Not just when i click any chest, cause the player can have normal chest. But when i click a chest in the generator
then do checks
to make it different, use pdc
then check if that chest has the pdc in the interact event
?pdc
Alright i will try, thanks!
im not offline
what should i return in getBiomes() if i want every biome except the CUSTOM one
yes finally
I'm currently writing a spigot wiki article
for what
oh
What is the event called for checking if the player opens a chest?
InventoryOpenEvent
PlayerInteractEvent
and PlayerInteractEvent
no lol
that gets called too
not for this case
100%
it does but it’s not what they want
now I wont find the packets (I ran Buildtools) https://paste.md-5.net/suqonubiba.xml pom.xml
with a custom gui to replace it
But isnt that with anything then? Like if i interact with a furnace, crafting table etc
Do they though?
do dead entities get removed from arraylists?
im cleaning up my old code but i haven't noticed any memory leaks
if statements?
how do i check if its a chest being used?
They o0nly want to know if the chest is being used so they can open their own UI
click the "mavn reload" button
yeah
yeah
yeah
@quaint mantle we also need a command to tell people to "reload maven" in intelliJ
You can do it either in teh PlayerInteractEvent, or the InventoryOpenEvent
oh so hes the one that does the bot
still not working
did you actually reload it
yes
reimport
Lmao yeah i know but
idk
i will just try a few things ig
@quaint mantle ?reloadmaven
"If you're using IntelliJ + maven, and you've changed something in your pom.xml, be sure to hit the maven reload button, so that IntelliJ can recognize the changes made in your pom.xml file."
oh wait the screenshot is shitty
better screenshot ^
I reload maven 3 times restartet IntelliJ and restartet my pc still wont work
@ivory sleet
run mvn clean package -U
then see what happens
public void onChestClicked(PlayerInteractEvent e){
if(e.getMaterial()== Material.CHEST){
Player player = (Player) e.getPlayer();
player.sendMessage("You clicked on a chest");
}
}
With this, it only runs when the player place a chest, not when they click to open it
Im sry i just started learning plugin development yesterday
im very new to all of this
it compiled fine, so everything's good. Use File -> Invalidate Caches
What am i doing wrong since it only runs when they place a chest and not when they open it
hi, im trying to load schematics with the help of worldedit-api. My debug messages say that the schematic has been successfully loaded but they are still not loading. Here is my code: ```java
try {
System.out.println("addrome");
File schematic = new File(path + "/" + room.type.toString() + "/" + room.id + ".schem");
ClipboardFormat format = ClipboardFormats.findByFile(schematic);
ClipboardReader reader = format.getReader(new FileInputStream(schematic));
Clipboard clipboard = reader.read();
Operation operation = new ClipboardHolder(clipboard)
.createPaste(worldEditPlugin.createEditSession(Bukkit.getPlayer("CarsCupcake")))
.to(BlockVector3.at(5*32 - room.x * 32, 50, 5*32 - room.y * 32))
.ignoreAirBlocks(false)
.build();
Operations.complete(operation);
clipboard.commit();
Bukkit.broadcastMessage("§a A schematic succesfully load Loc: " + (5*32 - room.x * 32) + " " + 50 + " " + (5*32 - room.y * 32));
} catch (Exception e) {
Bukkit.broadcastMessage("§c A schematic failed to load");
System.out.println(e);
}
i had some error when dispatching command: it gave me https://www.spigotmc.org/threads/plugins-triggering-commands-async.31815/ this link
this code probably sucks, but the server just hangs when i generate a world with it https://paste.md-5.net/umarofegut.java (the Utility.stringifyLoc works and just formats it for the file)
oh okay
its also taking up most of my ram rn
and my pc doesnt suck
something is straining it, dont know why
How would I test my plugin?
how do i bitshift
put it in plugins folder
Use that for x and y
of server
https://github.com/orbyfied/carbon/blob/master/carbon-core/src/main/java/net/orbyfied/carbon/world/CarbonWorld.java the function at the top turns x and z into a long
it puts in the z, shifts that 32 bits to the right
and then puts in the x
which should i use?
Is there a way to do it without doing so? Like for instance a task like gradle does that runs a server or something
16?
You shift by bits
nope
pain.
how many though
is there a way to not restart the server every time at least?
so that's 2^4 = 16
the size of one coordinate
which is what
id recommend two ints (32 bits) for x and z into one long (64 bits)
so 32 im guessing bc the function?
yes
Wait why are we making this so complex
it works like
00 // long c = 0
z0 // c |= z
0z // c >>= 32
xz // c |= x
some say x | z << 32 might work too
so i just shift it my 32?
*by
left or right tho
im guessing it doesnt matter but whatever
it wraps around so it doesnt really natter i think
oh ok
Someone who can help?
x | (long) z << 32 works out
ah
you need to get the clicked block and get its type
only cast z to long?
That's if you clicked with a chest not on a chest
you have to cast z to long, else shifting it by 32 bits -> 0
so all plugins have to be compiled to a jar file, is there a plugin that allows you to keep them as a regular file so i dont have to always compile it then make it a jar, and then run?
the e.getMaterial() returns the type of the item in your hand
or the used item
i guess
yes its called a compiler 
you can compile them at runtime and load them
how?
but you cant interpret java
cool kids just ByteBuffer.allocate(Long.BYTES).putInt(x).putInt(z).flip().getLong();
sorry im new to java
which then also uses the bukkit plugin manager to load it
then i wouldnt recommend trying that
Thanks, it works!
just stick with compiling it every time
ok well then learn how to use sun.tools.compiler
ok thanks
this makes no sense what so ever
and how to runtime load plugins
you are not going to get any better results than just following the debug setup for intellij on the spigot forums
intellij says not a statement
oh
oh
srry im not used to bitshifting and stuff
but i strongly recommend against it
because you will need to pacakage it into a jar
and add the spigot api and other deps to the classpath
you could call gradle using Runtime.exec
so everytime i make a change ima have to send it to a zip, then ima have to make that zip a jar.. and then run the server??
wait so what do i assign, i need x and z, so what does packed mean?
no use the jar exe included with jdk
either you pack two ints into a long
or you unpack two ints from a long
which one do you need
but just stick with compiling it every time
^
Orbyfied has been confused
^^ I sent that earlier
k
yea
im assuming just add it to sysyem variables?
idk how to or what those are
still hangs
im literally this is my first day learning java
oh
You don't need to make a jar then you should focus on the learning java part
You can run things directly in your IDE
yes but i want to run them in my server
any idea why it would hang?
Show your new code
I seem to be missing something. My .jar doesn't get my plugin.yml file packaged with the code for some reason. Do I need to specify it anywhere?
Fine. Install Intellij and the Minecraft Development Plugin. It takes care of the whole maven step for you. You can try learning that part later
do dead entities get removed from arraylists?
im cleaning up my old code and i realised i didnt remove anything from arraylists, but there is no memory problems on my server
no
i alr do
alr thanks
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
oh cool
Nice
neat
it shows preparing starting location for the world loaded before it, then shows time elapsed, creates the new world folder, and hangs
No need to stream that biomes array every time. You can store that in a field outside the method. Also why does get on your chunk map return an object. Make it store a biome??
yo guys, i wanna limit the way a witch moves, i dont want to let it go outside of X radius. how can I do so, especially when theres no event for entity movement
using JSONObject returns Object, ig i could cast
Guys
also also now you don't use the world in the key. Create a location with the bitshifted coords and use that as a key instead of a string
Not Guys
Do you make your plugins according to your needs or do you also use community options?
Use community options it saves time
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Just wrote this. Maybe someone has more suggestions?
?main
Hi all, I am trying to get BuildTools to run and I am getting the following error:
Exception in thread "main" javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
Is there any tutorial on how to add a certificate to Java? I have already tried with the flag --disable-certificate-check argument. I am using Windows.
Thats actually really good
wrong ` btw, its `
There are like 100 more commands. I only included the ones I found useful myself
but thanks ❤️
:D
I asked conclure for a full list of commands
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
lmfao
I wanted to know, why is your company/thing called "Jeff" Media
I m savin this gif, masterpiece
You might want to check your Java install. Are you on Linux by any chance?
and then I included all the ones I found useful myself. For example, there are commands like ?1.17 which I didnt think are worthy to add
ok
still hangs btw
I use Windows
minor bump
?workdistribution
@tender shard ^
hm?
add that one
i can?
oh and btw @tender shard your plugin update bot aint on github
just click on "Edit" and adjust the page
oh
I will upload it rn
tysm
so @chrome beacon what am i supposed to actually do to stop the hanging?
idk what is causing it to hang
it was on github the whole time https://github.com/JEFF-Media-GbR/DiscordSpigotUpdateBot
I just forgot to add the link on the spigot page >.< shame on me
wait
I didnt
Neither do I. Have you checked the thread dump
obviously the link is there
where do i find that
Where did you get your Java install from?
It comes in the console when the server freezes for too long
oh
it hasnt sent it
i noticed it doesnt send the preparing world thing
lags before showing that log
ig ill wait for thread dump
still hasnt happened
weird that its taking this long
usually when i crash my server its quicker
A thread dump should happen after 10 seconds
No idea
oh
ty
its not putting much strain on my pc
it has a ram cap tho
eventually itll surpass the ram cap and crash
but its been at 2 gb for the past 5 minutes
of ram usage
btw misspelled spigot in readme
wait is it
i saw it like 10 seconds ago
yeh
so it's my first time working on a plugin supporting multiple versions with NMS, one part of my code looks like this
if (version.equals("v1_8_R1")) {
actionbar = new Actionbar_1_8_R1();
} else if (version.equals("v1_8_R2")) {
actionbar = new Actionbar_1_8_R2();
} else if (version.equals("v1_8_R3")) {
actionbar = new Actionbar_1_8_R3();
} else if (version.equals("v1_9_R1")) {
actionbar = new Actionbar_1_9_R1();
} else if (version.equals("v1_9_R2")) {
actionbar = new Actionbar_1_9_R2();
} else if (version.equals("v1_10_R1")) {
actionbar = new Actionbar_1_10_R1();
} else if (version.equals("v1_11_R1")) {
actionbar = new Actionbar_1_11_R1();
} else if (version.equals("v1_12_R1")) {
actionbar = new Actionbar_1_12_R1();
} else if (version.equals("v1_13_R1")) {
actionbar = new Actionbar_1_13_R1();
} else if (version.equals("v1_14_R1")) {
actionbar = new Actionbar_1_14_R1();
} else if (version.equals("v1_15_R1")) {
actionbar = new Actionbar_1_15_R1();
} else if (version.equals("v1_16_R1")) {
actionbar = new Actionbar_1_16_R1();
} else if (version.equals("v1_16_R2")) {
actionbar = new Actionbar_1_16_R2();
} else if (version.equals("v1_16_R3")) {
actionbar = new Actionbar_1_16_R3();
} else if (version.equals("v1_17_R1")) {
actionbar = new Actionbar_1_17_R1();
} else if (version.equals("v1_18_R1")) {
actionbar = new Actionbar_1_18_R1();
} else if (version.equals("v1_18_R2")) {
actionbar = new Actionbar_1_18_R2();
} else if (version.equals("v1_19_R1")) {
actionbar = new Actionbar_1_19_R1();
}
return actionbar != null;
}
my question is can I now put sth else in this code? like
if (version.equals("v1_8_R1")) {
abcdfg = new Action_1_8_R1();
} else if (version.equals("v1_8_R2")) {
abcdfg = new Action_1_8_R2();
}
i dont believe thats wrong actually
oh?
so how can i create a minecraft 1.8 plugin if the minecraft extension for intelj only lets me go to .12
reflection
my server has been hanging on world creation for the past 10 or so minutes and hasnt had a thread dump
why do you code minecraft plugins for 1.8?
it loads the world before it and just stops
for the pvp
?
1.9+ pvp is shit lol
are you afraid that your players cannot do PVP if there's more to pvp then just "spam left click"?
?paste
1.8 is different combat systems
btw in these different classes
Actionbar_1_8_R1
Actionbar_1_9_R1
Actionbar_1_13_R1
I have to code it in their version or api right?
no
classes called like that probably do not use the API but use NMS
im wanting the players to use minecraft 1.8
the kb is still different im pretty sure
Player#setMaximumNoDamageTicks() lol?
and damage thing
PlayerDamageByPlayerEvent#setDamage
my server finally used another 3 mb of ram
wtf is happening
its like it just stopped the entire thing or smth
it doesnt say not responding and isnt using like any resources
so its not the standard high-usage hang
another 0.1 mb
of ram
is this gonna take like 6 hours to crash
Too old! (Click the link to get the exact time)
Hi, i was recently working on a bungeecord plugin, and i was wondering how to get a player's last login date (i know that in spigot you could do p.getLastTimePlayed() or something similar, but idk how to do that on bungeecord)
store it on PlayerQuitEvent
then load it
nah
ok, thx
i noticed that the world files are all made, just seems like they are empty (1 kb each lol)
well stuff in folders isnt there yet
i just dont understand whats happening rn
@tender shard any idea?
even minor bump
help is dead rn
need nms for that btw
youll have to play with the ai
i closed it bc theres no point in waiting
How do i check if the chest i just clicked have a specific block next to it?
the current code is
if(e.getClickedBlock().getType() == Material.CHEST){
for checking its a chest. So how do i check if it have specific blocks next to it
How would I have my plugin create a directory to store stuff?
Huh?
Im very sorry, i started learning plugin development yesterday
could you explain a bit more in depth maybe?
Learn Java first I think
Loop thru a cube around the block cords
Store the results in an list
If list contains the block
{ … ur code
I think if u don’t know Java
Start of Java basics
Nah, i know C# so im not new to programming
im a game developer
but i wanted to learn plugin development too
so my problem is not that i dont understand what i need to do, or how. I have the functionality in my head, it just need to learn the names for things, events etc
Then do a loop and check if any of results block is the block u was checking for
It’s so simple
If u don’t know how to loop u either not Dev of anything
Maybe html
Lmao i do know a loop xD
No need to get personal lmao
How can i make a placeholder which show custom prefix/suffix?
?jd
Its alright, we all have bad days. Just gonna ignore what you said there ;)
@waxen vapor
Check PAPI api
Loop cube around the chest
declaration: package: org.bukkit.block, interface: Block
I can spoon feed u later if u want
Evan you're not really being helpful lmfao
Or check direction to block
West to block
Yeah i know the javadocs :D
You can
Nah you dont learn from that
its alright i will figure it out
That will calculate a cube around
The self block
X+ Y+ . . . Simple math
If result = block unwanted
{
I actually did something similar to this on a mod once, although in two dimensions. You would just need to add a third loop to it for the Y dimension there
It's a mod, but the logic's still the same, since it's mostly maths
It s the most clear explanation
for x = -1 to x = 1
for y = -1 to y = 1
for z = -1 to z = 1
get block at (x,y,z) + block location
if block is desired block
do something here, and break out of x, y, z
Yeah... but sometimes people need a visual aid, ig. I'll give it to you, your explanation was very clear.
Im sry, have i insulted you or smth? You keep telling me im not a dev, that i dont understand x and y?
@waxen vapor here is a basic concept
I’m not Dev either
Im sry if i said something that insult your gaint ass ego, but just stop please?
I know :)
Thanks :)
Chill man only truth hurt people
Yeah exactly, so i dont know what i done wrong?
That’s the problem you didn’t understand
I dont remember insulting you, but if helping me is so hard, no one asked you to? I never pinged you
guy asks for help and you compain that he cant understand your vague directions
So I was thinking ur making joke out of me
^^
and when he asks for more clarification you wild out on him for being bad dev
So you started insulting because of what you thought, not because of facts?
I didn’t insult you
When did I
:DDD
Can I somehow send a message to a player on a different server (connected with bungeecord) using just spigot plugins?
In many ways
Well im done wasting my time with this guy, have fun doing whatever you doing! Hope you have a wonderfull day Evan <3 No hard feelings, we all have bad days, i will let this slide ;)
can you tell me how?
U can use SQLdatabase to make a bridge
Not would be best way
But in general it would work
Not everyone learns the same way, even though your explanation was clear, if someone doesn't understand it, you usually just have to adapt in order to make them understand it...
up 2 u
SQL for messaging 🤮
Possible .
yeah, I use SQL databases but wouldn't I have to query the DB too often?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I use them to transfer a player from server to server actually
but alright, thank you for the help
There's the message and messageraw types
I didn't know they can send messages
people tend to use redis or plugin messaging
i would say plugin messaging is most popular
messageraw might work better as you can grab a textcomponent, serialize it to a json string and just send it directly
redis messaging is quite helpful for things beyond simple server stuff
plugin messaging has drawbacks
and can I somehow do that using UUID instead of usernames?
but redis also requires its own instance running on machine
🥶
I understood what his point was, and what he told me to do that was not the problem. The problem was that im new to the variable names that was needed, not programming. I understand what he wanted me to do, i simply just dont know the code to do it. And as i said before, i dont want spoon feeding, therefor i said: Can you please explain in more depth, so he could say: First you get an instance of this and then do that and that. I didnt want the code, just smaller steps on how to do it
Yeah grab it from the event
From player
There a method .toString at the end
I mean if I have a list of UUIDs I want to send a message to, can I somehow do it directly or just with Bukkit.getOfflinePlayer
@simple silo
declaration: package: org.bukkit, interface: OfflinePlayer
you cannot send messages to offline players
does it throw an error when I try to send a message using the Message subchannel with plugin messaging?
that i am unsure of ive nevert done such a thing
Alright, I guess I will just try it, thanks for the help everyone!
Is there a way to get all the dimensions on the server?
you mean the worlds?
yea
Bukkit.getWorlds()
Bukkit.getWorlds()
Amazing, thank you!
Actually, I'm using this documentation here... is that method not documented at all? I can't find it under org.bukkit
ahhh alright, my bad
thanks
Oh, btw
Is the onEnable() method the one that acts upon the plugin when it is loading?
If I have a CommandSender field, and it is passed in as a player, how can I check if that command sender is no longer valid? (such as if the player quits)
::isOnline?
WHY 🤮
not player
if youre sure that it is a player then cast it
That's the thing
I am not
CommandSender sender = anySenderMayBeAPlayerThatCanQuit;
hi im creating a spigot plugin where the server listens for the player crouching and makes them crawl instead. I can make the client think that there is a block above the player (with player.sendBlockChange) and that puts them in the swimming position, but the position change does not reflect on the server. is there a way to make the server poll the player's position and make it change on the server?
Because of demand.
Thanks.
so commandsender might be rcon too
@rough drift if (commandsender instanceof OfflinePlayer)
💀 whos demanding 1.7.10
?1.8
Too old! (Click the link to get the exact time)
1.7 and 1.8 are decent
The server I play on unfortunately has the LOTR mod for 1.7.10, and the newest, 1.16.5 sucks and is unfinished
well i tried that and it does nothing. Also says in the documentation that it might have some weird behavior when not on water
Not matter how poor is the api back comparing to now
a passed in player object wont be an instanceof offlineplayer?
api has had thousands of updates since 1.7.10?
And newer versions just shit
Player is an subinterface of OfflinePlayer
That's not the point
wrong reply
It’s what I said
This is not the point
The api is a lot better now then it used to be with 1.7 - 1.8
oh
I would have to manually check for every single possible command sender and call appropriate methods?
isn't there a way to know if a sender isn't valid anymore? such as if a player quits, or rcon disconnects, or anything like that
this is actually pretty untrue
i dont care if you're on 1.8, just dont ask us to help with it
because its 7 years old
just do proper cleaning up id say
What about custom senders
Can I get the logger from a static context? I'm assuming that the logger name is Minecraft, if I can without issues?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Bukkit.getLogger()
nevermind
I see, thank you.
Alex if u understand me it would be great if u guide me
I mean understand the concept
Because abuse singletons really badly
And static sometimes
Far from. I understand the pains of answering stuff on an unsupported version. I'll only ever ask for help in concepts that are shared throughout all versions, and i'll figure out how to adapt it back to 1.7.10.
Oh, apologies.
I can help y with it
There really no difference
Infact
Just make sure u use 1.7.10 api
Is there a clean way to run code when a player leaves/enters an area between 2 given corners?
What do u mean arena
Like from x to y?
U cloud check player location every 4 ticks
Even every 20 ticks
And if he enters the arena add him to hashmap and check more often
( would be bad for many players )
it's not that difficult
PlayerMoveEvent -> BoundingBox.contains(Player.getLocation)
it's really not that difficult
literally what you want
BoundingBox area = new BoundingBox(loc1, loc2);
@EventHandler
public void on(PlayerMoveEvent ev) {
if (!area.contains(ev.getFrom()) && area.contains(ev.getTo())) {
// Entered
}
// do the same check backwards for left
}
Onplayermove event
i'd also back the runnable approach
Is a really bad event to use
doesn't it cause lag?
It seems worse use a runnable
8-10 integer operations
a tick delay is barely the ping to your server
how would I do something like this but in java? ```js
let finished = {}
something.on("event", (e) => {
finished[e.id] = e;
});
(async () => {
let ID = "abc";
console.log("Foo");
while (!finished[ID]) do { await wait(1); }
console.log("Bar: "+finished[ID].value);
delete finished[ID];
})();```
that isn't the best example but I'll try to explain it using words : I want my code to wait until a player chats something and then process their message.
it's fine
PlayerChatEvent -> check if the player is in a map, if they are cancel and get the message
So what I suggested is really bad ?
no
Making a runnable ?
lmao
don't loop unless you have no other choice
what are you talking about 😂
Runnable not a loop
Well you gotta loop over all players
And then loop thru the online players
and you gotta run the loop every X ticks
that's WAY more processing power than what you need
More easy
but I would have to process that value inside the event function, not my original async function. is there a way to just "wait" for a key in a Map?
Futures
your move event fires often enough to make the runnable seem like 0
?paste
check if the locations without yaw and pitch are the same
https://paste.md-5.net/zabayusago.cs
With nms shit (server version is 1.8.8)
Run a loop to near location let’s expand it by 40 blocks from border and if inside it loop every 20 ticks otherwise loop every 400 ticks
Performance
I made that exact same mistake myself
?
Question
They are like
ask
Is there a concept of "pluginid" like there is "modid" in forge?
oh but runnables are faster than player move event
more performance
easier
but no
it's not
?
Was, my typing style is just stupid and I sent that without thinking, my bad.
alright then, thank you.
Player move event is called everytime player moves
Yes?
Really not necessarily
no problem lol. plugins in spigot are simply identified by their name
Is it necessary to loop over all the players then?
Simple, I love it.
also, you can just check if the player just rotated their head
But plugins can have the same name which is not so simple lol
Well on one server it'd be only one
On like the resources section there could be more than one that has the same plugin yml name
true but who tf installs two plugins that have the same name
lmao
well you made a "life steal" plugin
no like
what did you expect lol
Heya! Does anyone happen to know where the source code for https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/bin/SpecialSource.jar
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/bin/SpecialSource-2.jar
is? I've seen SpecialSource on md_5's GitHub, but these jars seem to be custom as they have different code.
"LifeSteal" is not a proper name for a plugin
Lifesteal-Smp-Plugin
Voodoo
Wanna run a server in my network
or similar
no thanks
No thank you, I'd rather someone that knows how the basics of servers work ❤️
What
AND NOONE ELSE DOES
YEEE
This method doesn’t even exist in 1.8
not like even my pc is most likely better
thanks @rough drift
CompletableFuture is better btw
alr
bumppppy
@boreal seal noone ever uses dedicated servers lol
CompletableFuture<Object>
myFuture.get() will throw an exception if it runs out, but will wait until myFuture.complete(Object) is called
I mean dedi's are pretty good for intensive ops
I told him that I have a dedicated server
No to hype
Lol
Not *
Does anyone know if theres a packet that fires off when a bee chooses a new hive?
not bad, not bad, way overkill but not bad
bees are server side
In general I have only 1 game mode
no packet will be sent
I love my proxmox so much ❤️
And my server isn’t p2w no donations at all
EntityRemove, EntityAdd, BlockUpdate maybe?
❤️
Like spawn entity, remove entity
I mean
and beehive update
well ye
So I like to find some people who will like to host their unique game modes there
yes obv when the bee enters the hive it is removed from the world
So you can rip them off
close their connection
and market it as your own
nice
I either have 200 players base
Heya! Does anyone happen to know where the source code for these is?
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/bin/SpecialSource.jar
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/bin/SpecialSource-2.jar
I've seen SpecialSource on md_5's GitHub, but these jars seem to be custom as they have different code.
No not really
Yes really
I’m not that kind of person
I know people like you
Leave a back door
You are that person
I’m ur plugin
what
Does onLoad get fired when /reload is run?
no
yes
LOL
oh it does?!
only enable
Why rip them off
Well now, conflicting answers! o.o
For your gain
ofc it gets run
on load doesn’t get called iirc
might be private ?
you want money, why use that server otherwise
My server is non p2w I don’t need money
wait so I can just ftr.get(), which will wait for ftr.complete(...)?
yep
but .get throws InterruptedException iirc
To pay off my bills
so you gotta catch that
just call ::join
But why
why get
Could be, but I don't see why. It's not like it contains any minecraft code. 🤔
I don't quite understand what onEnable and onDisable do... could someone enlighten me there?
Can I somehow check if a player is touching the world border?
alr, sorry I accidentally created CompleteFuture instead of CompletableFuture so I was really confused why there was no .complete
I mean, spigot tooling is pretty trash xD
they get called when the plugin gets enabled and disabled
I never knew you could enable or disable a plugin
onLoad = when the plugin is first loaded
onEnable = when the plugin is enabled (onEnabled is also called on reload)
onDisabled = onEnabled but disabled
Ieff
onLoad DOES get called on every reload