#help-development
1 messages · Page 743 of 1
You can print any object
IT WORKS JUST FINE IN THIS CLASS
like
IT DOES NOT MAKE ANY SENSE
seems to already be an int too
I mean you could just check the return type
i mean but it does have to be another error cause
.
this works
100%
and its like
the same code
idk why it doesnt work here
You call some add function both times
Couldn’t that be the issue? (Dk what joiner::add does tho)
no i found out the problem
it was completly unrelated
really stupid too
while importing both objects i made an error
and because with the second one i imported it directly from my main it worked
cause there it was imported propperly
How would I find the current ram, as in what Pterodactyl shows it as?
Nah, I'm tryna do it programatically
Might need jni for that I'm not sure if java can find that
it can
Ptero should have internal api for that.
Might sound like a stupid question, but is JNI a dependency/library?
y'know how if you decompile certain java methods
they have the native keyword?
That means those methods have an implementation in C++
JNI is what allows the bridging between java and c++
if there is a PotionEffect.serialize, why isnt there a PotionEffect.deserialize? how am i supposed to get the PotionEffect object back from a serialized uh thing
yea, idk why i didnt think about that, thanks
Is there a website or smth to update my anvil world to lts version?
p sure DataFixerUpper might work for you
public boolean isEmpty(){
return head == null &&
body == null &&
legs == null &&
feet == null &&
hand == null;
}```
is there any way to make this less copy pasted looking? this is currently the worst part of my code
its ok lol
can an entity's Equipment Slot be null?
like their chestplate
why iis this place so silent
im waiting for someone to answer so i can countinue my coding session
entities have air in them if I remember correct. can check my code.
!boots.getType().equals(Material.AIR) yup it's air not null.
there may exists a null out there, but idk.
entity.getEquipment().setBoots(equipment.getFeet() == null ? equipment.getFeet() : new ItemStack(Material.AIR));
did i do this wrong
no im making like a custom entity builder
So I think I managed to serialize the Inventory-Contents now.
The json-String now outputs
"[ItemStack{ACACIA_PLANKS x 64}, ItemStack{ACACIA_PLANKS x 64}, ItemStack{ACACIA_PLANKS x 64}, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]"
Does it even work like that? bc I don't know how to deserialize now. I tried this and that but I can't get anything to work really
Did you... did you just call .toString() on your ItemStacks?
This doesnt make much sense
"If the mob has nothing on his feet: Put nothing on his feet"
Thats what you wrote
i fixed it
i changed == with !=
ItemStack implement configurationSerializable, meaning you shouldnt have to put in much effort to get to serialize/ deserialize
Thats no json
is there any way to unregister an event handler?
declaration: package: org.bukkit.event, class: HandlerList
thx
How can i add mvn install to the run lifecycle or whatever its called idk
nnnnnnnnmaybe
i never worked with serializing stuff, I don't get it :(
yeah toString was dumb asf lol
ItemStacks implement ConfigurationSerializable. You can just throw it in a config. Same goes for a List<ItemStack>
FileConfiguration config = ...;
List<ItemStack> items = ...;
config.set("some.items", items);
Damn then I misunderstood the FileConfiguration class whoops
for some reason i never realized that you could use FileConfiguration for json
Lol
Or… can u?
This is messing with my head
I know that raids get harder when you start them with higher levels of bad omen but does it work when the bad omen is higher than V?
I tried it and it doesn't seem harder
It probably is hardcoded, considering you tried and it didn't work
I don't know for sure, it just doesn't seem hard when I used bad omen X
Well, it would make sense for mojang to limit bad omen to 5 to prevent it from being way too hard
Make it harder yourself with some code 🙂
Cant normal items like chest show an enchantment glint I feel like they should be able
It seems to work with every block but chest
Yeah chest is discriminated
😔
There are few more blocks, but chest is one of them
mostly ones with weird models dont have a glint
What is the differance between
setTotalExperience
and
setExp
setExp is just a value for the current level
like the progress towards a new level
from 0 to 1
where 1 is a full bar
you can use it to manipulate how full the bar is
So if I want to add 1 full level to the bar I would use which one
I was thinking something like this
player.setExp(player.getExp() + Integer.parseInt(eventData));
you use setLevel(getLeve() + 1)
Ah yes. Didn't see that one. Thanks
I need some design advice
I have a bunch of passive abilities, and a bunch of event they depend on. Currently, I'm using an abstract class with empty methods that get called by the events, but i want to be able to say 'player handler, this this this that ability' without hard-coding it.
My two ideas are:
- void event(Event event) -> if(event instanceof AbilityEvent abilityEvent)
- doing a HashSet<Class, List<Listener>> and register by event class and listener
I'm fairly certain neither of those is anywhere close to the optimal solution. Any advice?
wdym without hardcoding it
if they're not coded into the class extending the abstract player handler. that's what im doing right now, but i want to be able to switch abilities around easily by editing a config
You can give the player a list<consumer<event>>
Consumer is a java class
consumer is java
Ignore the Bukkit one
bukkit has consumer because it existed before jaba
k
It’s from Ye old days before java 8
oh thats funny
so how would this work?
would i still need a set of methods for events calling the consumer(s)?
You would just loop the list and call accept(event) on each
and it would do the instanceof automatically?
You can do a bunch of funky generic stuff to make it only receive certain event types
No
like if i put a Consumer<InventoryClickEvent> into a List<Consumer<Event>> and throw in a PlayerLeaveEvent it just crashes then?
each implementation would decide what to do with the event
You could instead use a map<class, list<consumer>> to make sure you only activate the right ones
well i thought about that but it felt wrong
Consumer<Event> and in the consumer event instanceof then?
You can do that too, yeah
hm
i mean i cant just pass event cuz thats an interface
i already have it separated into the different events
feels weird merging then splitting it again
urgh
both of those feel wrong lol
My plugin wont load anymore saying the API version is not supported??
https://paste.gg/p/anonymous/35932202522443f28ce87490ecde658d
It would load fine like 10 mins ago and I didnt change the api version
don't use paper-plugin.yml
make sure the jar you are running does not have it
I deleted my build folder and rebuilt again. Seems to be working now, Thanks
👍
uh
im trying to link intellj and github desktop, can someone tell me why my intellij doesnt recognize its in a git dir, and how to solve it?
alright let me change that question, how do i make it recognize the git dir and not use my name it somehow got?
bleh screw it im just gonna log in
that didnt help bruh
can i please get some help here? Even logging in to github and saying 'clone repository' on the intelliJ dialogue does still shift my name back to my real name
Wdym ‘link’?
I mean, what is your name in the systems git config ?
like what does git config user.name return
you can lol
no like i know but i am not supposed to
github desktop can use per-project settings tho
isnt there a thing like that in intellij
Well yea, you run the config command in your git repo
intellij should respect that
like, in your project dir you'd run git config user.name "Not my real name"
wouldnt that screw over the global config?
it overwrites it in the project
but only in it
if you want to edit the global config you'd have to run with --global
literally yes 
intellij shows my real name
but in intellij its like 'created by: Full legal name'
and yes i did close ij, did the change, restarted it
created by ??
no, it shows my full name
do you mean the file header..
the name after that person icon
im also fairly sure the commits are done under that name there
I mean, if old commits that create those types have your full legal name as author
then sure, your git integration will show that
they dont
you'd have to edit the old commits
stupidly enough it worked with another project and i have no idea why
the weird thing is in intellij it shows the initial commit as 'Moterius' and the dated commit as 'Legal Name'
I mean, what does git log show
Welp /shrug
where does git log pull from btw?
the command ?
dafuq
it said 'legal name' cloned the repo, but i was logged in as moterius when i did that tho?
cloned?
yea i pushed it from github desktop cuz THERE account switching works
wait a sec
How can I make this not as resource intensive. Can I get a singular offline player instead of scanning through them all?
private String getOfflinePlayer(String uuid, String author) {
try {
UUID id = UUID.fromString(uuid);
for (OfflinePlayer offlinePlayer : Bukkit.getOfflinePlayers()) {
if (offlinePlayer.getUniqueId().equals(id))
return offlinePlayer.getName();
}
} catch (IllegalArgumentException e) { //Invalid UUID or CONSOLE
//Nothing, just get the default
}
return author != null ? author : uuid;
}
I mean, just Bukkit.getOfflinePlayer(id), dunno if that properly reads last known name tho
@EventHandler
public void onEntityDeath(EntityDeathEvent e){
LivingEntity entity = e.getEntity();
CustomEntity customEntity;
if(entity.getPersistentDataContainer().has(IranSkyEntities.getInstance().getEntityID(), PersistentDataType.STRING)){
customEntity = IranSkyEntities.getInstance().getEntityManager().getEntity(entity.getPersistentDataContainer().get(IranSkyEntities.getInstance().getEntityID(), PersistentDataType.STRING));
}else{
return;
}
customEntity.onEntityDeath(e);
new BukkitRunnable(){
@Override
public void run() {
for(ItemStack drop : customEntity.getDrops().getDrops(false, 0)){
entity.getWorld().dropItemNaturally(entity.getLocation().add(0, 1, 0), drop);
}
}
}.runTaskLater(IranSkyEntities.getInstance(), 1);
}```
does this code need further optimization?
I am using the adventure API and lores...is there any way to set italics to false for all lore components? Right now im setting it to false on every component)
if u just want the name of an offline player id query the mojang api and cache the result
no 👍
I'd suggest a helper method
You should only need it on the first component for each line though
Child components will inherit style
How are the lines defined I thought each element in the list is a new line but it didn't work when just setting it for the first...and the Component.newLine() adds this weird symbol so I just added an empty text component
That's correct
Every entry is a new line, and yes, use an empty component for an empty line
You may also be able to use null, but an empty component is better and is constant anyways
I mean, just throw a ```java
public static Component roman(final Component component) {
return component.decoration(TextDecoration.ITALIC, false);
}
static import it everywhere
and then you can just ```java
lore(List.of(
roman(text("First line"))
));
I was just about to complain to you about calling that method "italic"
Yeah I guess Il do that thx guys
ty
shushhhh
but yea, adventure gets a lot nicer if you static imports its stuff
so its a lot less verbose
Could also probably save yourself a step and pass a String instead and create the text component in the method
¯_(ツ)_/¯
Yeah? Well, you smell

