@EventHandler
public void onRedstoneChange(BlockRedstoneEvent event) {
Block block = event.getBlock();
Bukkit.getLogger().info("powered 1");
if (block.isBlockIndirectlyPowered() || block.isBlockPowered()) {
Bukkit.getLogger().info("powered 2");
}
}```
why does this event get called like 5-20 times when i just power a block on/off once
#help-development
1 messages ยท Page 1331 of 1
I'd assume it's triggered for every redstone update
i only have 1 redstone circuit on my server though and its where im testing
yeah so the thing with redstone is that it does a LOT of updates
oh so when i turn it on/off its doing some random updates that arnt "visible"?
yeah
I know there's a good video that visualizes it
but I'm having a hard time finding it rn
Not really
but there might be something that can be done depending on what block you're looking for or something else specific
its a sign, ill keep trying stuff ty though
look at whatever craftbook does
craftbook did powerable signs before most current plugin devs were out of their diapers
true
Yeah they just use the BlockRedstoneEvent https://github.com/EngineHub/CraftBook/blob/master/src/main/java/com/sk89q/craftbook/bukkit/MechanicListenerAdapter.java#L184
curious how do people work with forking spigot?
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
Contains info on how to build and manage stuff ^^
any1 wanna help dev my minecraft server im trying to do staff stuff rn i need help
I'm also trying to figure out how to make things there doesn't break Mojang's copyrights
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
You basically have two ways to go about it; BuildTools or Paperclip
If you're forking Spigot you can probably just fork BuildTools and make it build yours
whats the legal way of making modification like spigot?
Legality is subjective. Start your own nation state
๐
technically decompiled code is not source code at least in the US
Everyone in the industry has not allowed that issue to go before the supreme court because odds are the supreme court will not rule in their favor in that decompiled code is the same as source code when it is not lol
Therefore, copyrights do not apply to decompiled code ๐
It'll be real expensive to defend yourself
no
the person who brings forth a lawsuit is the one that has the burden of the majority of the cost
second, if you can't afford a lawyer the court will just appoint one for you as they are required to especially if you are not able to adequitely defend yourself
isn't it a derivation anyway?
might not be source code but it's still their property
rockstar goes after those who make cheats
i also see this
No. As I said not a single entity has allowed this to go before the supreme or circuit courts.
However if you want to treat it as such you can, which is perfectly fine. Just as long as you don't use everything you are generally fine
cheats are not the same thing as going after someone who decompiled code. Cheats typically fall in the category of bypassing DRM
or can also be classified as illegal as you are accessing the system in an illegal way
Reverse engineering is legal in the US
No one can 100% argue that decompiled code is a derivative work simply because you are using software to interpret software
you also can't argue that method names being the same is enough either. Also, you can't copyright API methods from Java either(mainly because there is limited or a single way you can really write something to access a particular api as well as you can't copyright someone elses work just because you rely on it) and can only copyright code that you solely created. So you have to use code that is in the methods which may not be exactly the same in the decompiled or at all.
this is why all cases that involved decompiled code solely has stopped short from going any higher because the odds that it is ruled that decompiled code is not covered under copyright is really possible
so because of this, many of those for legal purposes just say yeah its covered under copyright to protect themselves, but reality is its just a big grey area because copyright doesn't address this and there is no official rulings on it from any high courts. IE no one really knows. I am on the side that, well its not specifically addressed therefore its legal simply because there is more precedent for things not being specifically addressed as being legal or not covered by a law.
closest we got to a case is AI generated stuff. Anything generated by AI can not be copyrighted
simply because AI can not be an author nor own anything
supreme court in the US ruled on that last year
As for other countries, I can not say though as I don't particularly care for laws in other countries
i see
ai can create somethings, the government won't mind
You can try
not sure what you mean with this
xD
It's not the Ai that creates something, but the person who uses it
It is a tool for development assistance
supreme court in the US ruled that anything created by AI can not be copyrighted
How will they prove it?
What was created by AI
?
The answer is: they won't prove it
Not sure what you mean
but ok
knowingly filing a copyright that is fraudulent is a much worse offense then violating a copyright
and when you sue on copyright basis, you have to prove your copyright is valid
not that someone violated it
I am using a Russian-English translator to speak with you
You may not understand me.
I see so not even someone in the US
I'm trying to get across to you that the court will be shown the source code without any markings or other things, and they won't be digging into whether it's Ai or not.
This is not how it works in the US
It's stupid to bring up this topic at all.
How?
when you sue someone, the burden of proof lies on you. Also, the defense can subpoena any evidence in your possession to include materials on computers and development environment as well as subpoena your employees or anyone else that may be witness
you are required to hand over any evidence already that may help the defense as well. You can't exclude evidence because it hurts your case lol
You don't see a difference between the law and how it actually works.
Except you don't know how it actually works since you are not from here.
Can you find me any cases like this?
Supreme court case in 2025
send a link
I mean let's be honest, even if he sent it, you would have read only the headline lol
But it wasn't the SCOTUS, it was the Supreme Court of D.C. whose ruling was challenged in the SCOTUS but has yet to be heard
Thaler v. Perlmutter, case No. 1:22-cv-01564
Unsure where the disagreement lays, but you're both correct. You can create something with AI and the government won't care, but you cannot copyright that work in the United States according to the Supreme Court of D.C. ruling against it
Does Spigot/craftbukkit include sqlite?
yes
Does ItemFlag#HIDE_POTION_EFFECTS still work to hide "Interact with Spawn egg:" on spawners?
idk about that, but ItemFlag.HIDE_BLOCK_ENTITY_DATA should do it
Still there
Try HIDE_ADDITIONAL_TOOLTIP
That will hide whole lore right?
No
if hide_block_entity_data doesn't do it, that's a spigot bug
It does not even do anything lol something weird is happing
sounds like you are misusing the itemstack/itemmeta or something idk
can't really tell without seeing any code
public ItemStack createSpawnerItem(String type, int amount, int level, int stack) {
ItemStack item = new ItemStack(Material.SPAWNER, Math.max(1, amount));
ItemMeta meta = item.getItemMeta();
if (meta == null) return item;
meta.setDisplayName("Test Spawner");
meta.setLore(List.of("Line 1", "Line 2"));
meta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
item.setItemMeta(meta);
return item;
}```
created it just for testing
HIDE_BLOCK_ENTITY_DATA does not exist for me
What version are you depending on
^^ may you be depending on an old api version?
or god forbid, not spigot ๐ฑ โผ๏ธ
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
?whereami
Not using Spigot ๐ญ
why should i use spigot xD
Head over to the Paper discord
i mean, you can use whatever you want
^^ This is not the place to ask for help with it
but you should be asking for support to the platform you are using
Bruh. I saw similar things multiple times on the forge server. Why do people do that? Do they think it's all the same or are they trying to waste the time of others?
Probably the former
That or they think the people on the server know all of the forks under the sun
hey guys, im looking for minecraft developer, dm me for paid jobs
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Hey,
I am currently developing a Minecraft Minigame Plugin of which I want to combine the base classes into a API Plugin to use in all my minigames. So I started creating generic classes. But now I have a problem with circular dependencies as I pass the used types through.
Now I am only confused anymore and don't know how to fix it without loosing type safety...
https://github.com/KesSaft/EnderGames
The problem is in the GameStateManager and other connected classes.
What exactly is the point of the generic types params in this case?
Sounds more like a ground up rewrite is needed to properly take into account having an API
well abstract class BaseGameData<E extends Enum<E>, P extends BasePlayerData<T>, T extends BaseGameStateManager<E, BaseGameData<E, P, T>>>, not saying this isn't needed, but this is a lot of generic type params
do u really need this kind of type awareness to shine through and propagate the rest of the code base
they probably don't lmfao
๐
i have very little generic stuff in my game engine
i just take advantage of polymorphism
yea that can I understand
Something like this would be better lmfao
public abstract class BasePlayerData {
}
public abstract class BaseGameData {
private BasePlayerData data;
public BaseGameData(BasePlayerData data) { this.data = data;}
public BasePlayerData getPlayerData();
}
Hey, um. I got a problem with my unity game could you help me please?
-# jk, don't kill me
Unironically probably to an extent
$$$$$$$$$$
I gave up on unity due to their dumb decisions though lol
I want to put these base classes into a api plugin which I can use in all my plugins and so that the base class returns the right type, I want to pass it. else I would have to cast it everywhere right?
That is cleaner than.... whatever the fuck you're doing
yea, it is like a infinite loop. But I am not sure how to do it properly.
idk if u actually need like
If you're programming the implementation plugins correctly, you'll only have to cast once anyways
type params at all in ur case
yea, then I would need to cast it everywhere as most of the stuff I need will be in the extended class
you can technically have a simple cast at getGameManager(Class class)
and from there you can access game specific methods
Nope!
could u not just make an abstraction where u don't need to do so many casts
Only the implementation plugin has to cast, and if you program correctly you're only casting once lol
๐ ok
SpleggManager manager = registry.getByClass(SpleggManager.class);
you can probably scope ur types kess-apps
e.g. This is how casting in Java works. Note the first line
TriggerZones plugin = (TriggerZones) pluginManager.getPlugin("TriggerZones");
RegionManager regionManager = plugin.getRegionManager();
Location minCorner = new Location(getServer().getWorld("world"), 100, 50, 100);
Location maxCorner = new Location(getServer().getWorld("world"), 110, 60, 110);
TriggerZone trigger = new TriggerZone("example_zone", minCorner, maxCorner);
trigger.addAction(TriggerZone.TriggerEvent.ENTER, new SendMessageAction("You have entered a zone");
regionManager.addRegion(trigger);
totally fine to do the cast manually as optic did ๐
true
You'd just store TriggeZone variable and pass that around w/o needing to cast every time
but the game engine shouldn't care about game specific stuff
^
for example, if u have some player data in a specific minigame, then just have a player data type for that minigame
only enter point should be a generic method where you up cast
well of course
and that's all the generic you need
Lol. Well, I prolly actually have a problem with the last app I mate using unity. But that was months ago, and I can't remember much of the problems I had/fixed ๐
ok, I will try. probably a lot easier
thanks
But for the GameState Enum I would need a type right?
either way kess apps, you can think of generics as type constructions, you can have a list of ints and list of strings and they're different types
that would only be one type so not that big of a problem ig
you wouldn't want to create a list type for every other type yk
polymorphism wins here too ๐
I mean, if the GameState enum isn't shit you don't need to polymorph or cast
this is my impl of game state, i name them phases
this is in the base library and i can switch them up if a game needs something different
don't quite understand. you can't extend a enum...
public enum GameState {
CREATED,
WAITING,
RUNNING,
ENDING,
ENDED
}
Kinda covers everything you'd need for a basic GameState system
I mean I do understand the idea of generalizing game states since different minigames might have different state machines
similar to mine. but you don't have an enum too?
i actually do for my auto join system
Aye, but you don't want to over complicate things if you don't know it has to be so complicated
yea
yea, but they change for every minigame in my situation. makes it cleaner I think
this is what i have
Uh... why? A lot of those will be standard for every mini-game
you might want to have external and internal game states then, like common game states you could probably expose to the api, but then each mini game might have a set of internal states perhaps?
State does not necessarily mean Phase
yup
๐
for endergames I have LOBBY, PREPARE_MAP, SPAWN, GRACE, PLAY, END,
but for getdown I have LOBBY, PREPARE_MAP, JUMP, JUMP_END, SHOP, DEATCHMATCH_PREPARE, DEATHMATCH, END
You might have a
public abstract class GamePhase {
public abstract void onEnter();
public abstract void tick();
public abstract void onExit();
}
class, for example
I think it is a bit cleaner when I do it this way
Two of those can be done better w/ internal handling, not states
You'd just have a GameType.DEATHMATCH and then use GameState
Yea thats for the internal ones, but those are encapsulated more or less to each minigame, you might wna map
for example:
LOBBY --> PRE_GAME
PREPARE_MAP, SPAWN, GRACE, PLAY, --> RUNNING
END --> POST_GAME
and then let pre game, running and post game be for api where its shared for every minigame
Regardless they're implementing it from the very beginning really poorly
yea, I do like the honest attempt with generic type parameters
then I would have two state mashines inside another. not sure if that would make more readable
GameType & GameState are like the bare minimum
or perhaps turning it from an enum to a proper abstract class
public abstract class BaseGameType
{
private GameState state;
// Other variables
// constructor & other code
}
well, thats what I have
Which is one of the cleaner ways to do it lol
You're trying to over complicate things
Sometimes simple is better lol
here is where difficult choices come in play, you're going to have to choose between how complex you want your code base to be
what features do you find necessary? (from a library point of view and from a framework point of view)
when does it get too much for you (how simple do you want to keep it)?
for me personally the implementation is
public class BedwarsMinigame extends AbstractMinigame {
public BedwarsMinigame(GameContext context) {
// Context handles max players and stuff
}
// everything else
}
though you could do the following too
public abstract class AbstractMinigame { /* Code */}
public abstract class SingleplayerMinigame extends AbstractMinigame {
private Player player;
// Code
}
public abstract class MultiplayerMinigame extends AbstractMinigame
{
private TeamManager teamManager;
// Code
}
๐
I'm not releasing my library though lmfao
Only part of it that I have released though is https://www.spigotmc.org/resources/triggerzones.132905/
alright, keep your secrets ๐ฅฒ
It's for my own server KEKW
oh and there's there too https://www.spigotmc.org/resources/actionlib.117241/
how do i tell if BlockExplodeEvent is caused by Wind Burst
the only thing that comes to mind is on attack or interact if player used a mace with windburst to add it to add the player to a set, and on explosion check if said player is there
that sounds horribly hacky
i can't think of a better way
maybe there's a better event
does explosionprimeevent triggers?
if so it has the entity who triggered the event, you'd only have to check the hand for a mace with wind burst
good question
let me check
but its an entity event and i highly doubt its called here
EntityExplodeEvent is not called
still on it
btw @lilac dagger what kind of caching strategy do u usually resort to when u deal w lets say user/player data and state
oh I more meant like write behind, write around etc
i'm not familiar with the terms
let me see
i'll tell you how my system works in bedwars
go for it ^^
when the player joins their data is pulled from the database into local memory, after that when the data changes or needs to be sent i use a method like this to update the database
i'm yet to find time to do this system in frconomy
Yea, I just do it all in local memory & save on quit, disable, and every x amount of time lol
ah nice, how do you deal w offline users for example? do u just serve them directly from a db request?
that's how i did it in frconomy because vault doesn't have async callbacks
Good thing I don't use vault for my server LMFAO
but i have a solution in mind
vault is... vault yeaa
This is hard when you dont have java skills
confirmation based transactions
I do though ๐
I'd say lot of plugins use vault dependency
yea sadly so
you try to send data once, and then it tells the user if it's not cached to try again in a few seconds
or well I mean sometimes sadly so
so the database has time to cache that data async
I avoid using vault and protocolib for example, but this is hard
I just have a simple
public class User {
private UUID uniqueId;
private BigDecimal balance = BigDecimal.ZERO;
public (UUID uniqueId) {
this.uniqueId = uniqueId;
}
// code
}
And I use 0 of them lol
ah okay, but then even for offline users you'd cache the user for a short period of time in case of subsequent calls?
I code almost everything from scratch for my server
of course
20 minutes by default sounds like a good amount
yea, I mean luckily packetevents have become more standardised
I prefeir using NMS
but vault is still a bridge many servers use
fuck vault lol
yea but for packet listening it can be nice w packet events
i'm actually gonna spend some time tomorrow to fix fr conomy
i really like that project :d
:)
it deserves some time and love
I'm privileged enough to just fork paper lol
#YayForBeingProgrammerNerd
If you are interested on that you can give a check to https://github.com/Winds-Studio/Leaf/
Don't need packet events when i can just add patches to paper lmfao
yea
why is vault so popular though, if you make your own system, you dont need it
Only use I'd have for Leaf is pulling patches
its an eco system bridge
Well most of people does not know java as i've said
It's SUPER fucking old and used everywhere, which means it continues to get used
This implementation is cool, but folia exists too https://github.com/MultiPaper/ShreddedPaper
whats an eco system bridge? i feel like this could be much simpler, economy at the end of a day is just a number and doesn't need 2 mb of code
Don't need that either
you could do an economy plugin with api in a few classes and be done with it
why is vault so big
Old plugin, gives api
ohhh compatability
Times were different back then, which gave vault an edge which made it standard decade later lol
True
because independent of what chat, permission and economy plugin u use, vault acts like an interface
Only use I have for paper forks is just pulling patches, and most servers won't even need Folia or a fork of Folia lol
placeholder api, or any plugin that consumes economy balance
Also helps it's old as fuck. Roughly around the transition to BukkitDev, if not older
true
It's simple. It's old as fuck. It's cemented as a core API and likely will be for years
same as protocolib or citizens by the way
Are there better libraries? Yes
Are they as supported as Vault? Hell no
It would take a lot for there to be a new standard library for that kinda thing
I made my own system and didnt use any existing plugins, economy, permissions, ..
Similar situation to LP.
It's the most feature complete, pex died, groupmanager stagnated, and the other alternatives just aren't as good
made a cool database hikari wrapper plugin
then built permissions and economy on top of it
its really cool
both perms and economy plugin have an api to events, methods etc
You have to put yourself in the shoes of someone who configures plugins and doesn't make them; they want something that works well and has support
Most of my stuff is custom, but I won't waste my time making a custom permissions system lol
Not important if it's private use, not public lol
its really simple to make, but it works only with the custom system... i dont have intention of it working with any other plugin than mine
Almost all of my plugins are private, for example. This means I don't have to rely on third-party libraries and can make everything from scratch to properly suit my needs
They're really simple to make, yes. It's just not worth the time and effort personally, as LuckPerms has everything I'd need from a permissions plugin
really simple..
To a certain extent, I see the point. Imagine having a completely customized server and being the only one who has to update it. It's crazy
Plugins like LP, WorldEdit, ViaVersion hell
Not really crazy, a lot of large servers are like that
With the difference that they're a team
Still makes no difference. How often do you think core plugins get updated lol
Still crazy
that's kind of my dream
i own my plugins and the systems i have
I have several custom plugins, so for me it would be more of a nightmare
Debatable. I can make a moderation plugin and then never have to update it again
I don't think you want a custom viaversion
I dont need it
Then there's me. Too many plugins which do roughly the same thing.
Easier to just make my own stuff from scratch lol
Latest MC version?
That's the only version I support, personally lol
Because if you want multiple protocol support you will need it
yeah the server is always the latest, and specific version only
if you dont wanna play or dont have that version... just dont play
That explains why you want all custom, imagine 1.8+ to latest
You can do all custom even with ViaVersion lol
item ids were weird
You'd just have a wrapper API or something
Never said you had or needed too, just saying it's possible lol
I love that version I played it for many years when I was a kid. I still maintain the 1.8 paper a lot.
hell โ ๏ธ
use viaversion and make a wrapper around it?
they have an api?
For me personally, I could never work with anything lower than 1.13 for free lol
Yes
I use it to display on name tags protocol version
I think that's the version where every item and block got its own material ๐ค
xmaterials intensifies
my next project is probably a kingdoms plugin... that will be fun :DD
also have to do custom npcs for town shops
that will be pain in the ass
I can recommend you ZNPCplus or FancyNPCS
Mannequins at least makes that easier lol
w/ it being private & custom, you can ignore any sort of compatibiltiy risks with public resources lol
thank u i could take a look. but my goal is to make everything by myself so i know exactly how it works... because i have everything custom..
as previously stated lol
Just build off of Mannequins since you're on a version which has em
how well does it work?
As long as you're not needing pathfinder goals or anything you won't have to use NMS or anything
any bugs?
Don't believe so
is it open source?
No, the actual NPC thing minecraft added lol
oohh i didnt know about this
Yea, it's a 25w36a thing
part of 1.21.9
because i dont want the town to be dead
i want the npcs do to something
need to make a plan for it
In that case, you'd just hook into NMS and go about it as one normally does with pathfinder goals
i haven't done nms for a long time
or if you're using paper then their ai goal thing. not that i know how to use it
but the new Mannequin is the better way to do it from scratch nowadays lol
what takes most of the time is to make it customizable.. like.. little things.. i did a config class which auto synces values to its values class and has an event, when config reloads
w/o that you'll have to do it via NMS like Citizens and stuff
It takes a PlayerProfile and works the same as any other entity.
The only thing you'd have to add support for yourself if you're using spigot is pathfinder stuff
Yea, then just learn their AI Goal api and you're golden most likely
no clue lmfao
Probably you should use FancyNPCS is really easy with the api
I'm tempted to use it
I'll look at it over the weekend
the thing is, i like the process of learning new things... not just getting everything instantly
When I make a plugin or modification, it's usually because something is lacking, not because it's mine, at least in my case
That's a good point of view, but is a headache
Your best bet for this is Mannequin & Paper AI Goal API then lol
the caching strategy in my minigames is write back
i write instantly to the cache and then send it asynchronously to the db
Mannequin#setDescription(String) // The "NPC" part of the name
Mannequin#setCustomName(String) // The player name
Mannequin#setCustomNameVisible(true);
Mannequin#setPlayerProfile(playerProfile);
Mannequin#setImmovable(true);
Bare minimum
what about the pickaxe on the right near the oak log?
How do you do that
Invisible armor stand or something along those lines iirc
There are a lot of shenanigans with custom models and invisble armor stands and stuff
yeah
THere's a plugin, somewhere in this discord which shows all that stuff. Lemme find it lol
Mod*
Yea, used that on a server to see how they do things. It's just item & armor stand shenanigans lol
see my previous messages lol
if its armor stand.. I didn't know you can display an item on it
It's just holding the item & invisible
ohhhhhh
You're just setting the location to something that looks good
its an entity with an item but entity is invisible
Yes. It's just holding the item in one of it's arms, set to be invisible and unmovable, and positioned somewhere
Works with channel stuff? For example if i want to send to another server
Similar to how balloons and stuff work
cool
This uses invisible item frames, items, and barriers + a resource pack
Surely for bad hardware
As long as you don't over do it it won't
Any ways clients always can disable stuff
Yeah
Better example lol
cool stuff
Note the characters in the player name for the status & rank name as well
You can get real fancy with resource packs, albeit they ain't safe LOL
yeah that's just a different symbol/character
or a resource pack i guess
resource pack + character in a language you'll never use + other stuff
I need to rewrite my nametags functionality... planning to use TextDisplay and don't use teams at all
Better, in a font you'll never use
Unlimited Name tags similar stuff
and also use the packets a little
You can provide a font in components, which you should do instead of replacing the vanilla font characters
You can see the full thread here https://discordapp.com/channels/690411863766466590/694661573125472256/1101563685689884713 lol
You should but spigot doesnโt have good api for that
He's using paper
If only there was a PR to add component support to everything that wasnโt dead
If only
I honestly don't understand why that PR is dead

