#help-development
1 messages Β· Page 1580 of 1
no there both bungee but it still doesnt work
You're also just doing a hell of a lot of stuff that doesn't make any sense at all
Text is something you would pass to a HoverEvent. That's it
You're trying to invoke methods that would be called on a BaseComponent of some sort. You likely are wanting a TextComponent
Though really, the ComponentBuilder is probably what you want to be using anyways
bruhhhh
wat
its usage in HoverEvent is
No it's not
Yeah, in HoverEvent it is
You pass in a Text object there. Though that's not what he's trying to do above
ComponentBuilder builder = new ComponentBuilder();
builder.append(player.getName()).append(" would like to duel you")
.color(ChatColor.BLUE)
.bold(true)
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click here to accept the duel")))
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "whatever command you want to run"));
player.spigot().sendMessage(builder.build());```
afaic, that's all you need
Though some methods may not be 1:1, I did write that all in Discord from memory. I probably fucked up a name
i think thats right
its pretty much just what he had before
but with Text instead of ComponentBuilder
Rare occurrence seeing choco spoonfeeding
Sometimes I have some additional spoons laying around
lol.
any1 here up for a small code review? 
Yes.
Yeah
cool cool. there you go https://github.com/Luziferium/AsyncSpawnMob/
I see the word Async in the context of world-related features and I get scared
Async = good 

lmfao
its not async. its the same principle like FAWE
choco can I get my verified role
look in #verification
usage
My old discord got hacked
so....
"small code"
return true should print the usage in the chat. but since there is none 
its not much
for me it is
No he's right. false = usage message, true = no message
Itβs pog
rip. have to change that
Wynncraft is cool
Lmao yugi
Tho u should verify
Uh you need a spigot account
hf finding a userbase
I assume you got one
Haha
Yea I have an old one
I know
Maybe later
hoverEvent is not in componentbuilder
ig
to even get a team
yeah
Only then can you become a true function!
π
whats wrong with that?
Lucifer my only comment on this code would be to extract smaller methods from the command one to make the code more polite.
You call .next() twice
π₯²
π
thanks. already thought about it but splitting in too little code blocks makes it most likely more messy
thats intended. if there is just 1 block it will skip the while and return immediately
Okay well it's always gonna skip the first block
i'm too much of a perfectionist which is why this would end in a huge mess
but i could try myself at it
Myeah because currently that method of yours is jumping from low to high level and doing all crazy sort of things.
oh true, thanks. forgot that
why are so few plugins made with Kotlin? I feel like it would be more popular by now
yes and yes. it makes the code more clean to have f.e. a wrapper for an int which is just an id.
hoverEvent is not in compoundbuilder what could i use to replace it
also more or less going for the single responsibility principle
it is another dependency but it is soooo much nicer to code in
Yeah also about the static, is it really necessary?
Not everyone would agree to that
builder.append(player.getName()).append(" would like to duel you")
.color(ChatColor.BLUE)
.bold(true)
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click here to accept the duel")))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "whatever command you want to run"));```
this should work now right?
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.hover.content.Text;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.awt.*;
public class duelcmd implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("duel")) {
Player player = (Player) sender;
if (args.length != 1) {
return false;
}
if (args.length == 1) {
ComponentBuilder builder = new ComponentBuilder();
builder.append(player.getName()).append(" would like to duel you")
.color(ChatColor.BLUE)
.bold(true)
.event(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click here to accept the duel")))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "player2"));
String target = args[0];
Player targetplayer = Bukkit.getServer().getPlayer(target);
targetplayer.sendMessage(player + "would like to duel you");
targetplayer.sendMessage(String.valueOf(builder));
player.sendMessage(targetplayer + "has been invited to a duel");
player.performCommand("player1");
}
return true;
}
return false;
}
}
i now need to make it so that after the duel is accepted the second command will run
?paste
β¬οΈ
thanks for the feedback guys π
i do need to check if the sender is a player because you cant have the second person dueling the concole can you
and yes i dont know how to spell concole
I can write a more precise one gh if you wish.
all good. the hopefully most important things have been stated
What reasons could there be for not having correct permissions?
main: com.github.budgettoaster.infinitystones.Core
name: InfinityStones
version: 1.0
api-version: 1.17
description: "Creates infinity stones throughout the multiverse."
author: BanePig
commands:
stones:
description: "Base command for infinity stones plugin."
usage: "/stones <subcommand>"
permissions:
infinitystones.basic.locate:
description: "Allows you to locate infinity stones."
default: not op
infinitystones.admin.whereis:
description: "Allows you to get the exact location of an infinity stone."
default: op
Alrighty
how could i make it so once the command is accepted the sender puts a command
is there something like a ```if (command.ran()) {
player.preformcommand();
}
yea i already have that
ok
ok mabey i could make another class then add the duel accept command then make both of them do the commands i already have
i have a clickevent
ugh fine
ok i have an idea
i have a whole seperate command that gets run through the click event and it teleports the players and gives them both the gear that they need
wait i cant do that
ok can i teleport the players strait through the click event
Why can't I use a Custom Chunk Generator with an Amplified world?
hey there how would i go about checking if a json file is empty / check if a jsonobject is empty.
code:
if (checkpointsObj.isEmpty()) {
registerJSON();
}
}
public void registerJSON() {
try {
checkpointsObj.put("CheckpointCounter", -1);
FileWriter WriteJSON = new FileWriter(CheckpointsCounterFile);
WriteJSON.write(checkpointsObj.toJSONString());
WriteJSON.close();
getServer().getConsoleSender().sendMessage("[Parkour]"+ ChatColor.GREEN+" A JSON file was missing necessary info added it now!");
} catch (IOException e) {
e.printStackTrace();
}
}
``` for some reason this code works and changes my json file to this `{"CheckpointCounter":-1}` which is how i want it but then if i try to change my jsonfile to something like `{"CheckpointCounter": 2}` and then reload my server it changes it back to -1 but the obj is not empty
Hello someone can helpme? i get this error
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.createStatement()" because the return value of "lib.PatPeter.SQLibrary.Database.getConnection()" is null
at lib.PatPeter.SQLibrary.Database.query(Database.java:241) ~[?:?]
public final ResultSet query(String query) throws SQLException {
queryValidation(this.getStatement(query));
Statement statement = this.getConnection().createStatement();
if (statement.execute(query)) {
return statement.getResultSet();
} else {
int uc = statement.getUpdateCount();
this.lastUpdate = uc;
return this.getConnection().createStatement().executeQuery("SELECT " + uc);
}
}
this.getConnection() is null
yes ik, so how i fix that
Create a Connection and set it to whatever getConnection() returns
it was works befor
i just trying to change my spigot plugin to paper plugin if it possible
what is getConnection()
public final Connection getConnection() {
return this.connection;
}
And what is this.connection
import java.sql.Connection;
protected Connection connection;
Yeah connection isn't set to anything
but how it works befor and now not
Shouldn't have worked before
when do you initialize it
is there any way to get something like player.preformcommand in a click event?
for chat?
player.preformCommand(""); is already in chat i just need to know how to get it into a click event
What are you trying to achieve?
Could you explain ur plugin
it is a duel plugin and i alrready have a kits plugin and another plugin for teleporting into the arena i just need to get the commands into the click event for it to teleport the people
Is there documentation for the plugin.yml file anywhere? I couldn't find it in the API
Spigot wiki I believe
why do SheepDyeWoolEvent not tell who dunit
Indeed
ChatComponent has HoverEvent and ClickEvent
look up component api
if you looked at the code for a second i already have a click event i just need to get that code somehow incorperated into it
Tbh, I do not understand what does the .performcommand do
you want the player to perform a command for someone else?
I've never used it myself.
gooooood luck
the component only forces the player to run the command
to do a console-level command you would have to keep track of who can and can't do it and do something special based on a hidden command
CMI has a feature like that but it's a very difficult thing to accomplish
Well I still cant understand what he tryin to accomplish, why would you need to run a command for someone?
i accualy just relized that i need something that detects if the clickevent has happened any ideas
And if you detect if clickevent happens what next?
You just need to create an event
Just curious, has anyone ran a minecraft client through an mc plugin?
no
Ah i've never seen it before might try it since im bored lol
you'd have to make sure the server has minecraft installed first tho (client)
not all servers have the client
hey does anyone know how to make a compass track a specific player?
#setTarget?
declaration: package: org.bukkit.entity, interface: Player
player.setCompassTarget(target.getLocation());
pretty much what rack sent.
where do I put this exactly? sorry im new
is there a way to check if an air block would collide with a player if it were solid
oh nvm block has a collisionShape
wherever you need to change the compass direction
For example under playerinteractevent
if he interacts with the compass
you set the compass target
it's invoked by the server as required
ok, do you think server can handle if i will stream pixel video data from WebSocket to minecraft map?
trying to play a video on a map is very bad for performance
if its just images, sure
What version of java does 1.17 need?
16
try to update your JDK
ohk
For my plugin I'm trying to go about showing text in a sign to a player through ProtocolLib, and I've seen I need to send a BlockChange event to place the sign followed by a packet to open the sign editor from the server to the client.
The BlockChange is working just fine, but the OpenSignEditor packet isn't, and it crashes with this error. Here's my code for opening the sign (this.blockLocation is a Location for the sign and this.p is the Player):
public void open() {
PacketContainer blockChange = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.BLOCK_CHANGE);
blockChange.getBlockPositionModifier().write(0, new BlockPosition(this.blockLocation.toVector()));
blockChange.getBlockData().write(0, WrappedBlockData.createData(Material.SIGN_POST, 0));
try {
ProtocolLibrary.getProtocolManager().sendWirePacket(this.p, WirePacket.fromPacket(blockChange));
} catch (InvocationTargetException e) {
e.printStackTrace();
}
PacketContainer openSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR);
openSign.getBlockPositionModifier().write(0, new BlockPosition(this.blockLocation.toVector()));
try {
ProtocolLibrary.getProtocolManager().sendWirePacket(this.p, WirePacket.fromPacket(openSign));
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
If this is the wrong place to ask then I can delete but I felt like this should be a good place
I installed JDK 16 but now its showing this error
Well if this error is not self explanatory i would recommend to restart pc
Also I'm coding for 1.12 if that makes a difference
I looked it up on google and it says this is because of a failed install so i am trying to uninstall a recently installed java 8 version but it is not working
Is there another way of uninstalling a specific version of java
Oh it worked
I had to uninstall the java that i recently installed and then install the java for windows offline installation
i glad that you resolve the problem
So I know that you can take an NMS ItemStack and convert it to a Bukkit one with getBukkitStack(), but is the reverse possible? I tried checking the API but I couldn't find any leads.
I believe it's CraftItemStack#asNMSCopy
thanks a bunch mate that seems to be it!
Np!
Also the same as getBukkitStack is CraftItemStack#asBukkitCopy which is also in the same class
Just thought to mention that in case you wanted to know for some reason lol
yeah i also saw that pop up, but thanks a lot i appreciate it
when i search for java in the windows search thing i cant see the configure java and stuff i used to see earlier(earlier = when i has java 8). Instead i see this java(in pic) and when i open this it shows a command prompt window for half a second and then disappears(this started happening when i installed java 16).
Is this an issue to worry about?
I havent coded plugins in a strong while, how do i get build tools again for spigot, I searched up tuts and still cant do it
?bt
theres a download on that page
then it gives you a sample run.bat to use aswell
oops
i know but idf i try to install it it says i need java 7 or 8 and i have java 16
any direct way of installing it?
You need java 8 lol
Minecraft is built on java 8
To develop for minecraft
so uninstall java 16 and install java 8?
I'm trying to figure out my own packet problem rn :c
You can have them both installed, you'll just need to use a direct path to java 8 when you run buildtools
then i do have java 8 how do i do direct path tho?
you can have both at the same time
then i do have java 8 how do i do direct path tho?
Like you would any file
open with?
how would you direct it?
?
" you'll just need to use a direct path to java 8 when you run buildtools"
inside of the folder that build tools is in right?
Yes
why is there v1
Did you read the buildtools page
wont it be 1.8 replaced with v1.BLAH
why does Player and OfflinePlayer both exist if the Player javadocs says "Represents a player, connected or not"
I use https://gist.github.com/Jofkos/d0c469528b032d820f42 for this purpose
It uses the mojang api to convert from UUID to playername and vice versa
wont it be 1.8 replaced with v1.BLAH
it is not deprecated?
I put v1.BLAH because I have no idea what version you're using. If you're using 1.8 then yes it would be v1.8
what context are you talking about
It is I'm p sure
declaration: package: org.bukkit, class: Bukkit
where is player actually implemented
ik i mean where are the methods implemented
like what file
im trying to look inside
oh thats NMS
If I wanted to edit bungeecord to allow connections where you can /server a proxy, is that possible?
Looks like this probably
yes thats it ty
I'm gonna bump this cause I still have no idea
the system cannot find path specified
Please send a screenshot of what you're running
I-
Ok so the PATH\TO\JAVA\8 was a placeholder you were supposed to replace with your actual path to java 8
i accidentaly had my failed try posted this was my 2nd try
u told me to cd to the folder i had my buildtools in do u want me to cd it to my java path instead?
No
You cd to the folder buildtools is in
And replace the path at the beginning of the command
With the path to the java installation
how do i find it?
It should have said it when you were installing it
i didnt install java 8 yesterday. . .
obviously i dont remember it and i did have it apparently
nvm i found it
so like this?
C:\Program Files\Java\jdk1.8.0_281\java.exe -jar BuildTools.jar --rev v1.8
c:\program is not recognized
You need quotes around the path
If you tab complete the path as you make it then it'll put them there automatically
from c:\ to exe?
thats not what i mean
'"C:\Program Files\Java\jdk1.8.0_281\java.exe"' is not recognized as an internal or external command,
operable program or batch file.
Put an & before it like this:
& 'C:\Program Files\Java\jdk-11.0.10\bin\java.exe' -jar BuildTools.jar --rev v1.8
What do you mean
Can you send a screenshot of your window, not copy paste but an image
this channel cant send imgs
i tried
& 'C:\Program Files\Java\jdk-11.0.10\bin\java.exe' -jar BuildTools.jar --rev v1.8
First of all you put the path to your java 11 executable and not the java 8 one
Second of all try running that in powershell
its isntalling now in powershell but this happened before i need to see it if installs the jar
What do you mean install because all Buildtools does is make a jar in the same folder
could not get version 'v1.8'
lemme try removing v
is the jar gonna appear in the main folder or is it gonna appear in a folder inside of it?
Should appear in the main folder
ok
for jars 1.8 to 1.8.8 can i just get 1.8 and it will work for all or do i need to download all jars
Depends on what you're using them for, if you're using them to run a server then move this over to #help-server as I can't help with that, but for programming then for most purposes 1.8 should be fine for all of them I'd believe
I have a function that sets a bunch of NamespacedKeys to a player's persistentdatacontainer. However, when this function is fired, the PersistentDataContainer remains empty.
Code: ```java
public static void createPDC(Player p) {
PersistentDataContainer pdc = p.getPersistentDataContainer();
if (p.isEmpty()) { // only create the pdc if the player doesnt alr have one
pdc.set(PlayerData.pdcUsername,PersistentDataType.STRING,p.getName());
pdc.set(PlayerData.pdcUUID,PersistentDataType.STRING,p.getUniqueId().toString());
pdc.set(PlayerData.pdcIPAddress,PersistentDataType.STRING,p.getAddress().toString());
pdc.set(PlayerData.pdcSpectateX,PersistentDataType.DOUBLE, 0.0);
pdc.set(PlayerData.pdcSpectateY,PersistentDataType.DOUBLE, 0.0); // no, no it is not
pdc.set(PlayerData.pdcSpectateZ,PersistentDataType.DOUBLE, 0.0);
pdc.set(PlayerData.pdcCanFly,PersistentDataType.BYTE, (byte) 0); // PersistentDataType.BOOLEAN doesnt exist yet, so 0 means false and 1 means true
pdc.set(PlayerData.pdcGodMode,PersistentDataType.BYTE, (byte) 0);
pdc.set(PlayerData.pdcKeepIllegals,PersistentDataType.BYTE, (byte) 0);
pdc.set(PlayerData.pdcInVanish,PersistentDataType.BYTE, (byte) 0);
// pdc.set(PlayerData.pdcSomething,PersistentDataType.BYTE, (byte) 0);
Bukkit.getLogger().info("Generated PDC for player "+p.getName());
} else {
Bukkit.getLogger().warning("Incorrect function call: player "+p.getName()+" already has a PDC");
}
}```Is this an issue with the way I am implementing this or is this just not how PDCs work
if an entity exists but hasnt been spawned in yet, can it still be found with its UUID?
no
darn
i dont know anything about protocollib aaaaaaa
You're fine !
mostly because so far i havent had to deal with packets
thank god for that, theyre complicated asf
I mean making a sign pop up is proving to be a pain lol
Yeah
I mean I kinda have to because one of the features I want to implement is translated signs
why a sign specifically, if you don't mind me asking. Is this like a lobby plugin for bedwars?
oh
Here bumping this
And this
why are you checking if the player is empty?
any faster way on installing jars?
im checking if its pdc is empty
using dis
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
its a player though not a pdc
god damn it
idk how that even compiles because that isnt a player method
nvm yes it is
lol you're checking is someone is riding the player
.
I'm trying to create a copy of a MapView, but I'm having trouble copying the area already explored. I tried adding the MapRenderer from the original, but it stops tracking the cursor - maybe because I destroy the original. Anyone know how to copy the area explored/revealed from one map to another?
Hello,
is there any way to do this? https://bukkit.org/threads/open-furnace-inventory.261287/
Hello,
How could i open an working furnace inventory?
If i create the inventory with
this.inventory = Bukkit.createInventory(this,...
the opened furnace inventory has no functionality.
I cannot use file.delete() even after the plugin is disabled
isn't there any Enchantment.UNBREAKABLE or something like that? cause i don't seem to find it
oh ok
no, i wanted the one you gave me
thanks
player.isOnGround is deprecated, is there another way for me to check or should I just keep using it
is it the type of thing where lag or hacked clients can abuse it
ah
imma keep using it unless theres a good way to check
imma research and come back
does ItemMeta.getDisplayName() return the items default name if its not set?
No
found a forum where it looks like md_5 removes the player method because when called on entities it uses the server's info but it's obviously the deprecation still there so idk
You can create try this (might not be the best method):
new ItemStack(item.getType()).getItemMeta().getDisplayName()
does PersistentDataContainer store data only on items?
i did not find a tutorial where some data is stored for a specific player
can you pls tell the syntax
what about Material.name()?
ah ok TYSM
Probably similar to toString
okay
it doesnt say anything about it in the docs :(
yea, its a part of item meta
can you tell me how i can store a boolean for a player and then check later what boolean he has?
I can understand anything from the wiki, in the wiki it has T, Z and stuff
does doing meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS); for a chestplate hide potion effects on the player that is using it?
oh
set(key, PersistantDataType.byte, value)
is there a flag for player to hide its potion effects?
got it, thanks
so key would be some unique ID and value would be 0 or 1 right
And how do i store this for a player
would it be p.set(blah blaj blah) ?
p is the player
oh
so what would be the command?
sorry
I was not understanding the wiki so i asked here
bump
bump!
A furnace inventory needs a furnace to store the data and tick
Maybe you could fully reimplement the functionality yourself, but itβs probably not worth the effort
Alternatively you could attach the inventory to a furnace somewhere way out in the world
how can I fully reimplement the functionality?
But, like vanilla furance
Youβll need to tick the inventory to update the progress bar and all that
And validate the recipe in it, remove the input and set the output, remove the fuel, etc
if i need to get or set the persistent data in a player should i do:
p.getPersistentdata.... ?
P is the player
i am really confused
there are no tutorials for the same
i cant understand anything there
i know java
but i dont know how this works in spigot
if you dont want to help then ignore me dont keep saying spoon feed
okay
yea
so now do i need to store the players key or smtg in a variable?
and then use it when geting the value
?
oke
what?
umm not really
we use the get persistentdata method right?
yea
i got that
byte
or bool
anything works
okay
so byte
okay
so the key is what we got from getPersistentDataContainer
ah ok its a unique key
to differ from other data
right?
okay
i have a vps and want to make a bungeecord server can anybody help me by sending a video link
ohh ok
in dm
ohh ok
got it
Thank youuu sooo muchhh
yup byte also works
i will still check it out
Thank youuu
you the best
How can you make a BungeeCord Minecraft server? Start your own Minecraft server with Bungeecord. Bungeecord will work for any version of 1.8 and 1.15. BungeeCord is a proxy server that lets you link multiple Minecraft servers together in order to create a network with many different games.
π ...
i am not sure
Iβm sure there are enough tutorials on the internet to sink a battleship
isnt there ant Enchantment.SHARPNESS??
what is wrong in this?
Key is not a string
oh
Look at the javadocs and listen to your ide
ok
knock knock
who is there
your ide
my suffering is there
listen up
can you tell me what it is?
the doc says it is string namespace, string key
please
The doc says what is a string namespace, string key
umm
can you just tell what it is
i cant find anything
now dont tell spoon feed
if you dont want to tell then ignore
ok so you dont want to tell
Itβs a namespace key
nvm ill ask someone
The docs will say that in the set method
oh?
?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.
uh ok
how do I lern javae @young knoll
dont ask him
he will get mad at you
dont risk it
delete the message
dont ping
aaahhh
Lmao
ok so u made ur death trap
great job π
dont joke at serious stuff
is 2025 when you will graduate middle school
am i crazy i placed this all by hand
how can i add auto-complete option to my command? should i do like usage: /<command> [option1, option2,...] ?
tab completer
declaration: package: org.bukkit.command, interface: TabCompleter
β€οΈ
gtg
my plugin wont show up im my server
Listener:
package org.gamingproduction.listeners.join;
import org.bukkit.Bukkit;
import org.gamingproduction.listeners.Main;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.gamingproduction.listeners.utils.Utils;
public class JoinListener implements Listener {
private Main plugin;
public JoinListener(Main plugin) {
this.plugin = plugin;
Bukkit.getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (!p.hasPlayedBefore()) {
Bukkit.broadcastMessage(Utils.chat(plugin.getConfig().getString("firstjoin_message").replace("<player>", p.getName()).replace("<nickname>", p.getDisplayName())));
} else {
Bukkit.broadcastMessage(Utils.chat(plugin.getConfig().getString("join_message").replace("<player>", p.getName()).replace("<nickname>", p.getDisplayName())));
}
}
}
What is best practice for managing save files? How do I make sure that they stay in-sync with the rest of the server?
fixed it, i compiled in wrong v
im probs dumb for this but if i make it so theres a string in the config and it can be true or false, how would i make an if statement to check if its true in my file?
just use config.getBoolean()
hmm, imagine not doing this
config.yml
yessir: "true"
if(String.valueOf(Boolean.parseBoolean(config.getString("yessir")))== "true") sayHi();
people need to read docs more..
Hello someone can help me?
i am using SQLibrary and getting this error when i trying to connect the database
https://haste-bin.xyz/ciyofureye.java
someone know how to fix it please? thanks
what
do i import config?
to be clear do not use that code
why not?
yes, its just a joke
i dont even think it would compile
:/
Deleted it man saw it
it will
but
its trash
dont use that, worth less
you're comparing a boolean to a string, is that even legal?
you can just do if(config.getBoolean("path"))
I'm doing String.valueOf() at last
yeah but only after doing the compariso
hello?
WELP i was mistaken
imagine not using HikariCP
what is HikariCP
main class: https://haste-bin.xyz/batiwonaya.java
SQLManager class: https://haste-bin.xyz/ixusovovat.java
error?
i send error above
Database class inside SQlibrary
https://haste-bin.xyz/avifuhugum.java
so how i need to do that?
is your console saying you connected to db
well i suppose you must have to get the error
i think your library might just be outdated
yeah last update was 8 years ago
so how i can fix that?
HikariCP?
yes
it support MySQL?
pretty sure it does
ok thanks
(line 27 = line 11 in the link)
What API version are you building against
server version: 1.8.8
api version: 1.12
jdk: 8
theres your problem
what's the replacement for it?
you're using an api method that doesnt exist in 1.8 which is the sound
So use the 1.8.8 api
thats what ive been wondering
how do i
get to have 1.8.8 api...
may you help me?
What build system do you use, maven, gradle, etc?
maven
then just change the api version in your pom
replace 1.12 with 1.8.8
should pull from the repo just fine
hm you sure?
yes
this?
it should end up as 1.8.8-R0.1-SNAPSHOT iirc
if I recall correctly
then refresh your maven
If you use intellij its the little maven button that pops up
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
</dependency>
Do you have the repository set up?
how do i check if i have?
not sure if i do
Do you have a <repositories> block in your pom?
looks good to me
@tepid monolith did u use build tools
umm no
Then it is likely an IDE issue; since it's IntelliJ I cannot help you
i guess its doing something
If restarting your IDE/PC doesn't fix it and you have clicked on the refresh maven thingy, you might as well go back to notebook and code with tools that actually work when they are supposed to work
thanks @quiet ice
just had to build it once
so it gets to download sources
and now it works
The getCurrentItem() function might return a null value
You have to account for when they click nothing
You need to check if it's null before getItemMeta
ok
well, it is clicking outside of bounds
How do I set health for an entity
declaration: package: org.bukkit.entity, interface: Damageable
can someone hop on my serv and test a leave msg cuz its 5:20AM and none my friends are up
Wait aren't all entities Damagable?
No
bruhh
Enderpearls aren't, items aren't
Oh right...
etc
Imma just cast it to zombie then
What
Zombie e = (Zombie) player.getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
It's safe right
Oh yeah
Yeah
If you spawn a zombie then it's fine
Im not dumb enough to do unchecked cast :p
or am I
I think you can do Zombie.class, but idk
How to hide an entity from a specific player with packets?
Oh boy
Here's the sauce for an damage indicator mod
This is the class used to hide the armorstand from other players if that's desired
Go wild
iirc it uses protocolLib but I think TinyProtocol works too
And if not you can always do it youself
You can try and listen to EntityMetadata and set the metadata for the specific entity and the specific player invisible
Or just spawn it with packets and cancel the event for specific players
These entities are not manually spawned in though, I want them to only be hidden when a player loads the chunk they are in.
Then do the first option
The server will send entity metadata when the player loads the chunk the entity is in
Is this with NMS or ProtocolLib?
ProtocolLib
Ok
tdubz
There is a destroy entity packet
Clientbound
Wait why
I don't see any other moment, is there one ?
Spawnentityliving or something
I forget how I did it
For the one chunk render distance
What are you trying to do @gritty urchin
As in the final goal
Hide everything in a chunk for specific players.
Right ok
Entities, players, sounds etc
Hmm
There is a lot more to block than you think
Cause you have to listen for when entities move across borders, and back again
Also
Yeah
So how would I hide entities firstly?
Cancel the spawn event
Yeah but won't that completely remove them?
That's the whole point of packets
Check the player's username or uuid or whatever
And cancel the event only for some of them
Yeah just set up a packet adapter for the client packet for spawning
^
You can then get the target player
And then the target entity x,y,z
Actually, just do a binary shift on the x & z to get the chunk x&z and check to see if that player needs them blocked
If so, cancel the event
Sorry for a dumb question but is there a method to change server.properties?
Hello someone can help me?
i am using HikariCP and getting this error when i trying to connect the database
https://haste-bin.xyz/zezabigelu.java
someone know how to fix it please? thanks
Programmatically?
Afaik there is no way to reload the minecraft config
However theoretically you could open it just like any other file and write to it
Doesn't /reload reload the properties file ?
What packet is that?
Can't seem to find a clientside packet for spawning
thanks
Hello?
You do not have Hikari on yrou server nor shaded in your jar
If you are on current spigot use the libraries feature in the plugin.yml
i am using paper
Then you are asking in the wrong discord
paper has discord?
yes
Yeah but that is a terrible idea
Paloys linked it above
I made a custom mob ( zombie ) is it possible to make this zombie naturally spawn instead of the vanilla one?
Hey Quick question: Does anyone know how exactly I can program a listener that sets blocks around a certain item when I set it?
What blocks are you wanting to place around what?
I can't comment on Jira, is there something I need to do before I can comment on it
I would like to set a banner with a PersistentdataContainer, but this should then be deleted directly from the inventory and also removed from the place where it was set. and then I would like to build a house around the block. For this I would need different blocks
Not a simple task then. You need to think about schematics
You are literally describing a whole plugin
isn't it possible to simply calculate where which blocks have to be placed and then place them at these coordinates?
Well, I haven't done anything like that yet, but that's one idea I have.
Yes, but you have to have the whole design/schematic with block types, rotations/facings.
Whew ok. How can you do that? Are there any tutorials for this?
There is unlikely to be any tutorial other than somethign using the WorldEdit API
Google worldedit, its a plugin. But good luck with the API its a nightmare to use.
i couldn't sleep for the next 3 days of reading the usage docs 
hey there so with this code im trying to register a new jsonobj for each checkpoint. but for some reason when i run it once it registers 1 obj as it should but then once i run it twice i would like it to add another json obj for the other checkpoint but now it just updates the first json obj to the new checkpoint info. could anybody help me with this, i am not getting any stacktrace
code: https://pastebin.com/kind07D2
you talkin to me?
im pretty new to JSON
oh no sorry
np
Hey, I'm trying to make a program that runs the command /say hello after startup. I' not sure why this doesn't work. Can anyone help me? The code is: https://hastebin.com/napetifivo.java
is there a way to load custom head
skin from specific link
or file from harddrive ?
How would I get the entity x,y,z?
entity.getLocation().getX() would return the x coordinate
This is with PacketType.Play.Server.SPAWN_ENTITY_LIVING ProtocolLib packet
Can you disable spectator mode teleporting using the hotbar?
Yeah it calls teleport event when used
Just cancel the event
If gamemode is spectator
Alright, thanks for that.
which event do you need to make a listener that asks whether a certain block has been set? and how do you then ask whether the block has a certain persistent data container? And is it then possible to get the location of the set block and then use it to set blocks?
you can schedule a task to run after some time and put it in onEnable
Is there a way to program, that I can create a world border, that is permeable for players, but visible?
i don't think that you can make the wb permeable
you can try to make a particle border
but i think that it would consune a ton of resources
I don't know if this is a bug, but if I click a item in a inventory the InventoryClickEvent gets called twice, and if I click another item again it stops getting called. Only the item I click at the FIRST time works good
there is a cubiod resource on spigot. use that. you can mark the walls with some maths with particles
Thanks.
Static things are always available with <Class>.method/field, instances must be created with new <class>()
not really. a static method belongs to the class itself where a non-static method belongs to each object of that type
Error:
java.lang.NullPointerException: null
at de.cimeyclust.Plugin.onLoad(Plugin.java:48) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:399) ~[patched_1.16.5.jar:git-Paper-727]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:269) ~[patched_1.16.5.jar:git-Paper-727]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1068) ~[patched_1.16.5.jar:git-Paper-727]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:290) ~[patched_1.16.5.jar:git-Paper-727]
at java.lang.Thread.run(Thread.java:834) [?:?]```
Code:
@Override
public void onLoad()
{
this.getLogger().info("Plugin loads...");
// Check connection to database
this.getLogger().info("Check if connection to database is valid...");
this.connector = new MySQLConnector(this);
if(this.connector.isConnected())
{
this.getLogger().info("Β§aPlugin connected to DB successfully.");
}
else
{
this.getLogger().warning("Plugin couldn't connect to DB! Plugin get disabled!");
this.getServer().getPluginManager().disablePlugin(this);
}
// Loading Player Data
this.getLogger().info("Loading player data...");
List<OfflinePlayer> players = new ArrayList<>();
for(String playerUUID : this.connector.getColumns("general", "uuid"))
{
players.add(this.getServer().getOfflinePlayer(playerUUID));
}
this.allRolePlayers = players;
this.onlineRolePlayers = new ArrayList<>();
// Finished Loading
this.getLogger().info("Plugin loaded successfully!");
}
There is no line 48
whats on line 48
Why I get this error? this.connector is not null. I debugged
Oh. sorry
"for(String playerUUID : this.connector.getColumns("general", "uuid"))"
That's line 48
Then getColumns returns null
^^
if i put sender in a sendmessage will it just say who executed the command?
No. It sends the message FROM the sender
sender#getName will return you the name
I think
if there is a getName
sender.getName()
this
yeah
so target.sendMessage("you have ben healed by " + sender.getName());this will work
sender.sendMessage("your name is: " + sender.getName());
yea ok
most likely
that is my new fvorite video
which event do you need to make a listener that asks whether a certain block has been set? and how do you then ask whether the block has a certain persistent data container? And is it then possible to get the location of the set block and then use it to set blocks?
BlockPlaceEvent
yea ok
Ok guys, so im upgrading plugin and there is function called Inventory.getName
its showing ERROR
zombie.setHealth(20); How do I set health bigger then 20? I get error if it's >20
go over the inventoryView and get the title
most likely by setting the max. health higher
my plugin is going to be a heal/feed command and i want to do somthing like /do feed adeptvail or /do heal adeptvail but i need to know how to add the command so you heal/feed other people and i dont know if i should do args.length == 1 or args.length == 2
?paste
setMaxHealth is deprecated, should I worry?
you need to go over attributes
oh right, I forgot
there is my code so far
event.getInventory().getName().equals(name) - getName doesnt exist, please help me
check if the args length is 0 or < 1. otherwise /heal asjd ljkashd kashdkjawh kjash will heal yourself
check if target is null. otherwise there is a possibility of a NPE if the target is not online
instead of returning true you could just use else if
and why do you have 2 commands in 1 executor
OK and how can I get the location from the placed block and place blocks from there?
event#getPlacedBlock#getLocation 
i was goijng to ask if i could have two commands in one exicuter or i should just make a new class for it
a new class is more clear and less spaghetti
yea thats what i was thinking
i was trying to make it all one place
but i dont like spaggetti
so
and how can i set blocks from this location?
by getting the world and setting a block of type x at location x 
hello i have this error:
[16:00:22 ERROR]: Could not pass event PlayerMoveEvent to UltimateClaims v1.7.2 org.bukkit.event.EventException at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[server.jar:git-Spigot-d2856ae-8f0f4ed] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-Spigot-d2856ae-8f0f4ed] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [server.jar:git-Spigot-d2856ae-8f0f4ed] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:269) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.PacketPlayInFlying.a(SourceFile:126) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.PacketPlayInFlying$PacketPlayInPosition.a(SourceFile:57) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-Spigot-d2856ae-8f0f4ed] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_292] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_292] at net.minecraft.server.v1_8_R3.SystemUtils.a(SystemUtils.java:19) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:718) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [server.jar:git-Spigot-d2856ae-8f0f4ed] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [server.jar:git-Spigot-d2856ae-8f0f4ed] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292] Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.Player.sendTitle(Ljava/lang/String;Ljava/lang/String;)V at com.songoda.ultimateclaims.core.locale.Message.sendTitle(Message.java:84) ~[?:?] at com.songoda.ultimateclaims.listeners.EntityListeners.playerMove(EntityListeners.java:296) ~[?:?] at com.songoda.ultimateclaims.listeners.EntityListeners.onMove(EntityListeners.java:62) ~[?:?] at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[server.jar:git-Spigot-d2856ae-8f0f4ed]
?paste
does it matter if the args length is 1 bc its a subcommand or do i have to change it to 2
and i will do the <1 or 0
Hi, how to get player instance from a InventoryClickEvent?
if you wanna heal somebody else you should have at least a length of 1, yeah
help me pls
event#getWhoClicked
yea but it is a subcommand so i can keep it at 1
event.getInventory().getName().equals(name) - getName doesnt exist, please help me (im using version 1.17.1)
you are trying to access a method you don't have. probably using a higher API than the one on the server
as i already said. get the inventoryview of the inventory and get the title by the view
explain me more please
for first time im using inventory functions
you should understand that, mr gamedev
it doesn't return player instance. I need to use getWalkSpeed, but it only exists on player
declaration: package: org.bukkit.event.inventory, class: InventoryEvent
declaration: package: org.bukkit.inventory, class: InventoryView
declaration: package: org.bukkit.inventory, class: InventoryView
so cast it
how to fix it?
by using the correct api version
thanks
or not using a method that does not exist on the api version on the server
which api?
wouldent i do 1> not <1
you are using the api of spigot to code your plugin. the version of that api is probably higher than the spigot version of your server
Can't it have unexpected behavior? If it's not a player instance that means it can be something else as well
if args#length is smaller than 1
what else should click it in that case? the console? an animal?
how can i change it
otherwise check if the HUMAN ENTITY who clicked in the inventory is a player. but since its a HUMAN entity its redundant
yes, my bad. Thanks a lot π
is it not possible to set them in the same way as you can teleport entities? That is possible with entity.teleport(entity.getLocation().add(0, 3, 0));
you want to teleport the block?
no
World has a #getBlockAt(Location) method which returns the block at the given location. just set the type of that block to what you need
how would i run a MySQL in my server, on Windows (version 11, if thats important)?
It cant connect with InventoryClickEvent
InventoryClickEvent extends InventoryEvent
Is there any nms documentation?
no officials
oh ok
I do not want to change any blocks. I want to set a wood block from the location of a set block, e.g. 2 blocks further in the x direction.
yeah so you have to change blocks. you can't add blocks to the world, you can just change them
oh ... does air also count as a block in this case?
yes
how to change my api
How would I get entity metadata packet position protocol lib
is it possible to pass the location of the blocks to be changed via the same method as in my example?
@EventHandler(priority = EventPriority.HIGHEST)
public void onBukkitInventoryClick(InventoryClickEvent e)
{
if(inventoryEquals(e.getView().getTitle()) && e.getWhoClicked().getName().equals(this.player.getName()))
{
System.out.println("Bukkit inv click");
Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) TvheeAPIPlugin.getPlugin(), () -> onInventoryClick(e));
}
}
Looks like normal? The only problem is that onInventoryClick(e) gets called twice, but I see "Bukkit inv click" only once in the console
Oh I see, annotated the method also with @EventHandler so that was the clue
π by THIS code, now you help me to understand my mistake
Did I just solve your problem with this code?
yes XD
Nice
@quiet ice
Does Player#getEyePosition reflect f5 view?
how ican add it ?
Or does it just apply an offset
offset + pose are respected
Hello, when a player connects to my server I have this error in the console what should I do?
how ican add the code
`Could not pass event PlayerChangedWorldEvent to AParkour v3.5.5
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.PlayerList.moveToWorld(PlayerList.java:623) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer.teleport(CraftPlayer.java:476) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity.teleport(CraftEntity.java:223) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at me.retro.Inicio.onJoin(Inicio.java:130) [Spawn.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:296) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:156) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:817) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [server.jar:git-Spigot-d2856ae-8f0f4ed]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Caused by: java.lang.NullPointerException
at me.davidml16.aparkour.managers.StatsHologramManager.haveParkourData(StatsHologramManager.java:92) ~[?:?]
help me pls
fix your aparkour plugin
how to?
Hmm, I imagine that the view is not sent to the server? I assume that by pose you mean like crouch swimming etc etc
oh ok thx
pose is sneaking swimming etc
Ok thanks
LivingEntity.getEquipment().setItemInMainHand
Hey why is setLine() and getLine() in SignChangeEvent depreciated
?jd
hey there
I cannot find protocol documentation for 1.17.1, I guess it's not released yet?
Is there a way to get players in a 3 * 3 area near a certain player and then check if any of the nearby players have a value in their PersistentDataContainer ?
i would be able to manage the 2nd part
but im not sure how i will get the players in a radius of 3 blocks of him
hey there so with this code im trying to register a new jsonobj for each checkpoint. but for some reason when i run it once it registers 1 obj as it should but then once i run it twice i would like it to add another json obj for the other checkpoint but now it just updates the first json obj to the new checkpoint info. could anybody help me with this, i am not getting any stacktrace
code: https://pastebin.com/kind07D2
