#help-development
1 messages · Page 749 of 1
and gets job done better than lets say vscode
but lacks some features from more full fledge ide's like intellij
or the features are not as polished
and another factor that eclipse is and will be always free
thus businesses can install them on dev environments for little to no cost
intelji has free version too
Have you seen how a damn project is created in eliscape?
eliscape
eliscape
are you talking about some kind of eliscape or eclipse 😄
pretty sure u can configure ram usage w intellij lol
cpu gets destroyed on i3
when starting the projects
and my projects arent that big
are you using an i3 from 2008 or what
i used skylake
lol
Hello, I was wondering if Wall Signs still need to use the GetSide method in 1.20
Im Having a weird issue where an InventoryClickEvent behaves differently if two player are online...it seems to fire more then once or something like that because more then one case is taking place in the if else statement...
It's really weird because it has nothing to do with other players that did not click (After click it sets ItemMeta of an Item and a new Item to Cursor)
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Hello,
I reported a resource of mine asking for its premium status to be removed and convert it to free, and it hasn’t been restored yet. When will it be restored?
@EventHandler
public void onBackpackChangeItem(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
if (state.getManager().getPlayers().contains(p)) {
if (e.getClick() == ClickType.RIGHT && e.getCurrentItem() != null &&
e.getCurrentItem().getType() == Material.BUNDLE && !e.getCursor().getType().equals(Material.AIR)) { // Add to Backpack
//Bukkit.getLogger().info("Added to backpack");
BundleMeta newBackpack = state.getManager().getTeam(p).addItemToBackPack(e.getCursor());
if (newBackpack != null) {
e.getCurrentItem().setItemMeta(newBackpack);
e.getView().setCursor(new ItemStack(Material.AIR));
}
e.setCancelled(true);
Bukkit.getLogger().info("Jo1");
} else if (e.getClick() == ClickType.RIGHT && e.getCurrentItem() != null && e.getCurrentItem().getType() == Material.BUNDLE && e.getCursor().getType().equals(Material.AIR)) { // Remove from Backpack
//Bukkit.getLogger().info("Removed from backpack");
Pair<BundleMeta, ItemStack> pair = state.getManager().getTeam(p).removeItemFromBackPack();
if (pair != null) {
e.getCurrentItem().setItemMeta(pair.getLeft());
e.getView().setCursor(pair.getRight());
}
e.setCancelled(true);
Bukkit.getLogger().info("Jo2");
} else if (e.getClick() == ClickType.LEFT && e.getCurrentItem() != null && e.getCurrentItem().getType() == Material.BUNDLE) { // Update Backpack
//Bukkit.getLogger().info("Updated backpack");
e.getCurrentItem().setItemMeta(state.getManager().getTeam(p).updateBackPack());
}
}
}
Both players are in the same Scoreboard Team and in the getPlayers() list
💀
.
Have patience
But if the players are not in the same team (meaning nothing should change at all vs single player) it also doesn't work
wdym xD
Sup guys
start by returning early
and why are these different checks e.getCurrentItem().getType() == Material.BUNDLE && e.getCursor().getType().equals(Material.AIR))
why did you use .equals for one and == for the other
maybe explain waht you expect to happen vs what actually happens
Yeah a bit unconsistent I agree! But I still dont get why the event fires twice....Even if I remove the contents of the if statements and just run the event itself it comes twice
so how do you know it fires twice?
ah u cant do that
?jd-s
declaration: package: org.bukkit, class: GameRule
?paste
^
if (x.getType() == Boolean.class) {
GameRule<Boolean> booleanRule = (GameRule<Boolean>) gameRule;
}
in principle
Isn't it boolean (the primitive)?
https://paste.md-5.net/hacapujuma.js
guys rate my command framework, i dont know what to add else. I've implemented kick command in under 5 mins with tab completion, permissions, custom arguments, usages etc.
It looks like a big code for such a simple command, but that's just because i've added executor for each case without calling one method externally instead
search google for that
you're casting the generic type
in runtime generic types do not exist
in runtime GameRule<Boolean> would turn into GameRule, and compiler cannot be sure if that object is properly casted
just use @SuppressWarnings("unchecked") on the variable or the method
unchecked casts are not code smells if they're used accordingly
Sometimes you need to use them
even java collection classes afaik some use them
You just have to make sure the type errasure doesnt leave your scope.
Can be done with strong encapsulation and implicit type safety through inference.
Let me show a quick example
public class SomeManager {
private final Map<Class<?>, Something<?>> registry = new HashMap<>();
public <T> void addElement(Something<T> something, Class<T> type) {
this.registry.put(type, something);
}
@SuppressWarnings("unchecked")
public <T> Something<T> getElement(Class<T> type) {
return (Something<T>) this.registry.get(type);
}
}
Like this
The cast is unchecked but never fails as you have internal constraints
I got a logger in it
BTW I’m starting both Accs on the same pc
There is one way you can avoid it indirectly but like else dont care about unchecked casts
It only matters if you know its gonna be… well… unchecked
When you have runtime code that can ensure you get the right type its fine
The warning is pretty harmless tho
Does anyone have an idea how to get all blocks between multiple locations? (What I mean is whether it is possible to somehow get all the blocks in a specially shaped (non-square) region) https://cdn.discordapp.com/attachments/1091344845383147691/1162811890569851060/2023-10-14_19.52.24.png?ex=653d4bf6&is=652ad6f6&hm=341d5ec5b0bc9b85e8e4810988f3a96f11777580a207bce92839ef3e3dd722af&
I talked w some of the java devs at my uni
They really wanna add semantics to disable erasure
but like, legacy compatibility is really important
POV: Md is a java dev
Also a reason why iirc valhalla is so delayed
wait really
I can’t tell if you missed the joke or are also making a joke
take a guess
Idk
i am also making a joke
no hes too scared to do that
There are a few approaches to this. Either by getting the furthest corners, iterating over all blocks and checking if they are inside your shape.
Or by using some 2D discrete math:
- Detect all rectangles by pairing corners with at least one matching axis
- Calculate overlaps of rectangles and shrink them by using area as a priority
- Iterate over all shrunken rectangles (None should overlap anymore)
*If you have two (or more) points in one direction then you need to select the farthest
Does anyone know a good like tutorial or guide of how to make a client sided gui that opens when you run a command?
mb mb
You mean client side as in packet-based or as in client modification which introduces a new gui
You can also do a new gui with texture packs
Great! Thanks for your answer
Hey, question. Im using getConfig() to save and load my config. but im having trouble with the data after a reload
Its lost, anyone knows why?
@Override
public void onDisable() {
for (ZooFeeAnimal a : AllAnimals){
a.HolographicName.removeAll();
}
Bukkit.getScheduler().cancelTask(growTaskId);
saveConfig();
}
My on disable
- Reloads are not supported by spigot. Dont bother trying to support it.
- What do you mean by 'lost', maybe you just override your config on enable again?
is this a gradle error? never used it before
i didnt even set the java i just imported it from github
Hmm no. I dont use any config on onEnable
@Override
public void onEnable(){
instance = this;
ConfigurationSerialization.registerClass(ZooFeeAnimal.class);
ConfigurationSerialization.registerClass(ZooCow.class);
this.getCommand("ZooSpawn").setExecutor(new SpawnZooMobCommand());
this.getCommand("GetConfig").setExecutor(new GetConfigCommand());
this.getCommand("ZooSpawn").setTabCompleter(new SpawnZooMobTabCompleter());
guiManager = new GUIManager();
GUIListener guiListener = new GUIListener(guiManager);
this.getServer().getPluginManager().registerEvents(guiListener, this);
this.getServer().getPluginManager().registerEvents(this, this);
growTaskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(this, this::TryGrow, 0, 20 * 5);
}
it needs java 8 bc it used 1.16 api, file > project settings > top one then change the java version dropdown to a java 8 ver
This is my only use of config
and this one
private void loadEntities(ChunkLoadEvent e){
if(!getConfig().isSet("ZooAnimals")){
return;
}
for(String uuid : getConfig().getConfigurationSection("ZooAnimals").getValues(false).keySet()){
for(Entity entity : e.getChunk().getEntities()){
if(entity.getUniqueId().toString().equals(uuid)){
System.out.println(entity.getUniqueId().toString());
System.out.println("Found");
}
}
}
Do i have to use the saveConfig() on disable?
i know how to change it i just assumed it imported that from the github
most likely they just dont have it set on toolchains so it didnt auto realise
You don’t need to saveConfig on disable
no, u use saveConfig() whenever u write to ur config in principle
altho hopefully that should be almost never
yh no im to lazy for stuff like this
jetbrains released their own ai
ZooFee.getInstance().getConfig().set("ZooAnimals." + animal.getEntity().getUniqueId().toString(), animal);
ZooFee.getInstance().saveConfig();
I save the data here
Everything gets saved, normally
same error on java 8
ZooAnimals:
edb4b106-7c37-433a-962d-33f48f20c9f2:
==: org.example.elwarriorcito.zoofee.Models.CustomMobs.ZooAnimals.ZooCow
thirst: 12
entityUUID: edb4b106-7c37-433a-962d-33f48f20c9f2
entityType: COW
sex: Male
name: §8§lZoo§f§lCow
health: 12
age: Baby
hunger: 12
Oh boy
But after i reload, there is no data on getConfig
you dont need to reload
Let me try with restart
reload is only really useful if u wanna load in what the server owner has edited into the config.yml file (or on startup obv)
What could be other possible reasons for this
What java version do you run gradle with?
didnt even know i can change that this is my first time ever using gradle
maven superior
And what java version do you build for?
i didnt even try to build anything yet it gives me that right away
i think
yh it does as soon as i reload gradle it gives me the error
oh yh that is missing
Sounds like your java version is just too new to run gradle properly
what ever that is
Ah its a dependency in your build script...
do i need to manually download it or what?
its husksync
Dk what that is
-Dskip.tests=true
feck
That big of a project and uses groovy dsl 💀
leave groovy alone
Mye I suppose
Anyway you probably wanna replace replace tokens with the standard processResources#expand(props)
@valid burrow
husk sync is just broke, even the release version
Feels bad man
💀 hopefully no one places a husk spawner at the location where my spawn is in another world
It'll sync the husks into the player spawn!
arlight
well if hushsync is so brocken what else should i use
why does this happen and not like retract / go down
public void progress() {
boolean end = false;
if (!clicked) {
// display smoke particles
playFocusWaterEffect(source);
} else {
Vector direction = GeneralMethods.getDirection(startLocation, endLocation).normalize();
direction.multiply(speed);
if (startLocation.distanceSquared(endLocation) <= 1.5) {
end = true;
startLocation.subtract(direction);
new TempBlock(startLocation.getBlock(), Material.AIR);
}
if (startLocation.distanceSquared(endLocation) >= 1.5 && !end){
player.sendMessage("start");
startLocation.add(direction);
new TempBlock(startLocation.getBlock(), Material.WATER);
}
}
}```
add and subtract returns a new instance I believe
same goes with multiply for direction
Bukkit vectors are mutable
oh only location then ig
Location is also mutable
Yeah looks like you're right
🕺🏿🕺🏿🕺🏿🕺🏿
i <3 olivia rodrigo
Ey. I have a custom config, there is data inside, but when i log it, it doesnt show anything
System.out.println(ZooAnimalsConfig.getConfig().getConfigurationSection("ZooAnimals").getValues(false));
``` Im trying to log it like this
this is my config file.
```yml
ZooAnimals:
bab53bd0-7de5-4f23-811d-88041920b0f1:
==: org.example.elwarriorcito.zoofee.Models.CustomMobs.ZooAnimals.ZooCow
thirst: 12
entityUUID: bab53bd0-7de5-4f23-811d-88041920b0f1
entityType: COW
sex: Female
name: §8§lZoo§f§lCow
health: 12
age: Young
hunger: 12
it logs as: {}
Her music slaps frfr
@solar musk what's your goal?
Load and unload JARs?
Do you want to unload it?
Or do you want to just use it
you need to add a parent cl with the class
does ur gf like her so you have to too
What I do is simply
var classLoader = new URLClassLoader(new URL[] { ... }, /* parent class loader, usually the system class loader or the plugin's class loader */)
// Use the class loader, or Class.forName
Yes
Do not do that
Nah her music is just fire
you're also using the system class loader there, if that's in a bukkit plugin, it probably won't work if you want to access classes from your plugin
Where is the "en_us" taken from?
^
For what exactly?
I can only find en_US, but not all in lowercase
I am trying to find all possible locales of Minecraft
yes, use en_US
That's on the wiki
https://minecraft.wiki/w/Language @quaint mantle
Check the section in-game
Those are the language codes Minecraft uses
Np, I had to use them as well like a week or two ago
but do the loaded classes rely on classes from your plugin?
you should probably use the class loader of your enclosing class as the parent, i.e. getClass().getClassLoader()
Hi guys im getting null at line 28 and Idk why https://sourceb.in/lTCem5NMjL
Are you running saveConfiguration before or after createCustomConfig
marco, how exactly does this prevent gpl
ConfigFactory config = new ConfigFactory("config.yml");
config.saveConfiguration();
just doing this
Yep
You're not running createCustomConfig, meaning that file and config are null
you probably want to run that before running anything else
but at the constructor im running createCustomConfig
100% agree
config is null when you call saveConfiguration();
move the config = new YamlConfiguration() to before the if statement in createCustomConfig
Ah yep
I am way too tired for this lmao
oh
theone got your answer @quaint mantle
refer to what I said before, use the class loader of the enclosing class as the parent
now do this
La classe che contiene il codice @solar musk
(The class that contains the code)
the class that makes the class loader, getClass().getClassLoader()
getClass().getClassLoader() iirc
thanks sir, but I should improve it I think yeah?
It works, I don't know your usecase
also it is not a factory, a factory creates new objects, you're just using it as-is
true
Only improvement is in naming, and that is rename it to like CustomConfig or something
No
have you ever heard of abstraction? lol
That's wrong
@solar musk when you create the class loader
new URLClassLoader(urls, getClass().getClassLoader())
breaks* or broke*
Nice
And if I want to create more than one config at the same time?
Create a new instance
CustomConfig configA = new CustomConfig("configA.yml");
CustomConfig configB = new CustomConfig("configB.yml");
bro hasn't heard of abstraction
cmarco is just being cmarco
who r u
I am you from the future
o no
WTF
making pointless plugins, making them premium, saying hes gonna dmca forks of his old repos when the license allowed it
ong
just average cmarco activity
average cmarco
Ai so
The server ticks through every entity including players each tick, right?
I wanna stop that
Only certain players
player.kick 👍
Who's next?
E
why do you need to do that
why tho
^
I need to seperate a player in the captcha world from a verified one
One guy reported
Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaah
"What if he logs off having poison and needs to put in his login?"
The poison would wear off giving an unfair advanted
The thing is
Also you can stop potion effects ticking @grim hound
I am pretty sure there's events for that
I also need this for spigot servers
Yeah
Always when I do that some stuff happens
Like other things also need that making it really unoptimized, so I settle those solutions down
M
.
Mm
Well I guess if that's my only solution
how come 1 of them can produce a nullpointer exception but all the others cant
Well
@grim hound
you can clear the effects while logging in
and after logging in apply them back exactly
The first getTo throws an NPE and the rest of the code doesn't execute
I guess that's my only option
Dudeeeeeeeeeee
Why such limitations?
Anotha question
I've used the IntelliJ compiler for 3 years now
is Item::getItemStack() reference or clone?
clone
But now I've found out that a Headless graphic environment exists and the only solution for that would be using an external library, but it only has Maven. Is there a way I could incorporate maven into my project and have it compile with the already used libraries from the built-in compiler?
Or do I have to
if you really dont want to use maven download the jar from the repo manually
ideally maven is better
Am too lazy to add it now
yeah just make the url for it andmanually download the jar
No idea you could do that
get the repo
add the artifact, add the group, add the ver, add group-ver and boom
send the github and ill do it
But I would have to do that for all of my libraries
And I don't know if all of them even have a maven repo
And I would need to learn how jarinjar compiling works with maven
there's the maven local repo
you can use that
you have two options then
Can i get a sample about a getParent() would be implemented around a herarchiquical structure of commands? Im struggling too much with sub commands caused by recursivity
convert to maven and learn the new stuff, manually download the libraries
What class
i mean the concept of getting a parent itself im designin a simple cmd fraework
But of what?
I made mine in like 20
🏅
technically the sub class shouldnt have a forced connection to a parent class otherwise you loose the chance of using it for a no sub commands command
What? Could you more detail it
if you give a getParent without nullability or able to work without it you can only use single command for /faction something xyz, no longer using it for something like /faction-reload because it wouldnt have a parent
How do you know what he meant. Am I just too stupid for this conversation?
multi platform too
ive seen his cmd stuff already
You mean server engine type of platform?
commandManager
.newCommand("give")
.permission("test.give")
.registerArgument(new PlayerArgument("target"))
.registerArgument(new EnumArgument("type", Material.class))
.registerArgument(new IntegerArgument("amount").orDefault(1))
.handler((sender, context) -> {
Player target = context.getArgument("target");
Material type = context.getArgument("type");
int amount = context.getArgument("amount");
})
.build();
It is composed of 3 main classes:
Command an interface which contains getters and setters for name, aliases, permission, description and parent. It also contains a method execute(Sender<?> sender, String[] args).
Then there is the BaseCommand, which inherits from Command and is abstract, exposing the execute() method of command.
And then there is SubCommand, which inherits from Command and is not abstract, but makes the exeucte() method final and performs all the checks for the arguments and sub commands associated with it.
But my problem comes when it comes to know, if that executed command is a child of a sub command or not. Because a sub command can have many sub commands associated to it, basically recursion and it is a tremendous dizziness at least for me.
Also, what exactly is a command framework?
make it easier to do sub command stuff, just commands in general
some sort of utilities for working around commands easier
what? i explain more i cant understand ssorry maybe im not in my day
Oh shit, looks neat but also real fine to use
int rest = 0;
if(remains.size() != 0)
rest = remains.get(remains.keySet().stream().findAny().get());}
can the Optional from stream.findAny here be null?
remains is a hashmap
that was for the explanation of a command framework
And not really hard to program
Hello, I wonder about bungeecord inventory sync between multiples servers.
i found this "model":
on player leave (event) we get the inventory and stock it in the db.
and on async player join (after inventory clear), we give the inventory
is good?
i know that playerjoinevent is called before the playerleave event in the old server. So i have to wait few seconds before getting the inventory?
just thinking about ways to get rid of the argument "ids" but not sure
maybe overload a getArgument(int) which is the index?
ohh right, my bad
give me like 35 min and ill make a mock of what the stuff could look like
oh yeah, really thanks man. I have more or less done it, but struggling when havign a father-child of father-child
Because you end up in a infinite chain
thats a thing
ah cool
If you’re going to do builder hell you might as well use brigadier
It can hook with brigadier
Yours one is based over Brigadier or im totally wrong?
lol
It also supports contextual tab completion
As it passes the same context object to tab completers incrementally
what what? i cant catch that part
tab completion based on previous arguments
hmn
So you can, for example, only tab complete for materials the player has unlocked
sorry i cant understand it cant associate to it something
oh okay
Or based on the player's gamemode
any reason for using command over command executor
I use BukkitCommand i dont understand which is better to use
any reason to use that over executor
I think i use BukkitCommand because is less code for CommandMap registration
If you use CommandExecutor, you need to reflect over PluginCommand and then CommandMap. Atleast from what i have tested
ill use executor just for the example, same concept would follow for it regardless
fun thing
if you register commands after the server has loaded you need to resync the command map
There’s api for that
don't think so
Or just don’t register stuff super late :p
Is this to do with sending it to players
Or is there something else you have to sync
no I just need to load databases first and check what kind of setup based on what kind of databases we're running
I meant this
Wut
yea i dunno either
//Count is the number of items to be removed from the inventory
//CountMaterial is how many total items of the material are in the inventory
ItemStack rem = new ItemStack(material,count);
PlayerInventory inventory = player.getInventory();
int volume = countMaterial(inventory,material) - count;
inventory.remove(material);
inventory.addItem(new ItemStack(material,volume));
player.getWorld().dropItem(player.getLocation(),rem);
Why do yo not use BukkitCommand, it skips the PluginCommand reflection
this is pretty much just my cmd stuff reskined but it should give you a concept https://paste.epicebic.xyz/oxeyomutib.typescript
right really thanks i will check it
right, but there i have some small detail
I just get struggling with the helping part because i dont want to send fully help
I want to send it individually for each commands like:
if run /faction which is Parent of all the single and parent associated to it, will only appear the name of them.
if run /faction <sub command> - will appear all the single and parent names
Do i explain?
I was told by Zacken to implement some sort of getter for parenting, which allow me to know which is his father and then do the logic for usage or help as you want to callk
pretty much the way i would handle that usage is if they run /faction it sends the faction class sub commands, then the single command can arg length check and send usage
this doesnt work
or rather
it only works sometimes which is worse
nevermind my plugin is creating ghost items SOMEHOW
all im trying to do is make a player drop items bleh
What do you mean by that
i have a bunch of items in a player's inventory
without extra data
stuff like apples
i want to make them drop all but x amount
but so far I've had ghost items in my inventory, items in the world that arent shown to the client, and infinite loops of picking up items and dropping them again
Should be simple to just remove them and then drop them
Maybe add a pickup delay so they don’t get picked up right away
null or Optional
By convention of the standard we only return Optional, we don't really store it or pass it to functions, else use what you prefer
Well notably, Optional is quite limited since it its just a nullable object wrapper, as opposed to kotlins nullability, or rusts Option etc
Why you i wanted someone to say, "Well Optional is bad you should use null"
Basically don’t have an Optional field lol
either im color blind or this color codes doesnt exist
That is light green I'd guess
hex
Yeah and a hex code ofc
its probably like f6ffc3 or cfd3a2
since 1.16
Yeah that feature broke my plugin back then
Well wasn't mine - but was the reason my fork established as the standard back then
🫘
beans
Definitely #CFD3A2
What is the proper way to dispose of scoreboard teams on plugin disable? I thought:
if (game.scoreboard != null) {
game.scoreboard.getTeams().forEach(Team::unregister);
}
would be fine, but I keep getting this error whenever my server boots up: java.lang.IllegalArgumentException: Team name 'Blue' is already in use
And no, the code responsible for creating the team is only ever called once.
Version 1.19.2
Well why are you disposing of the teams when you could instead just not register a team if it exists already?
Because the teams shouldn't exist when the plugin is unloaded.
I would assume it is generally bad practice to keep bits and bobs left over from the plugin when it is unloaded.
i'm working on a plugin to warp players after a time delay on the condition that they have a certain permission. however, i'm having trouble dispatching a command after the delay. i understand that the problem is because i'm trying to dispatch a command outside the main thread, but i'm not sure how to do this instead.
here's my call:
EXECUTOR.schedule(() -> runCommand(target, args[2], args[3]), delay, TimeUnit.MILLISECONDS);
and here's the method it calls:
if (target.hasPermission(permission)){
System.out.println("warp "+warp+" "+target.getName());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "warp "+warp+" "+target.getName());
}
else System.out.println(target.getName()+" does not have "+permission+" and will not be teleported to "+warp);
}```
Mhm
thank you very much, so if im trying to feed off essentialsx warps then the best route of actions to read their config files and grab the world/coords myself?
Please I need help in networks to solve my school homework. The teacher asked us to set up this topology, where we have 2 sub networks:
a)
host: 192.168.100.0/24
mask: 255.255.255.0
gateway: 192.168.100.1
b)
host: 192.168.200.0/24
mask: 255.255.255.0
gateway: 192.168.200.1
And what you asked us, is that the sub networks cannot talk to each other. And at the same time, that a specific pc of the sub network 1 and 2, communicate between them in my case I have these pc to use 192.168.100.11 and 192.168.200.11
mask b is fucked
teacher gived us the thing
I cant change it haha
I done this config illusion
@wet breach help with this shit I skipped submasking classes
i just did this:
configure terminal
access-list 101 permit ip host 192.168.100.11 host 192.168.200.11
access-list 101 permit ip host 192.168.200.11 host 192.168.100.11
interface FastEthernet 0/0
ip access-group 101 out
interface FastEthernet 0/0
ip access-group 101 in
@wet breach
@worldly ingot sorry for tagging but i need to fix this its for school sorry to disturb
who know??
bro is that cisco PacketTracer 💀
Let me know pelase
yes!!
good luck lmao
:kekw: no

