#help-development
1 messages ยท Page 130 of 1
no
you have to keep track of that yourself
kinda theres a thingy
i can check if player has discovered ingredient
but not all ingredients are craftable
exactly
many things are not "discoverable"
e.g.
iron ore
there is no recipe for iron ore
can i check that tho?
no
you'd have to keep track of this yourself
e.g. get a PDC for "items-this-player-already-had-in-their-inv"
then save every material's name() there
Wouldnโt it be better to check whenever a player picks up, crafts etc
They check when you have it in your inventory
it doesn't keep track of this
Then they store the intruders you do
MC has a builtin statistics thing for "times picked up, times crafted, ..." but this wouldnt e.g. work for stuff that you get added using addItem(...)
if that works for you, sure
erm
idk
sth like this I guess ??? java
player.getStatistic(Statistic.MINE_BLOCK, Material.DIRT);
oh shit
yeah anyway, you get the idea
o
seems like there is no stat for "picking up stuff"
Statistic.PICKUP
is crafting something also counting as pickup?
idk
probably not
I think "picking up" refers to the actual "picking stuff up" thing
yeah thats what I think too
exactly, just check both
ez fix
I mean there isnt really any way to obtain an item except for crafting or picking it up
except for stuff added by Inventory#addItem(...)
yeah, checking the "pickup" and "craft" stuff is probably good enough :3
or you inject yourself into the slot listeners
but das work
and we all hate work
btw lynx you probably can answer this
wtf are mixins haha
is this some forge/fabric invention?
comes from spongepowered
think of it like reflection but on absolute crack
aight, that's what I suspected. thanks
theirs docs are an interesting read
if you have too much time on your hands
pretty powerful tech, just
maybe tomorrow ๐
hard to learn, harder to master
Hello again. I have this plugin where I run into a problem.
I am trying to cast my Custom Nms Entity class to an entity. But I'm getting an error. Note I am still very much learning a lot about how everything works with Java and Spigot. Anyways here is my code and the error.
https://sourceb.in/150chXk8Yu
https://sourceb.in/rj1Wzb1cR8
https://sourceb.in/GW1FbjOPE2
c++ be like
Sounds like fun! Link?
Not easy
Yes it is
wtf
that looks like you have 2 plugins
player.getPersistentDataContainer(); says Cannot resolve symbol, can someone help me?
(PersistentDataContainer data = new player.getPersistentDataContainer();)
Lol
switch to 1.14.1+
Everytime creating .h file, not only cpp
its on 1.19
?learnjava
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.
new player.getPDC
Remove the new keyword
you can, but it's very annoying
well no
I've seen plugins use mixin
yeah
or ignition ?
The worst thing about cpp is that u need to instal gcc compiler urself
that's what I meant with saying "annoying"
or not only gcc
depends on what devs want to use
yeah ahaha
What do you mean?
Sounds like a boring idea
do you have two plugins, and both have a NL.MTVehicles.General.MTVehicle class?
or they reloaded
I tried JNI, wrote the code rly fast and then realized i need gcc to build .dll library
mtvehicles and mtvehicle
yeah
Spent like 2 hours on downloading and installing and removing useless stuff
that's the problem
And then realized i installed 32bit gcc
you cannot cast class A to class B just because they have the same name
Imagine not using Vc code and have it install the compiler for you
Does it?
You can ask it to yes
I used normal visual studio
MTVehicles is the class that extends JavaPlugin. MTVehicle is my customentity class.
But when i worked with JNI i used Notepad++))))
and they are from 2 different plugins?
Cuz i know syntax and includes perfectly
No
No problem.
your stacktrace suggests that you have two different .jar files
weird
try to properly restart the server ๐
there is only 1 jar file. I'm actually quite sure that isn't the problem anyway
Fixed it idk how ๐ well thank you for responding anyway ๐
I made an item with ItemStack and what I want is that when I enchant it in the enchantment table it is added after the lore that the item has, how can I do it?
XD
Isn't it the base Minecraft behavior ?
Could you show us some screen of what you get ?
ItemEnchantEvent
or smth similar
If item has persistent data container with your custom tag
get it's meta, then lore, then change it
how can I set the folder that the plugin is being built to? Using intellij Idea
ready I know how to do it thanks
Gradle*
who cares
Does anyone have an idea of how Hypixel disables the Done button in the book inventory and also opens another book inventory depending on the ClickEvent
I doubt they are using ClickEvent.Action.RUN_COMMAND
The click event thing probably uses commands
And If I had to guess the done button is not present because the book is signed/immutable
Why not, what would you use it instead?
Well I'm not sure, that's why I'm asking haha
I'm wondering if there's a way to disable the Done button, or at least listen for an event, so I can know when it's being clicked
does someone know some way to make primary command which has another commands under it?
I would like to make it modular the same way CMI does it
I don't quite get you
those are probably arguments
which you get passed by onCommand method
for example CMI registers the command the normal way but also adds it into /cmi <those cmds there>
which I would like to reacreate
if you get me
Probably uses it's (own) command framework
yee they have their own framework
im trying to create it somehow but idk where to start
First you gotta figure out what format you want for the commands
Ah, so basically you want to add a subcommand to cmi?
yep
Just RE CMI I guess
In my custom command util, I have it as "one.two.three.*" -> /one two three <arg>
well not to cmi
to my plugin
but the in simillar way they use it
wdym by that?
type deal
you can make it register both as /class code <arg> and /plugin class code <arg> if you're into that
ok and how to handle them?
Then you also have to ask yourself if you want to use brigardier or not, but if you want to stay in the realm of bukkit you can just use the args array
register a BaseCommand on the command manager, hadnle tab completion n all
it's like 200 lines of processing
[19:47:25 ERROR]: Could not pass event PlayerInteractEvent to MeridianaCore v1.1
java.lang.NullPointerException: Cannot invoke "java.util.List.get(int)" because the return value of "org.bukkit.inventory.meta.ItemMeta.getLore()" is null
Code: https://sourceb.in/NBEs6wFBRA the line is after getting the thing
right thx
I hate this code so much jfc
thanks
if the lore is null, or the item meta is null (item without lore, let's say), you'll have issues
now refactor your code before I call the cops
You'd basically have something like
public class CommandNode {
private Map<String, CommandNode> nodes;
public boolean execute(String[] args) {
if (args.length == 0) throw new IllegalStateException();
String[] z = new String[args.length - 1];
System.arraycopy(/* You know the jazz */);
CommandNode n = nodes.get(args[0]);
if (n != null) n.execute(z);
}
}
a bit more than that
what am i doing wrong
For tab completion yeah - but it'd be easy too
it really is not
Because you are using dots for seperators - just using spaces is good enough :)
what? btw fix?
new ClassName(args)
that's simple enough until you have what I call "wildcards"
if you want to, for example
i mean like the error is only there but if i remove that section with return the same give the error
/island invite <playername>
oop, doesn't work with the new too tho
In my util, I just do island.invite.* and the playername gets passed as arg[0]
At that point use brigardier ... but if you override CommandNode you'd also be easily able to do it
I can also override a method has a Map<Integer, List<String>> for tab completion lol
wrong arguments then
or wrong import
Doing it recursively is what makes it so powerful while being simple
brigadier is annoying and not my library lol
my stupidass prefers to write my own libraries for 90% of things
There are plenty of decent to great wrappers out there
I only settle for ProtocolLib and NBT-API sometimes
But having the tab completion be on the client is kinda nice
time to send packets
args are correct, lemme check the import
Defo not worth it
brigadier grr
PersistentDataContainer coalContainer = coalChest.getPersistentDataContainer();
Chest dungeonChest = (Chest) clickedBlock.getState();
PersistentDataContainer container = dungeonChest.getPersistentDataContainer();```
How come these 2 are different when they are the exact same block?
```[21:12:37] [Server thread/INFO]: org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataContainer@c259b700
[21:12:44] [Server thread/INFO]: org.bukkit.craftbukkit.v1_19_R1.persistence.CraftPersistentDataContainer@3```
These are the 2 in order, printed out
getState creates a clone
yeah
anyone here a github god? need massive help lol - if you can vc its easier
basically you need to check if lore is not null
cuz items has null lore in the beginning
oh, is there a way to store a unique identifier in a block?
Which, in my case, is a chest
also how is it the same block, youre calling getState() on coalChestBlock and clickedBlock
Oh lol
2 different classes but the same block
ok
I can't save that directly on a block?
pdc does some weird shit to constantly transfer between nbt and pdc i think
maybe thats a problem
idk
is there another way to achieve the same thing?
Are you updating your state
store a unique id in a block, which in my case says that it is a dungeonChest
Like calling update
no
hmm, lemme try that
(it is)
Block states are usually snapshots
So any mutation won't show
Unless updated
didn't know that, thanks
heey
soo I made this:
just need to get it to execute now
Should I just retrieve the command using its identifier and run execute(..?
yes
oh thx
Is it possible to create a sign GUI that i can call for player's to edit
dam alright
if(event.getItem().getItemMeta().getLore().size() < 0 || event.getItem().getType() == Material.AIR) {
return;
}
i tried doing this check but not sure if it works
hi, how do i get the players total exp? i tried player.getTotalExperience but that returned 0 when i had 100 levels
feelsbadman
if you watch the code i already did that and doesn't work
?
will p.getName() still work since mojang is discontinuing the name api
What ?
They aren't
where
They are removing the name history API. Not name API
isnt there another option?
first lines
idk then
first lines of what
if(event.getItem().getItemMeta().getLore() == null || event.getItem().getItemMeta().getLore().size() < 0 || event.getItem().getType() == Material.AIR) {
return;
}
this way should work theorecaly
yes i notest now
bruh there must be a way
just leave first
idk there is getExp which returns percentage of exp to next level
getLevel() returns level
getTotalExperience() returns exp collected through time
spigot... i swear man...
paper maybe has what you need
ultimate solution is own exp system
which displays level as minecraft level
but in core has different setup
How can i check if a player is not standing on a chest?
I don't think vanilla even tracks that value as a single integer
i thought this was simple ๐ฉ
...check if block under him is a chest
To my knowledge, it holds their level and a float from 0 - 1 for the progress of the current level
if (!player.getLocation().clone().subtract(0, 1, 0).getBlock().getType().toString().matches("CHEST|DOUBLE_CHEST"))
why would you have to clone it?
Most of the time if you don't clone location, you gonna mess up everything
you're not doing anything with the location itself here
don't think you need to clone it in this example
Most of the questions asked on spigotmc forum were solved by clone
.subtract
time to do this ig..
I once tried to build a structure by adding and subtracting ints from location
And i only got it working with clone
add and subtract methods do not return clones
they modify location itself
and it sucks
I once made a safe location wrapper
Locations fetched from Bukkit objects are more often than not new objects
with methods like flatMagnitude
No need to clone it
it ins't working
hm true, we're still not doing anything to that loc then though if I'm not totally dumb
Basically need
Used it a lot
and suggested a lot
In certain cases yes not many thought
yeah
Player.getLocation() is a clone already
alr
not for everything still
wait, i dont understand, so it doesnt work if u /xp add levels?
well you can wrap it
with CommandPreProcessEvent
if it calls some kind of xpchangeevent then u can just apply it to your system
wdym?
if somebody uses /xp
you just cancel the event
and add xp by your xp system
like basically im doing a command to /transfer exp to players
so its harder with exp?
i saw this way of making an invsee https://github.com/StefanCz0/betterinvsee/blob/master/better invsee/src/cz/stefan/minecraft/bukkit/plugin/betterinvsee/main.java but shouldnt i put all the linkedlists into a hashmap?
yeah
the problem with transferring levels is that levels get harder and harder to get every time
exp resets to 0 when you level up?
LinkedList is kinda bad solution here
ArrayList is better
no
isn't it
then no order
its meant to mirror target's inventory
then you can put items
and take out
i mean you can with arraylist
but
then i have to use .add and .remove
which is kinda funky
Holder would have two fields
and getters
one for who is viewing
and one for who's inventory
So when you click inv and it's holder is instanceof CustomHolder
then you can get target from holder
and modify it's inventory
not understood
alright, what should i do now?
just transfer levels
not exp itself
in your plugin
.
rip
turn levels into exp
how would i go on about doing that
Is it published somewhere
does anyone know how to prevent multi-threaded access of a JS object with GraalVM? The error is Multi threaded access requested by thread Thread[ForkJoinPool.commonPool-worker-7,5,main] but is not allowed for language(s) js. and there is https://medium.com/graalvm/multi-threaded-java-javascript-language-interoperability-in-graalvm-2f19c1f9c37b this article but I am fuckin confused
just
onCommand
Nothing is working, i tried like anything
Inventory inv = Bukkit.createInventory(new CustomHolder(senderPlayer, targetPlayer), 36, targetPlayer.getName() + "'s inventory");
why isn' t the chest part working this is the code
if (block.getType().equals(Material.AIR) || (block.getWorld().getBlockAt(block.getX(), block.getY() - 1, block.getZ()).getType().equals(Material.AIR)) && !(block.getWorld().getBlockAt(block.getX(), block.getY() - 2, block.getZ()).getType().equals(Material.CHEST)))
i have to make an interface?
public class CustomHolder implements InventoryHolder {
private UUID viewer, target;
public Player getViewer() {
return Bukkit.getPlayer(viewer);
}
public Player getTarget() {
return Bukkit.getPlayer(target);
}
public CustomHolder(Player one, Player two) {
viewer = one;
target = two;
}
@Override
public Inventory getInventory() {
return null;
}
}```
```java
@EventHandler
public void onClick(InventoryClickEvent e) {
if (e.getInventory() == null || e.getInventory().getHolder() instanceof CustomHolder) {
CustomHolder holder = (CustomHolder) e.getInventory().getHolder(); // use pattern matching if java > 10
Player target = holder.getTarget();
}
}```
```java
public boolean onCommand(...) {
Player playerSender = (Player) sender;
Player targetPlayer = Bukkit.getPlayerExact(args[0]);
Inventory inv = Bukkit.createInventory(new CustomHolder(senderPlayer, targetPlayer), 36, targetPlayer.getName() + "'s inventory");
inv.setContents(targetPlayer.getInventory().getContents());
playerSender.openInventory(inv);
}```
can I use json components in Player.sendTitle() just like I can can when using the command in vanilla?
to do stuff like this /title me title [{"text":"just an example"}]
as far as I can see there are only string inputs, which dont work
Aloha again
I am wondering about best practice here
When I want to create a handshake on a plugin channel with a mod
Would I initiate it from the server or from the client?
Or doesn't it really matter?
Like
Either starting from player join event
Or from the clients login event
I'm not into modding at all. Usually you want to open connections from a client.
In that case it probably does not matter since both sides have the same info.
i love getting spoonfed
I understand
Semantically it would make sense
It's the client who wants something from the server
I just wasn't sure what current best practices suggest
Thank you for the information:)
i know like 1/3rd of java
too lazy to watch the tutorial
thats a bold claim
i think it would be better if you start from playerjoinevent
That's how I would have preferred it
Not in modding at all too
checkmybio
I would start it on the "leading" side in this case
close
yes
relatively
what city?
Moscow, capital
So if you just wanna message a plugin do it from the mod. If a plugins has the full control and just has to tell stuff to the mod then do it from the plugins side
im gonna be home at like 15:00
you will have to register outgoing and incoming channels anyways
Probably
Idk when i'm gonna be home
I see
In the end it would not make much difference
I was just wondering what end endures the polling better
do you have homework?
1 Reason to do it from the clients side is in case you ever plan to expand it to be useable while not on the server
e.g. from a website
On some disciplines your homework is needed to get access to exam
but i'm already done with them
i spend like 10 hours per day doing school stuff
school = cringe
yes
university = chill
my history teacher is really boring
University = can find a Java programmer job while studying
Already applying
russia โค๏ธ
is kfc not banned?
mcdonalds has different name
yes
Still operating lol
You are russian too?
No
Make sense
In this case it's majorly about Plugin and mod synchronization ๐
Thanks for the pointers
then tf
You know there is something called news
I know Russia doesnโt give any news thatโs tru
e
vpn
Russia is a shithole right now
other
The gdp dropped 11%
so?
and
how does that affect russians only
The only real issue is that the GDP will not recover significantly anytime soon
my lunch money increased due to inflation
My lunch money didn't change last 3 years
Only thing that effects other countries are gas prices however besides Sweden no other country got hurt
Except kfc baskets now cost like 0.3 dollars more
Damn mines still the same
Germany, England?
The sanctions wasnโt imposed on the citizens ๐
highly doubt so
i got 5 euros per week when i was in 1st grade, now i get 15 euros
guys this is development
shut up
politics in chat
Development of a country
developing our minds
Not really
No channel is safe from this stupid topic
Listen to retrooper
A lot of countries are hurt by the global situation, it just happens that russia will be one of the few coutries to be affected in the long term
there is unclaimed land somwhere in africa, lets go colonize it
i forgot where it is
moscow will just transfer problems to other cities
Most countries got hit bad because companies etc use it as an excuse to higher the prices
That is only partially the case. Anyways I am out
Move to #general in case you guys didnt get it, thanks
no
?kick @mighty pier
Done. That felt good.
Lmfai
Germany
wtf
Guys literally, this channel isnt a general chat, take it seriously
since my question got drowned I will refer to it, can I get help with this?
he did
Doesnt mean you can go on and talk about other stuff
Never seen anyone care if this is general or not tbh
like people go off topic all the time here
but they shouldnt
^
yeah just saying
having only 1 help channel is bad enough
Most likely so
well I havent figured out how yet though
Try it out, if it does not work it doesn't otherwise yes
okay so it doesnt
Create threads then
So yeah, then there are no workarounds
Noone uses them
Sadly I dont have all 24h to look over this chat, so im thankful retrooper stepped in here
sad
thanks for the help anyways
Outside of like using proper API
?jd-s
with spigot api you can send a string with chat colors
so i dont see why you want json components
because I want to send item translations
i.e. a title which will show the correct name for whichever language they are using
which pretty much requires either TranslatableComponent or JSON
channel your inner kacper and just say "I never need that"
lEgAcY tExT iS bEtTeR
does spigot not have send title with component ?
I want to refrain from using paper
like in their spigot()
nah
but the sendType or w/e doesnt include title
Then use Adventure-plattform-bukkit
god damn spigot, i think choco was talking about a pr to rework components
so maybe itll be possibly in the future
Well more like expansion
yea
any idea why my plugin crashes with the error java.lang.NoClassDefFoundError: net/minecraft/nbt/CompoundTag?
My Maven dependency:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
your plugin is not remapped/reobfed
Did you remap your built jar afterwards?
okay I see, well thanks for the help i guess lol
you need to the remapped plugin
oh, I don't think so
yeah, you need to use the specialsource plugin there (there is some random post detailing how it works, someone should spam the link in a moment)
That was the rando post I mentioned
๐
alright, thank you very much
I have that shit bookmarked
cuz I need it every time I use nms
When it comes to maven I always copy & paste stuff from one of my main plugins
I have an archetype just not setup on my new os install yet
I've yet to make an OS setup script :( too lazy
Archetypes are not my thing
not a big archetype user huh?
cool kids just maintain a github template
eh thats just as good
java.io.IOException: Unable to find POM for GAV[group=org.eclipse, artifact=jface, version=3.3.0-I20070606-0010 [Interpreted as 3.3-i-20070606-10]]
I hate maven.
worked like a charm, thank you
don't thank me thank the crazy german man who wrote it @tender shard
never had a big need to use it if I could just copy paste within seconds
smh
๐ doing gods work
Now do @Since 
(bungeecord) anyone got any idea how to set forcedHosts using the code?
can I somehow add entity to team? like team.addEntry(entity.getUniqueId())?
yes
How create api ?
Anything publicly accessible is an API
Whether or not it's good is a different story
Anyone know how i could add fortune to custom drops but directly adding it to inventory, this is probably jank as fuck but ill fix it later
Current code:
if (drops == Material.REDSTONE_BLOCK) {
event.setDropItems(false);
ItemStack redstone = new ItemStack(Material.REDSTONE, 9);
player.getInventory().addItem(redstone);
}
If i had a pickaxe with fortune 5 on, how could i apply that to my ItemStack amount
Check if item has fortune, then get level
I mean applying fortune to the block and drops you're doing here is going to result in dupes, so long as you're aware of that.
But yeah, just have to get the level, then add to the drop count however you see fit
Does fortune just work by multiplying the drops by fortune amount or is it different
It varies from item to item
Lapis for instance is more affected by fortune than coal is
The formula to calculate the average drops multiplier is <see attached>, which means Fortune II gives 1.75x (13โ4) drops on average, Fortune III gives 2.2x (21โ5) drops on average, etc.
At least by the wiki
That's average though
https://minecraft.fandom.com/wiki/Fortune#Ore is the most relevant info on how fortune works
just send data when needed
on joins
on leaves
not on timer
except for hard events like move or blockphysics
you just add a new method and throw an UnsupportedOperationExc everytime its called
Hi, I am wondering how to add entity to team. I tried team.addEntry(entity.getUniqueId.toString) but it does not work. Is here other way to do it?
What do you mean by "it doesn't work?" ? What are you expecting when adding the entity to the team ?
I have team members count in scoreboard and this number doesn't change. I tested it on players and it works
How do you count team members ?
You should Team#getEntries().size()
Teams add players by name, add Entities by UUID
exactly
Then the problem should come from your scoreboard. Maybe it doesn't update correctly
No, it's updating fine. When I add a player to the team, the number changes
Do you add player with the same method ?
if you mean addEntry(p.getName()) yes
I am spawning villager and adding him to team here: https://pastebin.com/n64LUraq (List name are random names)
And here is my team class: https://pastebin.com/K9NDjCKN
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.
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.
You are running this on java 8?
if not you need to initialize a driver Class.forName(driver);
Entities you add using their Id not their name
I know this, I was just testing something and forgot to change it back
Then its not going to work adding by name
you can;t "test" somethign which is not going to work
You have a problem with your Scoreboard class instance. You're creating multiple instance so the Team are independent (you're creating a new team each time the command is executed)
Players you add by name, Entities you add by ID.toString()
You should use a singleton pattern, or use dependency injection, or even use static to accomplish what you are trying to do
Show us the code where you initialize the driver
oh, so can you give me an example how to make it?
"Failed to get driver instance for ..."
did you add the "..." part?
or is this the original message?
show the URL please
because this must be where the error comes from
hm looks good to me
weird
Class.forName("com.mysql.jdbc.Driver");
Let's say you have a "Scoreboard" class (the one you already have). You should create an instance of it in your Main class and save it as a variable. (public Scoreboard myScoreboard... And in the onEnable set that variable... myScoreboard = new Scoreboard()).
Then in your Villager class, create a constructor with in arguments Scoreboard scoreboard. Then save this argument in the Villager class to use it ! Instead of doing new Scoreboard() in the Villager class
I'm on phone right now, and just about to sleep sorry
then you have no sql driver
then the problem is obvious, yeah
thats not what I told you
you fucked up the shading thing
wtf
why did you class.forName the DataSource object
try to use exactly what Elgar sent
if you are using v8 driver you use com.mysql.cj.jdbc.Driver
how do you compile? using your IDE, or using maven?
but the first one will work for new or old
I thing I understood. Thx. You helped me a lot.
alr perfect. Continue like that you'll soon understand how it all work ๐
nah, if no shade plugin Hikari is still shaded, but not relocated. It will still work
no
without maven-shade, nothing gets shaded
he has no scope on it so it gets shaded
it doesnt if they didnt declare the plugin
at least in Eclipse with no scope it gets shaded
yes
remove your shade-plugin, then do mvn packave
you will see that nothing gets shaded
honestly it does
it does not
in Eclipse, no plugins and no scope it shades
with shade plugin
Yes you only get one jar but its all shaded
without shade plugin
Is there a way to have a unique identifier for an inventory?
shade will not run unless your parent pom specifies it
InventoryHolder with random double number as id @fervent gate
no, you have to keep track of inventories yourself
um you may be correct. I just tested adn it didn;t shade. I guess it changed
Wdym, just store them somewhere and compare them with ==?
I'm pretty sure that it was always like this, because many times my stuff broke when I forgot the shade part
odd I remember the opposite. It always shaded crap I didn't want with no plugins
I guess you are right. my memory is just bad
mine is too haha
in this solution you just create list of invs
yes shade
yes, you have to add the maven shade plugin to your pom
and check if inventory clicked is in this list
unless you use the libraries feature in plugin.yml
https://blog.jeff-media.com/common-maven-questions/ @quaint mantle check the second headline
no
no
like this ^
you 100% need the <executions> part
you just leave it like this
and then hopefully, it will work now lol
show your code with teh class.forname in it
That is only a valid driver if you are shading the v8 driver for mysql
yes, wrong driver
uncomment the second one
that driver is included with spigot
it can;t fail to be there
its litterally IN spigot
are you not using spigot?
is this not Spigot code?
Then you need to include a mysql driver as well as Hikari
oh yeah you ofc need some mysql driver as well
latest that uses the first driver in your code is mysql:mysql-connector-java:8.0.30
you need java 17+
https://blog.jeff-media.com/common-maven-questions/ third headline
Hikari needs Java 11+
1.8 also works fine on java 11
so either go for java 11, or downgrade the hikari version
Not sure if I'm doing something wrong, but is it normal that Block::getLocation() doesn't contain a world?
impossible
checking what is wrong
okay, what is wrong is me being stupid -_-
big faceslap to myself ...

