#help-development
1 messages · Page 460 of 1
im so noob that i dont even understand what ur saying
but if I only want once instance of a module handler, what do I do then?
Meh. You usually dont want to do that.
You can let your JavaPlugin class manage your singleton instances
and make them static. But generally speaking you will have a better
design when using dependency injection.
Hello guys. When I add RGB Color codes to the prefix of a rank in LuckPerms, I do not have the colorcode in my nametag because nametags dont support RGB Color codes and TAB plugin doesn't have a script against it either. The normal color codes work on your nametag and in chat, so the color codes like &e, and rgb color codes also work in chat but not on your nametag. does anyone know a plugin to bypass this or another way to bypass this so that I can use rgb color codes in my nametag
Create an instance in your onEnable and pass this instance around.
Alternatively you can also create a static getter for your JavaPlugin instance which
contains all the instances created onEnable
for (Player p : event.getRecipients()) {
p.spigot().sendMessage(newMessage);
}
Done
I think this should also apply to private messages if priority is set correctly
no
free java lessons
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
here you go
Hello, I am using CratesPlus for my server, everything was working fine but crates started dissapearing every time the server gets restarted. There aren't any console errors, and the data.yml file still says the locations of crates, but the crates turn into normal chests (basically they get removed) anyone had a problem like this?
i dont rlly understand what this line does. Is it taking information from the server?
it registers a listener
and it registers it per plugin or smth, thats why it needs the plugin parameter
Dang
ngl acf kinda confusing
How is that confusing 
small brain problems, sorry
i looked into this a couple years ago. there's not really much that is possible here (at least as of version ~1.17)
the only plugin i know of that potentially does something like this is LibDisguises, but ive never used it myself so i don't really know if it'd work as intended in this situation. also it may be pretty resource heavy, iirc it hides the player entity and creates a new entity that follows you around? or something big brain like that. not really sure, i only know of it
it just needs 3 strings
all I want is for my "/balance" to become "/foobar balance"
first one either foobarcommand or foo or f
second bar or b
and third always baz
just look at the spaces
@CommandAlias("foobar balance")
i zee
any way to make all my commands like that without having to do that on all of em?
what are you trying to make?
My knowledge of ACF extends to that picture you sent so I have no clue 
basically want subcommands but not all bundled up in one big class
theres going to be a LOT of subcommands
and I mean a seriously big amount
Guys
fml hes back
?paste
After hours
yeah I basically wanna do that (a ton of subcommands) but not all in one class
If I want to get a player using Bukkit#getPlayer
the same thing you did, divided up in several classes (1 per command)
But the player can be both online or offline
Do I use getOfflinePlayer() in both cases?
@quaint mantle congrats bro now can you tell us your issue
Can someone please check it?
Idk if it works
if you know they are online then dont
looks fine
add the commands to plugin.yml
What if they could be both online or offline
then offlineplayer
I want to literally check if they are offline or not
Does it tell that it will remember player placed blocks?
using a UUID
or check online
get player with uuid then check for online
offlineplayer with uuid*
Bukkit#getOfflinePlayer(UUID)
if I want to add a new feature to the api, what's the standard procedure?
I tried using nametagedit, but nothing worked so far. I will tru this pligin thanks
Thanks
I believe that should work
submit a pr to the api with the feature and submit a pr to the server with the necessary patch?
Im out rn
this will forever be one of the funniest screenshots thank you
no, we cannot
And if I need your help
We're here to help you write good code, not to spoon-feed you
I’ll just ask it
Don’t worry guys, I’ll be back
Ok I asked to my friend if he can try it
why cant you try it
.
why are you codingwhile your out
do it when you get home
so ya know, you can fix bugs
unless you're a god-tier developer that is helping their team while they're out
just do shit when you actually have time
will @CommandAlias f with my args? @tardy delta ||sorry for ping||
like if I just put it as "mm balance" now will it say that I have 1 args instead of 0
what does "come good" mean
It will be good
guys my plugin will come out good I hope
No
Probably u made a lot of errors
damn how do you see that
statistics plugin on intellij
I honestly do not remember asking
thats like the name of the command
No, we don't make errors here, sorry
I don’t remember to have asked your opinion
I have never made a mistake before
we dont make errors we only make intentonal bugs
opinion is not something that is asked for
Yea
I can tell you my opinion on anything and you can't do shit about it
If I ask for your opinion then yes
probably that's why it's an opinion
Surprise features
I don't need your permission for that ❤️
Bc we live in a free country <333
nah I just hopped in for a sec
I wanna make a GUI Manager to start in advanced spigot develop, but i dont know where to start, smone can help me?
I don't <3333
@echo basalt he started it mom
7smile7 got a lovely structure
ive seen it
yeah
that
not if I can help it <333
You can then write some code that can, for example, read stuff from config and apply it
ok good
<3333
Or make a selection system where you can apply an element to multiple slots at once
can we please just have the funny command already
/goto take a shower
go learn java
/goto take a shit