You dont know everythibg?2?1
you know about it??
Never seen it before
right really thanks
good luck lol
you know about it??
please its something easy to do but cant understand why
So the sub networks is already solved. the only part is the 2 pcs on either network to communicate. This is solved by setting up a route on both switches so they can see each other and then you just use firewall rules that if its from a specific ip or host it can be forwarded on the route
The mask you would use is /32 if i am not mistaken
Thats dumb as that is the proper way. I suppose you could do it on the master and force feed the routes instead
Yeah that why is dum the config
Also take un account we configuring locally we dont get outside to internet
Well to feed routes the proper way with much issue is to use rip
But since you cant configure the slaves you have to go with dumb filters instead
i have configurad manually and static each PC that maybe help u ti understand
putting yo each PC from sub 1 to 100.10, 100.11 and 100.12
Smart with sub net 2, but instwad of 100 is 200
You can do that but subnet mask needs to be 255.255.0.0 then
As long as both switches have that subnet and same gateway. They can see each other. You would make a rule to block all ips from either except the two you specified
Ideally the other way you would set this up is assigning a second ip to those pcs of that of the other switch
Avoids needing rules
Not sure if that is an allowed solution but it does conform to the rules you said
It was what You mention Frist
Hello, I wonder about bungeecord inventory sync between multiples servers.
i found this "model":
on player leave (event) we get the inventory and stock it in the db.
and on async player join (after inventory clear), we give the inventory
is good?
i know that playerjoinevent is called before the playerleave event in the old server. So i have to wait few seconds before getting the inventory?
well
It's not that PlayerJoin is called before PlayerLeave
but the principle is the same
Storing data is often slower than reading data
If you have full ownership of the server and this is just a personal project, or you have high expectations of the people using your plugin
You make server A tell server B the data before sending the player
And server B caches that data for ~10 seconds
Server A then sends the player and saves the player's data
While server B already has the up-to-date data
Or if the player takes forever, the database will also be up-to-date by the time the data expires
It's a bit foolproof
Want to make it even more foolproof? Send a confirmation packet
Doubles the latency but 100% ensures there's no desync and the data is always cached
how do i only get the name when i use the getOnlinePlayers() method
well that returns a list of all online players
and for each player there's a getName() method
String name = p.getname ??
Iv say that
(Joinevnt before leave bot how Times ? Dew seconds or ms?)
Yes i throught about that but i have to be sure that i manage all bungee changement requests. The seconds probleme: if i have the inv but between the data save ans before server move( fews seconds interval) the player inventory got changement will not be saved
BatEntity class which extends EntityBat, doesnt spawn. The code is:
Spawning bat etc. https://paste.md-5.net/soyusamuyu.cs
Custom bat class: https://paste.md-5.net/ucogewajil.java
the sout in the loop prints the location correctly
but there isnt a bat there
😔
How time I have to wait before téléporte ?

