#help-development
1 messages · Page 532 of 1
hikari is coded in english iirc so if you cant understand english to an extent you should learn more first
yep
can u send ur code ?
i'm really just looking to know why the method doesn't work with the input of 'ZOMBIE'
u need do to EntityType.ZOMBIE ?
im not finding a fromString method in the EntityType enum, use EntityType.fromName
that may make sense
can someone help me do this and compile it for me im new
https://www.spigotmc.org/threads/scoreboard-toggling.333621/
just that isnt gonna work at all
i'm doing conversions from bukkit entities to nms crap so i can use packets
so u can pat urself on the back aye
((CraftEntity)yourEntity).getHandle
:( i just want my users to be able to toggle off scoreboard
sounds smart
what scoreboard plugin do you use
yeah you most likely will need a plugin if you want it toggleable
can i put scoreboard objectives with a scoreboard plugin?
if you find one with placeholderapi support you can do alot
i use /scoreboard to make objectives and display them on the sidebar, can a scoreboard plugin use those objectives?
what do you have on your scoreboard currently
time played
yeah theres a placeholder for that, you just need a plugin that can load them
ok
is there a way to get Keyed objects as string?
e.g. from StructureType structureType = StructureType.BURIED_TREASURE;
I'd like to get BURIED_TREASURE
Do registries have a function for that?
I'd be willing to use reflection if necessary
learning by doing
StructureType.BURIED_TREASURE.toString()
It returns the name of an enum in a string
It has to be dynamic for all Keyed Objects. Also StructureType is not an enum
iirc doesnt it have a getKey() method
doesn't that return the NamespacedKey but not the actual key of the object?
Enum#name()
oh well then receive the field name
you can then call getKey again and get the after colon part
Does it exist for Java 8?
getKey() should return minecraft:buried_treasure getKey() again should return buried_treasure
ohhh yeah if that works it's fine
yes
basic java ¯_(ツ)_/¯
I have been using .toString for my entire life
which field?
(╯°□°)╯︵ ┻━┻
i believe BURIED_TREASURE is a field isnt it
Yes but I can't know the name
Keyed test = StructureType.BURIED_TREASURE;
test.getClass().getField("name???");
it's not like I can do that. Remember that this is just an example and I usually don't know the value of the Keyed object like I do in this example.
loop over the fields
and search for?
whatever you need
upper case or whatever
look for patterns
or look for an easier way
weird enough that StructureType is not an enum
I only have a Field that implements Keyed with a value and reflective access to it.
They'll remove most enums if I understood that correctly
getDeclaredField 
why aren't you just using the key itself? why do you want the field name?
For configuration files
Why?? Enums are the most goated thing ever
use the key for config files
any standalone (ideally minimal) libraries to listen to mc packets?
Yeah I'll try the key thing
some-structure: minecraft:buried_treasure
or
some-structure: buried_treasure
you could also make a parallel enum class which has the same constants as the class's fields
minecraft is kinda data-driven, so enums aren't really suitable there
would break with each update sadly
otherwise just use the key if you dont want to overcomplicate it
yeah I can use the key, thx
you are looking for the best looking solution while already having one
you should be using the key for everything, not Enum#name (if it is an enum) or toString
Don't care, enums always great
do you think Material should be an enum?
I don't get the point of ditching enums either
like does the Material enum make sense, as its designed now?
Yes and no
how can i make these particles only last for 4 ticks?
private void shootParticleLaser(Player player, double damagePerTick, double maxDistance, int tickDelay) {
new BukkitRunnable() {
double distance = 0;
public void run() {
Location particleLocation = player.getEyeLocation().add(player.getLocation().getDirection().multiply(distance));
// Spawn laser particle
player.getWorld().spawnParticle(Particle.REDSTONE, particleLocation, 1, 0, 0, 0, 0, new Particle.DustOptions(Color.GREEN, 1));
// Check for players in the laser path
for (Entity entity : particleLocation.getWorld().getEntities()) {
if (entity != player && entity.getLocation().distance(particleLocation) < 1 && entity instanceof LivingEntity) {
// Apply damage to hit entity
LivingEntity livingEntity = (LivingEntity) entity;
livingEntity.damage(damagePerTick);
}
}
distance += 0.1;
// Check if the laser has reached its maximum distance
if (distance >= maxDistance) {
this.cancel();
}
}
}.runTaskTimer(this, 0, tickDelay);
}```
But honestly, more like yes
Biome biome = Biome.CUSTOM
yeah, enums make sense... for that
I think the Material rnum is good
It combines Block and Item in a way they shouldn't be combined
why are Stone block and Stone the item type the same thing?
I mean
Ok, so then what about potatoes.
you can seperate them
or carrots
There maybe should be a BlockMaterial and ItemMaterial enum
but the enum would be as a type probably the best option
those have separate enums
what about adding custom items
Material.POTATO, and Material.POTATOES, those are the same thing too, just like the item stone, and block stone
a reason to change, but not to ditch enums
you can't have a server implementation of an enum, so that means if you want to get some property of that enum, either it has to be hardcoded to the enum constructor, or you have to make a bridge method to get it, through UnsafeValues, Server, ItemFactory, one of those bridges
BlockMaterial.CUSTOM, then attach your Block to it
so im meant to do some hella jank do check if its a custom item
Yes I don't like magic strings
no thankyou
try with resource can close statement and connection after leave onenable?
yeah I know, but people said that block stone and block item are the same thing #help-development message
first of all, why would you want to implement a new material in a plugin context
Should be an enum if it has limited options
this isnt modding
try with resources closes the connection when the code is done running
what are you talking about... that doesn't make any sense as a response to what I said
By definition it is
not quite sure what you meant with "server implementation of an enum"
It's server side modding
Yes
what server impl always means here, all those CraftXXX classes are implementations of api types
and you can't do that with an enum, so you have to hardcode properties or have bridge methods
the material enum in its current state for the pr is being deprecated and stuff is converted to BlockType and ItemType
both of which are not needed if you just follow the interface + impl pattern
Wait really?
I literally just guessed that BlockType and ItemType would be a way LMAO
they aren't enums
one machine maker is also there
I did not know it was a thing
Why would that be split
because they are separate things
you can't have new ItemStack(Material.MOVING_PISTON)
But block has the same material as it's item
not always
Ah
not for everything
potatoes and carrots
theres a load @young knoll found
its a completely arbitrary connection, that an item and block happen to have the same name. It doesn't signify anything about them
So there would be duplicates?
Or
Yeah what do you do with those with regular behavior
you also shouldn't be able to do block.setType(Material.DIAMOND_PICKAXE)
but because they are combined as a single monstrocity, you can
shouldnt?
Never tried, does it error?
idk either, and thats a great reason why it shouldn't be a thing, which is why splitting them up is good
it could error, it could go to air, idk
As long as it stays as enums
What are they
static final fields in ItemType and BlockType
Ehh
idk why ehh
What does that benefit
extendable
you don't need to hardcode properties, or have bridge methods to get properties of an ItemType or BlockType
which is what the Material enum does all over the place now
you can have a CraftItemType which just gets the property directly from the nms type
well, they won't
once material is gone they will
lots of stuff is being fixed with bytecode rewriting, and Material isn't being deleted
no, its just being deprecated
fuck the latter
Maybe material could redirect to the new solution or something
and all methods that use it are being replaced with bytecode rewrites fixing the ABI breaks that causes
So it doesn't break
Material is staying as is
they need to fix their "compiles", but at runtime, most things will work
and there's an option to make sure pretty much everything will work, at a potential small performance hit, but that's disabled by default
a plugin complied against an api with Material-related methods and other enums that will be changed will still work after
you will just have to fix those issues before you compile against the new api
Bump it got lost a bit
PacketEvents
im taking a wild guess thats what he uses already and was wonder if any smaller exists
Yea I need it as minimal as possible
how big even is packet events
Over a meg shaded
just use libby to load it
Could be even more
its like 25kb
Yeah you can download the jar and then load it
I want to die
Multi support is getting extensively more complicated with each update
wrote a spawner plugin and i use minecraft’s block storage system to store data. there was no lag the server just crashed, i don’t understand too much about what happened or how to fix the issue
They should just keep Material as they had it before where it included both items and blocks
does anyone konw how hypixel makes this kind of things?
You managed to freeze the server for 30 seconds or so
what are they?
amorstands
invisible ones holding the items
yeah but how and why
i need to fix it, it was for a client who spent a ton 😂
is there a guide, api or smth to work with it?
armorstands are entities
?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.
Can't help then
im just so confused
Something you did froze the server
You can see the thread dump for what exactly
We can't help you more than that
is that something other than what i sent?
No
the error points to the customblockdata code which just uses mc’s block info storage system
which makes no sense
check the lines the thread dumb is saying is causing the errors
You could be stuck in an infinite loop or smth
nah not that
the error points to the customblockdata code which just uses mc’s block info storage system
no line #
check cmd's code then, see if its a bug and report it
i hate weird errors
does this mean that they are not friendly and shot not be used that freely?
what
if its 1.19.4 you can use the new item displays
wdym
i was just saying armorstands are entities and you can spawn them
in 1.19.4 mojang added item displays
they're non ticking entities for display items
with transformation
bro what is this mean ?
== or != ?
ty
its intellij enabling ligatures
lol I'm glad you already answered because I was going to say they were ligaments
and I realize that those are joints

Heyo, how do I play a note in world ?
I have not found a anything like playNote that is in player
actually why i need check is connection not null and return connection ?
ye, that is player specific, no?
I would like to do what noteblocks do
but in code
that code either returns an available connection. or when null attempts to establish one.
well you can use exactly the method i provided for that
you probably want to run that async and return a future if you arent using hikari
the method takes a "Sound" Enum
I do not believe that is what I want
which contain "BLOCK_NOTE_BLOCK_<instrument>"
I want to play the note in world, not for a specific player
declaration: package: org.bukkit, interface: World
then use this one
or the one taking a location
instead of an entity
ok so I have to create the pitch myself, can't use the Note class for this
sad
??
yea whats the problem with specifying that urself.
That I should not have to do that, Spigot should have the API for this
The same one as it is for player
Add a feature request
Connection connection;
public Connection getConnection() throws SQLException{
if (connection != null) return connection;
String userName = "root";
String password = "12345";
String dbUrl = "jdbc:mysql://localhost:3306/players";
this.connection = DriverManager.getConnection(dbUrl, userName, password);
return connection;
}
public void initializeDatabase(){
try (Statement statement = getConnection().createStatement()){
String sql = "CREATE TABLE IF NOT EXISTS playerstats(name varchar(16) primary key, emerald int, token int, level int, skillpoint int)";
getLogger().info(ChatColor.RED + "There was an error in database -> ");
statement.execute(sql);
}
catch (SQLException exception){
getLogger().info(ChatColor.RED + "There was an error in database -> ");
exception.printStackTrace();
}
}``` is my code true ? i don't wanna use try cath in onEnable so i do twr
I expected that
May you please point me to the correct place ?
?jira
I don't feel like signing the thingie
ty
so you dont want to meet md's kangaroo
can we cancel the item using ?
i mean bow pulling shield blocking ?
when i add the itemcooldown to shield
shield has cooldown but i can still blocking
Do you want to cancel it sometime or all the time?
sometime
when player get damage from sword attacker
Adventure api
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#playSound(org.bukkit.Location,org.bukkit.Sound,float,float) I don't think you need adventure do you?
declaration: package: org.bukkit, interface: World
Adventure is for components anyway...?
TIL
Where can I find a modified 1.8 spigot for good knockback etc, something like NitroSpigot but 1,8 only
adventure messes with everything yeah
why tho? the Stone item type and Stone block type are different things
I find the two new type classes pretty cool but it's pain that plugins developer must create a wrapper class to retain proper support for older versions
well, Material will still exist, just deprecated and not getting future updates
and the 2 new things aren't enums either, saw you corrected your statement
That's what I mean. You therefore must create wrapper classes each time you'd previously use Material
if you are developing for older versions, you probably aren't compiling against the new api right?
well actually, idk if its decided that Material won't get new constants, I think that's still up in the air
but new methods, I think is off the table
This depends on the plugin itself. Newer ones likely use the new API
well if you use new api, you obviously can't use it on a server that doesn't have that api, like an older version
that's just how it works
But this rather seemless change has massive affect on plugins as EssentialsX and any other
Each plugin is forced to create the wrapper classes if they want to retain the support
idk what seemless means to you in this context, if you mean seamless, that doesn't make sense either
I mean that it's a small change with massive consequences for almost any plugin
I feel like you still aren't understanding that you can't use new api on old servers, that's always the case, not something new that's happening here
if you compile against spigot api for 1.19.4 and use material, that will still work on a hypothetical 1.20 spigot server (assuming this happens for 1.20), and into the future
Eh QoL
QoL to use an entire library over just using a native method?
But there's nothing new. Something existing is just being split apart enforcing everyone to adapt something that's basically the same thing as before. Material will likely stay until the death of Spigot itself, similar to the past legacy methods that have been deprecated. It wouldn't be a lot of effort to add new items/blocks into the Material enum as well. As a result of this not being done, almost any plugin needs an overhaul if they just want to make use of the new materials
I can understand that it's being deprecated. There is no way around that
But the transition should be done easier for everyone
I said I don't think its been decided if new constants will continue to be added to Material
it sounds like doing that would solve all your issues
Yes, that's my main concern
Why arnt they just making them sub classes?
we can probably figure out when 1.20 comes out, im guessing the de-enumifcation is happening then too
they aint gonna just straight up get rid of them i doubt
wait what are they doing to material anyway
As far as I have understood it's being deprecated and possibly new entries aren't being added to it with future updates. They are being added to new ItemType and BlockType classes instead
Their first plan was to actually keep the Material classes (without it being deprecated) and to just de-enumificate it
Classes, with public static fields for each type
do they just not like enums since they not flexible or smthm
Ig because of potential mod support
makes sense sorta ish
cause yeah enums on their own do tend to be rather hardcoded
so its understandable sorta ish
I've been having some trouble using packets to simulate the movement of falling blocks. I find that they 'stutter' in space, teleporting 0.1~ blocks rapidly as they travel, rather than move smoothly. Here's the code:
public AsynchronousEntity(Vector velocity, Location spawnLocation, org.bukkit.entity.EntityType entityType, Material mat,
int x){
this.unmodVec = velocity;
this.velocity = new Vec3(velocity.getX()*x, velocity.getY()*x, velocity.getZ()*x);
this.lastLocation = spawnLocation;
lastTime = System.currentTimeMillis();
entityID = new Random().nextInt(Integer.MAX_VALUE);
entityUUID = UUID.randomUUID();
if (entityType != null) {
this.entityString = entityType.getKey().toString();
Bukkit.getOnlinePlayers().forEach(player -> {
CraftPlayer craftPlayer = (CraftPlayer) player;
if (mat != null) {
craftPlayer.getHandle().connection.send(new ClientboundAddEntityPacket(entityID, entityUUID, lastLocation.getX(), lastLocation.getY(), lastLocation.getZ(), 0, 0, EntityType.byString(entityString).get(), getId(CraftMagicNumbers.getBlock(mat, (byte) 0)), this.velocity));
} else {
craftPlayer.getHandle().connection.send(new ClientboundAddEntityPacket(entityID, entityUUID, lastLocation.getX(), lastLocation.getY(), lastLocation.getZ(), 0, 0, EntityType.byString(entityString).get(), 0, this.velocity));
}
craftPlayer.getHandle().connection.send(new ClientboundSetEntityMotionPacket(entityID, this.velocity));
});
}
}
public AsynchronousEntity updateLocation(){
Long timeDiff = System.currentTimeMillis() - lastTime;
lastTime = System.currentTimeMillis();
Vector vec = new Vector(unmodVec.getX(), unmodVec.getY(), unmodVec.getZ());
vec.multiply(((double) timeDiff)*0.05);
lastLocation.add(vec);
vec.multiply(32*128);
Bukkit.getOnlinePlayers().forEach(player -> {
CraftPlayer craftPlayer = (CraftPlayer) player;
if (vec.length() <32767) {
craftPlayer.getHandle().connection.send(new ClientboundMoveEntityPacket.Pos(entityID, (short) vec.getX(), (short) vec.getY(), (short) vec.getZ(), false));
}
craftPlayer.getHandle().connection.send(new ClientboundSetEntityMotionPacket(entityID, this.velocity));
});
return this;
}
Random.nextInt(1,101) should give from 1-100
then check for 30 percent for example if number is < 30
I have an asynchronous task which runs updateLocation
and obviously that percent could just be a variable
?
wdym
then it doesnt activate
90% chance for that to happen, so 1-90 mean it activates
95 means they dont get it
so make it 100%
ex
You shouldn't simulate movement using teleportation. 20 packets + potential ping aren't able to hold up against interpretation handled by the client with potential 165fps
if you want it to have to proc then make it 100% chance to proc
physics stuff is handled client side right
some of it at least
You could alternatively use the new display feature, disable gravity and use velocity instead or put it on an armorstand as a passanger
or am i just stupid
For some things. E.g. particles like arrows are being handled client side
For other entities it's usually just using the velocity
thats what else is for
absolutely, i'd prefer the client handle everything
but i can't tell a client to simulate spinning a floating object made of blocks in 3d space without simulating the movement of all the blocks composing that floating object
if (random <= 10) {
// rare item
} else if (random <= 45) {
// uncommon
} else if (random <= 90) {
// common
} else {
// dogshit
}
Before 1.19 you'd have just put the falling block as passanger on an armorstand (maybe disabling gravity also works?). For 1.19.4 i'd def use display entities
of the stuttering
I'm on 1.18.2
Uhuh... you realize even if I put it on an armorstand or whatever, it would still have the same problem? In normal MC, falling blocks throw packets every few seconds to update their locations, otherwise everything is done by simply updating motion using ClientboundSetEntityMotionPacket(entityID, velocity)
But I can send more packets more frequently than MC would normally.
Causing it to update the location more often
Now, when I send a motion packet to the FB, when it 'moves', it should 'line up' with where ClientboundMoveEntityPacket places the falling block at, but it doesn't, and I'm not sure why
Maybe my math is broken somewhere
I've been running through different X's to try to find the proper motion, but alas
Oh I thought you meant stuttering because of it falling down. That'd be a common question back then
no
i just turn off gravity lol
i don't include it in the above
because it was over the character limit
Everything is so easy nowadays
if (hasNoGravity) {
PacketContainer metapacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
metapacket.getIntegers().write(0, entityID);
List<WrappedWatchableObject> metadat = new ArrayList<>();
metadat.add(new WrappedWatchableObject(new WrappedDataWatcher.WrappedDataWatcherObject(5, WrappedDataWatcher.Registry.get(Boolean.class)), true));
metapacket.getWatchableCollectionModifier().write(0, metadat);
ProtocolLibrary.getProtocolManager().sendServerPacket(player, metapacket);
}
hm
No.
I have a large collection of FBs, say in the shape of a sword. When I 'rotate' that object in space, the relative positions of all those FB's change.
having a hard time understanding your problem then
ohhhh
I need that rotation to be 'smooth', that is, as the group of FBs move through space, they shouldn't 'stutter'.
hate to be that guy but why not just use texture packs
Because it's a server-side plugin.
well duh
There are other reasons I want to simulate using BOTH motion and moveentitypackets, namely, that this will allow me to ignore collision.
but server texture packs do exist
Anyway, if anywhere here knows why that stuttering exists, or how to fix it, let me know.
(hilariously, the motion packet isn't useful for living entities, go figure, all their movement is interpolated)
though
@warm mica do you know how I could send a packet of an invisible entity with a falling block riding it?
maybe that would solve this problem
isnt that literally exactly the armor stand suggestion
that's with MC entities
i'm asking packets
packets avoid having the server simulate hundreds of entities and their collision
he wants to have the same goal without the burden of the server knowing about it
yuh
buy more ram?
just send packets pretending a armor stand exists
there is definitely lmao
probably not called “riding entity” though
probably called a Vehicle packet of sorts
like if you want to make a fake entity just make a fake entity
uuuuugh
Send the armor stand packet, then the set passengers and it might work
well
you just asked how to create a fake entity
that is one possible solution
this is how to do it
bruh
i know that
what i am hoping for is someone to go 'oh yes that stuttering problem, i fixed it by just sending a server motion packet every other tick instead of every tick'
this is very much a roundabout solution
this is a roundabout problem ngl
Is possible to get class object of class with generic type?
no
at least definitely not that way
Class class is used for runtime nonsense and generics are pretty obsolete at runtime
What’s the actual goal you want to accomplish with clazz
register to DI container
register, and container?
ok nvm its not related to Spigot
dependecy injection container
I know what DI is but what you just said makes no sense
DI is a principle, are you talking about a DI framework in particular?
because otherwise you just use constructors
no idea what a “container” is in Java to be honest
For example Spring framework register all classes with @Bean annotation to its DI container
oh I have little Spring knowledge but do you mean a class that you can pass that contains all of your typical DI objects instead of passing each object individually?
please delete this epic lmao
ye
but beans
oh Xd
alright so now I need more information
register how? Are you using Spring or was that just an example?
Own implementation of DI. Its just pretty handy for to pass class as parameter for type i'm looking for in container. So it's bad that java don't allow to use ConfigOptions<TestConfig>.class in this case
yeah you can’t do that
pretty sure that’s the most specific a Class object can get
maybe you can use type tokens somehow which is a major hack?
well I can bypass this like that
pretty sure that the class will not have that generic parameter
like the TestConfig generic won’t be part of the object from getClass()
It seems that generic type is part of object
yeah, its like how lists work
List<String> list = new ArrayList<>()
like you dont add the type on the 2nd half
as I remember for case List<Some<Stuff>> list = new ArrayList<>() an Stuff type will be not included to relfelctions
Some won’t be either
is it true?
It’s just a List
It’s true and wrong, it’s just a List in reflections, not even a List<Some>
it is
generics get removed after compilation, so no you cant get the type
idk if you are trying to correct me Jacek because I’m absolutely positive it’s just a List lmfao
well I've check that. In case of Field you can get the Generic type of list. In case of local variable you can't
No you can’t, you can get the class of the first element which is likely to be the generic parameter of the List, that’s all
var memberType = arrayType.getActualTypeArguments()[0];
var memberClass = Class.forName(memberType.getTypeName());
``` Here is some code that can be use to get generics parameters
oh my bad, you’re right
you can’t get it with just the object though is what I mean, at least I’m pretty sure
yes
Only if you have the actual reflection field, and possibly method parameters it’ll work as well
actually not sure how they’re returned for that last bit
Java 👍
java > kotlin
so true bestie
kotlin sucks for a huge amount of reasons, imho.
- caring about what's important. what is more important? the type of something, or the name? imho the type is more important
String someVar;
this is definitely better than this:
someVar: String
-
getters and setters. kotlin thinks it's nice to break encapsulation and just mess around. You can literally do
someObject.someField = anotherValuelike Wtf. Is this now calling a setter? The funny thing is, it depends on whether the setter is available (aka visible). How stupid is that. Why not just use the setter? Erm.... -
"Consiseness" lmao yeah well, no. Kotlin is less lines of code, that is true. and Semicolons in java are useless, I agree with that. But Kotlin only makes everything more complicated. It's so ambiguous, I really do not understand why anyone would use it. Open for suggestions though, ofc
also kotlin claims to use less code than java, but a simple variable declaration needs more chars than java does
not that I'd care about that, but I wanted to mention it
just see here
its not less chars if you write java like me
I'm a maniac
I include final
:P
final String someVar = "Value";
how does that look like on kotlin?
it doesn't
I'm just saying if you're literally mad like me and don't like the compiler do its job its longer :P
i dont get it
type > name
kotlin is like "yeah the variable has the following value.... oh and btw it's a string"
like wtf
why not just directly say that it's a string
this one little line of code took 3 hours 🙂
public List<String> getMessageList(String key) { if (language.getStringList(key).equals(Collections.emptyList())) { BufferedReader reader = new BufferedReader(new InputStreamReader(this.getResource(translations.language))); return YamlConfiguration.loadConfiguration(reader).getStringList(key) .stream() .map(s -> s.replace("&", "§")) .collect(Collectors.toList()); } else { return language.getStringList(key) .stream() .map(s -> s.replace("&", "§")) .collect(Collectors.toList()); } }
most modern langauges do name first, but I'd argue since there are a ton of great more modern languages I'm fine putting up with name first even though its not something I prefer. Unfortunately, for kotlin its not one of the more modern languages I care about its a java reskin because google and oracle got in a fight
this is terrably inefficent
can someone explain why Deluxe Coinflip shows up as a trojan virus when I download it?
how?
also if it shows up as a trojan make sure @vagrant stratus heres about it
I'd report it and he will deal with it later
on spigot
your loading the config from disk every time this is called
no it doesnt
imho kotlin tries to fix issues that java simply doesn't have
also the overhead of loading an entire config for one value
is horrid idea
cache the config
e.g. nullability
and reuse it
nullability is not an issue, it's a feature
its a static config which means I can access it anywhere
oh yeah that reminds me, kotlin does not even support static members
"companion objects" lmao yeah, no
every language that thinks "name is more important than type" has not understood some very important concepts imho
wish the yamlconfiguration accepted inputstreams else I wouldnt have to go through the trouble of all of that code
and yes ik its deprecated
it does accept a reader
yes a buffered reader
and no, it's not deprecated
it accepts any reader
check rn its dep
declaration: package: org.bukkit.configuration.file, class: YamlConfiguration
I said inputstream
BufferedReader reader = new BufferedReader(new InputStreamReader(this.getResource(translations.language)));
why are you wrapping it into a BR, that's not needed
fixed lol
does it work correctly now?
ye
InputStreamReader.
CharArrayReader.
FileReader.
PipedReader.
BufferedReader.
FilterReader.
PushbackReader.
LineNumberReader. 🙂
are you jeff or alex
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
what
do you have a question?
i was asking if he is jeff or alex
#general
that was the question
Rust...
a great lang
no, Go is for different things
you should use Go to solve problems go is best at solving
and Rust to sovle problems rust is best at solving
rust is the only name first language i respect
no respec for python 😢
i despise python
python is one of my least favorite languages
hmmmm? What was your first language
python was my first but after learning new languages i hate it lol
poor python
python gives me aques
its so great, but no one loves
its main good quality is the fact so many people use it
its also just easy and extremely fast to write
its a scripting language after all
its goal isn't blazingly fast programs like C or C++
who hates arraylists cause I just found a better option
why would you hate ArrayLists
`import java.util.Map;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
Map<String, Integer> treeMap = new TreeMap<>();
// Adding elements to the tree map
treeMap.put("A", 1);
treeMap.put("C", 3);
treeMap.put("B", 2);
// Getting values from the tree map
int valueA = treeMap.get("A");
System.out.println("Value of A: " + valueA);
// Removing elements from the tree map
treeMap.remove("B");
// Iterating over the elements of the tree map
for (String key : treeMap.keySet()) {
System.out.println("Key: " + key + ", Value: " + treeMap.get(key));
}
}
}` ||(joke)||
they are a good data structure
lmfao
okay but i most of all hate doing : then indentation to show functions
what.
I get not liking the syntax but it is geared to be as stupidly simple as possible
yeah thats the only reason i dont like it
its simple as shit
but also i hate its syntax
and lack of any sort of decent typing
typing in python is very strong if you use it
number: int = 582
kinda like ruins the whole point of python
not really I mean who makes a value of a type than randomly switches the type of that value
that's a design flaw
yes i know
but its possible
🤡
im saying typing being weird
like it should be mandatory
and at least in ts you can trust people are probably gonna use typing otherwise they wouldnt be using ts
this is why I love python
made this script in like 10 minutes
why did you make a wrapper for buildtools
would have taken way longer in java
this doesnt need to exist
adding paper support when i get around to it
ah
true
also manages cacheing etc though its not fully flexible yet with the cacheing
simple scripts are what python is good for
i just dont like when people take super fancy massive projects
and do it in python
if someone makes a big project in python they are stupid
just dont like reading large py code
ok so we agree
unless the project is AI, then Its semi-excusable
it'd still be better to use C, but I'd understand not wanting to touch that shit show
dayum
but yeah python is fine as a scripting language
but large projects in python just feel confusing to me
I have uncoditional love for python as my favorite scripting language
(javascript can just go die)
i prefer js over py for most projects ngl
discord.js my beloved
I code my discord bots in java
i use nodejs as just a scripting language
for small projects
like for example a stock checker for those peepy stuffed animal things
also main reason I use py, is because latest version comes preinstalled on most linux distro
so it just makes it super portable
i made a stock checker for those lol
in js
im fine with py as long as it's used as a scripting languages i just hate having to look through big ass codebases with no brackets
the lack of brackets scares me
im just happy i made a little wrapper for bungee messaging channel i cant wait to hopefully never touch it again
like ill have to look at docs more cause all i did is make the messages automatically send but they dont know the specific data to send or anything
but its less work then writing everything to the message
hey listen BTGUI only took me uh
too long
to get working the way i wanted it to
started as an afternoon project ended up taking like a good week
"TextComponent message = new TextComponent(ConfigUtil.getplayerconfig((Player) p, "TpaArrivato"));
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + p.getName() + " " + target.getName()));
target.spigot().sendMessage(message);" How do I get it to run from the console?
dont cast to player
How do I not do this from the player?
Does anyone know how to use firebase with spigot, if there is a library or smth?
Could not find artifact com.google.firebase:firebase-firestore:pom:24.6.1 in spigotmc-repo I tried to use https://mvnrepository.com/artifact/com.google.firebase/firebase-firestore/24.6.1 maven dependency
like this?
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>google</id>
<url>https://maven.google.com/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-firestore</artifactId>
<version>24.6.1</version>
</dependency>
</dependencies>```
cause I get the same error
Does anyone know any alternative to Hibernate that works using libraries flag in plugin.yml
Whats not working
still get this
with this issue
Using 1.19.4
but I can give you full stack trace log if you want it
any help is appreciated
Not running spigot
I'm pretty sure that either your hibernate code is wrong or that hibernate uses reflection to access your class, in which case you'd have to somehow pass your plugin's classloader to hibernate
Using another library won't fix that. This is not caused by a spigot bug or hibernate. It's just that two components are being loaded by different class loader
By default, Class.forName (without passing a classloader) only goes through the classloader you currently are in and your parents. That being e.g. your plugin and the system classloader (used for Bukkit, NMS etc)
Alternatively you could also use hibernate with annotations instead of declaring everything in that xml file
But I may also be wrong. I am not certain how Spigot handles that internally
I mean technically it could be fixed on spigot's by using different classloading techniques. But classloading is painful from time to time with many rouge bugs so I understand if one doesn't touch it
how we can get all entities with specified scroeboard tag ? like how we do it with command @e[tag=test]
or at least how we can get a list of every entity in server ?
nvm
BlockDisplay#setIntepolationDuration doesn't seem to be working for me.
I assume it works by simply setting the delay, and afterwards all following transformations will take X ticks to interpolate?
I've set the duration to 10 but all transformations happen instantly
Supporting outdated versions should never be a concern for new API, the only concern is that a easy migration path exists. Supporting old shit is a you problem. You choose to go thru that pain, even tho the majority of servers are always on latest.
People with a mentality like you are the reason why the Bukkit API is in such a horrible state and we have to push back on that mentality whenever possible to be able to move forward
Glad to see that Choco agrees
Yeah honestly there is little point in supporting older versions
usually there is an older download of your plugin or a specifically made backport if you fancy latter so it is not as if the people running older servers are missing a lot. But new plugins should be written for new technology (which will get outdated in 5 years time but that is another issue)
"People like me"? Wtf? Sorry for not wanting you to break like thousands of plugins and server with a minor change that can easily be prevented? It's not about not wanting to move over, it's about making the transition easier
If you can't provide a proper stable API that doesn't break in the span of 5 updates, I could just as well use NMS
Only thing that I want is that the new materials are being added to the Material enum as well. It's that simple
No point
The API has been stable and not broken in MANY years. This is a change that is long overdue. Time to break.
It's not like as if there is anything that'd hold up from doing that. Just the mentality of the people responsible for that
Imagine if windows would remove 32bit support for programs just because they feel like it. Exact same thing
Material Enum is already a nightmare. It kills IDE's for many people
download sources
Imagine if Windows removed outdated 32bit support after MANY years of legacy support, in a NEW release. Some would complain. Many would update.
There is a compatibility layer provided (where multiple days worth of hours were put into) to make sure older plugins will stile work
However, there are tons of programs that still run 32bit that people can't move from. Microsoft didn't remove it because there is literally no benefit in doing that, it'd just annoy everyone
if anyone has ever worked with Reflections please take a look and tell me if this is obviously wrong or if it could potentially work
i want to go through every class in a package and create an instance of it
Every plugin I've written supports teh version it was written for and backwards. Going forward I'll support only the new system. If people want older versions they can download the appropriate jar.
i just kinda stole it from stackoverflow so this might be obviously wrong and outdated to someone who's worked with the lib before, if not, i'll test it later today
That's the lazy solution
Do you expect MS will retain 32bit support JUST for old programs? or do you think there is another reason?
It's not like as if the Material enum disappears with the update. It'll still he very actively used with many following updates
It's a transition. 32bit -> 64bit was a transition as well
For what reason?
performance
Performance. By removing that one class from the memory
yes
Lets just make everyone spend tons of time into forcing them to do something that can easily be avoided just to save a couple of bytes in the memory
yeah, a "couple of bytes"
Literally. You won't notice a difference
A mob spawned in your world likely consumes more
probably, but I think it's time to trim the fat.
As I said, you just want to get rid of it because you feel like it. Not because there is actually any benefit in doing that
There is guaranteed to be a benefit to removing it.
My reason for removing it is two fold.
Performance for one. Second is it would clean the gene pool of all old and outdated plugins. Those willing to update would be be clean.
Look up about weighted random
are those supposed to add up to 100
Yeah, you'd need to change the values so they add up to 100 first
Except if you just do other tricks - I guess that would work too
TextComponent message = new TextComponent(ConfigUtil.getplayerconfig((Player) p, "TpaArrived"));
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tp " + target.getName() + " " + p.getName()));
target.spigot().sendMessage(message);
how do i make the console execute the command?
and dont't the player
If you have 10 items all with a 90% chance, how do you expect to decide which it shoudl give?
I don;t believe you understand percentage chance
you tell us what you want it to do
no, i want when i click the message the console execute it
the code you gave me executes the command and that's it, I want to put it when I click but I don't know how to do it
Do what? You need to explain how you want it to work
Hey there, im trying to make a homesGUI plugin, how would i go about creating a folder that stores all the player data, so in the homesGUI folder there would be a UserData folder with many files of all the userID's with homes
new File(plugin.getDataFolder(), "UserData").mkdir()
https://www.spigotmc.org/threads/working-with-data.562421/ this is quite a nice resource to read for that
Thanks for all the help, appreciated 👍
Hey! I'm working on a framework for integration testing on Spigot plugins and I was wondering if you were interested in such a thing. The wiki entry is here: https://www.spigotmc.org/wiki/testing-with-watchwolf/ any feedback/suggestion is appreciated. Thanks!
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
It's not even a fucking break, lmao
Just a deprecation
Nothing major will be broken, the cases that will be broken has been warned for for years, in literally every major spigot update post
This API didn't change in 11 years
11 fucking years
Even tho Mojang completely rewrote their code in 1.13, which forced plugins to adopt anyways, but spigot decided to not change the API
That was the error right there
When Mojang did the flattening it would have been the perfect time to do this change
Apple did remove 32bit support, forcing everybody to update
And they did, nobody really complained
You don't know that. Removing old code is always a benefit. Removing compatibility layers is always a benefit. Reducing maintenance burden, code complexity, easier to innovate, etc
Apple 🤮
👏 👏, that's how everybody should do it. Don't let yourself hostage by a handful of idiots that decided to run outdated versions, holding back the majority of servers that actually update and taking a huge hit on your sanity
Removing old software is not a benefit
I said code
Removing old code from your codebase is a major benefit
I'd like to see 32 bit compat gone
Apple fully removed 32bit compat years ago
Too much is still using 32 bit. It's time to embrace technology
Was it Catalina?
that is the point I'm making
Old software will just break and not update
Software can be updated
Then just don't use old software?
But won't
If it's not getting updated, chances are you shouldn't use it anyways
If it's Foss, somebody will make the update
They would have to announce: "You either update to 64-bit or your application is not runnable"
When I need old software, I need old software
If it's commercial software, there is an incentive
Well of course, apple did a grace period, warned on starting a 32bit app, etc
You cannot expect some 10 year old open-source project made by one person that now has a full-time job to get updated
Just like spigot gave a big warning about the material enum, will but it a compat layer for a few versions and then hopefully nuke the material enum and the compat layer
The community is gonna update it then, there will be atleast one person
Not if the project is unknown
For most people it's just recompiling, lol
Atleast one person
One person will not make the effort and update
Also, they would have to confirm the PR
There is always gonna be impact
Which they won't if they don't care
But should we hold back innovation because of that?
Maybe
Its been years in the making. Time for breaking changes
Exactly
Take Materials
I wonder what will happen to 32-bit devices
They are gonna break a stupidly high amount of plugins
Which will never come back
the Material enum is subject for removal even in spigot rather soon (or at least deprecation from what I understand)
Since half of the old spigot devs are 10y/o kids that don't even know about those changes
Why
Because there is a compat layer
If a plugin breaks and is popular it will be updated
if its not popular it won't be missed
And the code must be public
not essential
Yeah yeah lets just rewrite 100k plugins, its that easy
You basically called every plugin developer and server owner an idiot. Congratz. I don't think that there is anyone who enjoys to do work that could be avoided by people who'd have just thought a step further
But again, if a plugin doesn't receive updates in general, you shouldn't use it anyways and look for alternative
because there are more accurate ways to represent item materials, and block materials etc
No just the ones that break and are popular enough to need it
There is gonna be damage for sure
I know that there will be plugins I need and cannot use in the future because of that
No, only idiots are idiots. Running ancient software is idiotic. Supporting ancient software is idiotic.
And the work can't be avoided
You can make a program (which already somewhat exists) to make it automatically.
We need to move forward
Thats wrong for some things
It's idiotic to declare something ancient that hasn't even been deprecated yet
grasping at straws now
For example, minecraft content modding. Way better in the past
Subjective
Well, is it really? You cannot deny variety
It's not deprecated because there is no alternative. The PR that brings the alternative will deprecated the material enum, but not break anything.
Plus it has been verbally deprecated in literally every single spigot update post of the recent versions
All I literally want is that the Material enum receives the new materials as well. This'd add a transition that'd make it easier for everyone. Never said that moving on is a bad idea
But why
^
Old projects
Because it is literally no effort? And it's a huge ton of work to update all these plugins?
To use new materials you would need to compile against a new spigot version anyways, they only work on new spigot versions, you have no reason to not adopt the new API then
Not really
soon(TM)
Structural find and replace can catch most of the places most likely
dw, class loader will do some bytecode magic
And now do that for almost any plugin, in which many cases aren't as easy as to just replace the word
unless you do use an EnumSet, you'll be alright
You will have ages to update most likely
Ah yes where do you detect if its a BlockType or ItemType then?
No rush needed
There is a compatibility layer for EnumSets
BlockType being for what?
there is? I did not know that
I find it fascinating how a lot of people here enjoy literally avoidable work
Adding new entries to the Material enum is unavoidable?
you probably have not understood the reasoning for the change
Of course its avoidable
Why would it not be
I have never said that I have something against the change
Was added this week
Hi
Enums in java have a limit on how entries can have, and Minecraft is touching that limit
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
The compat layer for enum sets is expensive tho
and pointless, probably
public class rtp implements CommandExecutor {
private HashMap<UUID,Long> cooldown = new HashMap<UUID, Long>();
private int cooldowntime = 10;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player){
if (command.getName().equalsIgnoreCase("rtp")){
Random random = new Random();
Player p = (Player) sender;
if (cooldown.containsKey(p.getUniqueId())){
long timeLeft = ((cooldown.get(p.getUniqueId()) /1000) + cooldowntime) - (System.currentTimeMillis() /1000);
if (timeLeft > 0){
if (timeLeft <= 4){
p.sendMessage(ChatColor.RED + "Możesz się teleportować dopiero za " + timeLeft + " sekundy");
}
else {
p.sendMessage(ChatColor.RED + "Możesz się teleportować dopiero za " + timeLeft + " sekund");
}
}
}
else{
int x = random.nextInt(1000);
int y = 150;
int z = random.nextInt(1000);
Location location = new Location(p.getWorld(),x,y,z);
y = location.getWorld().getHighestBlockYAt(location);
location.setY(y);
p.teleport(location);
cooldown.put(p.getUniqueId(),System.currentTimeMillis());
}
}
}
else {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Komenda może być wykonana tylko za poziomu klienta gry!");
}
return false;
}
}
Yeah, using an enum set for material is stupid, lmao
yeah it was announced 2 years ago that people should not use them for stuff like this, anymore
hmm insert some early returns in that lol
There are 2746 entries in that enum?
No like it brings no benefit because the enum is so large, it's gonna degrade to a normal hash set anyways, iirc
after cooldown command don't teleport player
The class itself is getting to large
Like the class file
it looks like you only teleport the player if they are NOT in the hashmap, which makes little sense
Whats the issue with a huge class file?
the actual issue is that using an enum will prevent dynamically adding new entries, e.g. because of data packs etc
How do I make a cooldown for the user of a certain item? Like on some servers there is a counter on the xp bar
~1k
Thats fair
It's also a massive burden on mc Updates, have you seen all the switch cases?
how to fix it?
I don't have an issue with changing, but for god sake just let compat be there
Not forever
step one: add a comment to every line that explains what it does, I'm sure you'll then find out the problem yourself
Forward compat is stupid
I have no idea how that would work
Nothing that'd prevent them to add further entries for the next few updates until everyone has transitioned
No its not
Nobody will transition then
you can use the builtin cooldown feature
Player#setCooldown(...)
declaration: package: org.bukkit.entity, interface: HumanEntity
If you just let everything continue to work we can never actual remove the enum because the cry would be too large
Imagine that you got some guy that made you a commission 2 years ago. You still use the plugin because it is great. Then its bonked
Instead we can use that little trick to force people to update their code if they are touching it for new blocks or items anyways
i remember how 1.13 broke literally every existing plugin, because people kept ignoring the announcement "item IDs will soon get removed"
Is it that minecraft built-in cooldown like ender pearls?
yes
exactly that's what it is
Spigot should have removed the material enum in 1.13
Or well deprecated and remove later
but there was no replacement for it back then
Is it a thing in 1.8.8? I would love to use a newer version but the way my server is doesn't let me do that
I agree there since it already broke everything
If you break every plugin, make ALL important changes to that point
The PR we have right now could have been done back then
I don't know anything about 1.8
That'd be their fault then if you'd have announced it beforehand. But giving them no time and expecting things to go fluently is just a bad solution
There have been plenty announcements
It's not like as if not adding the new entries would prevent anyone from using it
Plus again, there will be a compat layer
true. but just to be sure again - was this actually merged now? Material is now not an enum anymore, but a normal class with public static final fields that implements Keyed, right?
The class is still there
I will run buildtools now and check it out
You would need to find a person which would have been willing to make all those changes back than
Split into items and blocks
great!
I would have loved to do it
But I knew I wouldn't have a chance
did you not sign the CLA or what lol
Am happy that MD finally sees that it's important now
But he wouldn't have been open to it back then
People tried pushing it back then
If you do that drastic changes, finally give me a mixin-loader lmao
Oh god please no
That'd have been a great opportunity, I agree
never gonna happen for spigot
please, no
Gonna have to somehow get a JavaAgent in there then
Yes please
Don't, minecraft will die
It would be a desaster of incompabilities
Finally I can fix stupid plugins not being compatible with my plugin
I'm sure someone will do some kind of library/plugin that fixes this issue...
Exactly, monkey patching other plugins code, wooooooo
how do I properly setup MockBukkit? i remember that there was something that I had to add to my main plugin class, but it's not in the docs anymore and now i get an error at this line:
plugin = MockBukkit.load(UnderscoreEnchants::class.java)
What could go wrong
hm material still is an enum
I mean my Slimefun transformer seems to work. Didn't get any bug reports yet
It will be interesting to see what plugin devs come up with to still support 1.8.8 and up.
What if I finally write my system to get a JavaAgent inject at runtime, overwrite some shit and go STONKS?
I don't give a shit about please that touch 1.8
material IDs
kek
They deserve all the pain and suffering possible
That's not possible on modern java anyways
I'm one of those devs... Just a singletone class with interfaces that each "MC version" implements different
Why not
Wow thats VERY bad
if I need to load content from the past inventory, should I do that?
Fuck them for doing that
Lmao
Can I run that shit on runtime?
Yep and from a remote process
It was made by the Recaf guys
what the fuck are you doing then
If you have never heard about recaf you shouldn't be doing bytecode patching
I thought that this was already not possible
Recaf, yeah
Stupid BCV users, smh