if you're just here to be a troll then fuck off
Im not trolling?
why would I want to make more of you
why are you guys even still talking to them
He asked it
Hi!
I blocked him yesterday finally lol
I made some progress
I just couldn't anymore
good point I'll just block him
Why? Lol
true
Why?
you refuse to learn java
as harsh as it may sound, no one cares about your progress or anyone's progress
I am learning it
highly doubt that
Reminds me of someone else
@ivory sleet sorry for the ping but can you just type the funny command already
Are u my teacher? No, I’m learning for my self u can’t test it
shut
ready to bet actual money that everyone hates @quaint mantle here already
🤨
I don’t hate Egitto
Coming here and pretending you're the best because you've asked us to test your own code
congratulations! you win the money I bet
I had bet -1 pesos
being rude will definitely get you nowhere
now pay up
"your"* smh
and here's literal proof you're egotistical
acf acf acf
Is not going to get you far in life
How can I pass a parameter from the command over to CommandCompletion
acf kinda pog ngl
dw he is timeout'd
So just be humble ❤️
thank you conclure
FINALLY
You mean tab completion?
Yes
Tab completion is odd
he will shut up for a bit
But, It's dependant
You need to return a string list
1w
Wait wait
🔥
bet hes gonna try and dm someone for help
Oh wait nvm this won't work
don't give him ideas
too bad he cant dm many of us
I need tab completion dependant on something the player is holding
And logically that makes no sense
Unless I can pass a itemInHand to tabCompletion in ACF
how does CommandPermissions() work in acf? can I edit the action it takes when the user does not have said permissions?
I'm so glad I don't use acf
acf is confusing
Ok nvm
Acf is sick lol
acf.getCommandCompletions().registerAsyncCompletion("contacts", c ->
{
System.out.println(c.getPlayer().getInventory().getItemInMainHand().toString());
}
That actually works
How can I create my own ClickEvent
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/phone addcontact"))
To replace that, but instead, for example, make it open a specific GUI
make a command that opens the GUI, then run that command through the event
if I only want players to be able to use the clickevent, but not manually run the command, I just use a random UUID in the clickevent, then in onCommand I check if the UUID is correct
Or I can just hide the command behind something so dumb
It would never be found anything
@CommandAlias("mm|minememer")
public class bankCommand extends BaseCommand {
private static final MineMemer plugin = MineMemer.getInstance();
@Subcommand("bank|balance")
@CommandPermission("mm.balance.self")
public boolean viewBankSelf(CommandSender sender) throws Exception {
if (checkSenderIsPlayer(sender)) {
Player player = (Player) sender;
showPlayerBank(player, player.getUniqueId());
}
return true;
}
@Syntax("<player>")
@CommandCompletion("*")
@Subcommand("bank|balance")
@CommandPermission("mm.balance.other")
public boolean viewBankOther(CommandSender sender, Command command, String label, String[] args) throws Exception {
if (checkSenderIsPlayer(sender)) {
Player player = (Player) sender;
String rawUUID = getPlayerUUIDByName(args[0]);
if (rawUUID.equalsIgnoreCase("Player_Not_Found")) {
sendErrorToPlayer(player, "Player_Not_Found");
return true;
}
UUID tUUID = UUID.fromString(rawUUID);
showPlayerBank(player, tUUID);
}
return true;
}
definitely looks 10000% cleaner
you could still somehow see the command as its send to the client
better just use a random uuid as argument
Some server did that with an invsee command that was only supposed to be used from a click event
People figured out the command
yeah just create a random UUID everytime you send the message
Hey, I am currently working on a chest crate Plugin and now I want to check if the right click Block is a Chest and check the Title of the Chest. My Problem is that neither the getName() nor the getTitle() Method exist, so I don't know how to check the title of a chest. (I am on 1.19.2 btw.)
You are right, or just allow it to be used both ways
I get this error when I change Container title, the new title is just 7 unicodes, nothing else, yet it errors
any ideas why?
https://paste.md-5.net/bijijubehu.cs
https://paste.md-5.net/momepawoqo.md
No other way to have a custom event for BaseComponent?
wdym with custom event?
how long is your title o0
Like I said, replace ClickEvent with something else
I could make a class that extends ClickEvent with nms
just 7 unicodes
aka in the second link the ???..
Seems like more work that just command tho
how do i have a location always left of the player?
elaborate?
I think he wants to check the block immediately left of a player
or store the loc or sum
if it's to determine whether something is a crate, id recommend storing the crate locations in a database and loading in the locations on enable, and checking that way.
determining guis based on titles of inventories is Hellish for other developers - it can interfere with other plugins that have similar wording, etc. id strongly recommend against
get their eye location and eye direction. change yaw by -90, then add 1 or 2 blocks or whatever in that direction, and done
ah ok, thx. Did they remove the methods?
i think inventory title is only available through InventoryView, when the inventory is open. idk if it's accessible through the actual chest block but i may be wrong, never looked at that myself
maybe through the blockdata or something
Ohh okay, thank you 🙂
how would that look like? xd like having a particle always 1 block left of you (only need to know the location calculation)
Im in the bathtub, i can send some code in an hour or sth
How can I sent an empty line inside a sender.spigot().sendMessage
it is possible to get the custom name of the chest, you have to cast the blockstate to Chest. With that you can access the custom name.
also check if the block is a chest before casting
In 1 line that is
sender.spigot().sendMessage(firstLine);
Can I include \n inside firstLine?
"\n"?
How to make timer that goes from 5 to 0 and then teleports player, but if they move cancel it
How?!
what\
it's a leaderboard
very original 💀
how is it possible?
hmm
it changes i dont know
wanted to say resourcepack but data is dynamic
exactly
Yeah but, how can I create a thing like that using Java?
How can I create that image
It's going to be the heaviest task of the server lmao
just go into f3 and see if theres a map behind
yeah, it's a map
different ones?
100% correct
But it’s not that hard to manipulate maps
But, how can I create that base image?
There’s multiple frameworks/libraries to amke it even easier
With colors, positions and so on
Vector facing = player.getLocation().getDirection().normalize().setY(0);
// normal is the vector at 90 degrees. -1 is to the left, 1 is to the right.
// y (pitch) isn't taken into account here.
Vector normal = facing.crossProduct(new Vector(0, -1, 0));
normal.normalize(); //set length of vector to 1. can multiply it from here to set distance
Location left = player.getLocation().clone().add(normal);
i believe minestom has opengl support for renderin on maps 💀
how is that supposed to work? With a GPU on your server?
Would you have any ideas for replicating a similar result?
This wont help you much unless you have an APU or GPU on your server
Sure. Just draw on it using the CPU,
Hmhh... Rendering is the last problem I believe
Creating an updatable leaderboard per player is the main one
map rendering shet that is sick
I have never drawn using java before lmao
ofc i lost the screen of my beatiful rendering
Just create a BufferedImage with N*256 width and M*256 height
where N is the amount of column frames and M the amount of row frames,
then draw on it by using the Graphics2D capabilities of the image, split
the image up into N by M pieces and apply them on the maps.
.
Create a repeated runnable that counts down and stops if the distance to the original location is too high
Hi, does anyone know how to keep a mob around a location and if the mob go further the radius it stop following the player ?
Custom nms implementation with AI goals.
Without nms if it's possible
Iterate over entities every so often and teleport them back when they are too far from their location
Good idea, thanks 😀
i love <T>
Conventions
cuz that's just T without pair
but why is the convention to use single letter stuff
when everywhere else, people say it's bad
?
idk we just made this:
public static <T extends PersistentDataHolder> T addIntValue(T holder, String key, int value) {
holder.stuff();
return holder;
}
No idea. Maybe so you can differentiate between generic types and actual classes.
yeah probably
and this method does return the object of the same type as the one i gave to it, and not a PersistentDataHolder like in this example:
public static PersistentDataHolder addIntValue(PersistentDataHolder holder, String key, int value) {
holder.stuff();
return holder;
}
Without your IDE coloring everything in it could be harder to make out the generics in something like
<Element, Target, Result> Result combine(Target target, Element element) { ... }
🙂
tho the guy who coded this has another problem
itemstacks are not PD holders
only the meta is
I was about to say: It makes more sense to pass the PDC there
so if you want to change the itemstack without get/set but with just one method, it won't work
like name + pdc's
so you need to pass a meta which turns to unreadable shit overall
everything's a pickaxe if you try hard enough
😉
How can I access ChunkGenerator of the default world?
Tried with World#getGenerator() but it returns null
There is no default implementation of the spigot chunk generator
So is there any way I could get base height at given coordinates in world using vanilla generator?
When I placed blocks above it returned locations of these placed blocks
Is there an easy way of determining all the impact a block break event/block place event had?
Like when you break a block and it causes a torch to fall of or water to flow, that then turns lava into obsidian or flows away other torches?
I know there's the BlockFromToEvent for water and I could track that but maybe there's another solution that didn't come to mind yet.
Use the worldgen heightmap
@tender shard I red ur msg regarding type parameter names that have the same naming convention as classes, Ive tried it, the main problem arises that you can’t differentiate between type parameters and types, which becomes confusing, so I think the reason for the convention is that simple
Yeah probably, thats what my java book also said
Do you mean passing e.g. HeightMap.WORLD_SURFACE as second argument? I tried and it returned placed blocks too
LOL
im clearly better at java than at c++ then
declaration: package: org.bukkit, enum: HeightMap
how do i get org.bukkit.Color from string?
is it an enum
is there a way tho
??
lmao TIL you can freeze to death in MC
Guys how would I add metadata to an item in a players hand?
get the item, set the metadata, set the item to a new one
Oh, thanks, I didn't pay much attention to those with _WG suffix
but why do metadata if you can do pdc
what if i don't want to set a new item, and i only wanted to edit the metadata?
Alex where have you been it's existed for a comically long time
what's pdc?
Asking about your attempted solution rather than your actual problem
?pdc also
wth? How long has freezing to death been in MC?
ok, I've not really played since about 1.7
how can i select the itemstack in the players hand?
I didnt know either lol
player.getInventory().getItemInMainHand()
?jd-s
perhaps 1.8 but not much 😉
i began playing at 1.12
noob
I played 1.8 recently, and it made me realise how far the game has come and how many bugs have been fixed
if i wanted to use say for instance setChargedProjectiles on the item stack, where would i put setChargedProjectiles in that line?
but I do think some bugs were part of the fun
and how much longer it takes to load 💀
yep
i could load like at least 3 1.8 instances in the time it takes 1.19 to start
yeah the new client is slow af
although 1.19.4 is a big improvementa to load speed
and it doesn't make my whole computer freeze for a moment
isn't that only for crossbow meta?
yeah i want to add a projectile to a crossbow
get the itemstack in hand, check if it has itemmeta. if yes, get the itemmeta, check if its instanceof crossbowmeta. if yes, cast it to crossbowmeta
i mean how do i cast it to that item
?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.
i don't know the syntax to use
CrossbowMeta crossbowMeta = (CrossbowMeta) itemMeta;
If you just type
CrossbowMeta meta = itemMeta
The ide should suggest you the cast anyway
ah
i was having a genius idea to work with a rust enum alternative, turns out it doesnt work
i tried using player.getItemInHand().getItemMeta().addChargedProjectile() but addchargedprojectile isn't recognised
it cannot resolve method
apparently :/
im still waiting for java to allow this:
public record(OpCode, Operand...) instruction() {
return [..]
}```
what are you trying to do exactly?
i'm trying to get it so that when a player left clicks with a crossbow, a projectile is added to the crossbow.
i didn't worked with new version specially those ones with crossbow but this is the correct way ig, try it
ItemStack item = // get the item
ItemMeta meta = item.getItemMeta();
meta.doYourStuff();
item.setItemMeta(meta);
// set it in player hand
so it ahs to be in seperate lines?
has*
use ->
Java 8?
also how do i specify that the itemstack is the item in the players hand?
player.getInventory().getItemInMainHand()
so i'd do itemstack item = player.getinv... ?
yea
ah nice ok 🙂
if a player is in an inventory, does the inventory close event get called if he leaves the server?
the inventory close event is broken at all
I added <outputDirectory>DIR</outputDirectory> to the config section of my pom.xml file.
For some reason every time I build the plugin it starts to add new jars each time. How can I prevent this and just have it override the original plugin jar?
wdym D:
its not getting called at all
wait what
i keep getting the error "cannot resolve addchargedprojectile"?
also the Open one
why not
gimme a ss of your code
my question too
ok
yes in java 14+
its working for me?
it's called addChargedProjectile
run mvn clean
I think
if(player.getInventory().getItemInHand().getType() == Material.CROSSBOW){ if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK){ ItemStack item = player.getInventory().getItemInMainHand(); ItemMeta meta = item.getItemMeta(); meta.addChargedProjectile } }
its there ^^^
also on disconnect
you're doing it wrong
do it like this ^
have you cast the itemmeta to CrossbowMeta?
idk what that means rly i think so?
this is very helpful, I will read the link thank you 😄
Seems mfnalex gave a solid solution.
so would that go after itemmeta meta = item.getitemmeta();?
yes
does not go after, goes instead of that
ow
no it does not
nvm
i'm stuck in 1.12.2
yayayay no error ty 🙂
then use what i said
yes it seems i have no other choose
wait what should i put on line after that i tried CrossbowMeta.addChargedProjectile but error came back 😦
I think you should put the learn java on that line
why that wouldn't fix the error
Wait, are you trying using the object or class?
yep
i think the object
I think it's class because of the naming convention
oh ok class then
you should really learn java
i'm trying to do that here
CrossbowMeta is the class. you must clall that method on an instance of that class, as it's not a static method
learning my doing is a fine approach often
but don't do spigot plugins
before you learn java
?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.
CrossbowMeta crossbowMeta = (CrossbowMeta) myItem.getItemMeta();
crossbowMeta.addChargedProjectile(...);
and then you have to set back the itemmeta to the itemstack
myItem.setItemMeta(crossbowMeta);
How can i check what is a pressure plate or button triggering?
get its relative blocks, for a pressure plate it should be the block below (and if it isn't powerable, the block below the block)
for the button probably check the direction of the button if that's possible, and get a relative block in that direction
do you mean, you wanna detect when a player pressres a button or pressure plate?
because detecting it for players is easy, for other stuff, not so much
they already checked the material of the item
Great 👍
what does the myItem part do?
bruh it refers to your itemstack
ok
lmao are those yours?
i see
whqt does the leather builder build
armor colors?
hmm
guys i tried CrossbowMeta crossbowMeta = (CrossbowMeta) myItem.getItemMeta(); but "myitem" cannot be resolved.
i tried replacing it with ItemStack but that didn't work either.
I mean its quite handy to have these in one place
instead of using like 4 different libraries
I cant wait for your ItemTrimBuilder in 1.20
lol nice
put those in one class and make methods that make a static assertion on the held meta type
WHY
i want to detect what is the pressure plate or button triggering, for example i press a button and it opens a door, i want to get the triggered door
probably to use sane names when using enchantments
bleh
well if i interpret your previous code correctly, you don't call your variable "myItem" but "item" either
what kinda things can you build with the item builder
yeah i just realised that ty 🙂
translate components on item names?
yes that makes sense
is this your private library or do you post it for others to use as well?
i see
thats very relatable
you just mvn deply it somewhere
or you just upload it to github and tell people to mvn install it
yeah
or you use jitpack but that's so annoying
but like I like writing my own things instead of using libraries for evrything
until it gets to like using nms or whatever
yeah jitpack sucks. you can just upload your stuff to github, then other people can clone it, run mvn install and then they can use it as dependency
is there way to get the item if entity was attacked. Like I want to check if kill was done by bow by player and I want to get the bow that was shot
edit: rewriting doesnt make sense
listen to ProjectileLaunchEvent. Apply metadata to the arrow, or just use the arrow's PDC to store a copy of the itemstack.
You can?
welcome to minestom
ItemStack firework = ItemStack.of(Material.FIREWORK_WHATEVER).withMeta(FireworkMeta.class, meta -> meta.setFirework(/* idk */));```
Guys I'm trying to use addChargedProjectile
The docs give this example:
void addChargedProjectile(@NotNull ItemStack item)
In this item is supposed to be the projectile.
I replaced "item" with "Arrow" but it says that it "cannot resolve symbol".
Does anybody know why this is or how I might be able to fix it?
declaration: package: net.minestom.server.item, interface: ItemStack
ffs learn java
you don't know the difference between classes and instances
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
smh
i was just asking if anybody knew why that occured...
I assume all of us know
Does spigot have a method for that?
Depends on when you want to add it.
😦
oh?
because "Arrow" is not a symbol
Do anyone know how can I do that when I right click a spawner (block) that it runs a command that opens a gui or that when I right click it a gui will be open?
sure
heehee
what would work better then?
what's your group id?
I do know.
learning java
yay
You making a plugin or looking for one?
nope that also gives the same error
lmao
??
Idk I just want to open a script when right clicking spawners
the spawner gui
ok ty
or that it adds 100$ to economy when right click
Sounds like you want to ask in #help-server
A script or skript
a gui*
I'll create you a nexus account, 5 mins
kekw
You can use java to do that. Or use skript to make it really fast without learning hard stuff
how do I do it im new?
what is that?
?learnjava Start by learning Java
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.
what is skript
we dont use skript here
^
But skript is a plugin made in java to script simple stuff to minecraft servers.
I dont understand anything now
are you trying to code smth?
Skript Is scripting language used to make addons
alr so can I make that every minute 100$ gets added in the spawner and when I right click it I redeem it?
I use vault and essentials
Probably just need to decide how you want to do.
You can but I wouldn't recommend it
You're better off commissioning someone to make a plugin for you
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Not verified? Upload screenshots here: https://prnt.sc/
Dont think posting here for offer is good idea
does bungee api contain an enum somewhere that has all versions and their protocol versions?
Just use numbers?
istg I hate spigotmc website it logs me out everytime
and a method to get player version?
Proxiedplayer
20:17:24 [WARNING] [ViaVersion] Ignoring plugin channel in outgoing REGISTER: LMC
Please Help
MY Via Version Isnt Working
And I Get This Error Message
Sad
Already told him smh
Not the exact method smh
True
Does LivingEntity#getEquipment work on Player?
Yes
Ofc, players are living entities
what this
wdym
You make an if statement that checks the name?
i guess it gets the motd
Player player = event.getPlayer();
if (player.getname.equalsignorecase("Name")){
}```
hello, How make Player interact armorstand event with name condition?
._.
oh
You make an if statement with a name and an entity type check
listen to PlayerInteractEntityEvent
never used armour stands dont know if you can name them
You can name all living entities
I use Armorstand tool in my serveur!
hi, how to remove a armorstand if there a no player on the server, i use in onEnable, PluginDisableEvent
armorStand.remove();```
but the armorstand is not removed
There should be some up to date fork somewhere
I don't know haven't used Skript in 6 years
ok do I learn something when using it too?
You could remove the armor stand on chunk unload
and the spawn it back on chunk load
with ChunkLoadEvent && ChunkUnloadEvent ?
Depends on the version
Yes
In newer versions you should use the entity load and unload events
ah right I forgot about that
i'm in 1.19.4
Then use the entity load and unload events
ChunkLoadEvent && ChunkUnloadEvent ?
i don't see entity unload event
What would be best way to store ItemStack in PersistentDataContainer?
Use mfnalexs lib
First, why do you want full items in the PDC?
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
I want to store it in a projectile so I can get it when it hits entity
ho yes entities and not entity my bad haha
no point in storing the whole item
just store an ID to tell you what item to use when it hits
CrossbowMeta crossbowMeta = (CrossbowMeta) ItemMeta;
I get an error saying "expression expected" on this line, why might this be?
ItemMeta is a class
Looks like you're trying to cast a class not an object there
what should I use instead?
?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.
I've checked the docs but couldn't quickly find an answer.
Go through two or three of the courses above
Ok.
they keep ignoring that for 1.5 hours now
im just trynna figure out why its not working
ive searched the docs already
:/
i mean ive fixed most of the errors up to a point
except 1
ah another one
Why is my line still not "replacing"?
https://paste.md-5.net/leherevigi.js
You never set the meta back for one
the javadocs don't explain basic java though
they assume that you already know how java works
How can i get the door opened by a redstone circuit like clicking a button witch opens a door i can get the Door instance
is there any better way to do colors instead of doing ChAtCoLoR.GREEN
isnt that what im doing?
ow
Is there an easy way to check if a player can break a certain block with worldguard?
I can't find it
TPS 💀
@young knoll you know this probably
I cant understand how people till use things based on such an resource intensive plugin
uhh
Cuz worldedit TPS are absolute amazing 💀 💀 💀
It's pretty easy to set up, so it will do for now
thanks!
how do i concentrate BaseComponent[] into one BaseComponent?
you don't need to
BaseComponent[] can be sent to your target
if it can't we probably may need more api in that area
It can
Why would you need that?
i got it nvm
How could i fix this in nms, set up the corpse spawn location same as the cow because i whant the cow to be perfectly allined with the corpse to give a hitbox to the corpse, but i don't know why the corpse spawn in the opposite way
Col I got a question about this
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1176/overview
What could I do to stop the code duplication I feel like I may be missing something internally, but I couldn't figure it out when I tried earlier
this is the one for the corpse
you'll probably just need to rotate it 180 degrees
Does the suggested method not work?
well no
because its not CraftContainer
Do you me the yaw?
haven't worked with entities a lot, but if thats what rotates it yeah
you might just need to try multiplying -1
it sets the entity pose
main issue at hand is if you open a physical chest it'd be ContainerChest not CraftContainer so it wouldn't end up inheriting the abstract InventoryView within CraftContainer
or ContainerBarrell whatever it is
Are you sure it isn't wrapped by a craftcontainer for those too?
I did an instanceof check
and it wasn't wrapped
if(container instanceof CraftContainer container){
container.getBukkitView().sendTitleChange(title);
}else{
System.out.println("Container is not a CraftContainer");
}
could also be a scope issue
Check if it's a CraftContainer with Preconditions first
now that I see it
that's not the issue since I'm not modifying the container at all
sendTitleChange is the new API I'm working on
Preconditions.checkArgument(container instanceof CraftContainer, "Cannot change title of non-CraftContainer");
((CraftContainer) container).getBukkitView().sendTitleChange(title);
``` something like this?
Pretty much
Some NMS method, i don't remember what i does exaclty
java.lang.IllegalArgumentException: Cannot change title of non-CraftContainer
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.inventory.CraftInventoryView.sendTitleChange(CraftInventoryView.java:81) ~[craftbukkit-1.19.4-R0.1-SNAPSHOT.jar:git-Bukkit-c371d05]
at sh.miles.testplugin.TestPlugin.lambda$onEnable$0(TestPlugin.java:46) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092) ~[?:?]
at sh.miles.testplugin.TestPlugin.lambda$onEnable$1(TestPlugin.java:44) ~[?:?]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftTask.run(CraftTask.java:77) ~[craftbukkit-1.19.4-R0.1-SNAPSHOT.jar:git-Bukkit-c371d05]
at org.bukkit.craftbukkit.v1_19_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[craftbukkit-1.19.4-R0.1-SNAPSHOT.jar:git-Bukkit-c371d05]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
``` I got expected error
as was previously happening
That's good is it not
this occurred when opening a chest
I mean wouldn't you want the API replicated on TileEntities too
True
even though you can change their titles I see no reason to make it exclusive to plugin created gui's. There may actually be use cases for not permanently changing the title
You can always wait for more feedback
I proposed a Bukkit#sendInventoryTitleChange(InventoryView view, String title)
method, just waiting for feedback on that, was just wondering if I was missing something is all
is there someway to wrap text in a lore section, I've tried using \n but it doesn't seem to work and just removes everything after
Neither did I 2 days ago
TextComponent text;
Arrays.stream(components).forEach(component -> text.addExtra(component)); ?
Thanks I didn't know about that 👍
Not really needed since these methods should allow for sending of BaseComponent Artays
how can I use the new thing were you can mix 2 colors to gether and then they have like this smooth transiton
Bungee 1.8 doesnt allow that why
gradients?
yes
Gradients.
I think there are gradient to minecraft color code generators out there
Don't use such an old version then I guess
or you can install a plugin that will do it for you
Check out IridiumChatColorAPI
Or my api called DustChat
Both utilize gradients in text
thanks
I like it
you need to shade it lmao
bro
this is on you
you can post pictures
And blue
^
how to disable explosions in a world completely? (i legitimately couldnt find anything on google)
what does Entity#remove() do
despawns the entity
okay
yea i was gonna ask what marking it for removal means
does it mean it will be removed at some point in time
then why does it say mark
next tick would make sense
appreciate it
any idea?
I know you can with worldguard
ye but i dont want to
Latest version of bungee still supports 1.8
hello, I'm trying to deactivate the onIncentoryClick event through a command, I use a boolean variable if this is true the event will be setCancelled(true) otherwise it will be false. This is the code https://pastebin.pl/view/74021ae2
When the /edit command is executed, the plugin always remains in true...
Hi ! I have a question, can i put a custommodeldata only on leather leggings with by example color code #FFFFFF
Sure, ItemMeta supports custommodeldata
there is no need to have a resitriction like that
custom model data does all the lifting you'd need
for example if the model data 1 is taken just use 2
you have up to 2,147,483,647 possabilities
I misspelled the link
guys
anyone knows why this freaking square appears
project is UTF-8 in both maven and settings
never had this issue before
But can i put a custommodeldata on a specific leather color
no as I explained you wouldn't need that anyways
Maybe Minecraft doesn't have that font
Sure, if color == X, set model data
The API is all there
Do u have any example ?
i literally had no issues with all my other plugins before i coded this one
I mean that character
there is no
Have you used that character before
yeah
if(leath.colorOrWhatever().equals(myColor){
leath.setModelData(1)
}
without the plugin everything works fine
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&3Player &d" + pups.getName() + " &apooped: &e" + message));```
wait what
Look at the code block
how long can motd line be before it overflows
Ok
you have 2.7 billion model data
i love invisible whitespace characters
its ok
because you have 2.7 billion integers
please tell me why??
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
?paste
Ok
you know this code does the enabling and disabling for every single player right
thats bad design
Yes
But this isn't work, do you know why??
Sorry for the english
🤷♂️ probably has to do with there being multiple players or something
I swear I'm going crazy about this
I would recommend having separate packages for commands and events
and instead of keeping local variables, like enableInv, in objects, you can make a config file
Oh wait, I think I see the issue
Every time an event or command in the public class BreakEvents is used, a new BreakEvents object is created (I think). Along with that (because the boolean enableInv is not static, a new enableInv field is created. This means that when an inventoryClickEvent is fired, EnableInv will always be false
An ItemBuilder has already been rejected as a feature
(because false is the default)
Yes
you should A. make your code better by separating things into packages and using config files or B. make enableInv static
Ah
What does your plugin class look like?
is there a way to make more than one default config?
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
This code Is a test
kamehameha code
I don't understand
I try
Your main class
Send the code for your main class
The one that is the java plugin
try to not nest if statements
The event Is registred, you mean this?
Before i tryed wirh an arraylist of player
But don't work too..
he means the class that extends javaplugin and has the onenable method
Yeah where the event is registered. Can you show me the code for it?
Ok wait i send the mainclass
MainClass https://paste.md-5.net/wipuqagufi.java
I love you that's work
This Is the problem, i make enavleInv static and that's work
Ok
thank you all👋
is there a difference between scheduler.runtask and runtasklater with a delay of 0
That's work If i make enavleInv static
can you show me an example or the piece of code where I went wrong (I'm learning java by myself and I still don't know many things ..)
right now I've turned everything off but if maybe you write the steps tomorrow I'll do it
Ok
Is only Two steps?
And if i follow this steps the plugin work without enableInv static?
Check the config
when a door breaks because it has no block underneath it is that a BlockBreakEvent or BlockFadeEvent
then if i create a variable called for example and and i assign it new BreakEvents() in the main class, the other variable will get a value of ture or false correct me
until i see the complete code i don't understand ahha
event.getPlayer().getNearbyEntities(10, 10, 10).forEach(entity -> {
if (entity instanceof Player) {
event.getRecipients().add((Player) entity);
}
});
Is that the best way to do proximity chat?
I have two instances, one that changes the value of the variable, but doesn't let the other know the changed value. the other one doesn't receive the change, so should I cancel one or have the two communicate? (I think delete one)
as I told you I'm a beginner I'm trying to learn java because but by myself so I don't know where to start and I base myself on what I need to do, in this case small plugins, but sooner or later I'll do a course sorry for my ignorance
Now i understand
Tomorrow I'll try to deepen this discussion but I understood what you mean (even if I don't know much English haha)
How to use AsyncChatEvent setFormat and Message
If for example I want my format to be
event.setFormat(ChatColor.GOLD + "<%s, %s>: " + ChatColor.WHITE + "%s: %s");
From left to right:
%s: variable inside the event
%s: variable inside the event
%s: Sender of the event. event.getPlayer()
%s: Message
yes, what you said helped me a lot, you also don't understand why I use Google a to write sentences that I don't understand how to say, maybe this is it haha
Different things
First I want to change the format
I have an idea, 1 sec
Does ASyncPlayerChatEvent only trigger when a player sends a message
So if I want to edit a receiving message
nms
receiving?
if you want to change it for ALL players you modify the format/message
You can do that too
if you want it different per player there shoudl be a recipients list
Cancel the event and send it manually
Or remove the specific player from the recipients list and then send it manually to them
No broadcast but sending using recipients list is a good idea
What about proximity
Loop all players in the same world and compare distanceSquared
you remove everyone thats out of range
yes you can
Oh you're saying doing it without being async
Like
Without using the method above
event.getPlayer.getWorld.getPlayers
Yeah thought so
no you can do a distance calc async
you already have a recipients list in the event so use that to check distance from the sender
Oh true
True
lol
remove everyone outside yoru specified range
Smart
Just make sure they are in the same world first
i mean nah