no clue how you expect to have AI working if you never register the bat to the world
Also I'd prob send metadata packets
wtf my computer just told me i havent used java in 6 months
yea suuuuuure
Lol
Do you go outside?
Hello I have a problem configuring my bungeecord
Can someone tell me how I load a properties file from the resources folder? (maven)
i tried some different ways and all of these return errors
also google didn't help lol
How to spawn skeletons that dont attack players?
I tried setting their attack speed to 0 with attributes but I got errors
that they dont have attack speed
does setAI(false) work?
I would try setting the follower range attribute (not sure about name) to zero or maybe negative value
setAI(false) will disable the whole AI
no more walking, no attacking, nothing
basically a static NPC
doing nothing
yes, thats what I need, ig
what is your goal?
to shoot random players with this: ```java
public static void shootPlayer(Skeleton skeleton) {
Player target = findRandomTargetPlayer(skeleton);
if (target != null) {
Location skeletonLocation = skeleton.getEyeLocation();
Location targetLocation = target.getEyeLocation();
Vector direction = targetLocation.toVector().subtract(skeletonLocation.toVector()).normalize();
double arrowSpeed = 1.0;
Vector velocity = direction.multiply(arrowSpeed);
Arrow arrow = skeleton.launchProjectile(Arrow.class);
arrow.setVelocity(velocity);
}
}```
Hmmmmm, I doubt then that setAI(false) will work. Try it ig.
I've never worked with that
shootPlayer will never be called with no AI
oh you are calling that yourself?
that looks like wrong firewall/port/ip settings xd
as it is written there
its a custom method
fyi: early returns make code very pretty
if (target == null) return;
// ... do stuff when target is not null here
I mean as I said, try it with no AI. If it works: perfect, if not, come back ^^
Is there something like an auto-import?
I have a method called useMessage(String key) now that gets messages from a properties file (for language support) and I don't wanna import that in every damn class
((CraftWorld) location.getWorld()).addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
register like this?
did this + sent the metadata packet but still not working 😔
i meant the trivial case lol
like the method does things
i just forgot the name for when its in a case where it doesnt need to
yep
Hey I'm a bit lost with setting up sqlite for Spigot, what library should I use and how do I add it to my project?
I tried looking at the online docs but it confused me a bit
which part in the docs confused you?
is there any way to detect when blocks break naturally and to interact with its drops somehow
or is nms needed
BlockBreakEvent?
I think there is block.getDrops() iirc
blockbreakevent only occurs if the player breaks the block
Block#breakNaturally() doesn't involve a player
i'd also hope it to involve break events like grass or torches being destroyed by water
then call event after that
In a certain state, I want my plugin to disable. I managed to do that.
The problem is, in this state, there's a shit ton of log when executing a command of said plugin (because it is disabled, lol)
But I want my plugin to not be there at all. I basically want it deloaded. Is this possible?
no
nope
Check if a block can suffocate an entity
What you can do before disabling the plugin is unregister the listeners and commands
Should solve that problem
anyone?
A custom bat class is useless if you dont actually spawn the bat on the server.
am I just supposed to get the craftworld instance and use the addEntity method?
Hi all guys, I'm writing a plugin for the Hub, how could I create a system that through config you can add new items to the compass, with title, lore etc etc. Because I currently have created a configurable compass but with objects already configured via code, I would like to make the plugin more extensible
In my case i get the compass inventory and loop over the config section of ítems
Hmm ok
And create each item thru a item builser for naking it easier
Ando them add it yo the inventory
Once i'm at home i can senf a sample
Currently i'm on cellphone
Okay thanks, so I'll have an idea
Yo nice pfp, got me. confused for a second lmao
How exactly do I unregister commands or listeners? And I assume I would do that in the onDisable() method?
- we‘re the same age, lmao no way
you can unregister listeners but not commands
I thought listeners were automatically unregistered on disable
I kinda expected that :/
Hmm i gotta see what happens from a player‘s perspective when they try to execute a command from a disabled plugin
Maybe i could use the CommandPreProcessEvent where i catch the exception and print that the command is disabled if that is not already implemented
Wait
how i can get if player are looking Entity or Block? There is an Dependecy for do this semplify?
they are
is for that some server force player to users to go through the hub/lobby? (by the time we switch from the hub to the new server, the data will have been saved?)
and what is the best way to stock the inventory in the db? use json? (gson lib)
Btw i still didn‘t manage to serilize inventory contents for json 💀
no, server transfer is almost instant. data saving to a db will take time
I have never done that and i have no idea how i would do that. But i‘ll keep it in mind. I‘m keen to learn
yes, i want say "time taken for transfer to register in db"
is there a good api for plots?
im trying to make a rather simple plot system
with islands instead of the Standard plots
Hmm, I believe plotsquared is nice
will that work in my situation?
Idk lol, havent touched it since 3 years ago
like does it allow me to create plots from my own resources instead of the standart squares
I believe so
alright thank u
:)
any ideas why BuildTools doesn't want to build 1.20.2? Whenever im running 1.20.1 it completely works
Delete all the build tools data folders such as work, bukkit craftbukkit and spigot and run again
yeah im currently doing that, maybe it works
looks good tho
nice thanks its done
Damn i actually found the perfect page for that. Now i could save the vaults in PDC, that‘s pretty cool. Idk how good that idea is tho. Regarding performance
Like if a player has 10 saved inventories and everytime that is loded or saved, the whole playerdata has to be loaded, i guess?
base64 inventory decoded work in (not natif) java environnement/ server?
if i encode my inventory in the server1 in the db and i decode it in the server 2
and i need BukkitObjectInputStream?
yes probably not
yo guys
i need some help, but not related to spigot dev
actually it's about mc tick system
sure
basically i want to know
are they actually accurate to 0.05 seconds
or thay have some 0.00001 difference to real world time
each tick
No it's not accurate and it changes
okay
It's not a static timing system
so i'm currently coding a game
which is related to beat system
and i don't care if it's super accurate
but i want to get a thing which basically highlitghts the screen corners each 0.5 seconds
What language
Yeah but that shit would still have 0.00001 difference
Okay?
?
I mean, at some point you will always not be accurate
ofc
I run my game on an atomic clock