Hello, how would I go about making it so that NMS EntityPlayer's can take damage?
you are creating a Fake ServerPlayer?
No, an EntityPlayer via packets and NMS
EntityPlayer = curreent day ServerPlayer
alright then, I guess yeah
no its not
read it properly. it is very complete. I used it myself to design my own FakePlayers
๐ค
Thats because you skimmed it and didn;t read.
public class Test extends ServerPlayer {
oh wow, ty for the help
You mean for a bukkit task?
yes
Depends how you scheduled it.
Did you use it as a Thread action? Or schedule it with an executor service?
Because a runnable is just a normal class that does nothing on its own.
"probably"
Well then it depends on the executor and how you scheduled it
Show some code.
If you submit/execute then its being run instantly. Otherwise its scheduled for a time in the future.
I would not use an executor service for that. Use the bukkit scheduler.
Every variable in java is a references to an actual object.
Exceptions being primitives.
Does spigot's maven repo block non maven/gradle requests? trying to build a plugin on bazel and spigot's maven repo is 403ing
How do you get an Entity from an EntityType?
You mean how you would spawn one?
I'm trying to target an entity in a command by it's type.
So you want to target all entities of this type which are currently loaded and active on the server?
Yes.
getEntitiesByType is a thing
declaration: package: org.bukkit, interface: World
Thanks. ๐
is there anything i can pass to the stdin of a running spigot jar to get raw data like players info etc if im running it through a pipe in c
Elaborate a bit more
You want the console output?
man's making a C application
make a socket system and transmit whatever data you want with a custom plugin
i dont want the console output specifically, im wondering if theres anything write to the file descriptor of the pipe to get like player count etc
fair
or use influxdb lol
making my own server implementation to solve this ong
How do I get a players name in a scheduled task?
I want it to run the task with each player on the server.
Create one task -> inside call Bukkit.getOnlinePlayers()
yeah but that would get all online players, I just want it to get each player individually
Then implement a runnable which knows the UUID
public class SomePlayerTask extends BukkitRunnable {
private final UUID playerId;
public SomePlayerTask(UUID playerId) {
this.playerId = playerId;
}
@Override
public void run() {
// Get player
Player player = Bukkit.getPlayer(playerId);
// If null then the player is offline
if(player == null) {
// For this case cancel the task
this.cancel();
return;
}
player.sendMessage("Hi");
}
}
Later on
new SomePlayerTask(player.getUniqueId()).runTaskTimer(plugin, 20, 20);
onCommand, how do I know what the exact name of the command was since there are aliases I want to know if an aliase was used and which one was used
and so it starts, me wondering how I can add scriptable behavior to my plugin via config
good luck
it already feels like a mistake
Create your own language
you gonna design your oqwn lang?
I am not exaggerating when I am saying that I am so apprehensive about this one that I have gone out of my way to not write a single line even on paper planning it out
ffs magma it's 3:30am just make some presets
3:33 am lucky time to start this
bet you'll only start writing code at 6:66 oh wait 6:66 isn't a thing
oyou could use a js or lua interpreter?
I think I want something event-driven
I remember using js scripts for a project I worked on
and I passed a custom context object you could do math on
and probably not code because if someone shows up on my support channel and asks me about lua one of us will die before the end of that discussion
is this for your mobs plugin
it is
today is not the day for overengineering trivial concepts
I am 28 tomorrow
today is the day for listening to hood rap and overthinking life
I am 18 in... 6 months maybe?
plenty of time to procrastinate
what I would give to not go back to being 18
everything
Welcome to the club old man
boomer club
I think I'll go with event-driven presets and global/individual timers...?
how would you format it though
actually you know what just events and then I'll turn the internal timer into an event maybe... or a state
You can take a look at how MythicMobs solves it. Its quite nice for the user.
why not start a sub-industry and just make a very decent api
because I want the people who work for me to work on this
You have:
- Triggers
- Conditions
- Actions
Those 3 together with a delay() function and you can do a ton
and they are not programmers
make em pay you to do it
I have vaguely seen how mythic does it though I've never used it
adding a sync delay function would be interesting
I'm sure what mythic does works well for them but I want something simpler
I think their system is quite nice
variables arent very verbose
Yeah you always have to look up the docs...
I mean honestly I started elitemobs when I saw the config of mythicmobs, this isn't even a joke
my thinking was might as well code it myself
you could make it similar to skript
and I've always tried real hard to keep setting up things real simple at the cost of complexity and customization
how it's very english-like
I saw your code, who are you lying to
eh true
Use OpenAI and let the user write a text.
"I want the mob to burn if its health is below 30"
when MOB dies:
particle ANGRY_VILLAGER
wait 10 seconds
message "Dead" to player in radius 3
i think thats sorta easy to read
hm
but would also mean more complex commands are super verbose
one thing I'm almost certainly going to keep doing is creating premade content and this would probably extend into premade scripts
if you can call scripts in scripts with some basic constructors you might be able to skip a lot of the more verbose stuff
executing that super efficiently sounds like a bitch
nah it's pretty easy
precache all scripts, store by name, you're already getting your stuff real fast
dump it into a nice map
bob's your uncle
lmao
then I'm making a custom storage file
that's going to be my twitch channel
I'm tapping into a new market
ok so here's my thinking
events are for cool kids like me ๐
I think I can get away with making it real simple using only events
I don't know that mythic uses events
but I mean you can just use timers if you want to
events sounds easier on both ends tbh
so what I'll do is events and for the mob power stuff I'll add a priority and a weight
higher priority gets executed first (you know, the way that actually makes sense) assuming conditions are cleared, if multiple fall into the same priority then we do a weighed chance roll based on the weight
local cooldowns set the cooldown of the power (in case of powers which is the core use case here) and global cooldown sets the cooldown of powers in general
which is already how I've started doing things internally anyway
once the global cooldown clears an event fires letting the powers know they can get going again
I guess this might make reactive powers tricky to make though, hm
whats a reactive power?
stuff that activates when a boss gets hit
gotcha
you have gcd powers which trigger on a delay, reactive powers which trigger when hit, powers that trigger on attack and stuff that is just passive like increased movement speed
guess I have to figure out if I can escape my fate of doing 3 timers with 3 different cds each
actually sort of possible
if I evaluate how long a power is scripted to take I can enforce an internal timer to prevent power overlap, and I just have to tell people to make sure their cooldown timers extend beyond the time the power takes to complete
could even make a simple formula to create default cooldowns which grow in length depending on how many ticks they take, if something takes 5 seconds it probably shouldn't be happening back to back
MN u using skript??
I have a question about comparing blocks: I have 2 locations: z1, endLocation. I am testing to see if(z1.getBlock() == endLocation.getBlock())
but for some reason, they are not returning equal. Below is an image of the 2 blocks in log form. Do you know why they arent returning equal, what block property im missing and how I can fix this? Thanks!
Try using equals maybe?
ye I was thinking block x y and z but it seems a bit too complex and more work than is needed. I will try equals and if it doesnt work I will just use xyz
If u can, u can try to increase or decrease the 1 position -1. Because i got this problem and i tried to fix it for 8 hours and this dummy thing just fixed anyhow.
You can .equals() compare them just fine. Internally it just compares the x/y/z coordinates
Though getBlock() will always return a new CraftBlock instance, so they'll never ==
Huh
how do I make clickable text that makes the player execute a command
Make a command class, define the location of the text(make it unique and reachable) and listen for clicking event if player clicks the exact location
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "command line");```
I am actually saving the location
But its not a former way anyways i will just use my plugin for my server
TextComponent and BaseComponent
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Okay I got it, thank you
Normally a non-terminated ExecutorService prevents a JVM from shutting down. But not so on Spigot. Why?
And what actually happens to the threads? Is the behavior from spigot documented somewhere?
The executors just get shut down and the threads are interrupted. This is not documented. Might be nms behavior.
Could as well be the custom class loader from spigot. Would have to dig for that.
Doesn't seem like interruption on the threads. Because if so, they would have the possibility to ignore the interrupt, continue running and prevent the JVM from shutting down. Which was not the case for my tests.
Nope. Looks right.
"EntityPotionEffectEvent cannot be triggered asynchronously from another thread."
Pretty clear, isnt it?
Synchronize it
Yes and you want to remove it when a button in discord is clicked. I get it.
But you can simply not interact with spigot from another thread.
You need to schedule a bukkit task which will then execute the code on the next tick.
Thats not a maybe mr "Full Stack Developer". Thats quite messy.
Anyways: All you need to do is run the minecraft related code on the minecraft thread.
Easiest done by scheduling a bukkit task with the BukkitScheduler.
We explained in great detail whats wrong.
We even gave you the fix for it. All you need to do is write it now.
?scheduling
gus, do you know why Hex code is not working to me?
public static String translateColorCodes(String message){
if(message == null) return null;
String startTag = "&#";
String endTag = "";
char COLOR_CHAR = ChatColor.COLOR_CHAR;
final Pattern hexPattern = Pattern.compile(startTag + "([A-Fa-f0-9]{6})" + endTag);
Matcher matcher = hexPattern.matcher(message);
StringBuffer buffer = new StringBuffer(message.length() + 4 * 8);
while (matcher.find())
{
String group = matcher.group(1);
matcher.appendReplacement(buffer, COLOR_CHAR + "x"
+ COLOR_CHAR + group.charAt(0) + COLOR_CHAR + group.charAt(1)
+ COLOR_CHAR + group.charAt(2) + COLOR_CHAR + group.charAt(3)
+ COLOR_CHAR + group.charAt(4) + COLOR_CHAR + group.charAt(5)
);
}
String sr = matcher.appendTail(buffer).toString();
String aux = null;
try{
aux = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(null,sr);
}catch (Exception ignored){}
if(aux != null){
sr = aux;
}
return ChatColor.translateAlternateColorCodes('&', sr);
}
its not print the correct color :(
7smile7, I assume that the thread#stop method is called somewhere internally then. But thx for the help.
I looked at the bukkit bootstrap environment and there is nothing to find regarding executor eviction.
But generally it shouldnt matter. We just need to either clean up behind ourselves or simply use the bukkit scheduler ^^
}catch (Exception ignored){}
Ah yes. The classic.
Or could it be even by minecraft itsef? Still, definitely seems that the threads are stopped forcefully.
Which should be considered at least. Especially when doing I/O or stuff. As it changes the contract for a safe shutdown.
Normally shutting down the executor would be enough, here it then MUST be awaited/joined on the main thread, to prevent file/data corruption.
But thanks for the clarification.
Is your discord broken?
I just edited the message. nvm.
hey i try to send a text for a sign via sendSignChange when placing a sign but unfortunately it doesn't work
Delay it by one tick
Not really
If its daemon, usually just shutting the thing down works
But anyway, I believe ExecutorService::close is gonna be introduced coupled with the new StructuredTaskScope api which is gonna be a blocking way of terminating a service completely
I need help with my bungeecord callbacks, for some reason its not completing the the future
I know this because its returning numbers in the thousands for my player count
which is not the case
my use of the code is like this
SendAndReceive.send("PlayerCount", gameItem.getServerName()).whenComplete((msg, error) -> {
NeoUtils.getInstance().getFancyLogger().fatal(String.valueOf(error.getCause().getCause()));
ByteArrayDataInput in = ByteStreams.newDataInput(msg);
in.readUTF();
int playerCount = in.readInt();
specialItem.setLore("Player count: " + playerCount);
gameSelectorGUI.setItem(gameItem.slot(), new InventoryItem.InventoryItemBuilder(specialItem::getAndSet)
.setAction((event -> BungeeCordUtils.connect((Player) event.getWhoClicked(), gameItem.getServerName())))
.build());
});```
How could I make a block give off a light level of 15
packets, look here https://github.com/HexoCraft/AddLight
no other way?
google it
try again
WIP


