#help-development
1 messages ยท Page 1924 of 1
templeos better change my mind
No built in networking. In the words of Terry: "Networking is for pussies"
send your main class too
God tier and based opinion
in your other class why are you importing java.reflect.proxy when you don't use it
in your main class why are you implementing listener with no listeners
this shouldn't matter but here's how I do it:
ProxyServer.getInstance().getPluginManager().registerCommand(this, new PingCommand());
do you happen to know anything about bungeecord scoreboards
great
because nobody else does either
because I've scowered the entire internet and have found nothing about the actual api and how to use it
Bungee has scoreboards?
because I've attempted to use it, the data changed, but no scoreboard showed
display a scoreboard to a player
the command doesnt even exist
so I can easily get bungee-related stuff
and every information bit I need to pass is just in my proxy plugin
hahha
๐
๐
yeah and their rank is stored on the proxy
so it would make no sense to create an entirely different plugin just for that server and transfer data over there to create a bukkit scoreboard when bungeecord has the api for it
registered command in the plugin.yml?
lol
because there's literally no reason to when bungeecord has the api
and I've been told it's "perfectly good"
.
I've followed it though, it just won't show the scoreboard ๐
the data appears to update
let me send me code
ProxiedPlayer player = (ProxiedPlayer) commandSender;
Scoreboard scoreboard = player.getScoreboard();
scoreboard.setName("testboard");
scoreboard.setPosition(Position.SIDEBAR);
scoreboard.addObjective(new Objective("testboard", "Objective!", "integer"));
scoreboard.addScore(new Score("this is a test!", "uniquescore", 1));
Util.log(player.getScoreboard().toString());
@lethal coralim trying the same ๐
there's literally nothing on the internet about using the scoreboard api for bungeecord
yes, thats the thing. btw im trying to set scoreboard team prefix
No
Has anyone an idea, why the player doesn't get the prefix?
ProxiedPlayer proxiedPlayer = event.getPlayer();
Scoreboard scoreboard = proxiedPlayer.getScoreboard();
Team team = new Team("owner");
team.setPrefix("owner ");
team.setDisplayName("prefix");
team.addPlayer(proxiedPlayer.getName());
scoreboard.addTeam(team);
proxiedPlayer.sendMessage("add prefix");
You could force them to respawn
how can i make a crafting where i don't loose an item like i have a book that i need for the crafting but i don't want to lose the book when i craft
i want to use it unlimited times
ItemStack glass = new ItemStack(Material.LIGHT_GRAY_STAINED_GLASS_PANE);
ItemMeta glassMeta = glass.getItemMeta();
glassMeta.setDisplayName(" ");
glassMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
glassMeta.addEnchant(Enchantment.DURABILITY, 1, true);
glass.setItemMeta(glassMeta);```
This isn't giving me any enchanted glass panes.
Some items just don't glow
Remove the hide flags and ensure it actually has the enchantment
try to set it before the hide enchants
should i give custom objects in database an identifier in the class so i can identify it based on that one field instead of multipe fields?
My problem: having a map with homes as value, the key should be the name and the uuid of the owner, should i just give the homes an apart unique id?
isnt the home name the unqiue id ?
?paste
xD
No because different owners could have homes with the same name
help please lmao'
Gonna take a nap now
then the id is a pair of playerUUID and homename
anybody happen to be a pristine expert on bungeecord scoreboards
So like in java a map<map<uuid,string>, home>
only on newer versions right? i think it was 1.15 or something, where there is an auto respawn gamerule and you can use that method in the api too
You used to be able to do it with NMS
wait so that is an option?
i thought mc only have that from version 1.15 or above lol
The gamerule sure
I feel like I definitely did it before 1.15
I know this sounds simple, but how would I draw a line from one location to another with a vector?
There's no SQL field in your plugin class.
no NMS required, pretty sure it's just Player.spigot().respawn()
Still no SQL field
^
how do i give it, it
I assume DiscordSync is your class extending JavaPlugin
Needs to have a SQL field in there
bunp
No vector required really, just step through (so number of particles that you want) and add x,y,z components from 1 location to the other and render the line on each step.
@naive bolt what error r u getting btw
Extend JavaPlugin. Also make sure your plugin variable is set to your main class type
@grim ice
ah
btw
im having this problem with databases
connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database
+ "?useSSL=false", username, password);
this is how I do it
Pretty sure itโs a bungee plugin
Oh
i think its because i used Main in the file not DiscordSync
Yeah
thats what i get for following videos
Yeah I see the bungee yml
@naive bolt how do u not get errors btw
im not running the code
i just use intelij Problems tab
you may want to use a logger to print out that message
Did you read the error? Try finding that limiter for your os
if you dont want spigot to sometimes print out annoying messages
how do i do sql in a command file
is that really why
so /link does some sql
Do you think it's lying to you...? 
i thought i am lying to myself
:(
:(
:(
i like this server because people are the same as me trying to learn java
no, it is because people here shared the same braincell lol
wtf he saying bro
in the discord js discord they just say โlearn javascriptโ and donโt help
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.
@naive bolt dw this server does it too
no no no ๐ถ
Yeah I like that. But i dont like when people ask for support when they atleast dont know the Basic concept of Java
It just depends on what they're asking.
imma go lay in bed and watch java videos
I have a question im doing a protection plugin. I need recommendations how i can calculate the protection?
oh pog hes still talking here
With blocks amount or what?
Thanks
use chunks
Really?
Cuz they told that if possible me say the round
Like I have the protection and it protect 20 blocks around the protection block
I think the easiest way is to just have 2 corners
Agree?
Is there any tutorial?
But would that work?
Cuz I need to protect block on every side, top and under that block
Let say you the protection on coord 0 100 0
But i think you get the idea
So i will the block and 2 corners right?
Allright
I will need many events?
I thought doing it with BlockPlaceEvent
Or smth like that it was called
Is there an event
For knowing if you are near a block?
Oh that not my version
hahaha
I will check it on the version im using
ut thanks for help
Really helpfull i never worked with coordinates and blocks before
Hello. I'm wondering if there's an easy way to transfer yml data from a bungeecord proxy server to a connected server. If possible, I'd like to transfer the entire yml file.
How can I convert the yml file's contents to a bytearray?
Turn it into a string and then get the byte array from that
I'm starting to think that it may just be a better option to make a database
this is seemingly overkill since I could just use the bungeecord scoreboard api if there was any information on it or examples
Oh yea mr krabs
I wasted 2 hours trying to optimize my code by removing useless bukkit runnable
to realize that I need runnable in order for my code to function properly
because InventoryDragEvent doesnt support changing cursor
when the event is cancelled
while it supports setting the items in the inventoryView slots tho
Any modifications to slots that are modified by the results of this InventoryDragEvent will be overwritten. To change these slots, this event should be cancelled and the changes applied.
changing the inventory itemstacks inside slots works
but changing the cursor
not...
PlayerMoveEvent
cuz PlayerMoveEvent triggers even if you just move ur cam
just ignore the pitch and yaw
^
Opinions?
?
This will be served or posted as snippet/example code for my library
I accept recommendations
And how do you change the lines
ScoreboardProvider its an interfance, so you implements the methods
And them you can just return on getLines() your Config#getStringList("Scoreboard.Lines")
Ah, okay
Let say you create the provider for the scoreboard yourself
I only provide you the method getTitle and getLines
My intention its to create an all in one library
With the most used things for doing plugins
Scoreboard api, Menu api, Item builder, cooldown api, Filehandler, etc
Well I'll tell you right now it's difficult to do lol
Look for its doesnt look so dificult
A small spoiler
It's harder than you would think. Trying to make things as generic as possible while still being powerful enough to be useful can be challenging.
^ yes
If it's the same difficulty as just making the same thing in Spigot API your API is worthless
Yeah for example i think a lot what constructor to put, the methods name, the order of how yoo will use it
how to check if player went out side view distance
And if you're making an API you get to go through the joys of documentation! 
There is no other hard thing that netty
does server sends packet to destroy that entity
He?
PacketPlayOutEntityDestroy maybe?
but can I listen
when server sends it
The most hard thing ever find its Netty
Lmao you dont know the pains im having right now
๐
well u can set up rended distance
Probs using ProtocolLib or injecting your players into the packet pipeline yourself.
What version are you using Axe
Well if you were using 1.18 I have an API that can fire events for packets for you but I've not tested it in 1.16 or 1.17. You'd probably have to make some changes.
Otherwise... ProtocolLib or injecting is how you'd do it
Do you have the problem, that you start a project really motivated and work really hard on it. And then you get bored, and then work some hours and work on other projects. Or im alone with this?
I think everyone does that tbh
Or you start on a project then you see another project idea that sounds more fun ๐
Yes
can u share
I will try it out
Has anyone got experience with sending fake player packets to players in order to make the name of the fake player appear when tab completing? I'm wondering which packets I need to use, whether it be SpawnPlayer or SpawnEntity?
I just need packeterr
Yeah, and the core, current gradle config is bugged and won't install dependencies properly 
Maven is too verbose for me
oh ok
Maven its the best thing i could evenr find beside the Gradle yet
(Every not typed language == yet) || (Java && C#) == Good languages
Kotlin, JavaScript, C++, C, TypeScript (Not typed languages) == shit
I am attempting to develop a massive network, with a multitude of super complicated features. How practical would it be to make my own fork of Spigot, and make everything in the server jar, having everything directly edited, without a plug-in?
Means youโd have to patch a bunch of stuff
I donโt think hypixel even uses that approach
They definitely use a fork that they've developed but they also use plugins.
I think that Hipixel, only have a custom global core sync (Using MongoDB and Redis or RabitQM) and then the plugins
p.launchProjectile(EnderPearl.class, Movement.getVector(p, Movement.Direction.FORWARDS, 1.5));
Why does this not trigger the PlayerLaunchProjectileEvent event?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
sorry
if you have dought ask it
Dont "ask for help"
Ask giving your error/question and code using
And if possible what you are wanting to do
ok i will try again, wait
Yeah, no problem
At 1.8-1.12 the NMS contains the class IDataManager, that allows to change world settings, like directory, player data's file, etc... But in the newer versions that classes doesn't exists anymore, someone makes any idea?
what you mean?
because nms with spigot uses mojmap now iirc
so u need to see if it still exists but under a new name
mojmap = mojang mappings
aka the names for things like classes, fields, and methods mojang themselves used in their code
thats really util, thank you!
never heard that before
dang this is really helpful
Can somebody help me? I want to do that during the storm there is a bossbar that tells you the time that the storm has left
ItemStack pHead = new ItemStack(Material.PLAYER_HEAD);
ItemMeta pHeadMeta = pHead.getItemMeta();
pHeadMeta.``` im trying to set the metadata of this itemstack to a player's head. I dont see any method to setOwner or anything like that. What can I do?
public void onShoot(PlayerLaunchProjectileEvent event) {
if(event.getProjectile().getType() == EntityType.ENDER_PEARL){
event.getProjectile().addPassenger(event.getPlayer());
event.getPlayer().getInventory().setItem(4, Items.getEnderButt(2));
}
}
The mounting works, but the item is not added to their inventory in that slot. ๐ฉ
Skullmeta
SkullMeta skullMeta = (SkullMeta) pHeadMeta;
yep thanks,
Is it adding it at all?
No
any errors? Also what item are you trying to add?
an ender pearl
no errors
Instead of Items.getEnderButt use new ItemStack(Material.ENDER_PEARL, 1)
adding a bukkitrunnable for 1 second fixed the issue
I could probably just wait a tick but I did 1 second to be sure
it has a bit more information, that's why I'm using a custom method
Oh is it a custom item?
yeah
gotcha, glad its working
What would be easy way for converting CRROTS - block material to CARROT item stack
@ivory sleet
maybe you know
maybe like
Material carrot = Material.CARROT;
something.something(new ItemStack(carrot, 10));``` is this what you needed?
no exaple there are two types of
Material for Carrot
Block uses CARROTS
and ITemStack CARROT
ohhhh
now I am looking a way to get proper ID CARROT
when player brakes block
so they can just put in config CARROT
not CARROTS
because usally people look for material id by inventory
and then they don't know they need to use CARROTS because in inventory on item stack is CARROT
When a player breaks a block you can do block.getType() which will return Material.CARROT
if its a carrot block
it will return CARROTS
and I need to return CARROT
actual drop material type
im confused on what youre trying to acomplish
well I got config file in plugin
where people are putting proper material names
and when player is braking block it check
is that in config
right so make a special case for carrots
and make it return true for CARROT and CARROTS
to complicated and ugly I am looking if there is any way in api
post code
to get that corresponding block
?paste
Hey guys, what steps can I take to avoid players taking items from inventories that I create (that they're not supposed to take from)?
Some people have already found a way to get the items out even though I do event.setCancelled(true) on those events.
What version are you running?
What event are you checking against?
They might have used their offhand to take items. You may want to check for that. Also if TPS is low, players could get items from inventories they arenโt supposed to.
The server version is 1.16.5, my plugin is native 1.18
I'm checking InventoryClickEvent and if the inventory is my one I just setcancelled
Is your inventory set per player or just one that everyone accesses?
They run a command and it opens, it's just for information purposes and not interactive
I didn't even know you could take items from a chest like inventory to offhand directly lmao
Is there anything I can really do in the case of low tps?
I guess I could give all the items special tags and check every player inventory event for them
Well if you cancel the InventoryClickEvent, that should prevent most methods for taking the items. You will need a check for the offhand, which I think there is an event you can listen for. Once you make those you may want to update the player inventory to remove ghost items. Player#updateInventory()
Alr
Would also closing and reopening the inventory on click help?
Or is that just pointless
I donโt think there is much you can do about low TPS situations. Besides, if the TPS is that low, the server owners are probably trying to figure out how to fix it.
I donโt think it would really do anything. Other than refresh the top inventory.
Whoa wait, how are you checking your inventory?
I have a file that has an inventory which is also a listener
And when there's an inventory click event, if the inventory that caused the event = the inventory that my class is opening, I'll cancel it
Ah, I think I had some issues with a setup like that and switched to using a map that holds an inventory and a player uuid so I can always get the right one. That could be another possibility is the inventories donโt match.
for an ArrayList<> when you do .get()
if the index is out of bounds does it return null?
or does it throw an exception
java.lang.ArrayIndexOutOfBoundsException
i guess
yes thank you
np
that was a dum question lol
There are no stupid questions only stupid answers :D
hello how to reload default config ?
๐
reloadConfig()
thank you
anybody have experience with the bungee cord scoreboard api? I can't find any examples and when I tried to use it, it didn't actually show a scoreboard.
hello how do i make like this ?, do i have to use Placeholders.
message: '{#602ac3} Joined' #602ac3 is hex color
Hi, how do I get the number of drops when a block is mined?
?jd
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
Is it possible to get it before the block is broken?
Afaik it's not.
Since Iโm trying to make cut clean that is compatible with fortune
If you want to do custom drops then follow what the docs says to do
Alright, thanks
So I can replace the drops by modifying the list of items right?
What does the docs say to do
It says this
Canโt add new items but can remove
So I dunno if I can just directly replace
For example raw iron to iron ingot
That's the recommended method unless you're adding on top of the drops
Why im getting dependency not find when using maven dependency (a Project installed on local repo) on a project?
is you dependency a maven project?
he say's installed into maven local so id assume it is
hmmm, he could try putting it into his library folder and then calling the dependency from there
also make sure you've reloaded ur maven
idk about other ide's but intellij makes you reload maven
Also, is it in a scope?
I'm making player corpses that spawn an NPC with the player's skin and the NPC laying down when the player dies. An issue I'm having is the NPC's skin isn't always the players and instead is an Alex or a Steve skin. Does anyone know why the skin of the NPC doesn't always load? Is their a way to fix this?
@EventHandler
public void onJoin(PlayerJoinEvent event){
Util.initializePlayer(event.getPlayer());
Bukkit.getScheduler().scheduleSyncRepeatingTask(SpeedyHub.instance, new Runnable() {
@Override
public void run() {
if(event.getPlayer().isOnline()){
Particles.playSpiral(event.getPlayer());
}
}
}, 0L, 90L);
}
How can I cancel this repeated task if the player isn't online? scheduleSyncRepeatingTask using BukkitRunnable instead of Runnable is deprecated and no longer works
Read the docs to see how to use a BukkitRunnable
aha! I didn't see that! thank you.
How i install maven dependencies to local repo?
Let say i created a proejct, and i want to deploy it on local repo
Cuz i want to use it as dependency on another project
That's exactly what mvn install does
it doesnt work
It still saying that maven cannot resolve the dependency
Idk why its trying to download it from Maven repo
When its locally
Yes its inside
@solemn valley
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/ProxiedCommandSender.html
declaration: package: org.bukkit.command, interface: ProxiedCommandSender
?jd
should look at the javadocs and use the search function
be surprised in what you might find ๐
Yup! Did that and in the end didn't really find a difference in the end by just doing performCommand and sending out a message to Bungee
Found that the former was the easiest since it's just one line
So wondered if there was any difference in security/efficiency etc
perform command is a way to use another plugins commands without having to hook or depend on said plugin directly
or to invoke server commands
Meaning also Bungee Command, right?
Should yes
Ah kk, so if I don't need any direct info from my Bungee Plugin, I can just do performCommand instead of sending out a message and setting everything up
Like a one-way street
one way of looking at it lol
Yea
Grant is typing...
lol
(this is mainly directed at md_5 since they're who i was discussing this with, but i dont want to ping them in case they dont like being pinged. also sorry if this is the wrong channel--wasnt sure if it belonged here or in #general)
hey, im the one who reported SPIGOT-6917, the issue about /trigger
considering it seems there is an in-depth discussion to be had about how to address this issue, would it be better to discuss it over discord instead (perhaps in DMs)? i find discussion over discord to be much easier, especially since this discussion might be more on the lengthy side. plus then we (me especially with my edits) wouldnt be sending so many email notifications to all the watchers for each message
and of course, there would be no obligation to respond to me immediately if we do discuss it in discord, just as there isnt over jira. it would just be easier due to discord being synchronous, and because it's easier to keep track of full discussion in discord than in jira comments
why can't such things be discussed with everyone?
it can, im just thinking it might be more efficient over discord
we could do it in the server instead if that'd be better; DMs was just one idea
it would be yes ๐
but I am just saying it doesn't need to be DM's
however there is a thing called threads
ah okay, yeah
if you feel you don't wan to clutter the channel ๐
oh yeah, totally forgot about those. that would be perfect for this
this lets everyone participate, and become aware of the issue at hand as well as offer solutions and MD can respond if he feels like it ๐
seems like a win all around
๐ which channel would be the best place to make a thread for that?
this one since its development
the help server is more for people needing help setting up or running their server ๐
Just right click your original message and "Create Thread"
Woo
now sometime later I need to go read up on that issue
because I am unfamiliar with it
im willing to explain anything
on the data pack dev side of course
im not too knowledgeable on the plugin side
Well its more or less this is kind of my gaming time ๐
ahaha, doesnt have to be right now obviously
Ah data packs that is why I am not familiar with it
I don't normally mess with those things
i still dont know where is datapack in nms
i do see the advancements and stuff though
its in MinecraftServer or DedicatedServer iirc
so how would one go about removing the most recent component from a chat component builder?
the API is incredibly awkward about that
I'm torn between "yeah I guess I could just track how many elements I've processed and only add the newline if it's not the very last element" and "it should still be possible to remove it"
aight
Can somebody help me? I want to do that during the storm there is a bossbar that tells you the time that the storm has left
- listen to WeatherChangeEvent
- Create a bossbar (Bukkit.createBossBar iirc)
- World.getClearWeatherDuration() should return the amount of ticks left until the weather clears up
- Schedule a running task that runs every tick or every second etc to lower the progress until the weather is cleared again
hey im new to spigot how would i have my plugin respond in chat only to the player who wrote the command
By sending a message to the sender. sender.sendMessage
oh thats easy thanks
yo
how do I make a fireball summon
with this command
player.getWorld().createExplosion(player.getLocation(), 100);
launchProjectile not createExplosion
it does not work
so what will be the code?
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(itemManager.wand.getItemMeta())) {
Player player = event.getPlayer();
player.getWorld().createExplosion(fireball.getLocation(), 100);
player.sendMessage("Ok");
?jd-s
how do i get the players UUID
Player#getUniqueId()
thanks
"how do I send message" - "how do I get a player's uuid" sure that's both valid questions but you could found both within 7 seconds by using the javadocs
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
im having some trouble getting a Collection<CommandData> from my interface Command
The Command interface has a getCommandData() wich returns a CommandData obj
and I want to get all command data from a collection of Command
something like
Collection<CommandData> commandDataCollection = Arrays.stream(commands).filter(Command::hasCommandData).....
but I'm not sure how I would go further
List<CommandData> cc = Arrays.stream(commandArray).filter(Command::hasData).map(Command::commandData).collect(Collectors.toList());
this returns a List<List<CommandData>>
not sure why, I really need to dive into the doc about streams in java tho
flatMap does not take in a method reference tho
List<CommandData> cc = Arrays.stream(commandArray).filter(Command::hasData).map(Command::commandData).flatMap(Collection::stream).toList();
not sure if this does it
I mean replace the original map with fkatMap
public CommandHandler addCommands(Command ... commandArray){
List<CommandData> commandData = Arrays.stream(commandArray).filter(Command::hasData).map(Command::commandData).flatMap(Collection::stream).toList();
SkipBabe.jda.getGuilds().forEach(guild -> guild.updateCommands().addCommands(commandData).complete());
commands.addAll(List.of(commandArray));
return this;
}
I did but then I dont return list of CommandData right?
Or that, idk never actually used flatMap in java
ill try, thank you
Your example might be right
(lmk if this is the wrong channel for this kind of question)
i couldnt find any information about this on google: which minecraft release versions are currently actively maintained by spigot? e.g. 1.16+
github-api iirc is a decent one
Only latest
ah okay, thanks!
to be clear, that means if a spigot bug is patched, typically itll only be patched in the latest release? (excluding severe issues like log4j)
Yes
Itโs a bit painful maintaining more than one version, especially with all the patches and stuff
first time using java 16 uwu
how can i show a custom name of a mob permanently? Currently it only shows up when I look at it
setCustomNameVisible(true)
I have that active but can still only see the name when I target the mob
@young knoll I do this, still can't see the name unless I stare at it
Is it possible to give a player mining fatigue but make it so the effect doesn't actually show up at all
You can set it to be ambient and hide particles
But itโll still show in the inventory
can someone help me?
wtf
also its my java project
Invalidating Intellij Caches
doesnt work
restarting ide doesnt work
The project location is inside trusted locations configuration section
fixed it
i updated the ide
and it fixed it itself
Hey everyone, can i upload a plugin just for checking updates?
I haven't found a good API to check the plugin updates and i don't know how should i check for update from my site
Can i use spigot to upload my plugin and just use it for checking my plugin updates?
or will i get banned and my resource gets deleted?
@vagrant stratus (sry for ping)
is there a way instead of launching fireballs could I launch particles like water ballons?
ah what
I want to make
something like that purple
thing
I think it's just a skull on an armor stand
on EntityDamageByEntityEvent event how to get the Entity that hit?
damager
getDamager
nop
not working
I can assure you it does work
The anvil won't recognize it
Minecraft just thinks you are trying to combine two normal swords
stop adding hitlers to minecraft pls
Which it doesn't allow because neither are damaged
lol
lolll
how do I make an armor stand
like with the code?
this code?
World#spawnEntity
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getItem() != null) {
if (event.getItem().getItemMeta().equals(itemManager.wand.getItemMeta())) {
Player player = event.getPlayer();
player.getWorld().
what should I put after the getWorld().
declaration: package: org.bukkit, interface: RegionAccessor
spawnEntity(...)
Here is some cursed code i've used to fix it
spawnEntity(player.getLocation())?
ArmorStand armorStand = (ArmorStand) player.getWorld().spawnEntity(player.getLocation, EntityType.ARMOR_STAND);
what else would you use
That is some long code
anyone?
seriously?
I am new to this sorryyy
I already replied to you twice
ArmorStand.class
^
I did not see that
what method?
spawnEntity iirc
that only takes an EntityType as argument
well there's also RegionAccessor#spawn
you probably meant that
now how do I make a head for it?
no idea what you mean lol
like this
the purple ballon
ArmorStand has a method getEquipment
that returns an EntityEquipment object
and that object as a method setHelmet
the code please?
if you can't create the code from the information I gave you, you should look at this 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.
sorry but this channel is for general information and not for getting spoonfed ๐
you won't learn anything from just getting finished code
then you have to calculate that yourself
e.g. if the blockPlaceAgainst is south of the new block, then it was placed north of the clicked block
hmm
what do you need it for? maybe there's an easier solution
uh
in making a conveyor
so I need to get the direction to know what direction to push
I think you have to do it manually then
e.g. if Z < Z of the block clicked, it's north
if Z > Z of the block clicked, it's south
by adding to the location
is there a way to get a free database for testing? i cant setup mine in my pc
f
maybe other ppl know
I tried
when i try to connect to it
it tells me
a CommunicationException
How to check if a crop is fully grown? if (age.getAge() == age.getMaximumAge()) doesnt work, because a crop can be at age 5 but nonetheless fully grown?
oh fuck
I DONT BRUH
I FORGOT TO
OMFG
actually i didnt forget i didnt know i needed it
@quaint mantle pls give link
?
@EventHandler
public void onGrow(BlockGrowEvent e) {
BlockData data = e.getBlock().getBlockData();
if (data instanceof Ageable) {
Ageable age = (Ageable) data;
if (age.getMaterial() == Material.CARROTS) {
if (age.getAge() == age.getMaximumAge()) {
public class PrepareAnvil implements Listener {
@EventHandler
public void onPrepareAnvil(PrepareAnvilEvent e) {
AnvilInventory inventory = e.getInventory();
ItemStack item1 = inventory.getItem(0);
ItemStack item2 = inventory.getItem(1);
ItemStack result = e.getResult();
if (item1 == null || item2 == null) return;
if (result == null) {
if (item1.getType() == item2.getType()) result = new ItemStack(item1.getType());
}
if (result == null) return;
boolean hasCustomEnchant = false;
Set<Enchantment> all = CustomEnchants.getAll();
for (Enchantment enchant : all) {
if (item1.containsEnchantment(enchant)) {ApplyEnchant.applyEnchant(result, (EnchantmentWrapper) enchant, item1.getEnchantmentLevel(enchant)); hasCustomEnchant=true;}
if (item2.containsEnchantment(enchant)) {ApplyEnchant.applyEnchant(result, (EnchantmentWrapper) enchant, item2.getEnchantmentLevel(enchant)); hasCustomEnchant=true;}
}
if (!hasCustomEnchant) return;
e.setResult(result);
}
}
is there anything inheritly wrong with this, my code is much much shorter
How would I test if for if the sides of a mushroom block are true or false
Doesn't level up enchants
Its fine I dont want them to
Probably fine, idk
?tryit
Welp
?tryandsee
Just a simple harvester plugin, but thats not the problem. I was just wondering if there is a way to detect if crops are fully grown. Because they can be fully grown even though they arent at max age.
No they can't
but they are?
Block block = e.getBlock();
Block clickedBlock = e.getBlockAgainst();
char returnValue = 'E';
if (block.getLocation().add(0, 0, -1).getBlock().equals(clickedBlock))
returnValue = 'S';
else if (block.getLocation().add(0, 0, 1).getBlock().equals(clickedBlock))
returnValue = 'N';
else if (block.getLocation().add(1, 0, 0).getBlock().equals(clickedBlock))
returnValue = 'W';
return returnValue;``` Is there a better way to do this
they cant...
fully grown means max age
Yes, youre right. I found my mistake. I used the Age of e.getBlock().getBlockData(); and not e.getNewState().getBlockData();
thanks
@quaint mantle
im downloading these stuff
do I need the MySQL Server
yes i downloaded that
and its downloading all that shit with it
how can I push an entity
Entity#setVelocity
hm
also, where do you want to push them to?
which one
what do you need this for
this
so i do have the spigot-api as library but the import org.bukkit does not get recognized after the intellij update... anyone knows why?
so apparantly updating removed dependencies
I DOWNLOADED THE CONNECTOR
oops caps
anyways still havig the error
Caused by: java.net.BindException: Cannot assign requested address: connect
[14:37:03 WARN]: at java.base/sun.nio.ch.Net.connect0(Native Method)
[14:37:03 WARN]: at java.base/sun.nio.ch.Net.connect(Net.java:579)
[14:37:03 WARN]: at java.base/sun.nio.ch.Net.connect(Net.java:568)
[14:37:03 WARN]: at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
[14:37:03 WARN]: at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
[14:37:03 WARN]: at java.base/java.net.Socket.connect(Socket.java:633)
[14:37:03 WARN]: at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
[14:37:03 WARN]: at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
[14:37:03 WARN]: ... 20 more
that makes no sense
you can't just download an MSI file and expect it to work in your java app
this looks more like you're trying to bind to an address that the OS cannot resolve
e.g. if your DNS configuration is fucked up
wtf
its my address
everything is on my machine
@EventHandler
public void onPrepareAnvil(PrepareAnvilEvent e) {
AnvilInventory inventory = e.getInventory();
ItemStack item1 = inventory.getItem(0);
ItemStack item2 = inventory.getItem(1);
ItemStack result = e.getResult();
if (item1 == null || item2 == null) return;
if (result == null) {
if (item1.getType() == item2.getType()) result = new ItemStack(item1.getType());
}
if (result == null) return;
Map<Enchantment, Integer> enchantsToApply = new HashMap<Enchantment, Integer>();
Set<Enchantment> all = CustomEnchants.getAll();
for (Enchantment enchant : all) {
if (item1.containsEnchantment(enchant)) enchantsToApply.put(enchant, item1.getEnchantmentLevel(enchant));
if (item2.containsEnchantment(enchant)) {
if (!enchantsToApply.containsKey(enchant)) { // if it doesn't already contain add like normal
enchantsToApply.put(enchant, item1.getEnchantmentLevel(enchant));
} else {
int level1 = enchantsToApply.get(enchant);
int level2 = item2.getEnchantmentLevel(enchant);
if (level2 > level1) {
enchantsToApply.replace(enchant, level2);
}
if (level2 == level1) {
enchantsToApply.replace(enchant, level2+1);
}
}
}
}
if (enchantsToApply.size() == 0) return;
for (Enchantment enchant : enchantsToApply.keySet()) {
ApplyEnchant.applyEnchant(result, (EnchantmentWrapper) enchant, enchantsToApply.get(enchant));
}
e.setResult(result);
Does now ๐
then why does it fail to bind to that address?
Idk
show your code pls
Hey guys, you know how in the nether since the nether update the color of the atmosphere is different to the biome you are in. Is there a way to use that with code, and can I use it in the overworld or any other dimension?
there is some way to change biome colors, but not sure what you mean with "atmosphere"
Like there is some kind of fog in the sky which has multiple colors like blue, red, black or purple if it mixes
are you on 1.18?
Yes
check out the BiomeFog class
Thank you
here's a plugin that does similar things
but it's using the obfuscated NMS names
Ok thank you very much for finding that
np ๐ I hope it helps ๐
oo it can be used with data packs!
sure, datapacks can do that too
There is also a command for it ๐ค
/fog apparently
Oh ๐คฆโโ๏ธ
maybe it exists in java too (custom fog through resource packs), but there's definitely no /fog command in vanilla ๐
Hope it does, datapacks would be easier for custom dimensions and biomes, otherwise I'd need to find each biome with the code
It would be smoother to have it in a datapack then changing the fog whenever a member's biome updates
if datapacks are a solution for you, maybe look at Terralith or what's it called to see what's possible and what isn't
Alright thank you
You can color fog via custom biomes
Still waiting for custom structures to come back tough :(
Thank you guys again for the help
@EventHandler
public void onEnchantTable(PrepareItemEnchantEvent e) {
if(e.getItem().getType() != Material.DIAMOND_SWORD) return;
e.getOffers()[0] = new EnchantmentOffer(CustomEnchants.BLADEBEAM, 1, 1);
}
Can you not add custom enchant to enchant table? It removes the text of the enchant and then just applies the default enchant
Nope
it's perfectly possible to NOT add custom enchants, yes
but yeah, the client will never show your custom enchantments - it wouldn't even be able to know their name because they are not in the client's language files
I have a resource pack, could it be added. Though I also don't mind it being blank
I don't mind it not showing in the GUI aslong as they get it
what is LEASH_HITCH ?
But with this it not only shows as nothing like u said but it doesnt even work
the thing that gets added on fences when you attach a leash
oh
wdym it doesn't work?
"it doesn't work" is always a bit uninformative
what exactly doesn't work
no
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Well you'd expect the user to obtain a diamond sword with BLADEBEAM even if it appears blank on the gui
But they recieve sharpness
On AsyncPlayerChatEvent I cancel event and Bukkit.broadcast the Message with adding text components
But some plugins add special chats like gangchat, island chat etc and my plugin broadcasts them too
What is not clear there
I'm trying to add hover event thing to the chat messages do you know it
Can I add components then
is there anything wrong?
((!e.isInsideVehicle()) || e.getCustomName() == null) not working
Should be able too, unless you are using paper then you might have to change a small thing or two to use adventure
Did you understand what am I trying to do
I'm trying to add Hover and Click events to message not trying to change Message content
Yes, but you need to have the message have the actual components in them
Unless you don't want them in the message/format
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
sry ๐
I am so proud that I am responsible for this command being added lmao
It is great
Why dont u loop all online players instead?
Sorry but I couldn't understand,
My code is:
https://paste.md-5.net/kuzozuhile.cs
what am I doing wrong here and what should I do instead
?paste
You dont need static on events, if removing that doesnt fix it make sure you have @EventHandler, if you do have it, show ur code to register the listener
I'm normally using it as method not an event handler, for better reading I removed other params and pasted it as like event handler
normal code is: https://paste.md-5.net/gahamusocu.cs
Top method should work if u register it correctly
I gtg now tho
It is working, the problem is some plugins add special chats like gangchat, island chat etc and my plugin broadcasts them too
should i try to put my inventory calculations to another thread
What should I do instead?
or that's just too much hassle
then maybe dont add all those plugins ๐
man i hate
how almost everything in nms
thread unsafe
thanks to the community who managed to improve this mess
Location#add is really quirky to use
?paste
is it possible to detect a player shift-double clicking a whole inventory?
well it wasn't meant to be used in plugins
erm makes no sense
you can't click a "whole inventory"
you can only click single slots
and ofc yo ucan detect that
(unless you're in creative, then no)
i mean shift-double clicking
sure you can detect that
like when you click over all the items of that type
ah alright
yeah one sec
InventoryClickEvent
InventoryAction.COLLECT_TO_CURSOR
I think
try it
pretty sure thats the one where you double click to collect all items of one type to a stack you double-clicked
when i do DiscordSync.getInstance() it hylights red?
getInstance() doesn't exist
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
use this to debug
public static void debug(InventoryClickEvent event) {
Inventory top = event.getView().getTopInventory();
Inventory bottom = event.getView().getBottomInventory();
logger.warning("============================================================");
logger.warning("Top inventory holder: " + (top.getHolder() == null ? null : top.getHolder().getClass().getName()));
logger.warning("Bottom inventory holder: " + (bottom.getHolder() == null ? null : bottom.getHolder().getClass().getName()));
logger.warning("InventoryAction: " + event.getAction().name());
logger.warning("Clicked inventory holder: " + (event.getClickedInventory() == null ? null : (event.getClickedInventory().getHolder() == null ? null : event.getClickedInventory().getHolder().getClass().getName())));
logger.warning("Current Item: " + event.getCurrentItem());
logger.warning("Cursor: " + event.getCursor());
logger.warning("Hotbar Button: " + event.getHotbarButton());
logger.warning("Raw Slot: " + event.getRawSlot());
logger.warning("Slot: " + event.getSlot());
logger.warning("Slot Type: " + event.getSlotType().name());
logger.warning("Left Click: " + event.isLeftClick());
logger.warning("Right Click: " + event.isRightClick());
logger.warning("Shift Click: " + event.isShiftClick());
logger.warning("============================================================");
}
of couse add @EventHandler
then do the click you mentioned
and see what it prints
then you should be able to detect it according to what information this prints
alr
this video uses it
dont do static instance stuff
pass your plugin instance instead
getInstance() is nothing that's part of JavaPlugin. It's a method you have to add yourself
e.g. stuff like this:
public class YourMainClass extends JavaPlugin {
private static YourMainClass instance;
public static YourMainClass getInstance() { return instance; }
{
instance = this;
}
}
why does it work in the video
oh well thats ducking brilliant
the client sends every single stack as if it was a normal shift-click
thanks mojang ๐
why canโt you do static stuff ๐คจ
itโs not always possible or a good idea
extend JavaPlugin
its a bungeecord plugin btw if this helps
oh ok
Hello!
<!-- Bungeecord -->
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
I am trying to add Bungeecord to my pom.xml, but since few days I am getting 2x missing dependencies. Am I using the wrong version?
thanks it insnt highlighted anymore
Bungeecord Maven Dependency
how to give entity damage caculating with armors and buffs
Ok so like I'm trynna make a thing where if you have 1000+ kills you can unlock an enchantment, but Idk how to make it check if the player has 1000+ kills I tried with
if (p.getStatistic(Statistic.PLAYER_KILLS) == 1000) {
// Enchantment is unlocked
}
But it only checks if you have exactly 1000 kills soooo anyone care to help?
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.
O lol
you litterly just ask for == 1000
Hi. I did command in another java class and i just trying to import that class to my main java class. The error is: 'getExecutor()' in 'org.bukkit.command.PluginCommand' cannot be appied to '(me.jakub.xcraft.commands.xrow)'
Show your code please
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if(args.length > 0) {
if (args[0].equalsIgnoreCase("help")) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&2&lXrow&f&lRow" + " >> "+ "Nas plugin je zatim ve vyvoji. Ale brzy se toho hodne prida!"));
}
}
}
return true;
}
@Override
public void onEnable() {
System.out.println("Plugin funguje!");
getCommand("xrow").getExecutor(new xrow());
}
And show the full class please
Wait
You're doing getExecutor
You should be doing setExecutor
getExecutor is a method which takes no arguments and returns the executor for a command
setExecutor sets the executor for a command
You're using the wrong one
No worries, but it's much easier to help you if you give your code right off the bat
anyone know how to fix whne you type it removes the charecter after it
Life saver
i accidently press it all the time and i have to restart ide
same
is ur SQL null?
any one can point me to some good tool to compere mojang mappings and spigot
I am doing some reflections and now it is pain in the ass going and look what is correct name
of field
in spigot
version ?
then not
i only have smth for 1.17 and 1.18/.1
well that is what I need
https://timcloud.ddns.net/mapping/
the pages are big (contains all data) so you need to let it finish load and then you can search at top-left with class names and then go to a single page of that class (lagg-free)
so just type in search bar name of class
By the way is there a way to get corresponding itemStack of CARROTS
I know it is CARROT
but for example you can check if CARROTS.isItem which will return false
so is there method which can pull that CARROT from CARROTS.getDropableType some thing like that
or do I need to make like some if statment check class
or enum
to do that my self
Hi guys! Can anybody tell me how to make an entity look at a player using his yaw?
This is line 26 in LinkCommand?
?paste