:))))
so well
the thing im interested in is keeping the distance between beats as close as possible
so if last beat played like 0.001 sec later
the next beat would just shift a bit too
cuz i want to run method like prepareNextTick()
each time the tick happens
is it actually a great solution?
and does mc work like this
All I would do is determine how long the actual code took to run
And then subtract that from the default time you sleep for
not really, it speeds up by 1 tick to catch up
and then runs at 20tps
but you should use a delta-time system tbh
and for the inventory sync because join is called before leave, at my join event. Before request the db i have to wait? how time?
yeah but anyways i would need to use some kind of my own timer which runs on higher rate than 60
Just use a game engine
yeah i use unity bruh
yeah but the problem is i don't get how to actually use that shit
unity just has method Update()
which has it's own tickrate
and it's too low for me
FixedUpdate()
cuz i need to sync beats with player inputs and anims and a lot more stuff
0.02 seconds (50 calls per second) is the default time between calls.
and it's still kinda too slow
why?
Yes
I guess yeah 50 ticks
You can change that as well
i don't see it in docs tho
Edit > Project Settings > Time > Fixed Timestep
fr bruh
is it possible to change the fishing speed by ticks / seconds?
hi, i was wondering if there was some sort of HTTP api to fetch things like available plugin versions, download urls, and other details of plugins.
google was unhelpful :/
There is both official api(not sure to what extent it supports what u want) and there is also spiget
as a short clarification i dont mean the java library required for plugin development
is there a link for http api documentation? @hazy parrot
What would you all say regarding the performance stuff
On a let‘s say larger scale server
hey, I remember hearing that certain actions with the server itself should not be done in async which ones?
Or does PDC have some cool performance optimization i don‘t know about?
And also Google about Spiget
If this doesn't suit your needs
alright thank you
async in plugins o.o i‘m scared of that lol
Every IO
Http requests, database access etc
What would be things that can be handled async?
I mean, keeping them in memory should be somewhat fine ?
its a bit bleh tho, PDC is a serialised map
reading/writing is not free
especially with complex types like inventories
Who do we blame for that

