#help-development
1 messages · Page 1908 of 1
Got a better solution?
Edit, I dont see a problem with that
Walk and Run?
How to make?
The easiest thing is maybe getting Statistics of player ^^
if you need something specific PlayerMoveEvent (from -> to locations) and measure the distance
PlayerMoveEvent?
spigot api ^^
learning database design at school, finally something i can use in my code
I need to calculate the player's total walking distance, like a leaderboard, not two points
i learned it too there ... xD
it's more difficult than i expected
then safe the start location and get the distance to the player at any time .. thats the total distance
"normalisation of databases", "from erm diagram to relations"
which country ?
hmm sounded like stuff we did in my school too
The premise of this is that the player always walks in the positive direction
then probably currentLocation.distance(startLocation) is what you need
@ivory sleet do you can help on creating those patches ?
i need to somehow make a patch for a class i added/changed in craftbukkit .... adding the file and makePatches does nothing
Is this a Bukkit API?
Yes
yes Location is one of the biggest used stuff in minecraft
without that the api would be almost useless
when do you need the distance ? all the time ? or just every 10s or at the end of what your doing ?
PlayerMoveEvent
this is a statistic
then define somewhere where your startLocation (lowest point) is
in PlayerMoveEvent you just get the location where the player moves (p.getLocation() will do it)
Location has already builtin "distance" - method ...
Start location is a method?
no
its the point where you want the players to have walked distance 0
you said they walk always in + direction
No, I mean this method seems to only work if the player is only going in the positive direction
So I feel confused
what do you want to do ?
I need a suitable way to calculate the player's irregular walking distance
the overall walking distance ?
Yes
then you need to calculate it everytime or you just use the Statistics from the Player
Cumulative distance traveled on the server
player.getStatistics() or smth like that
getStatistics() is form player on the server or player on all server
current server
Hi, im gonna make a plugin which adapts how spiders can spawn but as of 1.10.2, do spiders spawn in 2x2 areas or 3x3 areas?
Can it reset?
probably
check wiki for that specific info
versionID:
versionList: [~~~~,~~~~,~~~~,~~~~,~~~~,~~~~]
How can i get full array versionList using getConfig()?
yea
String list
okay its getConfig()#getList(path)
isnt string list
path:
- "something"
- "something else"
whats this then?
both are lists ig xD
dictionaries as python & js devs like to call it
How can I set the time zone of my mysql server? Because I am from Austria and become an error when I try to connect from the Intelij Database Navigator, which says:
Cannot connect to "Connection".
The server time zone value 'Mitteleurop�ische Zeit' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.
Configure your driver?
How? Sry I just began to work with databases
Google how to make sure your db is configured correctly. For MySQL https://stackoverflow.com/questions/930900/how-do-i-set-the-time-zone-of-mysql
I get that error, when I restart it after I set it to +8:00:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@@global.time_zone' at line 1
@@global.time_zone ?
are those @ correct ?
When I set it everything works completly fine, but after the restart I become an erroo
What's wrong?
If I have a Plugin object, how can I get its current version?
PluginDescriptionFile#getDescription()
Solved
Is there any way to override suggestions for bungeecord command?
I found TabCompleteEvent but I don't know how to overwrite suggestions
you have to override the TabCompleter#onTabComplete, it works like onCommand but you'll need to set a tabcompleter in the same way as you set an executor for a command
I fixed it. I set it in the auto_conf. Thanks
is there anyway to detect if the player punches a dropped item
i had the idea of spawning an armor stand
but im not sure
You could use the interact event and rayTrace
Does anyone know this problem??
The thread :
#help-development message
Can yall help me improve my speed check ```java
if (player has the movement of a hacker) {
Console.print("This person is hacking");
}```
public Object test() {
File file = new File("plugins/" + getDirectory(), "Data.yml");
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(file);
Object returnThis = yamlConfiguration.get("Object");
return returnThis;
}
``` can this lead to memory leak?
dont think so
how about its being used 5 times per second?
dont
10?
to get data from files?
the result will be the same ... so you should safe the result onEnable()
wh- why
Then how would i store data?
why do you call the method that often ?
databases
if you want to know how many kills the player has you can store in at PlayerJoinEvent and increase it and do stuff with that ... and PlayerQuitEvent you safe the value back
I store my data for each player 1 file
Okay, then read them when the player logs on
so i should use caching system?
yes
YamlConfiguration is already a cache for you
if your lazy yes
no im not
using config method to get obj also takes time ...
if you store values seperate your faster
I have SSD tho
i know
but it's faster to read yml on ssd then hdd
i've noticed it
on HDD you would lag
yes... but still slow
I can't find TabCompleter#onTabComplete. What you wrote is probably not for bungeecord. (I want to change which names it shows in /tell , /msg and /f )
but its still fucking ssd for nothing
you would get hdd if you want a laggy server..
i Meant, what you do know is just a pointless spend of resources and disk usage
Hello,
How set amount on ShapedRecipe
Nohow
public ShapedRecipe getCommonCobblestone() {
NamespacedKey key = new NamespacedKey(Main.getInstance(), "commonCobblestone");
ShapedRecipe recipe = new ShapedRecipe(key, commonItems.cobblestone());
recipe.shape("CC ", "CC ");
recipe.setIngredient('C', Material.COBBLESTONE);
return recipe;
}```
not possible
ow
but
there is a way
you need to make a listener and check if the amount is X
I don't remember the name of it
ty
Delete this or stay?
Regardless, an IO operation is in fact an IO operation and unlike a normal java bytecode instruction execution, IO stuff can take arbitrarily more time to execute due to that it has to go through a lot, therefore caching it is still considerably needed and wanted
ok
so the best thing is caching?
Yeah, caching it is probably what you want to do here
Can caching lead to memory leaks?
No not really
I mean you can run out of memory
But that does not inherently imply any memory leaks
public void drawCircle(Location loc, float radius) {
for (double t = 0; t < 7; t += 0.1) {
float x = radius * (float) Math.sin(t);
float z = radius * (float) Math.cos(t);
}``` how can i get what's inside the circle as well?
because, that's doing this, just the borders
i mean, just draw multiple circles lowerinf the radius?
Two nested for loops.
Iterate over X and Z.
Check for every Blocks middle the distance to the center.
bounds are +/- the radius of the circle
i'll try, thanks!
If you want an approach with better performance you can take a look at gauss circle problem:
https://en.wikipedia.org/wiki/Gauss_circle_problem
In mathematics, the Gauss circle problem is the problem of determining how many integer lattice points there are in a circle centered at the origin and with radius
r
{\displaystyle r}
. This number is approximated by the area of the circle, so the real problem is to accurately bound the error term descr...
why are you so smart
which free college did you go to in germany
is the education that good
in the us we get bread and frozen fishsticks for lunches
what do they feed yall
duck feet
I should look into a good sphere algorithm
hmm almost every uni in germany (if you study something in math/physics and something related to it) teaches you too much in math xD
also cafeteria is a dream for students since they give extra discount for students too
I study in munich. I can confirm that we have too much useless math...
Alright people so i have ```java
Label lblChips = new Label("Chips: " + player.getChip());
lblChips.setAlignment(Pos.TOP_RIGHT);
lblChips.setFont(Font.font(SMALL_FONT));
root.add(lblChips, 2, 0);
ok well munich is on a different level of math xD while other universitys just go BR they go like brrrrrrrrrrr
aw
bro im reading a mathoverflow post about the gauss circle problem
ah yes of course
wtf is that z
idk lol
i have no idea what any of the symbols mean
it looks scary af
i know the less than or equal but thats about it
or is that not a less than or equal because that makes no sense
with the variables x and y weird stuff follows ^^
I remember someone talking about that
But iirc they’re just two numbers that belong to the set of Z
ah aight i gtg
Gl
x and y are elements of Z squared
Maybe it could be the complementary notation
Something from set theory... would have to look that up. Second semester...
imagine learning so much math it looks like a different language
cardinality. So basically the number of elements in the given set
Countably infinite and uncountably infinite
Fuck that module
thats a new one
does someone have link to nms maven dependency ?
tada
is there a way to get the default name of an item stack?
as in the way it displays in-game
if it doesn't have a custom name
@torn shuttle This will display to the client whatever is in their Resource Pack
So that would display "Red Glazed Terracotta" if English is their current lang
that requires nms right
Not NMS no
wait where does CraftItemStack come from?
It imports a version specific bukkit class though
right
Yeah... :(
But afaik there's not a way to get the description ID of an ItemStack with just Spigot API
well... balls
how do i detect when a player switches from their right hand to their left hand?
PlayerSwapHandItemsEvent
Oh oh
you can choose right hand or left hand
PlayerChangedMainHandEvent?
okie
how would i use this?
Like you would any other event
Oh, probably need to lookup some basic Spigot tutorials then 😛
em
Yo can I also ask for development help in this channel in case I require help with Java in general? (Including JUnit)
Hi, is there a way to emulate Player for java tests(src/test)?
Sure
mock Bukkit (emulates an entire server including capability of mocking players)
Or: PrismarineJS
Hello, I would like to create the beacon light effect but I don't know where to start, can someone help me?
I use version 1.8.8
Question incase anyone knows. Whenever I spawn a bukkit entity I get that entities UUID and add it to a set. Though whenever I hit the exact same entity I print out that entities UUID and I get a different UUID?
@quaint mantle https://bukkit.org/threads/lib-beacon-creator.179399/
I had thought that it would only be the light and with packets
Is there any way to convert this garbanzo bean of javadocs to the more modern, searchable one?
@lethal coral crtl+f
not what I'm looking for
package index
indeed
however, I'm using 1.8.8 javadocs
1.8.8?
then.... not sure in a few cases the javadocs not show the search for... dont know why xd
in my research the "javadocs search feature" was added in jdk 9 and I'm pretty sure 1.8.8 uses java 8
I've also had to download the javadocs for offline use since there's no website that keeps them up from what I've searched
What can't you find with ctrl+f ? xd
it's just kind of annoying. the search feature makes it easy to search everything and see results with some description
How is it annoying? It seems pretty straight forward to ctrl+f
There certainly wouldn't be more than 3 or 4 results for what you're looking for and you could skim those easily
Inspect the page
there's literally no point in arguing lol. It's ready over with
Live your truth.
pls help
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
Attempting to build version: '1.17' use --rev <version> to override
Found version
{
"name": "3170",
"description": "Jenkins build 3170",
"refs": {
"BuildData": "3cec511b16ffa31cb414997a14be313716882e12",
"Bukkit": "fc92ca8dd3b37dbc440de9d61575af17226cb8f0",
"CraftBukkit": "ec116f636d55eccae1d5bb0b716b1db3b245ccab",
"Spigot": "a483d2c9d916d4d05ad0923f2c9472e3bac64bc8"
},
"toolsVersion": 128,
"javaVersions": [60, 60]
}
*** The version you have requested to build requires Java versions between [Java 16, Java 16], but you are using Java 17
*** Please rerun BuildTools using an appropriate Java version. For obvious reasons outdated MC versions do not support Java versions that did not exist at their release.```
Well do you have the newest version of bt? Also why not just jump down to java 16 (when installing)
how do i do that
Or just use 1.18 (:
like whats the command to run
needs to be 1.17 for what im doing
I have java 16 corrteto installed
Go to your system variables and change the java variable
make it point to the java 16 bin (wherever that folder might be located on your disk)
wheres that lmao
system varibles i mean
Environment variables is probably the better term for it
How Can I get all blocks between n2 locations? this is what I have now, but it doesn't seem to work
final Vector vec1 = loc.toVector();
final Vector vec2 = anotherLoc.toVector();
final Vector diff = vec1.subtract(vec2).normalize();
BlockIterator iterator = new BlockIterator(block.getWorld(), vec1, diff, 0.0d, (int) vec1.distance(vec2));
this is what I have now, but it is not working
Wym by get?
Iterate over a volume of blocks in an AABB both min and max points being inclusive?
I want iterate through all blocks on a ray between two locations. Like draw a line between 2 points, and iterate though all the blocks that touch that line
Oh
Any ideas?
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder().uri(URI.create("https://discord.com/api/v9/users/" + DiscordId)).header("Authorization ", "Bot token").build();
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(System.out::println)
.join();
JSONArray array = new JSONArray(HttpResponse.BodyHandlers.ofString());
if (array.length() == 1) {
JSONObject json = array.getJSONObject(1);
DiscordUserName = json.getString("username") + "#" + json.getString("discriminator");
}``` I think I did something wrong? Obviously token is replaced with an actual bot token inside of the code.
Got any errors?
That looks fine, although idr if vectors are mutable in bukkit
And also does it not iterate at all or what goes wrong?
It iderates through the blocks, but not the blocks I want, it always starts at 0, 0, 0 and iderators from there. I have no clue why
I think I figured it out. Let me test. I subtracted in the wrong order I think
not sure if it matters
It matters for the direction of the vector
target - base
Ah then that was it! thanks
what is wrong with if (noteBlock.getNote() == Note.flat(0, Note.Tone.G))
.equals or else you check for identity (the exact location in memory)
okay
hm, it seems like I can't copy paste my screenshot file here
you need to be verified to upload files
oh /:
Im running into some issues with an observer pattern and have a question.
ObjectThatHasAItemFrame object = new ObjectThatHasAItemFrame();
list.add(object);
object.getItemFrame().setItem(someItemStack);
list.remove(object);
This is just an example but basically im trying to figure out why an object is not being removed from the list, would the code above work? when the object containing an item frame variable has the item on the itemframe changed does the object before the change still equal the object after the item in the frame is changed?
I mean
changed it to if (noteBlock.getNote().equals(Note.Tone.G)) should that fix the issue?
No. Now you are checking if a Note is equal to a Tone. Which is never true.
hi,
im trying to launch a player backwards according to where they're facing
ive set the Y value in the vector to a specific height
if the player is facing straight up or down it just launches them up in the air without moving them away from the block
i want it to have a set amount of velocity when it pushes the player back
this is my current code
Vector vec = player.getLocation().getDirection().normalize().multiply(-1);
player.setVelocity(new Vector(vec.getX(), 0.6, vec.getZ()));
I just want to make lightning strike where the arrow lands
does anyone know what I'm doing wrong?
oh, can I use an event within an event?
oh, ok thank you Rack
alright I figured it out
thanks for the help
Just iterate over all players in the target world...
ok thanks I use forEach
hello
gow do i make a bossbar
i know bar = Bukkit.createBossBar(etc.)
and to add to player
but like it wont show up
this doesn't work either /:
It's just one event, I see no reason why it shouldn't work
Yikes
what?
yoinks
Jonathan do you register the listener instance?
yes
try Bukkit.getServer().getWorld("world").strikeLightning(location);
(class name) "Implements Listener"?
Use setVisible
i did that
whats the damage cause of Player#damage
public void createBar(){
bar = Bukkit.createBossBar("Bruh", BarColor.BLUE, BarStyle.SOLID);
bar.setVisible(true);
}
public void addPlayer(Player player){
bar.addPlayer(player);
bar.setVisible(true);
}```
Just go yell at them, honestly if some api maintainer fails at maintaining the api, they should be given the reward of being yelled at 
And where do you call those methods?
Then that’s the issue
good advice
sir
Your methods/instructions will not be called by themselves CS
You have to call them (usually from some command or event listener method)
🗣️ 💯
fax ong
can i do it here
getLogger().info("plugin enabled");
getServer().getPluginManager().registerEvents(new Listeners(), this);
}
@Override
public void onDisable() {
getLogger().info("plugin disabled");
}
}```
Uh yeah but there aren’t gonna be any players online unless there’s a reload when you do it there
I could think of just doing it during PlayerJoinEvent perhaps?
ah
Player p = e.getPlayer();
p.sendMessage(ChatColor.BLUE + "Wassgud " + p.getName() + " Reminder that PCJ on top.");
}```
so i can call the methods here
iirc custom
CS yeah
In principle
aight
And what does ::getMayor do?
returns Resident from capital
can you like show that code also?
Si
You need to learn Java
Lmfao
Don’t be rude
this is me learning Java
The issue you're having is quite obvious.
if() return true?
No, you’re trying to learn the spigot api
I'm also taking a course on Java
but it's boring and I try to use what I learn inbetween
A vector is never equal to an integer
Okay fair enough
@azure osprey
But you should try to learn the concept object orientation (and differentiate it from the semantics of Java)
Which most Java courses suck at doing
You need to read the warnings that you're getting from your IDE the issue you're having is highlighted
Player p = e.getPlayer();
p.sendMessage(ChatColor.BLUE + "Wassgud " + p.getName() + " Reminder that PCJ on top.");
bar.createBar();
bar.addPlayer(e.getPlayer());
bar.getBar();
}```
it aint working son
ong
?conventions
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
Tbf I have no clue what you’re doing CS
ong me too
Don't start your methods with a capital letter
what is this, c#?
me?
yes
the captial letter aint at da start doe
Yes, it is
return mayor;
}```
The start of the method name
i think i get whatcha mean doe
private Resident mayor;
Oh that’s weird
ah it’s mutable
if (!hasResident(mayor))
return;
this.mayor = mayor;
TownyPerms.assignPermissions(mayor, null);
}```
Which just sucks most of the time but kopselek might be the case the field is reassigned just so often
its weird
when mayor is online
it returns correct
else it return my other player
who is mayor but not of this instance
You just confused me
im confused too
So this other player is mayor also?
What is your actual err CS?
if(fractionOwner != "null") {
if(!manager.fileExists(directoryNations + "/" + name)) {
Nation nation = TownyUniverse.getInstance().getNation(name);
if(nation != null) {
System.out.println(nation.getName());
Resident king = nation.getKing();
System.out.println(king.getPlayer().getName());
System.out.println(Bukkit.getServer().getPlayer(king.getPlayer().getName()).isOnline());
if(Bukkit.getServer().getPlayer(king.getPlayer().getName()).isOnline()) {
info(resident.getPlayer(), "offert_send");
//oferta wysyla sie do gracza nwm czemu ale King to kurwa kazdy gracz czy jak to dziala idk
}else {
info(resident.getPlayer(), "is_offline");
}
} else {
info(resident.getPlayer(), "wrong_nation");
}
}else {
info(resident.getPlayer(), "have_fraction");
}
}```
there is my code
Then what the heck does setMayor do if there can be more than one!?
null as a string 😕
he is mayor
but from other instance
nah
only one mayor
possible
Ok
aint no error son
jsut the shi aint popping up
i get no compiler error or nun
the boss bar just int appearing
so mayor of town is one, where mayor of capital is king
so it return other king
ugh
Nation nation = TownyUniverse.getInstance().getNation(name); return correct nation
maybe i will try to get capital and then get mayor
Resident king = capital.getMayor();```
🤔
now it works
that was so weird
Programming at its finest
- this return null if mayor is offline
It should not return null if the mayor is offline
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because the return value of "com.palmergames.bukkit.towny.object.Resident.getPlayer()" is null
sure
of course, you are getting a Player not a resident
resident/mayors/kings are always available
Players are Bukkit objects
always
ok
With Towny you use Residents
Hey, I want to make a chat click event call a function, how would I go about do this java TextComponent Accept = new TextComponent(ChatColor.GRAY + " " + ChatColor.BOLD + "CLICK HERE " + ChatColor.GRAY + "to accept."); Accept.setClickEvent(doDuel(p, target)); Accept.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{new TextComponent(ChatColor.GREEN + "Click to accept duel request")}));
What exactly are you trying to do?
Via commands. You can write a delegation system with encrypted, random arguments
that seems silly, is there any other way?
find if king is online
Nope
Its the only workaround
alright ¯_(ツ)_/¯
`
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.NotePlayEvent;
public class Blockupdate implements Listener {
@EventHandler
public void onNotePlayEvent(NotePlayEvent event) {
event.setCancelled(true);
}
}
`
trying to cancel the event of a noteblock being played, dont see whats wrong
if i wanted to allow a player in a full server if they are on the whitelist, should i use PlayerLoginEvent? i could probably do something with AsyncPreLoginEvent but id rather have simple(r) access to a Player object
A player is blocked from connecting to a full server really early. You need to negotiate this kind of behavior in the
AsyncPreLoginEvent
then what purpose does PlayerLoginEvent serve
its not Deprecated so id imagine its used somewhere
I mean PreLogin is literally before login
why doesn't it want to work for me ): I fixed the vector .equals problem, I even took out static for that one guy
Hm im not sure if the PlayerLoginEvent is early enough for this. But you can certainly try.
their javadoc description is basically the same thing, save for AsyncPlayerPreLoginEvent saying... its async
Has anyone ever made a tool that can automatically upload a Spigot plugin jar from Gradle/Maven
Use PDCs to identify custom items
Yup
it’s done non blocking
I don’t remember the implementation sadly
Not quite. The one happens before the Login
^
then their docs are real vague here
Yeah
share similar fields and are both Stores details for players attempting to log in.
i dont think the wiki is of any help to me here
It explains what information client and server exchanged before, during and after login
C→S: Handshake with Next State set to 2 (login)
C→S: Login Start
S→C: Encryption Request
Client auth
C→S: Encryption Response
Server auth, both enable encryption
S→C: Set Compression (optional)
S→C: Login Success
ill just see when each event runs ig
something doesnt sit right about shared fields and methods
I dont understand what that means tbh
it makes me think theyre fired around the same time
"around the same time" sounds right
That’s strange
Pretty sure its not
1.8 is very old and unsupported
idk tell it to the source, not me
that shouldnt affect what im trying to do though
Where is the fun in that. Speculation is where it's at
lol... just write a quick plugin and sysout "bip" and "bup"
it looks like a fake player is created, in that calling PlayerLoginEvent
and if that event is successful, then calls AsyncPlayerPreLoginEvent
true
I need help. I need more cute dog pictures in my life
?lmgfy cute dog pics
well damn
Argh why did they remove this god command
maybe i didnt look at locations in stash very well
how would I be able to stop players from increasing the note on a noteblock
what event handles that
cancel an interact event?
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Listener() {
@EventHandler
public void onLogin(PlayerLoginEvent event) {
System.out.println("LOGIN: " + System.nanoTime());
}
@EventHandler
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
System.out.println("PRE_LOGIN: " + System.nanoTime());
}
}, this);
}
Resulting in
[GradleSpigotPlugin] [STDOUT] PRE_LOGIN: 29965234825400
[GradleSpigotPlugin] [STDOUT] LOGIN: 29965338829100
Hey Conclure how long have you been making plugins?
oh
Ah, you have lots of fun ahead of you
i guess if u dont need? the player object then PreLogin is the way to go, but since im just checking whitelist i might as well just get the player from the UUID in Pre
do you ever get stuck on something that by all metrics should work but still doesn't and it's not even complicated
I have
I see, well I'll get back to it then, later
Mostly when I try to design code before making it work
Sounds excellent
Behold: My good boi
Thoughts on making a Spigot plugin using Kotlin?
plenty of ppl do it

