#help-development
1 messages ¡ Page 867 of 1
I was too lazy to create a separate interface for lambda
when is yours?
oh hehe
IntSupplier?
then we can share the cake
Less goo
How do i make a 5 second delay in my code. Can some one give me the real way of doing it. I see so many different ways and it is confusing me as most had issues or didnt work that i tried.
let's talk oliver into making us a saltcake
Eh
Oh, I completely forgot about him
A scheduler
EnumMap, or IdentityHashMap
@jagged quail My birthday is on feb 22 and ZBLL's birthday is on 23rd. We expect that you make us a salt cake then
enum map bad for materials
didnt work
better don't use EnumMaps for materials
so i want an example of how you acualy do it
you can still
myea I suppose if its gonna get de-enumified
I always use this if I wanna have Material as key:
public static <K,V> Map<K, V> createEnumMap(Class<K> keyClazz, Class<V> valueClazz) {
if(keyClazz.isEnum()) {
return new EnumMap(keyClazz);
} else {
return new HashMap<>();
}
}
to use an EnumMap
that's failsafe lol
Runnable = () -> void
Supplier<T> = () -> T
UnaryOperator<T> = (T) -> T
Function<T, U> = (T) -> U
Predicate<T> = (T) -> boolean
BiFunction<K, V, U> = (K, V) -> U
BiConsumer<K, V> = (K, V) -> void
A what now?
Thats good apart from the method name itself lol
a saltcake. ein Salzkuchen. a cake that consists of salt
i think, i forgot
ssshh
Uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Please explain your motives
createEnumMapIfFirstTypeParameterIsAnEnum_OtherwiseCreateANormalHashMap()
Damn
yeah clearly a better name would be createEnumMapIfTheEKeyClassIsAnEnumOtherwiseCreateAHashMap
Longest method name is histroy
Lol, now that sounds like a unit test
xd
Top 10 most normal test names
you haven't seen my worldguard code
doesShorterNameExistThatEquallyConvaysTheBehaviorOfTheMethod -> isTooLong
dw I was too đ
createEnumOrNormalMap(...)
createMapByType
that sounds as if it would return a LinkedHashMap if one passes LinkedHashMap as parameter
Java 8 optional api kinda sucks
i have seen lots of hate against java's optionals - why?
what else is it supposed to be?
I like it, but in Java 8 it's missing a lot of methods
Something more
I'd prefer some syntax sugar to handle nulls better tbh
this is the same as using NotNull, Nullable, etc. annotations, they seem to be there, but they don't seem to give anything
the issue is that there is no
PresentOptional extends Optional
AbsentOptional extends Optional
@tender shard
There is one benefit of using them, which is documenting an API
hm idk Kotlin also uses java's Optionals so I guess at least the kotlin devs don't think java's optionals are that bad lol
google's optional api does have that
i might use it
public abstract class Optional<T> implements Serializable {
/**
* Returns an {@code Optional} instance with no contained reference.
*/
public static <T> Optional<T> absent() {
return Absent.withType();
}
/**
* Returns an {@code Optional} instance containing the given non-null reference.
*/
public static <T> Optional<T> of(T reference) {
return new Present<T>(checkNotNull(reference));
}
/**
* If {@code nullableReference} is non-null, returns an {@code Optional} instance containing that
* reference; otherwise returns {@link Optional#absent}.
*/
public static <T> Optional<T> fromNullable(@Nullable T nullableReference) {
return (nullableReference == null)
? Optional.<T>absent()
: new Present<T>(nullableReference);
}
}```
yeah well ok. reminds me of my Either class
Yea
the PROS of having those subtypes is that u get compile time null safety regarding evaluation, preconditioning, analyzation etc
did somebody mention kotlin
Yea
hi itsm e
mario?
Kotlin has good nullability
I wish I was mario
Or better than java as of now
unfortunately it doesnt work well for java <> kotlin interop
Yeah, well
why Entity dont have getDropExp method?
Java has expressed a willingness to address type nullability
or well, better nullability just with valhall
val entry = JarFile("asd.jar").entry("non-existing.yml")
Should not work, entry should return a ZipEntry? and not ZipEntry
can you explain a bit more
what#
just gonna take like a decade
Why should it not work then
entry is just gonna be of ZipEntry? type
Don't entities drop exp in a range or was that ores
but it isn't
entry is a ZipEntry
Ah it's from java standard
Well look at the method signature, it doesn't specify nullability
So kotlin assumes notnull
That's the problem with working with some java libs
but it should assume Nullable if there's no NotNull annotation
You gotta trust the docs, not the signature
I thought Type! means explicitly not null?
it does?
yes
well then at least this should not work
ok intellij?
Why is the profiler weird like that?
Yes, getJarEntry is from a java library, in which you don't have to specify nullability
So Kotlin assumes it's not-null, but it technically can be null
and hence kotlin should treat it as Nullable / JarEntry?, unless it would be annotated with @NotNull
with java libs ^
I agree
But it doesn't treat it that way for some reason
guys, so its Preconditions.checkArgument for null arguments right
yeah kinda weird, because the docs clearly state that they respect both jetbrains annotations, and guava annotations, and some more
cause that's what i was told
Context?
then when do you even use Preconditions.checkNotNull
which Preconditions class are you talking about?
checkNotNull isn't necesarily ideal cuz it throws NullPointerException
I only see it using boolean methods
instead of IllegalArgumentException
yeah that's the point
they're all boolean
so how would one be able to pass null there

well null != null will be false ofc
yeah so it triggers the precondition and the method dies and throws IllegalArgumentException
we just explains Google's Preconditions#checkArgument
what's funny though is that Float.NaN == Float.NaN is false
shhh leave the weird shit out of this
yeah and
the thing about this is that
I get a stupid intellij warning
and it's rly annoying
what does it say
something is always false
the always true and always false when combined with the annotations
^
its really fucking stupid but either ignore it or disable it
ignore it
I just disabled it
damn
How lol, isn't it public static final field
this is somewhat correct if you were to use intellijs compilation
they inject those preconditions/asserts for you
based on the annotation
im not doing that
sure, but not at runtime
yes at runtime
btw in kotlin you dont need weird third-party Preconditions classes, you just use check(...) đ
how do i get all the experience points that a player has?
you don't. you have to calcualte them yourself
oh so basically anyone with a brain doesn't get that benefit from them
TIL
Exactly xD
how tho?
i dont find any useful methods
what if i just make my own preconditions argument
same issue
because it would still be always true or always false according to intellij
https://github.com/mfnalex/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/ExpUtils.java
Basically you do int required = 0;
int targetLevel = player.getLevel()
for(int i = 0; i < targetLevel; i++) {
required += getXpRequiredForNextLevel(i)
}
required += player.getCurrentXp() // or however it's called
sth like that should do
oh wait I also got a getTotalXpRequiredForLevel method
Conditions.notNullArgument(Object, Msg)
can just use that directly and then add whatever they have left in their current level
could do that or you could just disable or ignore the argument and move on
yeah but if I disable them, what if I accidentally make a constant condition in actual code
boolean algebra isn't that hard if you end up with an always true or always false you should just know by looking at it
you should never really end up with code that does
A || B && C && B || D || E && F
looks like a bash script where you're piping a lot of things
ill add that to pineapple
This is the type of stuff we had to do in Discrete Math
it'll never appear in the real world and if it does please fix your code
how can i make a printed tnt break only 1 type block?
Guys some know how I'm can do custom error text without other API?
Because it doesn't write my own custom text error
public static void sendPlayerToServer(Player player, String server, Plugin plugin) {
try {
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
out.writeUTF("Connect");
out.writeUTF(server);
player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());
b.close();
out.close();
} catch (Exception e) {
player.sendMessage(ChatColor.RED + "Here my custom text error");
}
}
apply a custom pdc tag to your tnt.
listen to EntityExplodeEvent, check if the exploded entity has your custom PDC tag. If yes, get the blockList() and remove everything except that one block type
if you want it to work for all TNTs, you don't need pdc ofc, just EntityExplodeEvent, check if entity is TNT, and then removeIf on the blockList if type != yourType
this doesnt answer your question, but please use try-with-resources, otherwise your streams never get closed if an exception happens e.g. at writeUTF
ByteArrayDataOutput
try(ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(b); ) {
out.writeUTF("Connect")
out.writeUTF(server)
player.sendPluginMessage(plugin, "Bungeecord", b.toByteArray());
} catch (Exception e) {
// Oh no!
}
no need to handle closing stuff yourself with try-w-resources
okay
i mean there isn't really a reason to use twr on a BAOS
BAOS's close method does nothing
still good practice
Sorry, I asked this yesterday, but I'm still unsure how to do this. How can I read the text on the side of a sign the player clicked on?
I understand it's possible to read the line once I've done sign.getSide(), but I'm unsure how to get the side from an event? Thanks if someone could help me with this.
just cast the BlockState to Sign and access it from there?
how should i save class data?
exemple: i want to save the GUI i've created throug reloads and updates (so it should be out of the jar)
public static class GUI {
private Map<Integer, ItemStack> dictionnaire;
private String nom;
private final int taille;
public GUI(String nom,int size){this.nom = nom;this.taille = size;this.dictionnaire = new HashMap<>();}
public void affiche(Player player){
Inventory inventaireFictif = Bukkit.createInventory(null, this.taille*9, this.nom);
for (Map.Entry<Integer, ItemStack> entry : dictionnaire.entrySet()) {
inventaireFictif.setItem(entry.getKey(), entry.getValue());
}player.openInventory(inventaireFictif);}
public void enregistrement(Player player){
Inventory inventaireFictif = Bukkit.createInventory(null, this.taille*9, "modif "+this.nom);
for (Map.Entry<Integer, ItemStack> entry : dictionnaire.entrySet()) {
inventaireFictif.setItem(entry.getKey(), entry.getValue());
}player.openInventory(inventaireFictif);}
public void enr(Inventory inv){
ItemStack[] contenu = inv.getContents();
this.dictionnaire = new HashMap<>();
for (int i = 0; i < contenu.length; i++) {
ItemStack item = contenu[i];
if (item != null) {this.dictionnaire.put(i,item);}
}}
public String getname(){return this.nom;}
public void rename(String ne){this.nom = ne;}
}}```
Guys can you think of any reason why the diffficulty of a world might be null?
Sorry, I should have included some more code. When I try this, I do have access to readLine(), however this method has been depreciated with the new double sided signs. Instead, there is a method to getSide() from the Sign, however this requires me to enter an enum for the sign side, and I'm unsure how to get this value from a blockFace (Or however else I am meant to get it). Thanks!
Is this a bug?
[16:58:25] [Server thread/ERROR]: Error occurred while disabling bloodmoon-advanced v2.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.Difficulty.getValue()" because "difficulty" is null
at org.bukkit.craftbukkit.v1_20_R3.CraftWorld.setDifficulty(CraftWorld.java:1032) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4020-Spigot-864e4ac-c9c2453]
Could you show your code
I can yes
@Override
public void stopBloodmoon(World world) throws BloodmoonStopException {
if(world == null){
throw new BloodmoonStopException("World is null");
}
Bloodmoon bloodmoon = this.bloodmoonRepository.get(world);
if(bloodmoon == null){
throw new BloodmoonStopException("Cannot find registration of bloodmoon for this world");
}
bloodmoon.setBloodmoonState(BloodmoonState.IDLE);
//reset difficulty
if(configService.changeDifficulty()){
world.setDifficulty(bloodmoon.getOriginalDifficulty());
}
}
Let me introduce you to empty lines
Or just whitespace in general
I run this when the plugin disables
Make sure getOriginalDifficulty doesn't return null
yeah, you probably stored a null difficulty (before worlds loaded)
hmm, checking
but wait, it say's this:
Cannot invoke "org.bukkit.Difficulty.getValue()" because "difficulty" is null
Okay, checking
^ the value you are passing is null so the set can;t get teh value.setDifficulty(bloodmoon.getOriginalDifficulty()
yeah it might be actually
I found I didn't set original difficulty, so checking now
Okay that seems tob e it
thank you very much
For reference with this
use armorstands instead
Would also recommend ItemDisplays over ArmorStands
With texture pack you can not make block look like sword?
I mean you could
Here you go
But youâll have to replace an existing block
Or add grass with sword texture as id 69
ItemDisplays what is that
How?
physics
Some cool shiz added in 1.19.4
item on head or sumn
Ahh i use 1.18
Ah, guess you're stuck with armorstands then. :sadge:
Apparently if you backtick-escape a variable name in kotlin you can get away with a LOT of shit
Ye
Thanks I hate it
I thought it was only that you could use keywords'
Lol
Apparently it's just a super escaper
Can it escape the police after robbing a bank too?
Yes I think
how do I get the amount of experience I get with an entity? I kill him through the damage method, he does not throw the event and does not throw the experience
finally I can give my variables "proper" names
you can just delegate police to a class that does nothing
e.g. an instance of LAPD
should work
Sorry, I don't mean to spam here or pester, but could anyone possibly help me with this? Thanks a lot!
Sign#getSide(Side)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/sign/Side.html
declaration: package: org.bukkit.block.sign, enum: Side
thats the enum it wants something of
Thanks for this, but this is what I'm slightly confused about. How would I get this enum from a PlayerInteract event? As far as I can see, I'm unable to convert a BlockFace to a SignSide as far as I can tell, unless I'm missing something?
its just an enum
if you have the block face its just math
if anything you can listen to sign change event
Thanks, but what sort of math would I be doing? I feel like there's probably a method for getting a SignSide without computing player position relative to the sign etc
I see, so would this event be fired when a player clicks a sign?
no, after its edited
If this doesn't exist, do you think it might be worth me opening a feature request for Spigot?
Feel free
I see. I need the event to be fired when a sign is clicked unfortunately, rather than edited (Needs to work with waxed signs too etc)
Coll, I'd massively appreciate that if you could.
If not, I'd be happy to request this as a feauture myself.
PlayerInteractEvent doesn't fire for this?
if not that's probably a bug
It does, yes, however I need to also get the side of the sign a player is clicking, which is where I'm running into problems with the new double sided signs etc
their a jira feature request for computeSignSide
can probably just complete that one
However, I do know multiple other plugins which are still able to read text from a sign on the side it was clicked on, although I'm unsure if they're using depreciated methods to do this.
Yep found the ticket
it can be computed still you just need to do some math
You can make a method to get the side yourself
Just needs math + the signs facing dir
its not terrible math either just a tad annoying
I assume Mojangly has a method for it
unsure probably though
let me look
So imma just look into hooking that
Alright. Honestly I won't mind too much if the method I make isn't perfect, since hopefully what I'm asking for will be implemented into Spigot in the future anyway
@young knoll
public boolean isFacingFrontText(Player player)```
Oh so are you implementing this now? Thanks so much if so
it'll take prolly a day or so to get merged though
Not a problem at all. You guys are awesome for doing this so quickly. I have other things I can work on in the meantime anyway (Such as more important things like picking a new IDE font). Thanks!
if you're interested in the actual code yourself here is how Mojang does it
if (this.getBlockState().getBlock() instanceof SignBlock signBlock) {
Vec3 signHitboxCenterPosition = signBlock.getSignHitboxCenterPosition(this.getBlockState());
double d = player.getX() - ((double)this.getBlockPos().getX() + signHitboxCenterPosition.x);
double d1 = player.getZ() - ((double)this.getBlockPos().getZ() + signHitboxCenterPosition.z);
float yRotationDegrees = signBlock.getYRotationDegrees(this.getBlockState());
float f = (float)(Mth.atan2(d1, d) * 180.0F / (float)Math.PI) - 90.0F;
return Mth.degreesDifferenceAbs(yRotationDegrees, f) <= 90.0F;
} else {
return false;
}``` bukkit should have most of this exposed
Alrighty. I'll probably bodge something together then in the mean time for testing purposes before this feature is added into Spigot. Thanks!
You can build it via the pr though :p
true I forget
I always just assume server owners wouldn't wanna do that
L
just get the checkstyle plugin
I want 50% of ownership of this PR coll
effort
for the amazing reference
why not computeSignSide like the request said it sounds fancy
in all seriousness though
/**
* Get the side of this sign the given player is facing. <br>
* If the player is not facing this sign at all, the back side will be returned.
*
* @param player the player
* @return the side the player is facing
*/
@NotNull
public SignSide getTargetSide(@NotNull Player player);
not to be that guy since I'm usually shit at this, but wouldn't it be getTargeted vs getTarget
Sadly there is no isFacingBackSide, so we kinda just have to assume
hmm yeah that makes sense
idk tho
sounds dangerous
I think getTargetBlock is a method
might have to implement that yourself tbh
merp
in all seriousness just assuming its the back is bad
let's see how mojang does it
one second
level.getBlockEntity(pos) instanceof SignBlockEntity signBlockEntity
they just check to make sure they even looking at the block
Yeah
It returns false otherwise
So I could raycast to see if the player is looking at the block ig
any infos about 1.20.5?
It's not out yet
It's not released yet
Is it
You wanna be a lad and point me to where this is? :p
bro.. i mean is there an ETA?
SignBlock.java
Ask Mojang
yeah about 3 hours
MD is actually ahead of mojang in releasing it
he's pretty fast like that
yea i know, just mixed smth up
how tf has mojang still not changed this
public static void tick(Level level, BlockPos pos, BlockState state, SignBlockEntity sign) {
UUID playerWhoMayEdit = sign.getPlayerWhoMayEdit();
if (playerWhoMayEdit != null) {
sign.clearInvalidPlayerWhoMayEdit(sign, level, playerWhoMayEdit);
}
}```

Same
its a terribly annoying update xD
given how much they fucked around in the network code
I'm going to uselessly optimize your target group if you aren't careful buddy so watch out

Brain cannot find out how mojang checks if player is facing a certain block
... assuming the even ever do that
BlockBehaviour#use
ServerPlayerGameMode#use
ServerGamePacketListenerImpl#handleUseItemOn
from the looks ofit
that should be the entire call stack
Compare different mappings with this website: https://mappings.cephx.dev
Hey guys, I have a problem with "Material", Deepslate blocks are considered as "air" as you can see :
set the api-version in your plugin.yml
^
This is what I had done in the past but it created errors when the plugin was used in 1.16
Well if you develop against the 1.20.4 api obviously that won't work in 1.16
the server said that the api version was invalid (when I put 1.16 in the plugin.yml and the server version was also 1.16)
yeah but did you build against 1.16
Ok it works now
thx
I feel stupid for asking this but I cant find the solution, onBlockBreak is firing twice per block broken. Any idea?
https://paste.learnspigot.com/kufenukika.csharp
If the block is not on y-level 99 it fires once, but it fires twice if it is on y-level 99
EDIT: New discovery, its a oneblock skyblock and it only happens when I break the specific generator block. Is there a chance the plugin itself is calling the event? Should I see if I can find an Event its calling itself to get a better read
Yes smth is prolly calling it
Is there an easy way to find what its calling? or will I just have to get in contact with the developer?
You can technically print the current stack trace
Ill have to look into how to do that haha but Ill look around, thanks!
Thread.currentThread().getStackTrace()
Thanks
new Exception().printStackTrace lmao
I wonder what that would print
just Exception Exception at line bla bla?
Thread.dumpStack() my beloved
How do i do a player specific veriable. For a toggle command that toggles something only for the player
I want to save a Boolean veriable that is specific to the player. So i have a command that only toggles it for that player and not globaly for everyone
depends if it needs to be changed while player isnt online
Dosnt it is a command that toggles it true and false
will you want other people, ie staff to modify it while a playe ris offline
Its a staff command that enables block breaking
for the player that excecutes it
it works right now, but it is server wide
pdc is fine for that then
okay so i'm working on an enchant system for a prison server, and i came up with this:
if this a good way to go? Everytime the player breaks a block it will find the enchants that aren't level 0 and will loop all of them executing the execute method on them
kotlin is such a weird language
how come?
it feels wrong to loosely interchange what looks like variable assingment and one liner functions, whilst also having the entire annotation framework turned into keywords
though I do like the parameter naming
yeah i thought it was weird at first now i kinda like it
are all those functions private?
no
or are they all public without needing public
they're all public by default
yucky
true, but most people still use the private keyword
cuz readability đ
ye
and technically private and package-private are two different things
wait wtf is that a keyword todo
I don't get what's wrong with it lol
itâs different and not my cup of tea ÂŻ_(ă)_/ÂŻ
anywayyss, is this a good implementation
i'm wanting to loop all the enchants that are on the pickaxe and executing the execute method
for every block
i've never made a prison with kotlin so, i've only made them in skript đ
Yo i got splosion problems
I made some custom items and such but i have 2 issues.
One: the explosion doesnt damage the player who caused it
Two: the explosions doesnt drop all items (It acts like a creeper explosion)
?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.
there we go
I forgot there where aternative ways to create an explosion, sorry bout that lol
Passing a player probably makes them immune to it
Since they caused it
As for drops, that's controlled by the yield which is only available in the event
Yea but tnt stores player cause and deals damage so why does this one make them invunerable?
So there is no way to effect the yield itself outside of some weird code stuff?
Yea but if the server was lagging wouldnt you see a flash of TNT?
Could make it invisible by default
setVisibleByDefault op
Yeah itâs been marked like that for a while
I guess md may still change it in the future
Gotta have a timeline for moving stuff out of unstable :p
I'm trying to serialize my ItemSTack object using GSON. When I try to do so, I get the error java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class in the console. Here is my code: https://paste.md-5.net/iguwitozay.js
Youâd have to check the contents of the map
Perhaps it doesnât want to serialize something in it
It should be serializable. The map that is created is from Spigot ItemStack's method
Means all the values are configuration serializable
Doesnât mean gson can handle them though
If I had to guess itâs the meta
What do you mean with "configuration serializable"
you need to implement a gson type adapter to handle ConfigurationSerializable
Itâs a Bukkit interface
I'm sure there's hundreds out there because everyone wants json instead of yaml because ??????
Snbt api when?
Ah gotcha
Because json better
Eh, ig
Also, does bukkit provide some nbt api
Yk, these days plugins do a lot of random stuff you can't prepare for
And?
I need to store data in a format that is not easily editable by the user
what does this even mean lol
And db sounds overkill for two values
like, yeah, it's picky about entirely different data types
I mean itâs similar to yml
You gotta make sure your spaces are right vs you gotta make sure your brackets are right
I mean, pdc exists
i s'pose
You can also store data in plain binary
base64'd gzip
Or use an NBT library like jnbt
Hmm
Linnode? Heard that somewhere
Linnode is prob something different lol
Lol
Would I just put this in my event class?
Now i have a new problem... How does one set the explosion size. đ
Wait wtf
I can do it using world.createExplosion() but the issue is I cant set its yeild. I can use world.spawnEntity(PrimedTNT) but then I cant set the size
No? its the amount of blocks that drop
Not on the entity
Yes
With the entity youâd also have to use the event to set the actually amount of blocks dropped
Yea I started using an event with metadata to track
Wouldnt it be removed with the entity?
or is there something I dont know
Why is there a sad face ;-;
can i make a player AFK watching its packets? how can i see packets? how do i interpret them?
Metadata isnât removed automatically
Pdc is though
You could listen for packets to see if a player is afk
But events work fine
yup but how ?
i can't for my usage
Why
My goodness... Ive been using metadata on hundreds of entities without cleaning it up.
Same
Kek
Ig
it's not in 1.20.1 ;-;
k i'll check it out
This makes sense now lol. This is memory usage
blud closed 2 google chrome tabs
True
does event priority Monitor take less memeory on PlayerMoveEvent then priority normal?
No
@EventHandler
public void onPlayerToggleFlight(PlayerToggleFlightEvent event) {
if (event.getPlayer().getInventory().getChestplate() != null &&
event.getPlayer().getInventory().getChestplate().getType() == Material.ELYTRA) {
if(isInHub(event.getPlayer())){
event.setCancelled(true);
event.getPlayer().setAllowFlight(false);
event.getPlayer().setFlying(false);
StringFuncs.toInfo(event.getPlayer(), ChatColor.YELLOW + "Hub", "Elytra use has been restricted due to abuse.", true);
}
}
}
Any reason why this isnt disabling the use of an elytra?
What event is called when using an elytra then?
EntityToggleGlideEvent iirc
what method should i use with protocol lib to listen to any packet?
found it
Parameter is not a subclass of org.bukkit.event.Event Compiling and running this listener may result in a runtime exception
why?
Packet event listerner are registered differently.
how?
thx
;-;
sometime i wanna die :D
package fr.axsc6_l.wamasterv3.Listener;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import org.bukkit.entity.Player;
public class packet {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.CHAT) {
@Override
public void onPacketReceiving(PacketEvent event) {
Player player = event.getPlayer();
PacketContainer packet = event.getPacket();
}
});
}
```halp
can I get a classloaer in kotlin outside of a class?
hmm, would it be a good practice to make a batching system for prison enchants? I dont really wanna run enchants on the main thread but i might have to deal with it
aren't you supposed to add manager.addPacketListener inside a method?
cuz i ain't making an async task everytime the player breaks a block
which would run every second or something
idk
this is my doc
read the documentation, it will help.
my doc is litteraly under, give me more if you do have it
Yeah you need to be inside a method
You canât operate on variables just in the void of a class
that makes no sense đ
he didnt ask if it works
minusten told him to do sum
and he said idk
Methods
in java I'd do Class<?>, what should I use in kotlin? KClass<out Any> or KClass<*>, any why?
fun getCoreLogger(clazz: KClass<*>): Logger {
// or
fun getCoreLogger(clazz: KClass<out Any>): Logger {
syntax highlighting broken?
Would go with the first one.
* in code needs escaping.
huh weird, if I escape it, the escape shows up
only information I found is that e.g. Nothing is not a subtype of Any
fun getCoreLogger(clazz: KClass<*>): Logger {
// or
fun getCoreLogger(clazz: KClass<out Any>): Logger {
fun getCoreLogger(clazz: KClass<*>): Logger {
// or
fun getCoreLogger(clazz: KClass<out Any>): Logger {
Looks fine to me
fun getCoreLogger(clazz: KClass<*>): Logger {
// or
fun getCoreLogger(clazz: KClass<out Any>): Logger {
fun getCoreLogger(clazz: KClass<*>): Logger {
// or
fun getCoreLogger(clazz: KClass<out Any>): Logger {
wtf
I have copied exactly my text from above
Jep, wtf
well discord moment
Itâs because you had a * before the code block
ooh
right
ok anyway, KClass<ASTERISK> or KClass<out Any>? and why?
I know that nullable types wouldn't be out Any but I will never have nullable class objects
guys need help im really new to dev and decided to do primitive things as editing simple plugins,and for some reason i cant setup depen always getting error,can someone help me?Im using intellij idea
*, out Any would be same as ? extends Object
Generally * by design means you do have no idea of generic type
but everything extends Object so where's the diference
While out is used to narrow it
I'll just go for * because it's next to the ? key which I would have used in java lol
Ig is just design choice, same as you can type ? extends Object in java
ÂŻ_(ă)_/ÂŻ
got this problem but this depend exist
https://mvnrepository.com/artifact/com.lenis0012.pluginutils/lenisutils-updater-manifest
how i do this?Im really new
Oh wow, mvnrepository.com has 1984 indexed repos
im ukrainian and at my language there is no community to watch video or find people to speak
<repository>
<id>codemc</id>
<url>http:// (the url from above)</url>
</repository>
into the <repositories> section
<repository>
<id>codemc</id>
<url>https://mvnrepository.com/repos/codemc-public</url>
</repository>
oke i added this and what i have to do?
reload maving projects or?
that isnt the repo url
the repo url is https://repo.codemc.io/repository/maven-public/
My repos don't show up on there ;)
ProtocolManager manager = ProtocolLibrary.getProtocolManager()
``` manager is null
pom:https://hastebin.skyra.pw/xalufafabu.htm
Mark it as scope provided
You canât shade it
i add but still error
Protocollib needs to run as a separate plugin
this ^. If you shade ProtocolLib, your plugin attempts to use the included class which is obviously never initialized
i dont see any error there
Invalidate caches and restart the IDE?
let me try
I mean there are a few Ukrainians here so you aren't alone
But they'll be much rarer than the germans
Could not transfer metadata org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT/maven-metadata.xml from/to dmulloy2-repo (https://repo.dmulloy2.net/repository/public/): Connection reset
org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT/maven-metadata.xml failed to transfer from https://repo.dmulloy2.net/repository/public/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of dmulloy2-repo has elapsed or updates are forced. Original error: Could not transfer metadata org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT/maven-metadata.xml from/to dmulloy2-repo (https://repo.dmulloy2.net/repository/public/): Connection reset
what does it means?
russian speaker community massive too but videos and instructions dont explain anything.
Do you have the spigot repo declared in your pom?
did you add the spigot repo?
looks like i dont,the russian speaker dude video i watched had very less info
Might be the wrong one? I can't check the link atm though
that's the spigot repo and it does include bukkit 1.13
Hm, they had that repo already
But with maven there is no other explanation (other than something on the transport being broken)
i got this plugin from github and didnt change any single line of code
just wanted to compile it see if i can do this and change some things as colors etc but i cant even compile xD
even my chestsort repo got 83 stars and the code is shit
Investing in the offline market seems counter intuitive
Since they donât want to spend/ donât have money
anyone got idea what i have to do to fix my problem?
I guess I am just too familiar with the fact that all my non-mc projects are VERY dormant
Hello, how can I set a persistent rotation on a nms npc? I've tried setting rotX and rotY, swinging the main hand, all of those after I sent PacketPlayOutEntityHeadRotation and PacketPlayOutEntity$PacketPlayOutEntityLook, but I can't seem to get it work, each time the npc unloads and loads again, the position is changed then what I've seen, any suggestions?
any one can hhelp with this mysql error
at me.mraxetv.beasttokens.libs.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596) ~[?:?]```
where do i find a 1.20.1 version of protocol lib?
dev reps
@hollow oxide https://ci.dmulloy2.net/job/ProtocolLib/
try
doesnt work for me for some reason
thx
bro can you help me to fix dependencies problem?Im just trying to edit already builded plugin cant figure out how to install dependeces at intellijidea @hollow oxide
send your pom
pom.xml
ok nvm i fixed it somehow no red error but got another problem xD
what version of protocol lib are you using ||and what minecraft version||?
https://github.com/lenis0012/LoginSecurity
trying to edit this plugin.
version of MC version if look to pom.xml 1.13
protocol lib 4.7.0
im badly understand what libraries i have to add and how to project
PLS
FOURTH TIMES THE CHARM
legit
I BELIEVE
?ban @errant isle cross post, advertisement
Done. That felt good.
Lets GOOO
đ¨
dont say anything
How much have you had to drink
^

I'd love to know xD
fk, i'm in 1.20.1 and idk what version i should use ||i can't find above 5.1.0||
yup
but the 5.1.1 page for the jar is down
and i can't put 5.1.1 in the dependency
wanna kms
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy.
what thats mean?
Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
error i got
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
yup i'm to bad for this xDD
im too
bad as hell
first day of my life doing this thing
no video or something
i just want to edit plugin i got from opensource at github and thats almost impossible...
i'm like 2weeks of doing shits but still to bad
yup didn't searched tho
https://hastebin.skyra.pw/oyenusuquv.htm
i'm on minecraft 1.20.1
can't update the dependency above 5.1.0
I know that 1.20.2 uses the 5.1.1
I found 2 different repo and IDK which is good
I have the 1.20.4 jar
and it's not working
yo im having the same problem currently
im looking for the 5.1.1 too but the site is down :/
Guess you can try PacketEvents instead
spend shit tons of time for nothing and its 4 am,time to cry and go sleep
?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/
I might be over thinking it, but when should I allow a user to pass in a null parameter
whenever you dont need a parameter
what does that mean
you can take a null parameter, if you dont need this parameter, if you need it and take a null, it will be a nullpointerexception?
The spigot api generally only allows it when it has meaning
In a lot of cases itâs used to remove or clear something
hmm
If you want scuff nullable parameters I'm your guy I was originally a python developer I'm an expert
idk
public void run(Object... parameters);
Thank me later kid
what are you even doing
I was simply making a joke Object... parameters is a fucking horrid idea
as far as this goes. Generally I'm a big fan of never I usually provide overloads so you never have to provide null rather it's inferred in implementation
nah im saying like, lets say:
boolean Repository#containsId(String id) something like that
if you have a shit ton of parameters though just make sure you mark things with annotations and doccument the method it's easier to keep track of in those cases
Oh yeah well how you gonna remove an items custom name huh
well I mean if i were to design a never pass in null library
i would just do
.removeDisplayName();
with how MC works passing null just works
Muh bytes
generally though I'd avoid it where it makes sense
it works with MC because we know the client will always have a backup
and if it doesn't it's not on the server to fix it
generally with contains and equals methods you can just return false if its null
Does anyone have any open source projects that showcase ImIllusion's minigame structure?
lmao
better ask Illusion himself
but I'm pretty sure he made a tutorial on it on his github
im like
having a brain error
I thought taking a look on an implementation would clear things
@echo basalt đ đ are there any projects that use your minigame structure that are open src?
having a hard time understanding the task related stuff
anyone know what the max value a furnaces CookTime & BurnTime can have?
nvm
alr
as far as recipes go there is no limit, but yeah the actual fuels are hard coded iirc
I wish mojang would just switch that over to registries or something
also makes me wonder why they haven't done such a thing for brewing stands
villager trades
oh I didn't see that message lol
I'm going to trade you to a villager for 3 emerald blocks
ahhh yes
Anyone know how i can extract the hover events?
you really can't
đ
you'll have to deserialize the Component into json
essentially gotta tear it apart into its Data object form
which depends on which component API you use
if you use BungeeChat you can tear it apart into a BaseComponent, but then you have to loop over the component until you find the events
I wish getKiller would return the entity that killed the player not just another player if it was pvp
should be easy enough to get the last damage and see if it was fatal
than you can simply get the inflictor of the damage
declaration: package: org.bukkit.entity, interface: Entity
I was using entity death event but it makes it impossible to get much more than the type of object that caused it rather than a reference of the entity itself
Wait why?
memory leaks
if the entity despawns or goes away and you hold the instance it just sits there in memory and doesn't magically dissapear
Oh no I meant like a reference as in how event.Player would receive a reference to the player involved with the event
well with getLastDamageCause you don't have to
since you know its specific to the player you want
Wait... There is literally something that says .name()
đ¤Śââď¸
the smell of paper
Im smort
Vanilla Components = Not Chad
MiniMessage = Chad
Fr
Today I learnt luckperms has support for minimessage
Which is awesome
MiniMessage just parses into components :P
Sure but who does that I myself use my own parser or Minedown
Still doesn't work well for going in reverse though
Hey guys I want to save inventory to MYSQL database
Is it good way to save on database? I mean encode every itemstack in inventory
Yeah that's pretty much how it works
MySqlPlayerDatabase uses NMS to serialize its items
InventorySaver uses the bukkit object output stream
they're both valid approaches
if(day < currentDay){
item.addUnsafeEnchantment(Enchantment.DURABILITY, 1);
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
The itemstack isnt showing the enchant glint, any idea why?
Note: The item is a Stained Glass Pane
are you setting the item back?
i may potentially be stupid
wait
no im not
cause i am
unless im missing a step here
item#setItemMeta is being done
inventory.setItem ??
yes
I'll need more code
found a "bug" - why when you press shift and click on a diamond in the stove, diamonds from the player's inventory and in the stove itself are stacked in the stove, ignoring the click cancel event.
@echo basalt https://paste.md-5.net/aricefogoh.java
before you say my code looks horrible yes i know lmao
your code looks horrible
honestly if you can tell me ways to improve my coding that would be awesome
i dont know what that is :(
this might mean nothing to you but every time you {{}} it creates a new class that is never garbage collected
ah
again, a lot of these terms in still learning
but ill research on this
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
It's just a constructor
Instead of checking slots in your GUI you can, for example, make a Selection interface and just pass a mask
You already use a mask for PatternUI
huh
why when you press shift and click on a diamond in the stove, diamonds from the player's inventory and in the stove itself are stacked in the stove, ignoring the click cancel event.
huh
rest is config https://paste.md-5.net/usoyikiguf.bash
is the menu system through the config?
yep
hey guys looking for a plugin for 1.8 spigot which adds a homing bow
can't seem to find any
looked everywhere
Wdym
getConfig()
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
homie's deleting messages
Yo guys, I have an external app that can control my server through my plugin like another plugin would, but I'm now thinking, to make events and other small things work properly, I would probably need to somehow wait/sleep the whole main thread for it to wait for the program. Tf am I doing wrong
Nah man, the program gotta do shit tick-on-tick, like a plugin, because that's kinda what I'm doing
If a player enters a chunk, will it be immediately loaded? I mean, if you check through PlayerMoveEvent whether a player is in a new chunk, then it will immediately be loaded with an entity and all that?
No, players may attempt to move to unloaded chunks
if the server can't keep up
badly
and if I have an Entity, I canât access it if itâs in an unloaded chunk?
or can I get it by UUID?
Don't think so no
You could theoretically just not let people into unloaded chunks, right?
?xy