Yeah that‘s why i originally had a folder with the uuid of the player where each inventory got an individual file
Spigot needs more byte[] serialization methods
I don't like having to make my own :c
this is not the purpose of making db requests in async so as not to block the main thread?
I mean sure
or just use a proper DB
So that would make more sense than pdc here, did i get that right?
(oops, sorry for the ping)
no worries, and well, yea I'd suggest a DB for this
PDC should really only be used for small bits of data
Simple boolean for a players setting? sure why not
Mhhhhhh don‘t really want DBs. Absolutely no idea about that.
Also the plugin is supposed to be used by any server. Small or big
A bunch of home locations? ehh maybe not
And small servers tend to not have a db
I mean, if you properly write it out it would also be fast enough to work
like, into multiple PersistentDataContainers in each other
o.o
those maps are relatively fast to traverse
(this is not for your inventory problem, those should defo be in sqlite or h2 or something)
(just a general argument for storing data in PDCs)
Wait u mean like included in the plugin? I have no idea how dbs work… yet lll
Mhhh okay…
It just saves locally in the plugin folder
What
Imma try getting it to work with files first. Once that works i‘ll start on DBs
SQLite and H2 are just a file
Oh that‘s pretty cool
But how is that faster than files?
I mean, yml is fineee I guess
make an sql request in the main thread, for example
is not a bad thing?
yml just becomes a pain to work with down the line
Isn‘t it also… well… stored in files?
Everything is a file at the end of the day
Yeah so why use local db instead of IO?
Just make an interface and fuck around with all the impls you want
Or like yaml
Because DBs are designed for storing and querying data
They keep it compact and allow queries
Plus it's not too hard to support both local and external databases
Incase someone wants to share the data across a network
might not be faster but kinda depends on the data too I guess
Its considered bad practice
And how much of it you're storing :p
a big advantage is that you can easily scale like a sqlite db into something bigger once you made some api for it you can just reuse it for other databases usually
All spigot
I will store everthing related or has spigot inside it
so you're saying that async should never be used and everything should be done in the main thread?
No
Real ones use Nitrite db which has similar syntax to mongodb
We are saying the opposite
No
Database operations, IO, web requests, should really be done async
IO should be done async, database stuff is io
Unless you're doing it on startup and shutdown ofc
Then those operations should be synchronous
Fr
Mm not sure how I feel about this
Startup is debatable but shutdown isn't
True
If you're not saving data synchronous on shutdown. You could lose data
Which is no bueno
Make them wait 
Even though you're jumping hoops
ah yes I misunderstood, I thought they were telling me to do everything in monothread but no^^ on the other hand the interaction with the spigot server itself must be done in the main thread right? (entitymanagement etc...)
because i can get concurency and atomic problem?
But you can write them
what is capture states?
you can get concurrency problems in all async stuff
I guess you can do async startup
Probably not worth it unless you are doing a lot of operations/working with a lot of data
Save the state as a data object that can only be read from but not edit. Examples of this would be ChunkSnapshots
ah okay
so as long as you interact with any object on the server: it must be done in main thread?
so in an async event like asyncplayerjoin or asyncchat if i want interact with the player i have to use bukkitrunable and run it in sync?
okay okay (i am trying to make inventory sync), for the inventory sync because join is called before leave, at my join event. Before request the db i have to wait? how time?
can i somehow simulate thread sleep with junit?
what ru tryna test
scheduled task running correctly
hmm, like are you trying to line them up and simulate a race condition or sth?
i have a class that has a map and a scheduler that removes elements under some condition
so i wanna compare elements before and after run
i mean yes its fine if u use thread.sleep in junit, but this sorta sounds like an xy problem
what exactly do u need to sleep for ?
this sounds more like you just populate the map, let the scheduler run and then compare the map data (in the test)
yup
does the EntityDamageEvent fires for both EntityDamageByEntityEvent and EntityDamageByBlockEvent?
I need to check if the player does not get damage from other player, but from any other way
iirc it does, yes
ig this is how I should do it, no?
Intuitive variable names 👍
Yeah. That can probably be prettier, but yeah
if (!(e.getEntity() instanceof Player player)) {
return;
}
if (e instanceof EntityDamageByEntityEvent ed && ed.getDamager() instanceof Player) {
return;
}
// Now do your thing```
And if you're not going to use that player instance, opt instead for an e.getEntityType() != EntityType.PLAYER check
im using it
Then you're fine :p
thx
why dont u just listen for the entitydamagebyentityevent
I think he needs to get any damage event besides that caused by players
because I need it to fire if the player gets fall damage, etc
if (!event.getCause() == DamageCause.FALL) return; ?
!=
I believe the default values just align with Mojang's default op vs. no op. I don't think you can change the defaults
Though a permission plugin would let you deny these permissions
well, i'have analyse few public plugins and I found a plugin code wiches use inventory.setContents in async, is bad partice?
Actually you probably can change the default. You could do it through the plugin manager I believe
Permission permission = Bukkit.getPluginManager().getPermission("minecraft.command.trigger");
// permission is nullable, but it should exist
permission.setDefault(PermissionDefault.FALSE);```
Not recommended, but doable
no, I meant every existent cause
I just gave an example
oopsies
this is while the server is loading spawn. dafuq?
Yes
so it's not something that's wanted for a specific reason? (it would be better to make it in main thread?)
Yes
hey @lost matrix ur code doesnt grab the item in offhand
is offhand not part of inventory?
huh offhand is specific to playerinventory
welp even changing it to playerinventory doesnt count it
urgh
inventory.remove(material) ignores offhand
of course it does
bleh
yea a bug in spigot. Who's to blame for this one? setting the hand item doesnt update it's count if its the same material
side note: calling it does no fix the number not displaying correctly
wtf
and inventoryview doesnt have a update method
ah
calling it at the wrong spot
putting it in the right spot didnt help
might be weird but try using null
spigot has inconsitencies sometimes using null will fix it other times Air is correct
ah as i said wrong spot
this sets it to null to do some math correctly
i then set it to an itemstack thats not air
and call the update
but that still didnt fix it
weird
🤷 Change it to make it work then
???
why is both main and off hand item null when switching armour into a smithing table
of the event i mean
wait
why does a offhand swap also trigger an inventory click
how can I hide a player just from the tablist?
why can a serialized location be duplicated even if the location is the same?
Why wouldnt it
What?
the same location is duplicated when saving to a file
Of course. Every object is "duplicated" if you save it to a file.
i mean key not same
but shold be same
location1: data
location2: data
location2 and 1 this same
Well, obviously not. You cant have the same key twice in yml.
hello everyone!
i'm trying to make a custom mob that works as a battle summon but i want it to not be hostile with the player
is there anything i should fix with my code?
Mahoraga:
public class Mahoraga extends Warden {
private final Player player;
public Mahoraga(Location location, org.bukkit.entity.Player player) {
super(EntityType.WARDEN, ((CraftWorld) location.getWorld()).getHandle());
this.setPos(location.getX(), location.getY(), location.getZ());
this.setCustomName(Component.literal(Common.colorize("&lMahoraga")));
this.setCustomNameVisible(true);
this.setHealth(60f);
this.player = player;
TargetEvent.mahoragaTarget.put(this.getUUID(), player.getUniqueId());
}
@Override
protected boolean shouldDropLoot() {
return false;
}
}
Target event listener:
public class TargetEvent implements Listener {
public static HashMap<UUID, UUID> mahoragaTarget = new HashMap<>();
@EventHandler
public void ignoreEvent(EntityTargetEvent event) {
if (event.getEntity() instanceof Mahoraga && mahoragaTarget.get(event.getEntity().getUniqueId()) == event.getTarget().getUniqueId()) {
event.setCancelled(true);
}
}
}
wait i see now
static 
also no clue why you need the target map rather than storing the target in your custom entity object
blud's playing with nms yet commits static abuse
During sterilization, other data is also saved that simply cannot be the same. head turn, etc.
With a custom nms implementation you can just remove the goal to attack a player in your constructor.
Using the EntityTargetEvent is less reliable. You can just remove it honestly.
Static be killing people
that's the problem
i still want it to attack players
just not the one summoning it
Also this:
event.getEntity() instanceof Mahoraga
Will always be false.
bukkit vs nms entities
i see
can someone please explain why my intellij keeps doing this
indexing
prob paperweight
mine consumes 14gb ram and 100% cpu when building paperweight
whats paperweight?
Remember a long time ago people would always complain about Eclipse being a memory and CPU hog?
Well how the turn tables, IJ users >:((
doesnt explain why it happens when im making a spigot plugin
do i seriously have to kill it every 5 minutes to get any chance at working on my plugin
IJ has to index a lot and it consumes a lot of memory and CPU
Unsure if there's a way to minimize that at all though. I'm not familiar enough with the IDE
I sometimes wonder how so many people have issues with IJ. Everything I do with it doesn't cause issues like the ones they show.
Is it because I use the ultimate edition?
create custom ide then 💀
or do refactoring
Get nms entity through handle
((CraftLivingEntity) event.getEntity()).getHandle() instanceof....
Is like mines, but consumes 24gb of 32gb assigned only to IJ