As good as doing it using Java
Kotlin has some cool features
I see (: How does one go about doing it? I had trouble following some of the tutorials
But both are in the same sandbox at the end of the day
any idea how i could go about stopping the player from changing the note on a noteblock?
Any recommended tutorials?
didnt i already say cancel interact event
https://www.baeldung.com/kotlin/data-classes
didnt see
Oops I meant setting up Spigot with Kotlin, not using Kotlin itself
Of course Java has them now too cause Java felt left out

?services
@EventHandler
private void onPreLogIn(AsyncPlayerPreLoginEvent event) {
if (event.getLoginResult() != AsyncPlayerPreLoginEvent.Result.KICK_FULL) return;
OfflinePlayer offlinePlayer = getPlugin().getServer().getOfflinePlayer(event.getUniqueId());
if (!offlinePlayer.isWhitelisted()) return;
event.allow();
}``` something like this should work then right? to allow a whitelisted player in a full server
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
?services
Sadly the discord does not yet possess a channel for such things although I proposed it long time ago
Could I ask why?
Because gradle supports kotlin really well
I don’t know how maven handles kotlin
But from what I’ve heard it’s scarce
i think maven has an archetype for it
how do i get the blockface opposited direction to a blockface?
I think its finally time for me to learn gradle and maybe use it in a project

Doesnt BlockFace have a getOpposite() method or something?
Hmm if anyone has used Kotlin here, does anyone have a tutorial they followed that worked?
getOppositeFace()
Its not much different than maven. Nobody has any idea how and why half of it works
and everyone just copies working examples from other people.
Two instances @little elm
Lol yeah gradle gets complicated if you wanna understand its entirety
thank you!
I think my main issue is that I have no clue how to set it up on my IDE (Intellij). For a Java spigot plugin, there are plenty of tutorials, and even an IntelliJ plugin that does everything for you
File | New Project | Gradle | Mark Kotlin DSL (at the very top) and Kotlin JVM (will be existing among the other alternatives lower down) |
That’s it (:
omg thank you LOL i really needed that
all the tutorials are in german for somer eason
lol
well this didnt work
still kicked me for full
I mean writing a spigot plugin is basically done like every other java application.
You add spigot as a dependency, then write code and compile it to a jar. Not much to it.
So if you know how to use kotlin with dependencies you also know how to write Spigot plugins with kotlin.
Hmm do you just mean downloading some Spigot jar, and then adding a line of code to build.gradle?
well ill be damned using PlayerLoginEvent did it instead 
dont even need to download anything. You just add the spigot dependency and you are good to go.
thank u bukkit u dont make sense to me rn
wow gotcha tyty
No. What doesnt work?
letting a player join if whitelisted and server is full
i thought i could just grab an OfflinePlayer from the UUID in the Async one
but that ended up not working
i could be grabbing the player incorrectly
Bukkit.getOfflinePlayer(uuid)
Didnt work?
Did it throw an exception?
Then there shouldnt be any problem. I think you need to handle the result of the async event a bit further
could i grab a Player object at that point? or would it have to be Offline
how else could i even handle it
quick q is there a way to add items to a player in a way that will drop them if the inventory is full without handling that case manually?
do remappings not exist for spigot 1.8.8?
no
nah
then what should I use
@EventHandler
public void onPreLogin(AsyncPlayerPreLoginEvent event) {
UUID userID = event.getUniqueId();
OfflinePlayer player = Bukkit.getOfflinePlayer(userID);
if (bypassingRestriction(player)) {
event.setLoginResult(Result.ALLOWED);
event.allow();
}
}
1.18
:mike:
oh i need to change the login result too?
So uh?
haha woops
lol
that doesn't help
u could just not use 1.8.8
once again, not solving my problem
1.8 is ancient and support was dropped a long time ago. Update to a version that people actually use.
I mean it does solve your problem?
It doesn't, as I want to use 1.8.8
yikes
Too old! (Click the link to get the exact time)
Then you are completely on your own. Nobody uses/supports that version.
Go search in old forum posts on Spigot.
Any suggestions you guys have as alternatives to gain that much access?
1.18
Thank you for your help!
Could just roll with 1.8.8 spigot mappings (still fuck 1.8.8 literally)
Where would those be?
Questiob how do I launch maven there's no exe and I am quite the literal idiot
Well just the jar itself
in the jar
ah, im real dumb, i was vaguely writing my code from what i remembered from https://www.spigotmc.org/wiki/bypassing-the-player-slot-limit/ lmao @lost matrix
its command line based
mvn
I saw there was a plugin by md-5 that I needed to use for maven for this to work. Will that work for 1.8.8?
nice
no. 1.17+ only
You don’t need to use it
By adding the spigot dependency, do you mean this? https://www.spigotmc.org/wiki/spigot-gradle/#build-gradle-kts
If so, I copied the lines in build.gradle.kts, but I got an error during build: Could not find org.bukkit:bukkit:1.18-R0.1-SNAPSHOT.
yikes
The highlighted one, yes?
Edit: figured it out
took me 10 seconds to find:
https://github.com/phase/MinecraftMappings
So how do I open maven?
Oh is this not supposed to be there lol.. i just followed that guide i linked
Use the spigot variant
Read the comments behind each dependency
Bukkit is cough obsolete
still didnt work
, kicked again
Well LoginEvent it is then
Yes you only need
compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT")
So I'm starting out with no experience whatsoever how do I get started for 1.16.5 since that's the server I'm using
?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.
?learnjava and
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.
?jd
?bt
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
?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!
Google your question before asking it:
https://www.google.com/
Thank you
?xy
Asking about your attempted solution rather than your actual problem
?stash
The mods: "fucking stop"
Such beautiful composition of commands
now that is how #help-development was meant to be used
Btw is there a list of commands?
not anymore
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
Use to be ?cc but it got disabled for some reason
Conclure?
?clean-code
l e a k e d
Hehe
?basics
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.
?details
Please provide your server version, relevant server logs ( https://paste.md-5.net/ ), a list of plugins, and what you've already tried doing.
Hmm that’d take quite a while
?cba 7smile7
Flo | Gestankbratwurst#4120 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
But maybe some day
?cba sativa
tiva#0001 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
Good point, I’ll consider doing it once I get some time over
pog
very pog
@quaint mantle 😲
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
: )
Bing your question before asking it:
https://www.bing.com/
?ddg
?duckduckgo

Yes Sam is real. I was not programmed to say this by Sam.
No, Choco is not real. I was not programmed to say this by Sam.
I gonna remember this
?codeblock
Old response to the ischocoreal was the best
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Gotten this far already
Lol
oh my god codeblock THATS SO USEFUL
did u run that in onedrive
true
That's off my desktop so yes?
but for small stuff code blocks are fine
what
i meant like the OneDrive folder
ive never seen the Status field before in explorer
how are yall sending images? i dont have an option for that on this channel particularly
verify
You need to verify
as long as u didnt run it in OneDrive folder
31,869 sync issues XD
we need like ?sendimage bot auto response lol
i do wonder what Status is though
to auto do responses for it lol
?picperms
Conclure u should add one
Neither did I
?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.
?readup
If you read up you might be able to find the answer to your question :)
?tas
aw it doesnt embed
?fixmuhlag
hang on
Hmm yeah, I’ll consider it, like that’ll be annoying to maintain
Just scrape them
Why not just
could just be the norm spigot and dont ever update it lol
Allow people to use ?cc list
what if u just added back a commands list for every1
Yeah lol
fr
Yeah maow
idk I don’t mess with permissions
That's sams job
Yup
is there something wrong with my directories? I get an error that my plugin.yml cannot be found.
... 15 more```
Your configuration is probably fucked
Build with Gradle not IntelliJ btw
^
Oh ok. Yeah I just use IntelliJ and Build Artifacts
This ignores everything gradle/maven related...
wow i am clueless
How would I do this?
uhh it's in settings I believe
but you should probably also add a configuration in the top right
that runs the build task from Gradle
on BlockBreakEvent
how do you get the BlockFace that the block was broken
i made @EventHandler public void onInteract(PlayerInteractEvent e) { if(e.getAction() == Action.LEFT_CLICK_BLOCK) { blockFaceTouched.put(e.getPlayer().getUniqueId(), e.getBlockFace()); } }
but that's kinda crappy
2 ways:
- Ray trace in the BlockBreakEvent
- get the interacted BlockFace from the PlayerInteractEvent
ray trace bruh that's so complicated XD
not really
Something like this is fine:
private final Map<UUID, BlockFace> faceMap = new HashMap<>();
@EventHandler
public void onInteract(PlayerInteractEvent event) {
faceMap.put(event.getPlayer().getUniqueId(), event.getBlockFace());
}
@EventHandler
public void onBreak(BlockBreakEvent event) {
BlockFace brokenFace = faceMap.get(event.getPlayer().getUniqueId());
// Do stuff
}
Or trace it
@EventHandler
public void onBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
RayTraceResult result = player.rayTraceBlocks(4.0);
if (result != null) {
BlockFace face = result.getHitBlockFace(); // Might still be null
}
}
ok so the most random thing just happened
a jetbrains rep hopped on my twitch stream while I was doing some dev work and gifted me a year sub with all of jetbrains products
can't be a student forever
Does anyone know what the hash is used for when sending a resource pack?
Why event.getPlayer().getStatistic(Statistic.MINE_BLOCK) is null?
To make sure that client and server have the same. If the hash matches then the client wont download it again but rather use its currently downloaded pack.
Because you need to pass a Material i believe
Or you didnt mine any blocks so far 😄
How would a client have a different rp hash?
If the server changed his rp or the client changed his rp
How to put Material ?
I dont... know what to answer. Just add it as a parameter to the method call...
@ivory sleet I did it! 🙂
I know I could test this, but are you aware if this would allow the player who has downloaded the pack to relog and not have to be sent the pack assuming the pack has not been changed on the server side?
Statistic.MINE_BLOCK.getType()?
I don't think a total for blocks mined is kept. You have to check the statistic per material, so like: Player#getStatistic(Statistic.MINE_BLOCK, Material.x)
Just checking:
Got it
?main
In the interact event, how would i test if the player is just breaking the block instead of interacting with it
use BlockBreakEvent or check if the event action is LEFT_CLICK_BLOCK
yo
how do i make the bars progress move contuniously
for bossbar
i tried this
if (line > 100){
line = 0;
}```
but dat shit dont work cuh
If I create a class that implements Listener, is it okay to create instances of that class in my code?
Look up runnables (BukkitRunnables) online. Right now, your loop is running on the same tick (time interval), so each progression that it makes will happen instantaneously and you wont be able to see it as a player. You need to use a runnable to run tasks on a timer every x ticks/seconds to have it spaced out like an animation.
I do that myself for my menu api, I would just say be careful what you are doing with your event handlers if you are going to make multiple instances of a listener class.
aight cuh
No candidates found for method call Bukkit.getScheduler().sheduleSyncRepeatingTask(this, new Runnable() { public void run(){ line = line - time; if(line =0){ count++; line = 1.0; } } }).
aw hell naw...
Does anyone have a good method to force a resource pack but also kick a player with a message if they haven't accepted the resource pack? I'm currently listening to ResourcePackStatusEvent and PlayerJoinEvent to send the resource pack and then see the status, then I have a runnable running 2.5 seconds later to see if the player has accepted the resource pack. This does not seem to work on servers where players may have bad ping. For example, it works on my test server (0ms) but not a server hosted in Germany while I am in the us (100+ ms). It seems that if I kick a player before they fully load in, it gives them an "IOexeption" message instead of my kick message, which is where I am going wrong. Any ideas?
You'll need to show your actual code instead of just the error message
u right...
all of it?
public void cast(){
int task = 0;
double time = 1.0/30;
bar.setProgress(line);
task = Bukkit.getScheduler().sheduleSyncRepeatingTask(this, new Runnable() {
public void run(){
line = line - time;
if(line <=0){
count++;
line = 1.0;
}
}
},0,20);
}```
Don't do new Runnable()
And the way you set that up, it'll be running once per second, I believe
It's also not updating the bar
It's just changing the value of the variable, but you have to call bar.setProgress again
You want:
what do you mean by this?
i changed the variable because thats what the bars progress takes
Bukkit.getScheduler().scheduleSyncRepeatingTask(pluginHere, () -> {
line -= time;
if (line <= 0) {
count++;
line = 1;
}
bar.setProgress(line);
}, 0, 20);```
bar.setProgress(line)
The reason I put pluginHere and not this is because this is only a valid value to pass there if you're in your plugin main class - if you're not, you will need to get an instance of the plugin
aight cuh
lemme test this shit out
dam son
my whole bar dissapeared
oh wait.
i didnt call the function
thats why
nvm cuh
even with it called my bar is gone
ong
how would I go about changing the hardness of a block
You wouldn't
ok
As in it's not filled, or it's not there at all?
not there at all
You can't do it directly, but you can send the player various block cracking animations to imitate a block taking longer to break
a bit tedious but I'm sure there are threads about it online
Are you adding the player to the bar
I have to add them again?
cuz the bar worked before
bar.addplayer(e.getPlayer());
}```
ive had this
and its working
If the server is reloaded then online players will not be sent the new boss bar
Or if the bar is created while players are already online
Ill try to see if I can find something on that
I get this error when my plugin loads up https://paste.md-5.net/owelevihax.bash, and the file that has the error code is https://paste.md-5.net/ejonejofaq.js. Obviously I removed the sensitive stuff such as bot token and database connection link from the code link.
Line 21 of FastStats is new hookeddiscordexpansion(this).register(); btw.
Looks like it relies on a library, Bson, that's not loaded at runtime
And how do I fix this?
Shade it or load it at runtime
Would System.loadLibrary("bson"); work?
Maven.
loadLibrary is for native libraries, bson is not a native library.
any idea on how to disable punching in a world
i dont want players in my parkour to punch eachother off
Just cancel entity damage entity event
yea but i have a hunter with a bow that should be able to shoot them :/
check if they are the hunter
Then only cancel it for the players parkouring
