#help-development
1 messages · Page 1404 of 1
Just asking for advice on how to do it. How am i then supposed to learn it.
You can find some inspiration here: https://www.spigotmc.org/threads/async-update-checker-for-premium-and-regular-plugins.327921/
Thanks that is exactly what i needed! 😄
no
what happens if two plugins want to load last?
what you can do, however, is declare a specific plugin as a dependency or a soft dependency
doing that will make your plugin load after that plugin
Can loadafter in plugin yml
you can also use a schedule to run after the server has started
there is still no guarantee that your scheduled task runs after all other plugins' such scheduled tasks
well it did work with a specific issue of mine regarding multiverse core
yeah
but if I now want to create a plugin that loads after your plugin
there's no guarantee that my task runs after your task
If i serialize an item and then load it by literally copying all the meta, does it guarantee it will be the same item?
For example if i put a crate key inside some kind of bank, and when I want to withdraw it, is it safe to create a same item and just copy the serialized meta to it and give it to me?
if the serializer works, the item going in will be exactly the same as the item coming out
Why not just serialize the entire item
i'm not sure why you're mixing in item meta and shit into it though
I just want to save it directly to a file, from the memory, and when loading it , it becomes the same item
Crate keys are a good example , if they dont work after , something is wrong
ok i'll try, thanks
Wait are there methods for doing that for me?
or do i have to copy the item meta myself?
the bukkit serializer is pretty weak :(
meaning you can set and getSerializable it in a Configuration
is that what Essentials does for kits?
no
but its similar?
it is not
how exactly
i've got one
essentials uses some shitty item syntax parser
it's not a serializer
it can't represent all itemstacks as text
I mean i believe there is no efficient and stable way for doing that
and only has limited options with what it can do
ConfiguationSection::set
ConfigurationSection.getSerializable(ItemStack.class)
there's also bukkit object output stream
but it might have the same issue as the config serializer
github is best
Lmao I think not by the looks of that thumbnail
if you know what youre reading
a written guide is always better than a video
if you know how to program already yes
but if you've never used an api that is probably not the case
If it’s spigot api you fundamentally need to know java and oop
look up a guide on java first
once you can write some simple shit in java, then you can start getting into the bukkit api
Hello, i'm Comparing location. but it returns false always
if (event.getClickedBlock().getLocation().toString().equalsIgnoreCase(reactLocation.toString()))
[20:25:26 INFO]: Location{world=CraftWorld{name=world},x=-46.0,y=82.0,z=-16.0,pitch=0.0,yaw=0.0} Location{world=CraftWorld{name=world},x=-46.0,y=83.0,z=-16.0,pitch=0.0,yaw=0.0}
[20:25:26 INFO]: Location{world=CraftWorld{name=world},x=-46.0,y=82.0,z=-16.0,pitch=0.0,yaw=0.0} Location{world=CraftWorld{name=world},x=-46.0,y=83.0,z=-16.0,pitch=0.0,yaw=0.0}
``` (toString() location)
it's same
Why are you turning it into a string? You can simply compare the two objects with .equals
yeha, i already tried with that too 😭
but it doesn't work
if (event.getClickedBlock().getLocation().equals(reactLocation))
how can I test distance squared? 🙂
reactLocation.distanceSquared()?
what should I put on ()?
it needs double
ah! thanks i forgot to see javadoc
it returns 1.0
ah
I understood thansk!
Location::equals tests both the position and the direction of the location
meaning the two locations need to be exactly the same
help ```package me.yowshee.test;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
public class diamondBlockBreak implements Listener {
@EventHandler
public void onPlayerBreakBlock(BlockBreakEvent event) {
Block blockBroken = event.getBlock();
if (blockBroken.getType() == Material.DIAMOND_ORE)
{ event.setCancelled(true);
blockBroken.setType(Material.AIR);
ItemStack iron_ingot = new(Material.IRON_ORE)
blockBroken.getWorld().dropItemNaturally(blockBroken.getLocation(), iron_ingot);
}
}
}
why no work
down to like 1/8000th of a block and some minute fraction of a degree for the angle
i am new to java
you can start by describing "no work"
why will this not compile
what does it say when it doesn't compile
I mean surly your IDE will tell you why it won’t compile
There is nothign visibly wrong with that code
then WHY
we can't tell you why your code explodes if you don't give us any information
look at your fucking IDE
it tells you
or javac output if you're not using an ide
that is not valid java
new ItemStack....
wdym
You can’t make a new nothing
ohhhhhhhhh
If I want to create an universal class which supports both bungee and bukkit, how would I do that? Because it can't extend 2 classes
you don't
you create 2 classes
and move your plugin's main functionality to a third class
Ok
the purpose of the bukkit/bungee classes becomes to be the entry points for bukkit and bungee
Your plugin needs two main classes, one for Spigot which extends JavaPlugin, and one for Bungee that extends Plugin.
Yes, but I want to let people extend the 3th class, what do they have to type in the main?
Ok
they just extend your main class then
call the classes BukkitEntryPoint and BungeeEntryPoint and MyPlugin respectively if you want
an extending class would then extends MyPlugin
that said why do you want someone to extend your main class
This is what I want
public class Bukkit extends JavaPlugin
{
}
public class Bungee extends Plugin
{
}
public class Universal
{
}
public class InMyPlugin extends Universal
{
}
no suitable method found for registerEvent(me.yowshee.test.diamondBlockBreak,me.yowshee.test.Main)
waht
include a plugin.yml for Spigot and a bungee.yml for Bungee
why do you want to extend your main class
Because it's an API
How? Pls give an idea with code
public interface Universal
whatever methods you declare there
Yes I will choose the methods for my API then
halp
Some defaults as getConfig, onEnable, onDisable, getResource, etc
oh
incompatible types: org.bukkit.Material cannot be converted to org.bukkit.inventory.ItemStack
stupid
bruh
python wasnt this hard
why java do me like dat tho
I want an apple
why are you giving me an orange
give me an apple instead
that is a fucking orange
Oh I got ya
public interface Universal
public class Bukkit extends JavaPlugin implements Universal
public class Bungee extends Plugin implements Universal
And I let people extend Bukkit or Bungee, and if I want to get the plugin I just need to call the Universal interface?
it wants an itemstack
you are giving it a material
an apple is not an orange
you give it the apple it wants
it's not that hard
no, you just suck
(at java)
and listening to instructions
you want an itemstack
you have a material
new ItemStack(Material)
maybe look at the itemstack class and see if it has any constructors that take a material
Cmon learn Java
sigh
They literally gave you all the code you need
tvhee told you already
consult the fucking tutorial
No it's your first day with bukkit
we're not an interactive day 0 tutorial
Drop it and learn java
Learn Basic java before you attempt plugins
October 2020 isn’t even that old
👀
You are struggling on the Basics of object constructors
every object has a Type in Java.
so you need to declare the type of that variable as well
ItemStack iron_ingot
the first one is the type of the variable/field
and the second one is the name of the variable/field
= means put the thing on the left in the thing on the right
new ItemStack means "make me a new itemstack"
=
close
no
ok, so you want to create a field called IRON_INGOT
so the first thing you do is create your field ItemStack IRON_INGOT
then you need to assign it a value, which youwant to be an ItemStack
so ItemStack IRON_INGOT =
now you have to create the value ItemStack IRON_INGOT = new Itemstack(
and to create a new ItemStack you have to tell it what type
If only the internet had info on this
dude has literally not written a single line of java before this
ItemStack IRON_INGOT = new Itemstack(Material.IRON_INGOT);
doesn't know how to declare a field, how to assign anything in it, let alone how to construct the thing to assign
._.
literally knows nothing
Please go learn some basic Java and come back here
Hey! I cant seem to figure out how to check if there is a player in a worldguard region
anyone capable of helping me?
you're in for a fucking aneurysm
basically
Pretty sure it’s a simple get region from location
the folks at enginehub don't document their shit
and all of their existing documentation is from like 3 major versions ago
and all of the posts and guides on the internet are outdated
the best option is to ask on the enginehub discord
their wiki thing has a small set of simple functions documented
You don't
cant
checking whether a player is in a region is one of those functions
yeah but i cant seem to figure out which function it is 🤣
but go pester them on their discord so maybe one of them will eventually write proper docs
no, you're the stupid one here
It's not Intellijs fault
OMG
just use the Minecraft Developer plugin
a plugin.yml is just a text file that has no TABS and is formatted as YAML
you need to smash the little buttons on your keyboard for a bit
this will generate the content for the file
okay so if u just use the mc developer plugin it auto generates one for you
just remake the project with spigot as the minecraft version
and it wil make one
i would tell you to look at the bukkit docs and learn how to write one yourself, as that is a crucial bit of information for a developer, even if they use the mcdev plugin
but based on how you are here asking about day 0 java questions, you probably aren't into learning
In my opinion everyone should manually create their project and first plugin when starting out.
hey @wraith rapids cant i just use this: ``` if(region.getMembers().getPlayers().contains(event.getPlayer())) {
}```
on a player move event
Depends on how you are building yoru pluign
uh, don't
then it goes in the resources folder
that is going to make the server shit bricks with a lot of players
oh
player move event fires like multiple times a tick
and having worldguard check every player's location against every region for every player every time any player moves
This would be ok IF you early return
is unwise
only process IF the player has moved a full block
so getFrom().getBlockX() != getTo().getBlockX() etc
yeah but idk if this is a good option xD
ill just go ask those guys at the other discord
or something
its teh only option if you need to check players entering an area
I’m pretty sure get members gets the list of added players
Not the players inside it
Also there is a region entry event iirc
yeeeah that's also true
members are like the owners/residents of a region
not just the people in it
i want a countdown on a hologram to tick down when players are in a area
then when it hits 0 it triggers a method
thats it
If they have an enters event use it
yea and reset when they leave right?
it will be running the same code as you on move
i have been kicked for the 3rd time
what i meant to say
wHy tHe fUcK is pLugIn.yml Not ComPiLiNG
hello?
have you all given up on me
hi yowsheeeeee
a long time ago
show yml
helo
pleas
the issue isn't his yml, it's him
he has not written a line of java ever and refuses to read a guide
u assume i am male???
and has no idea what he is doing
tru
There are no girls on the Internet
the entire one will be How TO DO HELO WORL
ah
Hey! I have a problem, im developing a custom items plugin, but if i enchant the weapon it doesnt has its abilities anymore. I do know why, because i made the event only executing, when you have an item with that item meta. I want my players to enchant it by themselves so i couldnt just add the enchantments in the meta.
wyht
it's in the fucking test directory
yes
where do put
what the fuck
just put it in the main directory
in the correct directory
oh
now he's going to literally put it in the main directory
you sure you selected spigot. because for me it put it into the main folder automatically
else create a new project
and just copy everything over
oh yeah
this good?
main: 1.0
version: 1```
i recommend you give up
well the minecraft developer plugin automatically makes a yml file for you
NEVR
i recommend you learn how to code
I have a problem, im developing a custom items plugin, but if i enchant the weapon it doesnt has its abilities anymore. I do know why, because i made the event only executing, when you have an item with that item meta. I want my players to enchant it by themselves so i couldnt just add the enchantments in the meta.
enchanting an item changes the item meta
because the enchant is stores in the item meta
if you are doing isSimilar or equals or whatever, an item with an enchant will obviously not be equal to an item that does not have an enchant
what you should do is use the persistent data container of the itemmeta to store a tag
and then use that tag to identify the item
ok im gonna try
I dont get it lmao
Does the PotionSplashEvent also trigger when throwing lingering potions? or do i need a seperate LingeringPotionSplashEvent?
which type of listener should I use to just changed the packet completely
like monitor or veryhigh
or high
No changes on Monitor
depends on what you are doing
uh some sort of runes that come up on attack
trying to cancel the damage_indicator particle
if you are always going to cancel then highest
ok
uh dumb question but
how can I check if its only damage_indicator type of apcket
That would be protocolLib not spigot
public class BukkitPlugin extends JavaPlugin implements UniversalPlugin
{
@Override
public InputStream getResource(String name)
{
return ((JavaPlugin) this).getResource(name);
}
...
Why do I get this error? java.lang.StackOverflowError: null
that method is calling itself
I just want to call the JavaPlugin method, if I click with my mousewheel I will also get the JavaPlugin method
You are overriding so use super
@Override
public InputStream getResource(String name)
{
return super.getResource(name);
}```
Yes thanks
Btw is there an option that I can override onEnable from JavaPlugin, and do my thing and then the plugin which is extending my plugin must use my onEnable?
If your universal plugin actually has logic why is it an interface
Cause I want to have multiple bungee and bukkit support, and both have 2 the same methods so for some of my classes it doesn't matter if it's bungee of bukkit
Have you seen luckperms? They kinda fix this by splitting common bootstrapping into a separate class while platform based bootstrapping happens in the entry point class
Can you show the source?
And which class?
common/.../plugin/
bukkit/.../
Classes named like LuckPermsPlugin, LuckPermsBootstrap etc
Ok
yall thought i could not code
https://www.spigotmc.org/resources/orechanger.91811/
lol
i'm proud of you
thank you 🙂
pog you!
You don't need so many classes for the same event....
lol no its for different blocks
yeah but like...
its easier for me to access
sh sh sh
Tho why is it called Event when you’re just listening to an event. By the looks of it one could be fooled enough thinking that’s an api
Well we know you can copy/paste
pff thats THEIR fault
Not really
bruh
well yes, but actually no
At least no static abuse (:
what is static abuse
a bad thing
something bad
what i actually do
People who uses the keyword static whenever they want to design logic
and i am too lazy to change my static abuse
can yall try t out?
You could just do java switch (blockBroken.getType()) { case DIAMOND_ORE: //code break; case IRON_ORE: //code break; default: }
well
they are just giving you tips
they don't judge u, we'all are proud of you
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if you spam more i change my mind
nvm
i swear to god if you rate it one star-
can any1 rate it two star?
sure if u ask so
store the entity and sent living entity packet 🤔
if your entity isn't a LivingEntity yes
otherwise this one https://wiki.vg/Protocol#Spawn_Living_Entity
Can you change the colour of light
nope
would have to look it up
seems like you just have to catch the particle effect packet, check if the particles are those which you don't want and block/cancel it
how can i add a white bed to a gui on 1.12?when i try to make an itemstack with material: Material.WHITE_BED with amount 1 add some meta to it and add it to a inv i get No such field error: WHITE_BED
What java version are you compiling for?
1.16
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
in your pom
Anyone can help me setup a script to automatically execute ./start.sh if the process -java spigot.jar is not running?
1.8
how i disable a colidition of projectile between entity using a spigot api ?
?paste
YOO it works
TYSM
Your entire Listeners in one class https://paste.md-5.net/bifiriqece.cs
xD
and how do i generate it
wdym
static {
replacements.put(Material.DIAMOND_ORE, Material.IRON_ORE);
replacements.put(Material.EMERALD_ORE, Material.LAPIS_ORE);
replacements.put(Material.GOLD_ORE, Material.REDSTONE);
replacements.put(Material.IRON_ORE, Material.DIAMOND);
replacements.put(Material.LAPIS_ORE, Material.EMERALD);
replacements.put(Material.REDSTONE_ORE, Material.GOLD_ORE);
}
@EventHandler
public void onPlayerBreakBlock(BlockBreakEvent event) {
Block blockBroken = event.getBlock();
Material material = blockBroken.getType();
if (replacements.keySet().contains(material)) {
event.setCancelled(true);
blockBroken.setType(Material.AIR);
ItemStack itemDrop = new ItemStack(replacements.get(material));
blockBroken.getWorld().dropItemNaturally(blockBroken.getLocation(), itemDrop);
}
}```
Hello here! config getkeys returning only first key! My config looks like:
data:
test:
d: 1
ee:
a: 2
and code:
for (String name : ReactData.ReactDataFile.getConfigurationSection("data").getKeys(false)) {
Bukkit.broadcastMessage(name + " <");
``` and it returns only test
where is on enable
ohh
in the main one
okkk
Yep, thats all the code you need in one listener class
ok
ayo how much do I have to wait for the plugin to update the config.yml
afte like setting it to smth
you have to save it
wait but how do i make it NOT generate a config if it has been already made
actually nvm
config too hard
this.saveDefaultConfig() in your onEnable
saves a config from your jar to the plugins data folder, IF one doesn;t exist
what are you trying to change?
do you have anything in yoru config now?
well i could do that but i also want it to be customisable
so basically i can put at the start random: true
or false
and if it is true
No real point in customizing. As soon as players break an ore they know what to look for
thats even easier
sec
Pls help I need antigrief chest plugin
And login plugins pls help
nlogin for login
is there a config.reload or do i must use YamlConfiguration.loadConfiguration
File file = new File(plugin.getDataFolder().getAbsolutePath() + "/config.yml");
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
like that
Is n login best
wat
I need best login plugin
how can I summon particles with protocolib
and why do you tag me?
yea fk off
not plgin recommendations
things like this
not i nEED l0gin plUgIN
i cAnt BuY MinECrAFT
How can I send a global particle?
o yeah I think so
ok
Probably this, but I've not tested it https://paste.md-5.net/buladuwipi.cs
that just gives you a random ore
uh um
l.getWorld().spawnParticle(Particle.CRIT_MAGIC,l2,8, 0.3F, 0.2F, 0.3F); this will work right
idk
yes
If you want different drops then create a second list for drops and add whatever materials you want
i mean this
Every item has a Material
so
Material.values()
so
it would
yes
however no
how
if you just set random to teh Material.values() it would drop a random item when you broke anything
You need teh random List to check what block was broken on line 8
You need a second list for rewards OR pick a random from Material.values()
keep in mind tho that it's also items and blocks
yeh that fine
i just want it to drop anything
since that is a variable i could make a config.yml also
bcz anyone could enter in their own material
maybe an if else statement?
public void Damage(EntityDamageByEntityEvent event) {
if(event.getDamager() instanceof Player) {
if(getConfig().getBoolean("Status", true)) {
Location l = event.getDamager().getLocation();
String p = getConfig().getString("Particle");
l.getWorld().spawnParticle(Particle.p, l, 1);
}
}
}``` what am I missing
seems like I cant use it but does anyone know how
this part
l.getWorld().spawnParticle(Particle.p, l, 1);
if block broken is one of these blocks then just choose a random block to drop from the same list
but if not then just drop what would normally be dropped
thats the code I gave you. It would return a random of what was broken
If you want anything to drop from those ore blocks https://paste.md-5.net/bodixidayi.cs
However I'd not recomend use that
why
You could drop a command block
or spawn eggs
it covers literally every item in Minecraft
ok
I'd recomend you make a rewards list for it to pick from
ok
someone?
spawnParticle requres a particle not a string
how can i teleport a player to a location saved as a lore
Location loc = (Location) clickedItem.getItemMeta().getLore();
doesnt work
Particle.valueOf(p)
i need to open a gui and send them to the location of the item clicked (the item has a lore with coordinates)
how are you going about rebuilding the location from the lore?
i got the lore as an array [x,y,z]
i dont get why i cant cast that to a location and send the player there tho
you can;t cast it as its not a sub type of Location
you need new Location(values here )
so use new Location(world, x, y, z)
then create a new Location from them
hey uh
what am I doing wrong
public void Damage(EntityDamageByEntityEvent event) {
if(event.getDamager() instanceof Player) {
if(getConfig().getBoolean("Status", true)) {
Location l = event.getEntity().getLocation();
String p = getConfig().getString("Particle");
if(event.getDamager().hasPermission(Objects.requireNonNull(getConfig().getString("RunePerm")))) {
event.getEntity().getWorld().spawnParticle(Particle.valueOf(p), l, 1);
event.getDamager().sendMessage("Works also " + p + l);
} else {
event.getDamager().sendMessage(ChatColor.RED + "[!] " + ChatColor.GRAY + getConfig().getString("NoPerm"));
}
}
}
}```
any errors?
you have too much code piled up, you have no idea what you are doing because you simply cant see what you are doing
lol
nope
split that into functions and you will see
it doesnt even send the message
how it starts working on its own
i assume you correctly registerd the event and have the eventhandler annotation
possible to expand the hitbox here?
if you have ur own hitbox system yeah,if not no
wdym custom hitbox system
some have such system for diferent things(mostly gun based)
Gotta create your own bounding box and check if it was clicked.
basically armortands simulating body parts or such
i guess ill go with the aabb solution
please if ur making a custom hitbox system make it properly
non-alighed-axis bounding boxes when @mojang:c_:
how can i change a string to a world ?
you get the world by name thru bukkit
clickedItem.getItemMeta().getLore().get(0)
Bukkit.getWorld(name)
ah
also its nullable so yeah..
thanks
will touppercase make it so it will be like CRIT
well the method name...
hmmm
k
and yes it will make everything
aaaaaaaa
everything works except the particle spawning
event.getEntity().getWorld().spawnParticle(Particle.valueOf(ps), l, 1);
Location l = event.getEntity().getLocation();
String p = getConfig().getString("Particle");
String ps = p.toUpperCase();
package index
huh
hey uhhh
@eternal oxide i got an error java.lang.ClassCastException: com.yowshee.randomore.BlockBreak cannot be cast to org.bukkit.event.Listener
Hey @lost matrix, you know the method you made a while back to show entities, it seems to not work with other players...
i never really noticed though cause i always tested it alone
That says you are attempting to use BlockBreak method as a Listener
idrk why though, i tried adding an EntityPlayer selection but it doesn't change anything
a Method is inside a class. The class implements Listener
ok so what do i change
?paste No clue, you'd need to show code
kk
BlockBreak.java: https://paste.md-5.net/tawoqabucu.java
RandomOre.java: https://paste.md-5.net/teqiceteto.java
needs to implement listener in the block break
BlockBreak implements Listener
how
public class BlockBreak implements Listener{
someone help for some reason I cant spawn the particles Location l = event.getEntity().getLocation(); String p = getConfig().getString("Particle"); String ps = p.toUpperCase(); if(event.getDamager().hasPermission(Objects.requireNonNull(getConfig().getString("RunePerm")))) { event.getEntity().getWorld().spawnParticle(Particle.valueOf(ps), l, 1); event.getDamager().sendMessage("Works also " + p + l + event.getEntity());
the locations work
in randomore.java?
ok
this is one line of code
Location loc = new Location(Bukkit.getWorld(Objects.requireNonNull(clickedItem.getItemMeta().getLore()).get(0)) , Double.parseDouble(clickedItem.getItemMeta().getLore().get(1)),Double.parseDouble(clickedItem.getItemMeta().getLore().get(2)),Double.parseDouble(clickedItem.getItemMeta().getLore().get(3)));
lol
Stop using Objects.requireNonNull its pointless and only hiding any issues you have
create your objects properly
Objects.requireNonNull explodes if it is null
it doesn't make things magically not null
it just makes null things explode sooner
But I like to hide the issues :P
you can hide it by doing
try {
//your code
}
catch (NullPointerException ignore) {}
can someone tell me why my particles arent workin
event.getEntity().getWorld().spawnParticle(Particle.valueOf(p), l, 500, 2, 2, 2, 0.1);
define not working
does not spawn particles
check your valueOf is returning a valid particle
if it doesn't find a proper particle by that name it should explode because it's an illegal argument
but if the code runs without exceptions yet doesn't spawn anything, dunno
What particle are you attempting to spawn?
is there a function in like java standard libraries or apache commons or something to get the lexicographic distance between two strings
not levenshtein distance, mind you
if you already have l as a location, just use l.getWorld().spawn
and try somethign simple like l.getWorld().spawnParticle(Particle.CLOUD, l.getLocation(), 100);
l i the location of the entity tho
doesn't matter, its in the same world
i guess computing the lexicographic values of and distances between strings is kind of expensive
if it doesn;t spawn with a simple spawn code as I showed you its the rest of yoru logic thats failing
i guess i'll just do it myself
this works
so now replace the particle and see what happens
so teh issue is yoru particle it seems
ok
completely forgot I made it so damage indicator packets are not sewnt
Hello everyone if someone needs to setup plugins or server for free dm me. I can help you make it. I am Jr.Developer.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
uh dumb question but can I add 2 blocks to the Y value of l
yes
type l.add and see what shows up
hey how do i send some one a message on spigot*
to send a message to a player you use Player#sendMessage
so
player.sendMessage("Your message");
because . implies it's a static method
o
:: is technically the "correct" indicator for instance methods
but # works just as well
were do i go tho
❓
were do i go to message them
you said player
I am here
i fucking called it
ok
this is the developer channel
shoo
only sub 70 iq junior developers allowed here
?
were do i go
to #general
;-;
I was told to go here
I bet you were not
they misunderstood your question
they thought you wanted to code a plugin
which you are not
OH
So my core plugin has class like StringUtil and FileUtil, should I add something to the name to help distinguish them from the 50 other classes with those names.
not really
thats what packages are for
the class name should indicate what it does
the package name is responsible for distinguishing it from the 50 other such classes
Fair
of course if you have to use all of those 50 classes in a single class, you might want to do something about it
Some libraries like to make classes named String, and my IDE loves to import them by default sometimes
yeesh yeah don't make a god class
yeeeah I don't think calling things String or any of the other standard library class names is a good idea
Agreed
i've started adding Master and Slave to class names at random
yeah well fuck them
i don't have any public github repositories but I've changed the main branch back to master manually on all of the private ones
you should start using cuck and simp too
I changed the default back
simp?
i've also added several branches with names typical to black people with a _slave suffix
errmm, idk if that is really appropriate
if you call attention to something, it will have more attention drawn to it
does anyone know what packet calls PlayerInteractEvent
the arm animation packet
the right click with empty hand
whatever it was called
define doesn't work
doesn't work as in i'm listening to the arm animation packet
and I'm making it output to console but it's not outputting anything when right clicking
only when left clicking
could be that it monitors a different packet for right clicks, I don't remember
what are you doing though
I have a plugin for my roleplay server but I have a different server for every city/town in my roleplay server.
So the inventory has to load from the database when a player joins, but I want to cancel every possible interaction.
of every plugin
block AsyncPlayerPreLogin event until the inventory is loaded
you can block it up to 30 seconds before the client times out
would an inventory still load then?
as in would I still be able to add items to a player's inventory
the player isn't on the server yet during the event
so no plugin can interact with the player
so that wouldn't work
hey does anyone know why my zombie kills stat doesnt work?
you can probably write the inventory data to the offline player's file
that would work
and leave it to the server to load it from there atomically
that sucks haha
that means I will have to rewrite everything haha
thank you
ill try this 🙂
just build the inventory in the PlayerJoinEvent. Whats the issue?
i'm not sure whether the inventory is loaded from disk before or after the event, so check and make sure it's done after
yes
wouldn't work because I want to make sure the PlayerInteractEvent cannot be fired whilest a player is loading
why sending packets from the main thread is faster than from the netty thread wtf
the Interact event can;t fire during the PlayerJoinEvent
i'm not 100% sure but common sense would kind of dictate that the player can't fire interact events before the join event finishes for it
i get way much faster response time to the client when sending packets via main threads
the loading takes up to 3-4 seconds.
async is delayed
im not using schedulers
yeah obv
ill try that first thank you
yeah, 3-4 seconds is yoru data access times. Have the data ready
why are they delayed?
most packets need to be scheduled to the main thread to be sent
oh
so you still get some thread hopping overhead if you send them off the main thread
compared to just immediately getting shat out the tube on the main thread
yes but during those 3-4 seconds people shouldn't be able to interact with anything at all
i don't remember, on paper it's because of the anti xray processing
don't know if it happens on spigot or if it does why
and I also have plugins for backpacks etc that have to be unable to open during loading
read the data from your database during the async prelogin
block until it's ready
then on actual login, apply the ready data
this is my listener: https://ghostbin.com/paste/AWuKP and this is the error i get when I move: https://ghostbin.com/paste/ejZuC
that way the server doesn't shit bricks because you're blocking the join event
yes I'll try that thank you 🙂
if you load your inventory data in the async event there won;t be a 3-4 second delay as you fill the inventory in the join event
should i send packets via main thread instead then? i get way faster response time of client
depends
yes I understand that
that doesn't sound like it would be caused by just thread hopping alone
I'm already using hte AsyncPreLoginEvent
well im overexageratting
thread hopping would be like a few milliseconds at most
but never thought of making the inventory data ready there too
make everything ready there
yeah thank you for the help
lots of plugins make the mistake of making everything ready in the join event
which starts stacking up when you have 50 plugins doing dumb shit in the same tick
haha
even seemingly negligible time usage of a few fractions of a millisecond from loading a bukkit yml file for the player or some shit stacks up quickly
You said I have like 30 seconds in the AsyncPreLoginEvent right
yeah
because at the PlayerQuitEvent in the other server it saves the inventory
and it needs about 2 secs to make sure its totally saved
to prevent inventory loss
to the database^^
if the client doesn't receive any packets from the server in 30 seconds, the connection is timed out
okay thank you
and the server doesn't send any packets while you block the event
(for that specific player)
you could maybe get around it by throwing keepalive packets at the player but that seems kind of dubious
wouldn't need that the longest this has taken ever was max 10 secs
(the loading)
so I think I'll be fine
what line is 45
but using like the bukkit scheduler to hop onto the main thread should 100% be slower than letting the server sync it for packet sending
if(location.containsKey(player)) {
im not using it
location or player = null
im using DedicatedServer
and looking at your event
.executeSync()
it's probably location
which executes it instantly
because player is from the PlayerMoveEvent
use UUID not player
by using .get()
that too
well, more or less instantly
alright ill try that, ty
unless you really need Player
it can't exactly terminate stuff like plugin code or individual entity ticking to just do it instantly
thats not what throws the NullPointerException tho
Its safer to get a player from a UUID as the UUID object is persistent. Player is not
but it might be able to splice it in between ticking of individual entities or however it works
haven't looked at the impl
tbh i always wondered wtf caused that delay because when i enable netty channel chaining, and let NMS handle it its instant and when i would disable it its not instant. Now i know, thanks! I've been investigating this shit for weeks.
❤️
also do you know any library methods for calculating the lexicographic distance between two strings
@wide galleon just assign the new HashMap<>(); after the variable
because now you're assigning it to a static method in your class constructor
so like this? public static HashMap<UUID, Location> location = new HashMap<>();
yes
and do I have to use the uuid or the player
okay