I don't even know what's on the JIRA lol
OH choco did anything come about when it came to our talk about implementing that random teleport api lol
the only negative review it got was MachineMaker's comment about the bad interopability with the old methods
Yeah at which point I gave up
I already had the RIP prepared for that reaction LOL
I don't believe that was enough to just disregard merging the PR, but welp
I don't either
how many dead prs are there xD
well, some are dead with actual reasons, this one in particular just got enough friction in it to leave it in the limbo state that it is now
same deal with the material to itemtype/blocktype conversion
just fyi, clients can use jvm arguements/flags just like the server does. Should play around with these as they do in fact help the client more than you think ๐
If you just heard of client flags you should leave it as default. You wonโt be able to do better than default without proper knowledge, even if your skript is 1 thousand lines long
yea didnt they recently change the vanilla client to run on gzgc or also
or well not recently
but not too long ago
where do i access the legacy version of https://hub.spigotmc.org/javadocs/spigot/index.html ?
That's still in the snapshots so pretty recent
oo right right
Help chat has them
oops sorry
With helpchat I mean the website
found it , awesome
Wasnโt gzgc made the default in a certain java version
G1 is still default as far as I'm aware
is there a way to determine what world a player joins when they join a server before theyre sent to the world
Maybe you can use PlayerSpawnLocationEvent
yes thank u
I have a duels server that has a couple of duels, and each duel requires some different login in some listeners. is there a smarter way to go about this rather than checking what duel the player is in in each listener. I feel like this isnt expansive as the listeners would just become slabs of code growing with each new duel type.
I am thinking about having a sort of "ClassicDuelListener", "UHCDuelListener" etc class, or is this overengineering?
The performance difference will br negligible, but from a clean code perspective you should have separate listeners
Separation of concerns
doesn't make a difference performance wise
at least not on paper where they do evil asm bullshit rather than reflection for calling eventhandlers
on spigot there might be a difference you might be able to measure with a microbenchmark harness or something, it would indeed be negligible
huh
yeah you generate classes/bytecode at runtime to directly call eventhandler methods, while spigot does it reflectively
or did you both switch to methodhandles now?
pretty sure we replaced all that asm bs with a much simpler constant methodhandle approach
spigot still uses a non-constant foldable Method afaik
yippee
lambdametafactory bs my beloved
i didn't really mind the asm nonsense but i remember someone complaining about it
i guess it did allow billy to create his EntityMoveEvent without killing the server just with the reflection overhead
nope
the problem is that the code was all over the place, difficult to read and all that
the current code should be at least just as fast
and is far simpler
yeah probably not nice to maintain
sadge
looking at it now
similar-ish approach for using LMF but more interesting, never seen defineHiddenClassWithClassData
public void onPlayerMove(PlayerMoveEvent event) {
if (event.getFrom().getBlockX() == event.getTo().getBlockX()
&& event.getFrom().getBlockY() == event.getTo().getBlockY()
&& event.getFrom().getBlockZ() == event.getTo().getBlockZ()) {
return;
}
}
thank you
?paste
Looking to paste something? Try a code block or one of the following websites:
- https://pastes.dev/
- https://sourceb.in/
- https://mclo.gs/ (best for server logs)
https://pastes.dev/KHIYgEtNP6 this aint exactly the prettiest it could look, but lambdametafactory ftw
both basically give u a POJO that gets called rather than a reflect call ig
based on an event bus that isnt as strict about input types however, iirc lmf is picky about param types otherwise
asm sounds nostalgic
Hello there, i am sorry for this request, this is not publishing or advertisement i am just looking for someone can help me
is there an event when that happens or is that totally client side? when glass attaches to blocks next to it
I know basics but very basics of java and I am interested at learning how to make plugins... at the moment i am looking at a developer teacher can teach me how plugins works and how to give a structure to those, because i am a beginner i had in my intention to pay for those lessons
For more info please just direct message me, and I thank you all for your availability
Try the BlockUpdateEvent
or whatever it was called ๐
BlockPhysicsEvent
great
Just be careful with what you do in that listener. It's called very often
idk if glass connecting to the block next to it is considered a physics
but ill try
I believe it's "physics" in the Minecraft world :p
hahaha right
i'm really close to making an async economi api
vault api just doesn't cut it
it wants data now
doesn't matter if it's in a blocking database
๐
and just falling back to 0 whilst loading isnt an option?
there's also has account checks
with no way for players to know
that they have to wait a bit
if there's an offline player shop
this would be annoying
there's withdraw and deposit with an economy respone
where i could embed a message to wait
but if the plugin does if economy.has first
Tried to get one natively into Bukkit. Problem isn't making an economy API, the problem is getting economy plugins and API consumers to adopt it
there's no way to let players know
i'd adopt it tomorrow
i have already made the futures
I think i'll implement 2 vault hooks
One that's blocking and one that you can click twice to buy
And let users choose which one they want more
Also about caching offline players i have to worry about players on a different server being online with a changing balance
In mysql mode
vault really doesn't lend itself to anything blocking
i you can, i would recommend just writing against your eco backend/plugin directly
good
ill just cancel everything
XD
clearlag "stop-lag" mode in a nutshell
actionbar native api would be nice to have in bukkit
the issue has always been action bars overriding themselves
lets say you have a 24/7 actionbar with some stats
but another plugin sends a notification thru actionbar
next tick its gone
bukkit could have a priority based system
similar to hide/showEntity where u pass in the plugin instance?
this would definitely be nice
currently i end up jerryrigging this through protocollib
I designed a system like this at work a few years ago
it's not very complicated to make happen, issue is mostly adoption; without bukkit forcing developers to register their things with priorities, you have to fall back either with external priorities based on regex or callsites, or treat all plugins not explicitly opt-in as "normal" priority
yea
speaking of adoption, has it ever been brought up as an issue or pr to add async support to vault?
probably
but vault is "feature complete"
so it probably isn't ever going to happen
they've been fighting over explicit UUID support for years
:,)
All they had to do is provide an AsyncEconomy interface and deprecate the current one
People would've implemented both and eventually switched to async economy
Is that much different to the caller just running it async though?
The issue is some plugins would still use the old interface
As a economy provider i guess it makes sense to have support for both for a while
An economy caller should definitely be async only
the main issue with vault is it doesn't offer any kind of transaction api
it's not an issue with just threading, but also logging and moderation
you can't have a "x paid y to z", you'll have a "x paid y" and "z received y", which you have to stitch together manually
didn't vaultunlocked support it
vault poisoned the proverbial well with the minimum viable product and now we're stuck with it forever
ah no VaultUnlocked is mostly for uuid & bigdecimal
no async
but there are some async econ plugins
also yeah, floats, yikes!
is NMS like mixins but for plugins? i cant understand it
so with NMS i can modify the minecraft code?
-# also enable ping reply
yes
you can do almost everything
sometimes reflections are needed to access private methods and fields
but it can be done
Unless you fork spigot or paper, in which case you can just edit it directly & recompile lol
too much work
depends tbf
w/ me doing a server with 99% custom plugins, forking it makes things easier lol
I mean you canโt actually modify the vanilla code
well not with that attitude
You can mess with variables, and hook into certain things, but thereโs no equivalent of mixins with spigot
well...
I have created something like a mixin into code that isn't mixinable when working with neoforge
and I am fairly certain that same trick could work with spigot
to some degree
What
Sure, in regular plugins lol
what is a "regular" plugin? and what is an irregular plugin
In these NMS packages, each version is installed in my local repository and has jars. When I try to set the scope to system, none of the jars work, and ChatGPT tells me that this won't work. It tells me things I don't understand, like multi-module. I'm new to NMS. I'm not sure how to create NMS's between 1.16.5 and 1.21.11 in a single jar. and load or run the NMS accordingly in a single JAR file.
?nms
๐ญ link not updated
i cant reach the website
i never used idk how to use
how can i do?
if u get me an updated link I can change it
Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: Packet login/serverbound/minecraft:hello (PacketLoginInStart) was larger than I expected, found 1 bytes extra whilst reading packet serverbound/minecraft:hello
[03:11:25] [Netty Server IO #3/ERROR]: Error sending packet clientbound/minecraft:disconnect
io.netty.handler.codec.EncoderException: Sending unknown packet 'clientbound/minecraft:disconnect'
then people send me incorrect information to my server
broo
But this is when your plugin or an server issue?
Is there a way to hide the saddle and like leash from an invisible horse? cause i want the player to ride an ball of air, but the saddle is still visible.
Why use a horse though
A slime idk
for the saddle you can probably send an equipment change
for the leash I think since those are now entities, you can just hide the leash entity?
maybe not with the API tbh
I mean you can do both the above with the api
?jd-s
is it possible to open the enderchest inventory without needing an actual enderchest near the player?
i see HumanEntity#getEnderChest is just an Inventory that should be useable for HumanEntity#openInventory so like id assume yes right
too common infact lol
If there's an inventory, there's a plugin that lets you open it without needing the actual block lmfao
Does anyone have tips for storing/sending complex command usages? It's become quite tedious with some of my plugins
figured lol
How can I listen to a packet using nms?
https://pastes.dev/ktOhH0SaDu I received a tutorial on how to do what I want with NMS, and I think it's easier to do it with NMS than with Packet Events
hm? What are you trying to do
Why are you messing with chunk lighting
and chunk packets
I have a Skyblock-gamemode server, but instead of islands, it's a normal world with borders; it's one world per player, and I'd like chunks outside the world's border to be intercepted with fake chunk data; so, instead of the world being 300x300 for example, it's 200x200 for example, and this way I use less disk space
The player cannot go to or interact with the chunks, so there won't be bugs like the player flying etc
You can just stop the chunks outside the border from saving to disk
And how can I show a 300x300 world to the player, but only save to the disk as 200x200?
https://imgur.com/a/HzdQ8vX I also tried using packetevents but I can't send a chunk from bytes
you can either hold those chunks in memory (which is going to be a lot of memory), or recreate them on the fly whenever you need to send a chunk packet (only really feasible for superflat style worlds)
since you're doing skyblock, i assume you'd want them to be sent as air-only chunks, which should be very easy
however, in practice i don't think this is going to make any reasonable difference in disk usage, since air-only chunks are also extremely small on disk
It's not a normal skyblock; it has the idea of โโa skyblock but it's a vanilla world with borders so they aren't air-chunks
well you're going to have something to send
if it's a regular vanilla chunk with trees and carvers and shit, recreating that from scratch on chunk send is going to be infeasibly expensive
yea no you're not generating that on the fly for each packet
^ better off storing it
you need to generate them ahead of time and store them either on disk or in memory
if you have multiple worlds/servers with the exact same out-of-bounds chunks, you could store the chunk packets themselves in a database/file shared across them all to reduce disk usage
https://pastes.dev/ktOhH0SaDu Does this solution generate every time it loads? I didn't understand this solution, that's why I'm asking
mcWorld.palettedContainerFactory().blockStatesContainerCodec.parse<Tag>(NbtOps.INSTANCE, Converter.convertTag(section.blockStatesTag)).getOrThrow()
this parses it from nbt
the nbt would presumably come from the disk
it doesn't magically generate a full chunk with all blockpopulators and everything applied
otherwise initialize them as empty: PalettedContainer(Blocks.AIR.defaultBlockState(),mcWorld.palettedContainerFactory().blockStatesStrategy(), null) and PalettedContainer(biome.get(Biomes.PLAINS).orElseThrow(), mcWorld.palettedContainerFactory().biomeStrategy(), null)
this creates an empty chunk
i.e. air only
so the first one would be what you would use for this
but unless the file/nbt is shared across multiple worlds or servers, there is no point to doing it over just having the chunks saved in region files normally
wdym with this
i quoted two parts of the paste
and replied to something i suggested
i mean you would use the first part of the paste that i quoted to do the something i suggested
From what I understand, you're saying to have a template world where the chunks outside the border will be shared between all worlds, and the per-player world doesn't have those chunks in the file. The problem is, I have no idea how to do that
you use this to create a chunk from nbt
you store the nbt in a file, in a database, or whatever
then you send it in the chunk packet
But in this way, am I not generating the chunks every time they are loaded?
no, you are loading the already-generated chunk from disk
you are still parsing it which is not free either, but is much cheaper than generating it
Well, I'm lost. I don't even know how to listen to a packet with NMS, lol
you listen to player join and inject a netty stage into their netty pipeline
but like someone else said, there's no need to reinvent the wheel; just use protocollib or packetevents and get the packet handle from them
But that doesn't make sense to me; if I need to inject into the playerjoinevent to listen for packets, then how do I listen for packets before the playerjoinevent is processed?
All the code I sent you uses nms, and with packetevents it's completely different
unless you specifically need to put your packet listener at a particular spot in the pipeline e.g. after packets get turned into raw bytes, or before viaversion, there's zero reason to do netty shit on your own, and you should use existing solutions like protocollib or packetevents
again, you can get the nms packet handle from protocollib and packetevents
and use them with nms code
anyway, doing this at all is predicated upon this ^ being true
i take it since you're still going for it that it is?
i.e. you have many worlds/servers with the same out-of-bounds chunks
yea they are shared
the world is the same for everyone
right
how can I do this with packetevents?
i don't know, i've never used it
with protocllib you just PacketContainer::getHandle, and cast to the nms packet you want
Do you have any idea what I might be doing here?
the only annoying part is the that PacketType names don't line up with mojang or the wiki or anything sensible so it's a bit of a guessing game
In my head, this code makes sense, but for some reason it doesn't work
is that bytebuf for the entire packet or the block data
because the nms packet has a byte[]/bytebuf for the block data, and heightmaps and other shit stored separately
i also don't think you can just reuse the same bytebuf like that
have you worked with bytebufs before? they're not exactly like byte arrays; they have read and write indices
Are these bytes not enough to send a chunk packet?
no
to reuse it, clone it and pass a mirror/slice to the future packets instead of the clone
But I know that they kind of have indexes and advance something like that
i don't know, that's what i'm asking you
oh
Just let the chunk be
i think is the entire packet
It's not worth messing with
one issue i guess is happening here is that the sendPacket(buf) reads the buffer to the end, so after sending that buffer once, it will have no bytes left in it and any future attempts to send it will send nothing
This getFullBufferClone method is present in all packets, so I imagine it is entire packet
I've already tried 1001 different things xd
when you get the bytebuf from the first packet, clone it before assigning it to the field
otherwise, when netty reads it, it will be empty
and when passing it to new packets, mirror it; otherwise the first sent packet will again empty it
mirror basically creates a "view" into the buffer, sharing the underlying data, but having its own read/write indices
clone copies the data as well
if (buf == null) { ByteBuf buffer = (ByteBuf) event.getFullBufferClone(); this.buf = buffer.retainedDuplicate(); BoxPlugin.plugin.getLogger().info("v2 chunk loaded by first time"); } else { event.setCancelled(true); buf.readerIndex(0); event.getUser().sendPacket(buf); BoxPlugin.plugin.getLogger().info("v2 fake chunk sent"); }
you might want to rather than cloning it, copy it manually into a heap bytebuf or you might run out of native memory
pass a .slice() or something instead of changing the index manually
i'll try this:
if (buf == null) { ByteBuf buffer = (ByteBuf) event.getFullBufferClone(); this.buf = buffer.retainedDuplicate(); BoxPlugin.plugin.getLogger().info("v2 chunk loaded by first time"); } else { event.setCancelled(true); event.getUser().sendPacket(buf.slice()); BoxPlugin.plugin.getLogger().info("v2 fake chunk sent"); }
https://pastes.dev/zy6pGWgW10 this code results on this
what's the writer index on the buffer before you copy/slice it?
16:19:24 INFO]: [box-plugin] readerIndex: 0 | writerIndex: 1
hey
what api for voting do you guys usually use?
i just wanna detect votes
i haven't done this for awhile so im asking, i used to use nuVotifier or something, idk if that's still an ok thing
It's probably still NuVotifier
i wonder how i prevent these internet packets
Time to start banning ips
There's not much you can do about that
i need to filter it out
sorry im slightly venting here
you can block them by hiding behind a proxy
proxies dont understand that kind of information and therefore ignore it
ah
well
they dont reeaaally ignore unknown packet info
but yeah i use velocity as proxy
i used to have TCPShield
these are generally harmless and cant do anything to your server
i never played around with netty much but if you really want to dig deep you could make a netty channel handler
you could inject into netty pipeline before wellll ... minecraft decoding
is there a php nuvotifier api? if you wanna make a voting site?
i found some but they all seem to be almost a decade old XD
Probably still work
if not make your own https://github.com/vexsoftware/votifier/wiki/Protocol-Documentation
made my own
but im getting issues, ill fix it XD
Attackk
Attaccccckk
HI OPTIC
Think Minecraft's AI impl is good enough for modern games, or is there a more modern (or just generally better) apporach to implementing it? I'm making a game & need to know lol ๐
is good enough ๐
Depends on the game you're making tbh
take a look at finite state machines and behavior trees
those are the two industry standards
^
I was just gonna yoink MC's impl if it was good enough for modern games LOL
the new brain system is kind of like a behavior tree
using it is fine if you're familiar with it
Remembered I have a bunch of game dev/design books. Gonna hope at least one of them goes into the AI stuff KEKW
I mean if you want to learn about behavior trees you can watch this https://www.youtube.com/playlist?list=PLFQdM4LOGDr_vYJuo8YTRcmv3FrwczdKg
I'e got this book that i haven't yet read
It's by joshua bloch, i see him often as an author in the impl of the standard java lib
Yup ๐
Concurrency in practice is also a good read
I want to get head first java patterns
But it's a bit too expensive
Design patterns
Not java patterns
I'll try to give it a try when i can
physical books? ew
Too much $$$$
Had a look at the old MC AI impl and it's simple enough ig
I should have books that go into other methods, but if anything I can yoink that & ignore the brain impl lol
I could use the Brain impl, but I'm doing this in C++ and that's abstracted to hell and i don't wanna figure that mess out in C++ KEKW
A few buffer overflows never hurt anyone
I mean ig the Brain could be massively simplified too if it's just kept to has/doesn't have memory ๐ค
Yeah of course
Depends on how much functionality you need
There's activities, memories
Not sure it's that hard to come with your own version
Yea, not really that difficult really
If I have a book that goes into it, I'll use that as a base instead kekw
So far, no LMFAO
i'm pretty sure you can find enough online if you want to save money
path finder
math to look at stuff
and then use those in your brain recreation to give activities to entities
$1000/question
XD
๐
I'm so happy with this, always wanted to do it, but i was on shared hosting before, couldn't do it
im on vps with root access now
THE best part comes now, making an actual plugin lol
There are plenty of existing ones
no
fuck them
XD
I'm making my own, everything custom
Most of my plugins are much more customizable than existing ones
each question gives me many snacks KEKW
i still think you should use some public plugins
making everything yourself means you don't have as much time to actually make sure all the features are top quality and bug free
i take the time with my plugins because i love making them
alright then ๐
minecraft offers creativity which i like
XD
right now im thinking where i put my weighted random generator
because
does it use a treemap and a range from 0-1 or 0 to 100?
+1 question = many McRibs ๐
+1 free antimalware check
tbf some plugins just don't need that much debugging or testing
Nah that'll probably be an invoice at some point considering how much time it can take up lol
XD
i made it for a fishing plugin a few years ago and idk where the plugin is
it has to be somewhere
well it's true lmfao
That can take ages if it's not a quick scan or check lol
It's usually not even a single plugin, but an entire server's worth
๐
no fishing
Not sure how I'd price the checks though ๐ค
not found anywhere... might be on other hard drive
i shouldn't get too distracted...
I think I have a weightedrandom impl actually lol
i might end up looking for it for an hour
give xD
gotta wait KEKW
i know linux, but im more used to windows
i do have a mc server and sql server on linux though
i just made one, not sure if it works tho
yup ๐
Mine's a bit more complex than that. Mine supports weighted lists and stuff lol
very nice
weighted list?
GIVE IT A SEC
cleaned it up a bit ๐
this implementation won't work
hmm, what's wrong?
PlayerToggleFlightEvent can be called on SURVIVAL mode?
you're using the weight as the key, meaning if you have two entries with the same weight, one will override the other
oh
that does sound like an issue
just make a list t then
and then randomly select from the list one element
similarly, if you have two entries with weights 0.9 and 1.0, the actual chances to roll them will be 90% and 10%, where you would expect them to be the other way around
the way you make it work is you make the key cumulative
i'll fix them up now ๐
for any given entry e with the weight w, you want there to be an exact span of w from its key to the previous key
double weightCumulative = 0.0;
for (var e : map.entrySet()) {
treeMap.put(weightCumulative, e.getValue);
weightCumulative += e.getKey() / totalWeight;
}
however, there is another issue, which is that the Map<Double, T> you're taking as a parameter will also cause two entries with the same weight to override one another
so you should switch it to Map<T, Double>
okay, one moment ๐
How do I know if a player is pressing two jump keys as if they were going to fly in survival mode?
enable the flight capability for them and cancel the toggle fly event
note that this will be ass with high latency
have some another alternative?
you could try the PlayerInputEvent or Packet
but i don't know if the client reports spacebar inputs midair
worth a try i suppose
they report if they are creative mode for sure
now on survival idk
what's site wtemplate
no templates i made it myself
i think you might've misread what i said a bit
the issue is with the math of how you're building the weights map
because vote systems are advantageous if they are famous
im making this for myself
it doesn't result in the correct probabilities
XD
for ur server ?
yes
