#help-development
1 messages · Page 853 of 1
i will try to look at the java versions
i have installed java 17, but i dont think thats causing the issue
alternatively you can disable the epoll with use-native-transport in server.properties, don't know whether it'll have a measurable performance impact
right thanks, i will try that
spigot 1.16.5 won't even start using java 17
okay, this definitly not okay
not sound as troller but the server is starting with no problem
just start to spam the stracktrace when pinging or trying to connect the server
java -version
yeah isn't that a 1.8 verison?
yeah lmao
that why it was starting but no giving any version message
okay, know not understanding why is not being server executed with path specified
?
really thanks mfalex, i already figured everything. I appretiate your help as always you helping me
is it possible to create several custom data models in a resource pack for one item? I now have several items that contain a custom date model, is it possible to make only one item, for example, a stick, have several models and the texture of the item itself, as in my case, was not broken
for example
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/stick"
},
"overrides": [
{
"predicate": {
"custom_model_data": 1
},
"model": "ak47/ak47"
}
]
"overrides": [
{
"predicate": {
"custom_model_data": 2
},
"model": "mp5/mp5"
}
]
}```
but even if it is possible, why is the stick texture itself broken?
And then what?
The overrides is an array, but your second override there
I bet the reason for thr Stick breaking is an invalid model json
if model is invalid, then why is the stick with custom model data displayed correctly
smash
¯_(ツ)_/¯
Well, you also forgot a comma after the first overrides array
I see a problem.
Yes, you have two elements with the same key in your json and you also forgot a comma
I have to add to the atlas texture of the item itself right?
minecraft:textures/atlas/blocks.png:minecraft:item/white_wool```
smash
The atlast texture? Man, you should make a correct model file first
md_5 smash
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/stick"
},
"overrides": [
{
"predicate": {
"custom_model_data": 18
},
"model": "ak47/ak47"
}
]
}```
Also, as far as I'm aware thr atlast stuff is done automatically
You had two overrides before
I showed this as an example to ask if it is possible to do this
But I don't have it like that
Hm
Well, the right thing would be to add a new element to the overrides array with other custom model data values and another model location
Honestly, I didn't understand anything from your words.
you mean
"overrides": [
{
"predicate": {
"custom_model_data": 18
},
"model": "ak47/ak47"
},
{
"predicate": {
"custom_model_data": 2
},
"model": "mp5/mp5"
}
]```
?
Yeah
ak47??
That should work, as far as I'm aware
and what about the problem of the broken texture of the item itself
Hello, could anyone help?
Im trying to make a tnt stick that can be ignited using a flint and steel. Because it is imposible for me to make it unstackable, i made the tnt stick change its state from ignited to non ignited when thrown, while working on it, i noticed that it runs both of these functions at the same time.
public static void playerInteract(PlayerInteractEvent e)
{
World world = Bukkit.getServer().getWorld("world");
if((e.getAction()==Action.RIGHT_CLICK_AIR||
e.getAction()==Action.RIGHT_CLICK_BLOCK)&&
e.getPlayer().getInventory().getItemInMainHand().getType()==Material.SCUTE&&
e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getCustomModelData()==1&&
e.getPlayer().getInventory().getItemInOffHand().getType()==Material.FLINT_AND_STEEL)
{
e.getPlayer().swingOffHand();
e.setCancelled(true);
ItemMeta meta = CustomItem.tntStick.getItemMeta();
meta.setCustomModelData(2);
e.getPlayer().getInventory().getItemInMainHand().setItemMeta(meta);
world.playSound(e.getPlayer().getLocation(), Sound.ENTITY_TNT_PRIMED, 1, (float) 1.2);
world.playSound(e.getPlayer().getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1, (float) 1.2);
return;
}
if((e.getAction()==Action.RIGHT_CLICK_AIR||
e.getAction()==Action.RIGHT_CLICK_BLOCK)&&e.getPlayer().getInventory().getItemInMainHand().getType()==Material.SCUTE&&
e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getCustomModelData()==2)
{
ItemMeta meta = CustomItem.tntStick.getItemMeta();
meta.setCustomModelData(1);
world.playSound(e.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 1);
e.getPlayer().getInventory().getItemInMainHand().setItemMeta(meta);
return;
}
}
Any idea what i could do?
What is the windowClick packet?
depends
can it overlap?
why do you need it
There are crashes with it on 1.20.1, (I think)
Just update
I just wanted to know what it was for
It's for when clicking in inventories
No, then they‘d be stackable
Just add a pdc tag with name „unstackable“ and value random uuid
ok
super strange
i even changed the order in which the functions are executed (the function that requires changed custom model data comes first and the one that changes it comes second)... IT STILL RUNS WRONG WTF
@EventHandler
public static void playerInteract(PlayerInteractEvent e)
{
World world = Bukkit.getServer().getWorld("world");
if((e.getAction()==Action.RIGHT_CLICK_AIR||
e.getAction()==Action.RIGHT_CLICK_BLOCK)&&
e.getPlayer().getInventory().getItemInMainHand().getType()==Material.SCUTE&&
e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getCustomModelData()==2)
{
e.setCancelled(true);
world.playSound(e.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 1);
}
if((e.getAction()==Action.RIGHT_CLICK_AIR||
e.getAction()==Action.RIGHT_CLICK_BLOCK)&&
e.getPlayer().getInventory().getItemInMainHand().getType()==Material.SCUTE&&
e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getCustomModelData()==1&&
e.getPlayer().getInventory().getItemInOffHand().getType()==Material.FLINT_AND_STEEL)
{
e.getPlayer().swingOffHand();
e.setCancelled(true);
ItemMeta meta = CustomItem.tntStick.getItemMeta();
meta.setCustomModelData(2);
e.getPlayer().getInventory().getItemInMainHand().setItemMeta(meta);
world.playSound(e.getPlayer().getLocation(), Sound.ENTITY_TNT_PRIMED, 1, (float) 1.2);
world.playSound(e.getPlayer().getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1, (float) 1.2);
}
}
probably a stupid mistake, i tend to do those
but how
...
please take a look at early return
or guard clause
what
?paste
put your code in there
okay what exactly is the problem
so it runs in a wrong order
like it executes both of the ifs at the same tick
that should not happen
both of what
I dont want it to... tho
put return; at the end of your 1st statement to prevent that
i tried using return; it still did not do that
return; will make the code stop
yeah it didnt ima try again
it maybe will work
where did you put it
in the end
@EventHandler
public static void playerInteract(PlayerInteractEvent e)
{
World world = Bukkit.getServer().getWorld("world");
if((e.getAction()==Action.RIGHT_CLICK_AIR||
e.getAction()==Action.RIGHT_CLICK_BLOCK)&&
e.getPlayer().getInventory().getItemInMainHand().getType()==Material.SCUTE&&
e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getCustomModelData()==2)
{
e.setCancelled(true);
world.playSound(e.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 1);
return;
}
if((e.getAction()==Action.RIGHT_CLICK_AIR||
e.getAction()==Action.RIGHT_CLICK_BLOCK)&&
e.getPlayer().getInventory().getItemInMainHand().getType()==Material.SCUTE&&
e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getCustomModelData()==1&&
e.getPlayer().getInventory().getItemInOffHand().getType()==Material.FLINT_AND_STEEL)
{
e.getPlayer().swingOffHand();
e.setCancelled(true);
ItemMeta meta = CustomItem.tntStick.getItemMeta();
meta.setCustomModelData(2);
e.getPlayer().getInventory().getItemInMainHand().setItemMeta(meta);
world.playSound(e.getPlayer().getLocation(), Sound.ENTITY_TNT_PRIMED, 1, (float) 1.2);
world.playSound(e.getPlayer().getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1, (float) 1.2);
return;
}
}
well
you want to only run the first statement or tthe second statement
so
you need to stop the code after the first statement
put it before the first if statement ends
or do else if
like this https://paste.md-5.net/eyijibalid.java
how do you remove plugins off of spigot again? i got a couple i don't maintain any more
setting them to premium right
you report them and say to delete I think
I would do something like
@EventHandler
public static void playerInteract(PlayerInteractEvent e) {
World world = Bukkit.getServer().getWorld("world");
org.bukkit.event.block.Action action = e.getAction()
Player player = e.getPlayer();
if (!(action.equals(Action.RIGHT_CLICK_AIR) && action.equals(ACTION_RIGHT_CLICK_BLOCK))) return;
//If the interaction is not a right click to air or block, do nothing
ItemStack item = player.getInventory().getItemInMainHand();
if (item == null || item.getType().equals(Material.AIR)) return;
//If the item is null or air, do nothing
Material type = item.getType();
ItemMeta meta = item.getItemMeta();
if (meta == null) return; //Just in case, don't really needed
int modelData = meta.getCustomModelData();
if (modelData == 2) {
e.setCancelled(true);
world.playSound(player.getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1, 1);
} else if (modelData == 1) {
ItemStack off = player.getInventory().getItemInOffHand();
if (off == null) return;
Material typeOff = off.getType();
if (type.equals(Material.SCUTE) && typeOff.equals(MaterialFLINT_AND_STEEL)) {
player.swingOffHand();
e.setCancelled(true);
ItemMeta meta = CustomItem.tntStick.getItemMeta();
meta.setCustomModelData(2);
player.getInventory().getItemInMainHand().setItemMeta(meta);
world.playSound(player.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, (float) 1.2);
world.playSound(player.getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1, (float) 1.2);
}
}
//If you end up adding more, I would recommend a switch structure instead
}
if you end up adding more, you should make some system to do that
Yes, that's a better solution
I have a registry system that works with namespaces stuff, so I could make that in like 2 classes
That's way better, the code would look cleaner than that
yes, probably
What would be the best way to do this:
For the next 5 seconds (while the hologram is alive) I need it to be teleported to 2 blocks above the player's location, so its constantly there, even if the player moves.
Maybe something like this would work?
uh oh, server crashed
yeah because you kept it stuck in the while loop
what could I do to not make it stuck then?
use a scheduler to teleport the entity every tick
also why are yo uchecking the command's name in the onCommand method?
so I know its the right command
did you register this executor to a ton of different unrelated commands, or why do you need to know that?
the proper way is to simply only register the executor to the correct command o0
so... wait... you're right
use runTaskTimer with a delay of 1 tick that teleports the entity every run
no because hologram (armour stand) is being teleported
also, how would I make the runtasktimer only run whilst !holo.isDeleted()?
create a class that implements Consumer<BukktTask> and takes in the entity as constructor parameter, then once it's dead (or isDeleted or whatever) call BukkitTask#cancel()
e.g. like this
Player player = null;
Entity hologram = null;
Bukkit.getScheduler().runTaskTimer(myPlugin, task -> {
if(hologram.isDead()) {
task.cancel();
} else {
hologram.teleport(player);
}
}, 0, 1);
or with a declared class
public class HologramTeleporter implements Consumer<BukkitTask> {
private final Player player;
private final Entity hologram;
public HologramTeleporter(Player player, Entity hologram) {
this.player = player;
this.hologram = hologram;
}
@Override
public void accept(BukkitTask task) {
if(hologram.isDead()) {
task.cancel();
} else {
hologram.teleport(player);
}
}
}
ok epic thanks
is there some app or plugin that trims a world size by removing chunks that haven't been changed by a player
so dynmap has this thing where if you hold compass and a sword you are invisible on the map, squaremap has none of these things, would it be possible to implement it on squaremap? If anyone has some experience with squaremap api please let me know!
@hushed spindle Try looking in to https://docs.pufferfish.host/plugins/trim-minecraft-world-mcaselector/
Anyone know good chart image generator libary for java?
(I want to do something with maps)
OH WAIT @valid burrow I realised what the problem was. If you have two items in (off and main)hand it uses the interaction event twice. Any way to prevent that?
Char.Js, they have wrapper for java
Chart.js?
Yes
Tyty
Or smth along those lines
They have official one
As official as it can get, no?
thereee i fixed it. found the event has a method Gethand :)
Anyone have some experience with squaremap’s api? I want to implement something that dynmap has where a player holds both a Diamond sword and a compass making them invisible on squaremap
Is that IO thing?
Or it just runs js code
Oh, cool then
arl nice
Anyone ever had an issue with BlockFertilizeEvent being cancelled but the bonemeal still being used?
Or am I targeting the incorrect event to detect and cancel bone_meal application?
how do i get the world player got into from PlayerChangedWorldEvent
It's their current world
ah okay
If I want to draw a straight line between point a and point b, which are two locations, what is the easiest thing to use? Between these points I also want to retrieve all locations.
(If it's possible to instead add velocity to change direction so it's just not a straight stretch that would be great)
create a vector between A and B, normalize it, multiply it with the desired gap between locations, and then keep adding it to to Location A until you're at B
hello, small question about code design. I am making a proxy composed of multiple instances and I need to handle player data loading. To prevent data duplication and desyncronization, should I only allow the proxy to load data and then send it to the server where the player is connecting to through plugin messages/a socket or should I use something such as redis to cache online player data and send it to the server requesting it?
MySql
and in case I use redis, how can I prevent data duplication? Is there some sort of lock to block access from a certain value until the lock is released?
I am already using mongodb for data storage, I am not asking about suggestions for data storage, i'm looking for suggestions about caching the data and sending it to where it is needed
Dont use the socket if servers are not in one machine
when doing player.inventory.contents (in kt) if an item is empty on the inv is it air or null
Redis for sure
normally i think we use air but theres still null in places
Craftbukkit ❤️
How much experience do u have with caches?
not much i'd say
i know what caching is, but i have never used any external program such as redis
I mean the obvious answer is that you probably want a read through and write through code implementation
But like
There is more to it if you’re willing to go deeper
public class BetterHitbox {
private final Entity entity;
public BetterHitbox(Entity entity) {
this.entity = entity;
}
public boolean areLookBy(Player player) {
BoundingBox hitbox = entity.getBoundingBox();
return player.getLocation().getDirection().isInAABB(hitbox.getMin(), hitbox.getMax());
}
}
Return always false, because?
not sure what you mean with that
get if the player is looking the entity
Players look vector will almost certainly not be in an entities bounding box
Unless they are very close
You need to raytrace
i was replying to conclube
in paper dont go, i want use it in spigot and paper
right now i cache player profiles in an hashmap and i pull data from mongodb
but i've figured out i probably need a better caching system to do what i described
Alr I found it
This is a good read
Its not entirely up to date i believe but it gives you the basics
Assuming you’re planning on using redis
so what i was thinking was pulling data from mongo when a player joins the proxy, store to redis and when the player moves to a server, make the instance read from redis and parse the profile
when a player leaves a server, serialize the data and send to redis
when a player moves from a proxy to another, data is saved to the cache and then pulled again
lemme read that rq
declaration: package: org.bukkit, interface: World
i know it
but i want use the AABB
because PaperMC is very poorly made and there aren't any useful things
are you suggesting i use Coherence to cache data?
never heard of it
but a read-through cache sounds like something i would need
I'm trying to update a plugin from 1.19.2 to 1.20.4, and Registry.BIOME_REGISTRY doesn't exist anymore
WritableRegistry<Biome> registryWriteable = (WritableRegistry<Biome>) dedicatedServer.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY);
Anyone know what I can use instead?
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
net.minecraft.core.registries.Registries
How did u find it so quick?
magics
The issue with a fully read through write through system is that you may be bound to double lock your system
Really stupid question but is there any way to express boolean return = obj instanceof clazz as a method handle? clazz can be a java.lang.Class object but other things work. Of course I could directly call Class#isInstance via a method handle but I figured that ought to be better ways around it
obj.getClass().isAssignableFrom(clazz)
Well that is the same thing as using clazz.isInstance(obj)
might be even worse honestly
ah right I miss read your question
if you're using MethodHandles you should really know what they are returning tbh
just blind cast the result if you're wrong you aren't using the correct version of the library / code you are reflecting
Problem is that I give it an interface and call a method on it. Instead of throwing some random exception I'd rather print the exact cause of the issue. The other parts were rather easy to set up, but I wasn't able to find a neat drop-in replacement for instanceof.
Id say isInstance is best
Basically right now I have
if (modJar instanceof SoftwareComponent) {
if (!(modJar instanceof DefaultAdhocSoftwareComponent)) {
throw new IllegalStateException("Only implementations of SoftwareComponent that are an instance of DefaultAdhocSoftwareComponent can be used as a mod jar.");
}
for (UsageContext usageCtx : ((DefaultAdhocSoftwareComponent) modJar).getUsages()) {
// ...
Problem is that gradle moved the package of DefaultAdhocSoftwareComponent, so I'd need to make use of reflection or method handles regardless in order to still keep compatibility with older gradle versions. Figured it might be neater to learn method handles.
Remember instanceof is a bytecode instruction afterall, not sure how method handle-able that is
any ideas why this doesnt work on 1.20.4
PotionBrewer potionBrewer = this.getServer().getPotionBrewer();
getPotionBrewer() cannot be found, how am I supposed to get the brewer?
java: cannot find symbol
symbol: method getPotionBrewer()
location: interface org.bukkit.Server
that’d be sad
I mean method handles do support other instructions like array element getters/setters and constructors
yea fair enough, well i was just unsure regarding that
🗿
I'd even guess that method handles generate bytecode directly (if not even skipping that step) given that you can construct loops and other stuff with method handles
because their is no method getPotionBrewer in Server in 1.20.4
@fallen grove and their never was afaik
I went back to 1.19.3 no such method
no such method in 1.18.2
no such method in 1.17.1
I could keep going but I feel like 2 years worth of updates is enough

the jdk also uses isInstance, it's fine
cluster name is database name in mongo, right?
I was looking at this example to do something similar
I suppose it's getting inlined then
no... 💀
this is cmarco you are talking about
sounds like a paper moment
is it (it is)
@eternal night does paper have such a method
yea xD
something like MethodHandles.publicLookup().findVirtual(Class.class, "isInstance", MethodType.methodType(Boolean.TYPE, Object.class)).bindTo(clazz) should work fine
oh? so what does that mean?
why? Is it useful in some way> seems kinda random is it like some mock registry type deal
Yeah already did so
helper method iirc
paper has the potionmix class which i am also using, i just cannot figure out how to get the brewer
spigot exposes theirs on Potion
i am crying
if you want to use paper-api stuff anyway, you'll have to use paper-api lol
^
at which point, that method would exist
I mean nothing wrong with it if you use Paper already too
Although I used boolean.class, but I guess it's equivalent even if it won't get inlined by javac
i am using the paper api, i am using the potionmix class
boolean.class and Boolean.TYPE is the same thing
then something is pulling in spigot-api
if you're using paper api though you should seek help at discord.gg/papermc
(He did actually)

us spigoters can't help with the mysteries of the random missing paper classes and methods
🫡
is there a reason why i should use placeholders, even thought i can insert the object directly into the string?
depends ?
if you are talking about like SQL it would be a different answer than talking about printing something to console
So it depends on whether i use sql or not?
And when it comes to placeholders it can be niece for configs or other types of configurable stuff :)
So readability?
i mean it can theoretically attribute to having clearer readability, but it depends again
^
you should use placeholders only then, when a thing within your string is variable
then you can opt into using string#format
or default concatenation
or string builder
or whatever you want
Is "my string" + number + "afgfssa" bad practice ?
Well if you use SQL, placeholders are needed because your inputs are escaped. If you just concat via a + in an SQL query you might expose yourself to SQL injection
for just plain text output, concatination is fine /shrug
Oh ok, so placeholders stop SQL injection in queries?
well thats why you have setParameter on statements
It happens when you passed user input
YourSalvation, yk how bad websites have an input field, and then u can end up inputting some sql thingy and it ends up working
Otherwise it does not matter
Yes
Prepared statements as its called, is a way of compiling the sql statements you have, such that when u get the input data from whatever input field, we will already know what data, how much data and where it should be since we compiled the statement, thus arbitrary data becomes impossible to input. I think pHp had a tragic history w this type of vulnerability.
That too ^
MongoDatabase#getCollection() may return null if collection doesnt exists?
or if collection doesnt exists it creates it
make a threat actor's day and don't sanitise your inputs 🙏
Everybody needs some love
Download sources and find it out
Quick question:
I have a function which returns a CompleteableFuture<Void> and now I have a different function which calls the prior function X amount of times. How would I check that everything was completed?
Do I really make a collection of the futures and everytime one completes check every other if they are complete or not?
But if I #get on all of them, won't it only wait for one, then the other, then the other, etc.?
can't you use CompletableFuture.allOf
That exists? Damn, didn't know. Thanks 👍
It was like wrestling with a pig, but I finally got my TinyProtocol / Keep_Alive thing working.
Among other things, I had to grab some random unmerged ProtocolLib PR because TinyProtocol has been broken since 1.19.
hello i try to make a square of particule, i use this code but i don't work can you help me?
like the particule go everywhere
Locations are mutable
yes and ? 😅
try ploc.clone().add
No problem
Locations are mutable, so everytime you use .add, it changes the location
oo i see
You can just do 2f to cast it
Something is wrong with my output debugs from my command api
21:13:35 INFO: argument(faction.points.*)= false
argument(faction.points.info)=true
Im not sure why i get the debug message 2 times
For debugging im running the /faction points info command and getting the output on top
?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.
Oh sorry the link wasnt sent it, my bad
argument.execute
what do you mean?
I must apply recursion, because a ParentCommand command can be parent of another command
Like Tree strcutures works
- faction => ParentCommand
- list
- points => ParentCommand
- info
someone knows why this doesnt work in nether (didnt test in overworld)
lodestone.getBlock().setType(Material.LODESTONE);
CompassMeta meta = (CompassMeta) itemStack.getItemMeta();
meta.setLodestone(lodestone);
meta.setLodestoneTracked(true);
itemStack.setItemMeta(meta);```
compass is still spinning
So you get two outputs
yeah exactly when executing the info command from points. I get 2 differents outputs
One of them is correct, which the second one
argument(faction.points.info)=true
.
okay, but can you detail more please
im not really understanding
I dont wanna sound as troll, but i dont catch where you trying to go with the argument.execute()
cuz, argument execute calls the execute method from the command class itself?
🤔
I guess it is not
Try setting setLodestoneTracked(boolean tracked)
im struggling because yesterday after removing the debug message to add the permission check started to happen this issue i posted. Because before touching the code, the debug was giving just one output and with the correct info
remember i nee to apply recursion, that why im calling the argument#execute(). Because ParentCommand can be parent of another ParentCommand, just like how a LinkedList works tho
yeah there is a line setting that to true
@rotund ravine sorry for tagging but this is not normal
i just removed all debug messages, created just argument.bla() debug and is okay
Is Vault on 1.19.4 really necessary or an analogue of this plugin? please tag, otherwise I'm Russian
Can I create a ServerSocket if the port is already used?
no, i mean it’s still possible to create a server socket and not have it binded
But like, if a port is used, then na
But like listen to the connections?
you mean when the clients connect?
yeah multiple clients can connect to the same server socket
Yeah but like
When I tried doing it with netty instead
I got the PortBindedException or smthg
What did you try?
try {
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new Interceptor());
Channel channel = serverBootstrap.bind(port).sync().channel();
channel.closeFuture().sync();
} catch (InterruptedException e) {
throw new AlixException(e);
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
Made by chat gpt
Or if this is valid, where can I find the ServerBootstrap variable
seems like you're trying to listen on an already used port
To add my childHandler
Figured
What are you trying to do
Seems it's probably used by the server
AntiBot
Fast connection refuse
FireWall in other words
Why not, y know, a firewall then?
For now I'm only using APIs for that
Is there a way I could add an ip to the server's firewall in java?
Run the relevant command
What do you mean
Would every system accept the command?
Does every os have a firewall
Interaction command?
I mean probably?
Makes sense
Make the command configurable
Will do 👍
i doubt that the server has (or should have) root perms 🥲
only if the server has root ofc
what one could do is to allow password-less sudo for only certain commands, e.g. iptables, with /etc/sudoers
Why would someone restrict it and someone not?
ofc that would never work for shared hosters etc though
Hi, when I retrieve the projectile's location in the hit event, it is sometimes up to 3 blocks wrong, i.e. not all the way, mainly this occurs when the projectile travels very fast, for example from a crossbow. Anyone know how I can solve this?
I guess just listening to AsyncPlayerPreLoginEvent is probably fine for whatever you are trying to do
Hellll naaawh
That is way after everything
It'd be far more laggy if I were to do that
Or unoptimized, I should say
It'd a shame for an antibot to have it's main firewall be that
Uh, I don't think it matters. It's enough for a bot that joins every now and then. You are not trying to block a DDoS attack, which you couldn't do anyways on that level
why if i unload and load an nms entity it is no longer custom and turns into a normal nms entity of it's original type
Because neither vanilla minecraft nor bukkit were designed for that. It reconstructs the instance using the original class when the entity gets loaded again
Its not going to make a difference if the connection is halted at the system level or not as the connection reached the system anyways. If you do it at prelogin the server hasnt processed much and you can suspend connections here without causing issues to the server. If you are worried about lag you need to have a box that is further upstream that monitors connections
That is pretty ignorant
Same here
I mean, they are both correct
Its not ignorant just a fact that all you are doing is just changing where in the system the connection is halted. If you add more and more rules to the system firewall eventually you will overwhelm the system which is no different if the mc server is doing it. It is too late to really do much about a connection that has reached a system as it will consume resources regardless. If your goal is to avoid this you need to stop the connection further upstream this is why you can rent firewall boxes
"on that level" I don't mean that in an offensive matter (if that's what you have interpreted), but rather that you won't be able to stop a DDoS attack on the application level
[15:35:53 ERROR]: Error occurred while enabling MazerArena v1.1.1 (Is it up to date?)
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
?????????'
i already tried almost all solutions online
nothing works
Either your database is offline or your credentials are invalid
Well, it's either of the two, and you should ask that at #help-server
wa
I made a plugin using the FAWE API, importing things from FAWE and world edit into the plugin, but whenever I run the plugin on my server, it just errors saying FAWE is already imported and such
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
Thoughts on this? I'm trying to improve minecraft's biomes by adding more color variation to trees. Does the sky color seem good?
Color and sky variation is done through my biome editing system
Never seen a sky that colour irl
Yeah working on the sky colors. I do think vanilla’s sky is too blue though
Make sure you never try and create a new instance of your main class
im pretty sure i dont do that anywhere
It replaces them with custom ones, while containing the default data such as mob spawning
At worldgen or via packets?
quite simple, i didnt really know how to set it up properly, do I have to like add loadbefore or softdepend idk anything about plugin.yml configuration
name: Techniques
version: 1.0
main: bridging.techniques.Techniques
commands:
techniques:
description: Open the Techniques GUI
usage: /techniques
spawn-schematic:
description: Spawn a schematic
usage: /spawn-schematic
On startup, a list of all default biomes within the world are gathered. It iterates through the list creating new registries of the same biome. These new copies have the same path, but a different namespace (specified by the plugin). When a chunk is loaded, it’s checked if the chunk contains the necessary alterations. If it does not, the biome is changed in specific places with the copy, according to a simplex octave generator.
I don’t quite understand simplex octave generators, but I got it working
So it’s done at worldgen, neat
Looks alright, you should probably have depend: [worldedit] if you depend on it
this seems to have fixed it
still giving errors but thats my code's problem
it loads now
Why isSimilir doesnt work sometimes?
Define sometimes
Everything about the item needs to match except stack size
This includes things like durability
Hmm
Yes, I use NMS and reflection
Quickest response ever
I’m proud
There’s a guide for 1.17 but it’s very outdated and uses obfuscated mappings. I’m working on a tutorial for everyone, which is in 1.20.2
I can send you it when I’m done
Yeah I use the mojang mappings
Same basic stuff, but just different code
If that made sense LOL
Also releasing a tutorial for custom blocks with GeyserMC
I’ll release the custom biome tutorial on the spigot forums, and MAYBE YouTube
For geyser, IDK
Somewhere. People need to know stuff about geyser because their documentation is completely useless
Sure! It’s Cyrei
Same name
blue name = verified = same discord and spigot name 😛
it was possible to trick the bot but this got fixed meanwhile i think
You could have discord associated with a past account?
well ok but in 99% of cases, it should be the same name lol
What kind of logic is that?
Yes, you can do it through datapacks. I use custom biomes for seasons though (a plugin I’m developing). Adding custom biomes through plugins gives me more control for this. Plus, you don’t need a datapack and a plugin
Hello, so i have an issue, how would i go converting a minecraft world itemstack to a bukkit inventory itemstack?
what is a minecraft world itemstack? you mean an item on the ground?
papermc was no help sadly 🦗
so i come to you all
seeking guidance
lol
Yeah great, I can't block 10 million connections per second so I should assume it's 1 bot per 5 seconds and block at most that
Logical fallacy
CraftItemStack#asCraftMirror or sth similar
I’m not very familiar with data packs, but to my knowledge, biomes must be hardcoded into the pack. My way allows me to make changes on every initialization
yes and sadly its the only stuff i got, and i tried doing craftitemstack but idk how to get it into my program
Now I’m curious if that would work… I probably won’t try it, but
one of those, preferrably asCraftMirror @hot reef
Isn't it static?
HOW DO I GET CRAFTITEMSTACK THOUGH
lol
what import
🦗
org.bukkit.craftbukkit.v1_20_R3.inventory.CraftItemStack
Or reflection
I can send you my github where I use it for multiversion support
?nms
how do you acquire an NMS itemstack in the first place if you don't have NMS on the classpath?
thats how
yikes
Then do reflections
ima just say it right here, im very much lost in what to do to make it work 😅
the code is set up right, except its just not the right class for it to be used properly
Wait how do I
Bright up the line
BRUH
you did
Oh I did nice
do i just copy that and put it in and use it?
I'm using the asNMSCopy
no, you're usually supposed to understand what it does, then you know what to copy/paste, if anything
And you want asCraftMirror
yes
So replace that in the code
Also, I input ItemStack as the argument
And you want to do the reverse yeah?
btw shouldnt you cache all those reflection stuff?
Nms to bukkit
Do you not see the 50 variables?
I'd just add craftbukkit as dependency and call CraftItemStack.asNmsCopy directly
thats what i want to do 😂 how do i do it
So input the nms class instead
i coulnd't find a maven repo of cratbukkit
?nms
jesus
there is none because it contains mojang code
WHAT DID YOU MEAAAN
this ^is for one version, this is for multi-version: https://blog.jeff-media.com/maven-multi-module-setup-for-supporting-different-nms-versions/
It's cached
my brain hurts again.
Ok
public static void tempBanPlayer(Player p, int dungeonTime, String reason) {
long durationInMillis = (long) dungeonTime * 60 * 60 * 1000;
Date banTime = new Date(System.currentTimeMillis() + durationInMillis);
BanList<Player> banList = Bukkit.getBanList(BanList.Type.PROFILE);
BanEntry<Player> banEntry = banList.getBanEntry(p);
if (banEntry == null) {
banList.addBan(p, reason, banTime, null);
} else {
banEntry.setExpiration(banTime);
}
}
How do I do a tempban thingy?
If change it to this
public static void tempBanPlayer(Player p, int dungeonTime, String reason) {
long durationInMillis = (long) dungeonTime * 60 * 60 * 1000;
Date banTime = new Date(System.currentTimeMillis() + durationInMillis);
BanList banList = Bukkit.getBanList(BanList.Type.NAME);
// Note: Use the player's name for ban entry
BanEntry banEntry = banList.getBanEntry(p.getName());
if (banEntry == null) {
// The player is not already banned
banList.addBan(p.getName(), reason, banTime, null);
} else {
// The player is already banned, update the expiration time
banEntry.setExpiration(banTime);
}
}
It yells about BanList.Type.NAME being depracated
What's the question
How do I make a tempban function, 1.20
First code block looks pretty much correct? Although I think it's PlayerProfile not player generic
?jd-s
declaration: package: org.bukkit.ban, interface: ProfileBanList
So I have to convert it from Player to PlayerProfie?
Yes, player.getProfile or whatever
BanList<Player> banList = Bukkit.getBanList(BanList.Type.PROFILE);
PlayerProfile profile = (p.getProfile());
BanEntry<PlayerProfile> banEntry = banList.getBanEntry(profile);
The method getProfile() is undefined for the type Player
well damn
Type mismatch: cannot convert from com.destroystokyo.paper.profile.PlayerProfile to com.marcusslover.plus.lib.mojang.PlayerProfile
Is paper the correct one to use?
And read the docs linked above
'org.bukkit.profile.PlayerProfile' is deprecated
?whereami
I am aware this is the Spigot server
you are using paper API
ah, depencencies...
Thanks md_5
It would appear that the project was created w/ paper instead of bukkit
Md 5 has sent more whereami's this hour than I have in my life
Yeah I was confused why the bukkit api wasn't working on that...
That makes quite a bit more sense lol
How to set npc skin using protocollib?
i use this one
profile.getProperties().get("textures").forEach(property -> profile.getProperties().put("textures", new WrappedSignedProperty("textures", property.getValue(), property.getSignature())));
but it didn't show anything
Hello im trying to spawn 36 different particles, they are supposed to be colored like a rainbow in order, i dont want to hardcode the color, therefore, does somebody know a reliable way that i could calculate the colors and get them from rgb
well the rainbow and the rgb spectrum are two different things
okay
So hardcoding would be the way?
okay
you don't necessarily need to hardcode
I recommend sticking with RGB because you can use bitshifting
and with just a shift of a bit or two you can essentially get any color and value you want
bit shifting sounds bad
its not
I have a project that demonstrates it with rgb
basically it compresses 32bit colors to 8bit colors
I meant to say it sounds hard
Thanks i will look into that
Well yeah you don't need to hardcode you can just have it be configurable
you still need to know the 7 colors of the rainbow as there's like no mathemathical expression to gen it
If I want to make so certain set of players cant break blocks placed by another set of players, is there a better idea to store the blocks placed in a list and check if that block was placed by another player?
actually there is, you only need to know red, blue and green
is it sumn cursed
and even then those don't need to necessarily be hardcoded either since you know the limit is 255
I'm talking about the starting colors
interpolation is separate
that can be algorithmic
Like there's no obvious pattern for the rainbow
there doesn't need to be one
as long as you know the ranges for the colors you want
the order is arbitrary really
not sure what you mean linear
255,0,0 is red, 255,255,0 is yellow
0,255,0 is green and so forth
127,255,0 is green if I remember right
er not green
0,0,255 is blue lol
127,255,0 is lime green
just because something isn't linear doesn't mean it has to be hardcoded
I will admit non-linear things are not as intuitive to see it though
homie I know how colors work
I just don't know how you expect me to create a rainbow algorithmically without having at least 7 colors to start with
public List<Color> createRainbow(int listSize) {
}
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
thanks, did not remeber this existed
you only need 3 colors
and as I said you already know the limits of each
That's the rgb spectrum not the rainbow
Interpolating in RGB works very poorly
frosty talking about the rgb spectrum not the damn rainbow wtf
I already told you about the raindbow
the rainbow isn't some mystical colors
its a combination of the primary colors
something you learn in school
also so happens to be something easy to replicate with just rgb
is it possible to have like an already existing Spigot server
but link a sub-server to it?
with a plugin
What does this "link" do?
like he tries to join this
would it be possible to do on a Spigot server?
that is the exact task a proxy is made for
so just use that. they are all very lightweight
Hmm. That would be extremely hard to do because you would have to use the spigot server as a proxy.
on like a proxy
creating a dummy server with a plugin
with my own server engine
Start a jvm and use a server jar as target. Just like you would in your terminal.
can't I use the currently existing JVM?
or do proxies have a vm for each server?
How do you expect two applications share their stack?
Proxies dont own any servers. They just reroute packets from client A to server X,Y or Z
You mean emulate a server using a plugin on your proxy?
yep
Its really nice to just isolate each backend server into its own jvm, and then having your proxy on a separate jvm, in practice everything could run on the same jvm, but that sounds like a duct tape hassle
Sure, that can be done. You just need to implement the protocol.
But be prepared to write a ton of code. Also proxies are really not meant to have any functionality besides
routing packets.
Maybe explain what you are trying to do. I smell an xy problem.
technically yes
should you? probably not
create a server on like BungeeCord/Velocity
and connect the player to it
you want dynamic servers?
and have it create from my own server engine jar
I am not understanding what it is you want then
.
.
ok, but it still doesn't make sense
or is not very clear in what you are trying to achieve
Create it
with a plugin
that is placed on the proxy server
and is of my own creation
so I code this plugin
How would you run two applications on one jvm? I dont think thats really possible without having an additional layer.
I'll make a vm
It is possible to do, just not from a plugin because it is too low in the program process
can I start another vm from java?
you need to use a Java Agent which handles processes in the JVM
yes
No i mean like, assuming you own the software, its possible to invoke the server socket for both backend servers and the proxy server on the same jvm
is that like a library or something connecting many jvms?
but you probably shouldnt
No, its part of the JDK
its designed to be a wrapper around JVM processes
And who initializes this agent? You would need an additional application which was written to handle several sub-apps.
basically you would create a wrapper client which makes use of Java Agent, it can then launch Java processes inside of it
or launch JVM's outside of it
should you do this or is it wise? Not really, the only nice thing of a Java wrapper client is that it can do some utility things for you that make it easy
like letting you know if a server died or something and rebooting it back up
etc
I want it to be as efficient as possible
Are you trying to dynamically start/stop spigot servers, based on demand?
ok that is fine, but your idea isn't efficient or optimal
no
proxy starts up
I look for my dummy server
if not present I put the jar file
and start it
and send players to it
just 1
They want the ability to start up more servers without creating more JVM processes, basically have a single JVM process where everything is in that
Ok. But why?
No.
JUST 1
1 SERVER
a dummy server
Then take 2 steps back and explain what your goal is.
We are still doing xy
oh you want the proxy server to also be the hub server?
where I'd send players as the primary one
not necessarily
yes this is doable, in fact a world doesn't even need to actually load for a player to connect to it just fyi
tbf it's for my antibot
so what you are wanting is completely doable on a proxy
ok, well I don't know what inefficiency you are experiencing
but I still don't know how I could start a server from within a plugin
you saying efficient as possible is just arbitrary at this point
I haven't done anything yet, but I'd like to start from the right point
so that I don't have to recode it later on
Is this public or for private use?
well you keep explaining dynamic servers, but you keep saying no you don't want dynamic servers despite what you are describing
public
like I said, I want only 1 server
and it's unchanging
no, the server will have it's own hub
so 2 servers now
my dummy server will just be for verification
Does it need to be a spigot server, or just a "place where a client can connect to"
2nd
I'm planning on creating my own server engine
ok what kind of verification is needed?
so I have the jar, how could I create a dummy server the player could connect to
because I may have an easy solution which requires nothing but a hub
There is no need for a server engine.
You can just emulate the protocol and send a few packets.
I'll decide on that, but a visual one for sure
ok that is it?
yep
use demoscreen then
just like netty communication
when they connect to the hub, give them the demoscreen
you can do all kinds of things with that
Can you help me with my problem tho?
For the past 15 minutes I've asking for this
on a proxy
you can even do visual verification with demoscreen too since there is buttons for the screen 🙂
mhm
oo
just fyi, you are talking with the few people who are actually highly experienced with dynamic servers
but what you want doesn't need any protocol manipulation or even a second server
can all be done on the hub
but I want to minimize or remove calculations made by the server
that's still the rgb spectrum, just 8 points evenly spread out
What does "server" refer to here?
Go back to your game
the server the player is currently on
if I had my own server engine I could ensure that
Well
thus why I want to create the server
I thought he said no to that...
which is what makes it all the more confusing lol
I really dunno what that is
You need a "core" service that receives a server creation request and sends it to one of its "workers" (one per machine) that make sure the image is up to date and starts a server out of that
What has he said yes to?
yeah
You want the server allocation part
Well that's a cloud system
If you want an already existing one there's TimoCloud
which in a nutshell is a dynamic servers setup
I don't understand CloudNet enough to recommend it
I'm just making my own because I can
which is what was asked quite a few times
Wait. Initially the player is on no server. And my interpretation was that you wanted a
minimal server implementation without any functionality (no world, no entities, no other players, no chunks etc)
with just a limbo. And that could be done on a separate thread, started by the proxy, simply sending a few packets.
The loadbalancer is basically velocity/bungee
The loadbalancer can run on top of the proxies so that no individual proxy gets overloaded
that'd be correct
The player on login is redirected to an empty server
which my plugin would create
So we're talking 2 separate things
Does Shadow really need a hierarchical proxy topology?
probably not
Alright, then just look at the protocol and send a few packets.
they just want a verification system for their anti-bot thing
Instead of having a "plugin create a server" you'd have a matchmaking service and a server management system working together
and they seem to be going on the path of over engineering right now
but we're probably not talking about cloud anymore
bot pls
You've thought so hard of an anti-bot solution you've crossed the realms of cloud server management
:)
Maybe what you want to achieve isn't the right solution to your problem
Ignorant.
so far everything they asked in what it needs to do
demoscreen provides
and this can all be done on the hub
welp I'm done here
which is just 1 server and no other server spooled up
imma do my beard and trim the sides n stuff
mostly maintenance so I don't look like a hobo
ah
gotta pass by my school in a couple hrs to sort out some degree stuff
I get that the people here only act nice and in reality are douchebags
I am not entitled to be nice to anyone
yeah really depends what kind of bot problem they are trying to solve
Without escalating rudeness, I thought smile gave you a really niece solution
yeah smiles solution is nice too
if you don't want to make use of the DemoScreen stuff
after looking
it seems the API is a bit lacking on the DemoScreen area though
Obviously the fact that illusion deployed a huge skull emoji sticker is a bit rude, but don’t think any of us meant any harm or rudeness initially
I think the Game Event packet handles that. Never used it so far.
I have seen it used, and there is a lot that can be done with it
it takes the player to like a separate area where you can give tutorials etc if you wanted
its really cool
Lecture continues
see ya guys
cya later
That was my answer to calling frosty an ignorant
But ye I'm ticked off today
Need my 2 minutes of sleep
guys any way to change the blast resistance of a block?
ik its with nms but so far I cant figure it out
?paste
https://paste.md-5.net/ecerazeyil.cs - why custom craft not adding ? i not find error but crafts not exists. How check this
the easiest way, is to track the resistance yourself
craft registred but not worked
you don't really need to modify it, just have a list of blocks you want the resistance changed, make use of the events
I'm lined up with 1$ to spare
Every time I hit the barber the guy charges me a different price
mood pricing
It's always 17-18$
Same
if they like you or in good mood, you get $1 discount 🙂
otherwise its full price all the way
how do I track it?
basically you would make a configuration that has a list of blocks that you want resistance changed to, and their values you want it to be
then its a matter of listening for events and detecting the blocks, if the resistance is to be greater, you just don't let it get destroyed if it should be less then you let it get destroyed
etc
ItemStack toString() returns the same as /data get entity… SelectedItem right?
Including NBT tags etc?
I believe so yeah
That‘d be great
Then i can tell people to just blacklist items by regexing toString
is there any simpler way to catch exceptions in the lambda thingy? It looks so ugly compared to the rest lol
this.toStringRegex = config.getStringList(name + ".toStringRegex").stream().map(entry -> {
try {
return Pattern.compile(entry);
} catch (PatternSyntaxException exception) {
main.getLogger().warning("Invalid regex in blacklist entry \"" + name + "\": " + entry);
return null;
}
}).filter(Objects::nonNull).collect(Collectors.toList());;
if( main.debug) main.debug("- toStringRegex: " + toStringRegex.stream().map(Pattern::toString).collect(Collectors.joining(System.lineSeparator())));
this.toStringRegex = config.getStringList(name + ".toStringRegex").stream()
.map(this::compilePattern)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (main.debug) {
main.debug("- toStringRegex: " + toStringRegex.stream().map(Pattern::toString).collect(Collectors.joining(System.lineSeparator())));
}
// ...
private Pattern compilePattern(String entry) {
try {
return Pattern.compile(entry);
} catch (PatternSyntaxException exception) {
main.getLogger().warning("Invalid regex in blacklist entry \"" + name + "\": " + entry);
return null;
}
}
Is it possible to modify the daytime and nightime times?
so daytime is x minutes long and night is y minutes long
Yeah that’s possible
There is an event you probably could use to reset the day time every so often making it feel longer
Adjust day and night time cycle intervals. Contribute to foncused/LongerDays development by creating an account on GitHub.
yeah lol why didnt ithink of that
interesting
alex I also believe there exists some utility thing in guava to wrap around any functional interface with a sneaky throw
maybe it was apache commons, idr but yea
I'm trying to blacklist items by regular expressions, which works fine. I also added a command to automatically print out the regular expression to match exactly the item the player is holding, however admins need to throw this into a yaml, and hence I have to correctly escape it. The regular expression might look like this:
^\QItemStack{WRITTEN_BOOK x 1, BOOK_SIGNED_META:{meta-type=BOOK_SIGNED, title="Quoted" Title, author=mfnalex, pages=["\"this book contains double quotes\" and 'single quotes'"]}}\E$
Obviously it would need to be quoted to be store din a YAML. I could ofc just create a YamlConfiguration, use set("dummy", myRegex) and use saveToString(), then substring the "dummy: " part, but I wonder if there's a better way to get a correctly escaped version of this string
but I also need to print the proper warning
Myea in that case
Yes
Pattern does have a literal regex static factory method
Pattern qoute()
But I think you can otherwise construct a normal regex instance and just pass the Pattern.LITERAL flag also :)
how to display item crafts in inventory like mods (visual)
when you click and this opened in inv
that only quotes the regex stuff as mentioned above (wraps it into \Q and \E) but doesn't allow me to throw it into yaml
It needs e.g. to also escape all quotes inside, all \ chars, etc
oh
i'll be back in an hour, if someone knows a solution, ping me pls :3
Yeah I think you just mentioned the solution yourself
im getting the following error
java.lang.NoSuchMethodError: 'org.bukkit.generator.structure.Structure org.bukkit.craftbukkit.v1_20_R3.generator.structure.CraftStructure.minecraftToBukkit(net.minecraft.world.level.levelgen.structure.Structure, net.minecraft.core.IRegistryCustom)'
but within the IDE there's no complaints about such a method not existing on 1_20_R3
how would i go about resolving that
Sounds like your server isn't up to date
I'd just run buildtools for 1.20.4 and try again
?stash
Who knows
Maybe legacy stuff
Heck, there are even two structure packages
Becuase nothing is ever fully removed it seems like you end up with weird artifacts
its spaghettin' time
Well good thing is that with the release of Java 26 or so we will see the end of Java 8 - though you'd still be able to run these plugins for god knows how long
One represents a structure in minecraft
Like a mineshaft or stronghold
The other is about structures you save/load with structure blocks
aren't they practically identical?
the only issue you will run into is people might notice the slight reset of the time if they are paying attention to the moon or sun