Make an overload
rude
Adventure? I hardly know her
hey @eternal night can u use git to use a specific account instead of using the name in user.name ?
I've noticed that some of my commits were 'verified' and some not

verified means your GPG signature on the keys are valid
well yea it ought to be valid when i create the repo online
but how do i tell git to actually commit using that account and not some random name
dafuq
make sure you set them globally
cant
but that wouldnt help either
its just values stacked onto
its not 'me'
just 'someone named like me'
like the creation commit is credited to my account
but all commits after that are credited to 'Author: Moterius'
i dont think I'm supposed to put that thing in my user.name am i?
Hello, I've installed OptiFine on my Minecraft version 1.8.8, and when I try to start a single-player world, I get this crash. Can someone help me?
you should try the optifine discord, this is for spigot
I've a feeling they probably don't support 1.8.8 either though lol
Why doesn’t optifine run on spigot
Probably the wrong version
I'm yet again a bit confused. In my event to open an iron door by hand if the key in the player's and the door's (using CBD) PDC match, I had the following code:
// in PlayerInteractEvent-method
BlockState state = block.getState();
Openable ironDoor = (Openable) state.getData();
ironDoor.setOpen(!ironDoor.isOpen());
state.setData((MaterialData) ironDoor);
state.update();
This was supposed to open the door. Which it did. (The conditions are (finally) done with early returns instead of kamehameha code)
Now it throws an error.
Which I just realized, I can't show rn bc i don't have minecraft on this pc
shit
Anyway: This code opened the door before (at least when I clicked the bottom half, bc the key was only saved in there fsr) and now it doesn't
yeahhhhh... i'm on 1.19 but that's what the internet said to use.... i also have no idea what else to put in there. did i miss documentation? o.O
Use BlockData
Oh right
yeah i just read it
Lol
wait, but it wants MaterialData from me what
ah, setBlockData ig
alright i guess for now i'll try if that fixed it once i get home.
otherwise i'll be back :))
thanks
Yeah, that's what I usually do with deprecated stuff xd
but i was a lil blind when i read the documentation
There is no material data in ba sing se
i really just had to google what "ba sing se" means lmao
Hello, I've created a tabCompleter for a command, does anybody know if it is possible to add suggestions, that you cannot tab, but recommend what can be there
for example:
/pay <Player> <amount>
in this case i dont want the player to be able to tab <Player> or <amount> in his command, i just want him to see it as a recommendation.
isn't that what Syntaxerrors are for?
The Bukkit API doesn't support this, no
dont think so using vanilla spigot. U might ge somewhere with brigadir
does this mean other API's support it?
No
whats brigadir?
But you could use a library like Luck's Commodore to use Brigadier which would support that
a command library but idk what exactly it does
Brig is Mojang's command library
We just don't expose it in Bukkit is all
Because choco is bad
It's hard!
ok :( So implementing something like this would be worth it?
Probably not
hi mr chocolate
Unless your commands are very complex (LuckPerms for example), it's probably not at all worth switching to a Brigadier based command system
It's a totally different way to write commands and significantly more complex
Sometimes I don't like when Coll opens his mouth 
does mr chocolate hate me
No I was just mid conversation lol
We do
We... do...?
wait rly?
oh interesting
If you mean completing player names in the chat box without a command, that's not server driven and so we can't have an event for that
yea u might wanna use that then lol
pls no
If you're writing your own Command then you'll want to use a TabCompleter :p
well ye, tab completer to return a list of online player names
you can intercept it then right?
Don’t we have methods to add custom chat completions
Yes
Or is that downstream
for which of us was this lol
Both
You don’t need the event unless you wanna mess with other commands or something
You can accomplish everything with just TabCompleter
tab completer doesnt allow you to cancel the tab completion, does it?
What do you mean by cancel
You could remove all the suggestions
^ just return an empty list
its what the guy above said
Well that's what cancelling would do
to show args but not allow em to tab
Oh

No, that's not how that works
I don’t think the event can do that either
I doubt anything can lol
If the client can see a suggestion, it can use it
yea
There are argument context suggestions, Bukkit just doesn't expose Brig to be able to use those
Not yet
cant you send a packet with 'this is in your chat' if you make changes to a command youre typing?
No
no lol
There is no “this is in your chat box” packet
that would be fucking insane lmao
Omw to make a plugin that constantly overrides the chat box with deez nuts
You wanna tpa to someone? Too bad deez nuts
omw to have the server switch your chat right before you send it, have your client sign it, have someone report you for it, get you banned


it’s not the same but it’s similar
Are you talking about the click action on a component that suggests a command ? 
mhm
not a packet tho
isnt everything a packet

the client is send the full component, then it performs the suggestion action when it knows the user clicked
ah
client doesn’t say “hey I clicked this” then the server processes it and sends “well hey there’s a suggest command thingy here, this is your new chat box”
nerd
Does someone know how i can give infinity potion effects (Am using Int.MAX right now but it still shows the time)
declaration: package: org.bukkit.potion, class: PotionEffect
Thx my bad
im so fucked
i forgot to make a backup of my custom items plugin and i already sent the laptop that contained it to heaven
Am i allowed to ask resource pack questions here because im using a resource pack in my plugin
Hello?
i managed to decompile it and convert it to a maven project
now what
who can help me with wpf? i need make a simple program with animations
Cannot resolve file 'C:\Users\xxxxxx\Downloads\plugin\src'
how can i fix this
When a player drinks milk I have a handler that reapplies some potion effects but now I get a Ticking Player error. Do I have to schedule the reapplying of the effects or can I do it through the event or smth like that? (Im on Paper if that may cause it)
reproduce on spigot. does it err on spigot? if yes, share the error + code; if it doesn't, go to paper discord and share the error + code in there
Probably best to just delay it a tick and see if that works
it didn't
damn
Caused by: java.lang.ClassCastException: class org.bukkit.material.Door cannot be cast to class org.bukkit.block.data.type.Door (org.bukkit.material.Door and org.bukkit.block.data.type.Door are in unnamed module of loader java.net.URLClassLoader @108c4c35)
at com.github.shioku.serversystem.listeners.player.KeyListener.onUseKeyOnDoor(KeyListener.java:68) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 22 more
that's the exception that's thrown
oh- wait
nvm, same thing with Openable
line 68 is one of these depending on what is correct now
Door ironDoor = (Door) state.getData();
Openable ironDoor = (Openable) state.getData();
Unsure why you have a BlockState too
BlockState = Minecraft block/tile entity
BlockData = Minecraft block states (e.g. chest[facing=north])
Very unfortunate naming scheme but it is what it is
Mojang also doesn’t bundle the states into a single object
oh frick
yeah
someone did that
in roblox
the exact same thing pretty much
uhm wait what i'm confused now
Block block = // ...
Door door = (Door) block.getBlockData();
door.setOpen(true);
block.setBlockData(door);```
yep, that was it
Now I only have to fix the problem wth the key only being saved in the bottom block
any ideas? :/
Door has a half state to get whether it's the top or bottom half. You can use that to call Block#getRelative(), then do the same thing to that state
If you have the top half, get relative to BlockFace.DOWN. If you have the bottom half, get relative to BlockFace.UP
How do I get the TextComponent in the AsyncPlayerChatEvent? I'm using both the spigot api and the bungeecord api.
I need to get the font that was set to the text component
You can't. Bungee components haven't really extended beyond sending messages to players, and books. So at the moment there's no API for it. I'm adding a lot more API but even that PR doesn't have support for AsyncPlayerChatEvent because it's such a nightmare to implement it in lol
If you want the data in a font, no. The server doesn't care about that information, only the key of the font
Resource packs can provide multiple fonts as well. It's not just one singular font
Hello how about, I wanted to make a query, I last Friday uploaded a premium plugin but it is still waiting for approval means that I must wait longer or there is something that does not comply, or they themselves warn me if something is missing to solve?
How much does that take?
I see, I guess the only solution would be to have users upload their texture pack to my plugin folder and write something to read that out.
I uploaded a zip file of the plugin with a gift from schematic, that's fine or i should upload only the plugin because it is an inclusive that gift of the plugin
does that mean the top half of the door is like the top side of a block? or do i misunderstand BlockFace?
Can I get the block above the blockPlaceEvent.getBlock()?
As, iirc, the CustomBlockData-API just saves the data to the chunk with the coordinates as key (or something like that) so I need the coordinates above to save it to the whole door. otherwhise the check for the key will fail.
I see thank you very much :D
around a month or so at the most
It can vary a lot
Depends on how much is in the queue and how busy the reviewers are with other things
anyone here know how to work with dates
what about them
they suck
mainly because there is java.util.date and java.sql.Date
and they both are the same
but also arent
well
anyone have an idea how i can convert a Date into the remaining time until that date
cant find anything
oh thats pretty simple
thx
oh no its not simple :D
at java.sql.Date.toInstant(Date.java:316) ~[java.sql:?]
forgot its a fk sql date
i hate all of this
yeah
yh found i
it
its simple but still
its fking anoying
like
why cant they just use the same object
if they are both imported from java
yeah
WHY ARE THEY NOT THE SAME
I would like to get memory refreshed about how i can achive this structured using typed lambda arguments? I will use it for my menu api. I would like to achive an structure similar to the next:
MenuAction action = ((MenuClickEvent event) -> {
event.getPlayer().sendMessage("Clicked item " + event.getSlot() + " from " + event.getMenu().getView().getTitle());
});
MenuItem item = ItemBuilder.of(Material.BLA).action(action).build();
respectively, any interface with a single method to implement
Don't be respective! Say what you want to say without holding back!
Yeah but functional interface is lingo
the annotation ?
I figured you meant the @FunctionalInterface annotation which
ah
yea
that is that then
talkiing about the same thing 
Im a bit lost on this error message
https://paste.md-5.net/nujilerima.bash
The error says I cant cast a double to an int, but I saved the data as an integer
and read it back as an integer
snakeyml might just always parse back a double
its json
{
"LastRound": 4,
"LootLocations": "MORIA:-27:242:229_MORIA:-27:242:235_",
"Dungeon": "MORIA",
"Level": 1,
"SpawnLocations": "MORIA:-16:245:251_MORIA:-18:247:221_MORIA:-42:245:219_MORIA:-40:241:251_MORIA:-26:242:232_"
}```
if(map.containsKey("Level")){
level = (int) map.get("Level");
}```
I mean, might still be the same issue ?
ye
Cast to Number and run intValue

I literally never looked at this
public final class Integer extends Number```
lmao
i'm trying to make custom blocks using a resource pack and armorstands with retextured player heads, the custom player head works when i hold it in my hand or offhand but when i put it on an armorstand it reverts to the default steve head texture how do i fix this?
Also is related to spigot because im spawning the armorstands with a plugin
I did it! The key thing works now! (It just looks a bit asynchronous how the 2 halfs of the door open, is this fixable?)
stream
db access is VERY slow
ns for sorting the list, seconds for counting the db
bump
loaded into list at server start gives me geol (
) flashbacks 
so all the support ppl doing something else rn?
Yep
How do I disallow an iron door to be opened by redstone?
What the hell
guys is this okay?
SomeClass <- an interface
AbstractSomeClass impls SomeClass <- abstract class
SomeClassImpl extends AbstractSomeClass
But in AbstractSomeClass I have a bunch of util methods that are for the child classes
This sounds like the profile of the head is not properly transferred during the block placement.
Mind showing some code of how the blocks are placed?
By using the redstone event i suppose
yes
code's pretty basic it just spawns an armorstand and sets its head to a player head with the correct custommodeldata
Why do you use heads for that?
so they can be put on armorstands
I thought you can put anything onto anything from code
You can put anything on an armorstand
is there an issue with using a player head though?
Sounds like it might be an issue. Or the model data is not applied properly.
One classic would be forgetting to set the ItemMeta back on the ItemStack.
i definitely did that its not a problem with the plugin its more likely to be a problem with resource pack as i can do it manually and it still doesnt work
i can send resource pack if you want
Use a stick and check if it helps
oh why didnt i think of that? damn
thanks lmao
If you go to the doc linked one of the first methods
Is getTrim
Cast the meta to armor meta
I mean obviously you should check first
But yeah
Mhm
ArmorTrim armorTrim = ((ArmorMeta) player.getInventory().getHelmet().getItemMeta()).getTrim();
check for not null then getMaterial()
Kek visual bukkit
why?
idk i just wanna know why it is allowed
like ik its allowed by why is it allowed
my only guess is that from an API standpoint, the API user will not need to know about the util methods
that I added to the abstract class
is anyone familiar with TAB? to get it sort "colorful" placeholders?
sorting-types:
- "PLACEHOLDER:%bedwars_player_prefix%:§cR ,§9R "
# - "PLACEHOLDER:%bedwars_player_prefix%:§7[Spectator] ,§cR ,§9B ,§aG ,§eY ,§bA ,§fW ,§dP ,§7G ,§7 ,"
- "PLACEHOLDER_A_TO_Z:%bedwars_player%%"
this is what i tried so far
no luck
sorting-types:
- "PLACEHOLDER:%bedwars_player_prefix%:&cR ,&9R "
still
i tried removing the space, but still getting the same results
R Groovy should move to top, which remains on bottom
thats tab 4.0.6 btw
huh wat is output of that placeholder
@glad prawn

Hey, I got an little CoinAPI module that I put in my maven now if I try to use it as an dependency in another project this error comes up: https://paste.md-5.net/quzomifimu.rb I got the api as an jar exported and its also in the plugin folder
i think it's impossible to sort if color is included
nvm, created an additional placeholder and fixed it, should i open an issue on TAB's repository for this?
how do I control speed/length of Vectors? If I were to multiply my vector, it would multiply in speed but I don't want that
What do you want then
If I change an item's meta, do I need to put it in the inventory again to update it?
do I just make a scheduler and set the velocity every tick?
Yeah
which event is fired when dirt becomes grass when the dirt is next to grass? the three events i can see are BlockGrowEvent, BlockFormEvent and BlockSpreadEvent and i have no clue which of the three it is
can I async it?
Don’t think so
I’m going to guess spread event
Could be wrong though
so normal TaskTimer repeating?
Yes
i guess its time for some trial and error lmao, thank you though
alright thanks
If I want to add some custom crafting recipes only for specific players how could i do that I dont really see where I can change the outcome in a handler
And I want to overload normal crafting recipes (Only few people should get tools with enchantments)
PrepareItemCraftEvent or CraftItemEvent
Yeah but I cant change the outcome of PrepareItemCraftEvent or am I missing something and the other is a click event
Wait im dumb I can
Theres a custom Inventory for that stuff
Yeah you can get the inventory and setResult
Does anyone know why internally on the bungee servers (not the main one) the users' IPs are the same as the server? How can i fix this?
It's bungee's IP
did you enable IP forwarding on Bungee?
Any idea why in BukkitRunnable "return;" didnt work but cancel() with local TaskId work?
just asking
well what are you trying to do?
just for cancel task
what is the regular expression of the plugin name?
then use the cancenl method to cancel the runnable...?
im pretty sure plugin.yml wiki documentation isnt correct about allowing (0-9,a-z,A-Z,_) characters only in plugin names
ik but only asking why return didnt work when call return end everything
because i've tried hyphen before and it works just fine for a plugin name
alright thanks
Might be a stupid thing to ask, but in the following code:
getServer().dispatchCommand(getServer().getConsoleSender(), "d"); System.out.println("t");
does the code wait for the command "d" to be fully executed before it prints "t"?
How do I use my own Plugins as an API in other plugins ? (i couldnt really find any in-depth ressources)
Yes
Okay thank you
You just have to add it to your classpath. If you're using Maven, add the dependency like you would normally. Just make sure it's installed to your local Maven repo
Then in your plugin.yml be sure to add it to your depends
how do I install it in my local Maven repo?
like this?
<groupId>idk</groupId>
<artifactId>my-api</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
Yeah, build your project with mvn clean install and it will install to your repository with the groupId, artifactId, and version you've set
Then you can use those in your dependent project
okay, thank you
What would be a good way to protect a generated structure, an optimized way because it would need to protect hundreds of structures, these are generated with the world generation with datapacks
i can do player1.openInventory(player2.getInventory()) to see and modify someone elses inventory, i can even do player1.openInventory(player2.getEnderChest()) and modify that, but, is there a way to do the same with armor slots? without having to create my own class, inherit from Inventory and all that thing
like a specific region?
couldn't you just check block location if its within some bounding box if its a rect prism
i mean, in theory Player.getInventory contains armor slots, but you dont see that when you open that inventory from someone elses pov, for some reason, so i guess there is the concept of shared slots or something? and i can get an inventory slice somehow?
Bounding box api allows for other shapes too
such as the infamous dodecahedron
Bukkit's bounding box doesn't. It's just a min/max x/y/z
concave dodecahedron
yo pulse is back :o
question:
no main manifest attribute, in .\InputTranslator-1.0-SNAPSHOT.jar
but
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
<key>value</key>
</manifestEntries>
decompile and see if its being put in the dir
Wouldn't that be really unoptimized for hundreds of regions?
Maybe I could use the worldguard API?
i dont understand java docs
If ur simply looking to disable them, you can use this event https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandPreprocessEvent.html
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
i just wanna put it in my plugin lol
thats what i got
Use the event methods, not whatever is in the commandmap
u realise im trying to block the tab completion
LOL
if you want to remove commands visibility fromtab complete https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandSendEvent.html
yeah i was gonna say i already have this
In Paper
ah
not in Spigot its not
sounds like a ?whereami moment but I won't complain
so wait, are you trying to just block all tab completions?
or just the ones like /plugin:<tab>
beautiful, thank you
any way I can omit all the try catches for jdbc stuff?
looks ugly to me
I can do it for preparedstatements but resultsets are annoying
Lombok
I mean inside a lambda
Painfully
oh fuck off
pls don't force me to wrap ResultSet
but remove all the shitty throws SQLException
Could alternatively write a new consumer whose accept() method throws SQLException
Is there a reason some of my events are being called and some aren't?
https://gist.github.com/braulio-dev/470e1645153db8b439f5bd971d145331
Every time I restart the server, the ones that are being called change
Which ones dont get called?
Every time I run the server it's random ones. Though the ones I'm noticing most are the Block Place/Break events and the normal Piston and Extend/Retract events
frost, do you know anything about gen zgc?
Small bit. Remember it not being ideal for mc but that was before it was production ready
yeah, I met the guy who is the project leader for it today, sounds like they have done a lot since it was first introduced as an idea merely
If i recall it does alright with mc now i think. Aikar was one of the few that ran a bunch of tests with it
grr why can't we have interfaces with fields 
yeah back some time ago
well technically we can but it's funky
are those tests public?
Interfaces with fields are abstract classes lol
or documented, would be very interesting
yeah but you can't extend multiple abstract classes
the diamond problem
pain
No multiple inheritance for you
Not that i know of. Last he did a test it acted weird when it came to high memory allocations
Otherwise it did better then the default gc
yeah, I mean zgc impls in general can spike very quickly
easy fix
which is why they sorta made gen zgc
For mc that is. But mc is a weird application in itself too to be fair lmao
just leave a todo and let the later me figure it out
i suppose, since some objects dont need to be checked up on as often
yeah true frost
Maybe i could do some tests this weekend with it
well I m gonna see if I can get a good zgc impl for minecraft servers coming weeks, I know you're knowledgable in these kinds of fields, you wouldn't mind if I kept u up-to-date?
Dont mind at all
👍
I want to believe zgc stands for ze garbage collecter but it probably doesnt
lol yeah, I mean maybe
you could pull a joke regarding the Gen ZGC also lol cuz Gen Z
I think I managed to break my gradle env
average gradle moment
might need to restart my pc
Now they just need to implement into java memory optimizations when application is not under load or allow a predefined load it can optimize memory usage
Sort of like reorganize where are all the pointers are at
ah yeah
so I know there is some work where java is caching boostraps since the jvm bootstrap process tend to follow quite the same procedures
Contiguous memory is generally always better instead of being split all over the place lol
And then maybe at some point java can satisfy the people who want java to truely release memory back to the system lol
foreign mem api might do that on a basic level?
Maybe. Currently and has always been the case once java asks the system for memory java wont give that memory back for the system to use
Minor issue these days given servers have gigs of ram now
fair enough
But you know some people are still picky with the free memory on a system lol
well I got to know recently that serial is becoming extremely popular
I do like how far java has come in terms of development 🙂
yea its very nice
Interesting that there will be developers who will have never experienced the horrors of old java lmao
oh yeah def
No lambda, generics, IJ
And libs folder 💀💀
who even uses the libs folder anymore maven is just easier
I did actually start making plugins when lambdas weren't really a thing
fun times
how do i turn an image into like a map / on item frame
small little painful process called uhh
the map api
With packets, you need to convert all the colors from the rgb spectrum to the map palette
With bukkit, you just make a map view with the api and render the image
i’m trying to put my ai image bot into mc maps
What?
Are you talking about all these projects that are not on a maven repo? This is still standard practice
IJ is actually one of the oldest IDEs out there
Yeah all these things have been a non-issue for decades. Lambdas are the most recent addition of the lot
I personally did not use lambdas when I started as I had no idea how they work and was too scared to figure out
May even have been J7.
Preview releases are a J9+ thing
So you are right with J8 then. Although I could swear that J7 introduced it and J8 introduced the needed utility classes such as consumer, supplier, etc.
But I might confuse it with invokedynamic
Internet says Java 8. Indy was introduced in J7 - lambdas probably were an afterthought afterwards
Spigot 👍
wdym
I want to make some kind of method which returns the same as the getHandle method
maybe like
MobUtils#getHandle(LivingEntity) not sure how I'd do it though
Lambdas were still work in progress
Personally i dont really use lambdas except couple of things lol
someone know an actionbar api?
Because I need to send an action bar like this:
Api.sendActionBar(target, ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("venendo-ammanettato")))
Api.sendActionbar is an example
player.spigot().sendMessage(...) allows you to send action bars
yes but I can't take the message from the config
and I cant use ChatColor
I'm making a handle the protocol in order to let a player see tilentities in a threshold
When updating from 1.12 to 1.17, I'm getting some issues sending player the packet
Why can't you
They told me that starting from 1.17 you have to send the entire chunk to show a send a packet of a tile entity
But even sending the chunk it doesn't work
I have to use a string that not contains ChatColor or config,getString
or he give me an error
But all of that are just strings?
Yes I know
but idk why the code give me an error
Show the code and the error then ig
ok wait a second
p.spigot().sendMessage(p, ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("venendo-ammanettato")));
o
wait
I miss a thing
wait
wtf
Now it works
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("venendo-ammanettato"))));
Yes
Maybe
Setting up Testing Environment
?paste
But split this into 3 or for 4 lines pls
Also be aware that in the newest versions the constructor will be private and you need to use the static create method to construct it.
You are probably missing this property in your chunk packets
Actually that's a great Idea
Or maybe class generic thing
getHandle<EntityZombie>(entityLiving)
This results in an unchecked cast
So what do you advise I do?
If you're talking to me
You cant really make this method generic because of the uncertain relationship between
the bukkit and the nms entity.
So lowest possible member like zacken schowed
Yeah let me try that
I'm in 1.17.1 and it seems working the public constructor
the Z() method returns a NBTTagCompound
Why the hell does this even work 😂
What is even going on
As i said, it results in an unchecked cast and makes the whole method useless
https://paste.md-5.net/ufusemedej.cs full method
public Entity handle(org.bukkit.entity.Entity entity) {
return ((CraftEntity) entity).getHandle();
}
This is probably the best you can do. Afterwards you can always do an instanceof check and cast.
Or if you really want to use the generic method, at least add type constraints to the generic type
and if you want to be safe then you need type inference from a class parameter and a class type check.
TL;DR: Generics erasure
Yeah
I think It's good enough for me
I usually just need to get the handle for checking if the nms class implements an interface
public <T extends Entity> T handle(org.bukkit.entity.Entity entity, Class<T> nmsType) {
Entity raw = ((CraftEntity) entity).getHandle();
if(!nmsType.isInstance(raw)) {
throw new IllegalArgumentException("Missmatch of nms and bukkit type.");
}
return (T) raw;
}
This would be with constraints and inference.
For example, like this:
I would just check
EntityZombie zombie = BukkitWrapper.getHandle(livingEntity);
if(zombie instanceof ISlayerMob iSlayerMob){
println!("hello");
}
Yep, got it
Well in that case... yeah. No need for any of that 👍
yeah I'm just using to get some methods in my nmy entity classes
I did get what you mean by the generic stuff
I'll keep it in mind
I have a problem with the handcuffs plugin. Practically everything works, but when the person is handcuffed to five hits he only gets one. What could be the problem?
- The plugin doesnt properly count the hits
- An exception is being thrown on the first hit
- Wrong configuration
- Using /reload or other garbage like plugman
- A hit counts 5-fold
- A recursive call of the EntityDamageEvent which triggers 5 hits in one tick
- It doesnt count hits but damage and one hit did 5 damange
- The action to apply the actual hits to a player was faulty
- An old entry of a hit counter was not removed
And it could go on for a while
Errori?
I think is a garbage
I'll try to stop and restart the server
It'isnt plugman
Nothing of this
Wait It's the safe-teleport
manda il codice
I was actually being sarcastic with this list, to show you that it could be literally anything.
We needed more infos like code/exceptions to actually help.
have you found anything about my issue? :p
I send you the code
?paste
come lo devo mandare qua poi
Ctrl + s per salvare e copia il link della pagina
prende solo una hit ogni tanto
cazzo vuol di una hit ogni tanto
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
sono del partito NSSJ mi dispiace
non è questione di impare java, è questione che il player per lasciarlo li viene tippato ed essentials ha la merda del safe teleport di base e si buggava per quello
il plugin funziona tutto
non lo metto in dubbio che il pl vada e funzioni
però se usi quel codice su un server ti conviene andare in cambogia
fidati impara java prima di andarci su spigot
how would i go about checking if a projectile shot is one of the extra projectiles from multishot?
checking if shot from crossbow and if pickup status is disallowed?
Not knowing recent spigot stuff, I guess you can just listen to the EntityShootBowEvent and then setting a metadata if it is a multishot crossbow
Im a jetbrains guy, all the way
I got the serializer and all, i just cant figure out the data index for it...
*If this is really part of the metadata. Im suspecting there is another packet for this.
Already checked. Paintings dont have that either
Im looking at that right now as well XD. But it seems so odd to have a fp rotation instead of a discrete one...
reasons on why intellij >
?
i mean, i never used eclipse
so
idk if its better or not
Its preference. Eclipse is a lighter tool with fewer features.
A bit more barebones. The next step would be something like Atom.
When I look at eclipse I get the feeling it wasn't updated for ages
Alright, good to know
what are those features?
or at least the ones that make a difference
I was thinking about that but im assuming the client just snaps it in place
intellij just feels more modern tbh
and it has some incredibly good refactoring tools
Static code analysis (+ jetbrains annotations)
More integrated build tools
And then for me the built-in profiler and syntax support for SQL are quite nice to have
This stuff just helps so much
Lmal
Fucking annoying when using forge capabilities
Yeah i rewrote that in my sandbox plugin real quick
"This value is null and will produce nullpointerexception"
Mf this shit literally has an annotation that injects the value
yea static code analysis + jetbrains annotations are a godsend
its less error prone to write non faulty code
DB support is insane
It checks your queries for syntax errors and if you connect it to your DB then it can also
type check everything with your current schema
that's nice
Oh. And the MC dev plugin for Intellij. Also a good selling point.
Is there a class that contains all mobs that have a spawn egg so that I can easily get a list of all spawn eggs (Mobs seems to have a bit more) or should I just filter all theMaterials once for example when my plugin starts or a fixed list I create myself with all materials?
yea i think filtering thruh all materials and grabbing the ones ending on "_SPAWN_EGG" should do it
as far as i know there is no way to get all monster eggs in the api
An if I run it once every time the plugin runs with a static list or smth like that should be the best so its a bit version dynamic right?
yea just grab them when the plugin enables
What if my plugins main class has a constructor
pretty sure an error will be thrown
Why
hmm it depends if the constructor has parameters
if its an empty constructor it would work i guess
cuz the pluginloader cannot pass anything & woulnt know what to pass
?paste
sup everyone
public static FileConfiguration config = new FileManager("config.yml", QuestAddon.getInstance()).load().getConfig();
private static String DATABASE_URL;
private static String IP = config.getString("MySQL.IP");
private static String PASSWORD = config.getString("MySQL.Password");
private static String USERNAME = config.getString("MySQL.Username");
private static String NAME = config.getString("MySQL.Name");
public static void load(QuestAddon plugin) {
try {
File dataFolder = plugin.getDataFolder();
if (!dataFolder.exists()) {
dataFolder.mkdirs();
}
DATABASE_URL = "jdbc:mariadb://"+ IP + "/" + NAME + "?useBulkStmtsForInserts=true";
Connection connection = DriverManager.getConnection(DATABASE_URL, USERNAME, PASSWORD);
PreparedStatement statement = connection.prepareStatement("CREATE TABLE IF NOT EXISTS quest_completed (uuid VARCHAR(36), questName VARCHAR(255))");
statement.executeUpdate();
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
private static Connection getConnection() throws SQLException {
return DriverManager.getConnection(DATABASE_URL, USERNAME, PASSWORD);
}
how i can redolve it?
you probably dont have jdbc mariadb driver in runtime classpath
I have it, i am hosting it
man
you're hosting mariadb server, but you need a .jar file with mariadb driver in order for java to know what kind of database to connect to. JDBC is just an API, JDBC driver jar does all the SQL connection for you wrapped inside JDBC api calls
Ok
i havent touched RDBMS for a while, how to load the driver alongside the spigot server though? Is there any functionality provided by spigot to load those drivers or you need to manually load with classloaders?
I think you have to open the file and it installs the drivers, at most I create a lib in the plugin and put it as a library
is a fork of MySQL mariadb
but they are not requesting the mysql connector
lies
its gotta break somehwere!
idk it works as i expected rn
Is there any good way to filter between normal and hostile mobs?
is there a way to remove the black color on an entity when it is in a block?
I mean this, maybe there is a method that allows you to remove this dark color
try entity target event
how to check if an item is wearable?
such as elytra and armors? do i need to make a utility class?
this seems like the job of a switch
or just a list with some items and then a contains
also true but still you'd need to update it every version in both ways
i am asking if there is a spigot way
you can look in Material and see if there's any materialdata
I need it without any event firing because I would need a list of all hostile spawn eggs
some items have common material data like wallsign
loop through the world
sadly no they do not share information
wdym? xD
EntityType#getEntityClass() will get you the class for that entity. You can check if it's an Enemy
Ah perfect thats what its called thx
List<EntityType> hostileTypes = new ArrayList<>();
for (EntityType type : EntityType.values()) {
if (type.getEntityClass().isAssignableFrom(Enemy.class)) {
hostileTypes.add(type);
}
}```
And that also works with the abstract ones right?
shouldn't it be the other way around for isAssignableFrom?
Why not use a stream?
Needs more streams
stream is a choice
I think that's obvious
Just switching from gradle to maven seems to do the trick for me, didn't change anything else.
You don't always have to use a stream for things
Especially for such a trivially small task
But yeah, sure, do what'cha want
It's more of a lifestyle
IT should never be that way around xD
wdym
You can do anything in gradle and it usually is more straight forward inmo
IDK bro, on Gradle it wouldn't send the skull and crossbones in chat it would just send some weird characters, Maven just made it work.
Did you have smth like this:
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
Don't think so.
Yeah that's what Emily meant when they said compiling with utf-8
afaik no
No, we don't
^
That's why we use PreparedStatements
It handles the sanitization for us
idk what API that is but surely there should be some way to use prepared statements for that
I really can’t figure out how to fill the matrix with empty elements


