#help-development
1 messages · Page 1925 of 1
yes
Because you're running it async and returning before it's finished.
Use CompletableFutures
um and how
data is probably null, what is that?
looks complicated 'CompletableFutures'
It's not, the method names are just confusing. You guys should lookup some tutorials on how to use them.
any yt tutorial
to recommend
I don't know of any, just will have to look around probably.
I hate yt is not showing
dislikes
You can't know which tutorials are good any more
😂
The official documentation gives more than enough information
that is, not enough information should be given
but I want to know
I need to know how multiverse is ticking
Why
Send the full LinkCommand class
You shouldn't know exactly what will happen to an operation, who will call it, etc.
Why are you defining another data field in that class?
because i need the data thing dont i
so i need DiscordSync.data ?
Yes
I mean you can instantiate another one if you wish but there's really no reason to do that.
You need the DiscordSync instance
DiscordSync.getInstance().data
Yeah because it's not the type.
do you know what is a monad
for (i = 27; i < 63; i+=1) {}
// the same content
for (i = 26; i > -1; i+=-1) {}
// the same content
so im having refactoring problems
so i need to get it a diffrent way?
i have two for loops which do the same thing but for two different starting and endpoints
No
No... SQLGetter is the type, just set data equal to the DiscordSync data.
how can i refactor the second condition of for loop expression
if you understand monads, you will understand completablefutures, and optional, and streams etc. though not all of them follow the exact laws of monad
they all use similar patterns
can you explain it? its fine if you cant ill google it but you're a good teacher
Nono, SQLGetter data = DiscordSync.getInstance().data;. SQLGetter is the type, the DiscordSync.getInstance().data is the value.
Refactor to what
the code inside for loop
the code inside both of the for loops the same
only the for loop expression differ
Yeah sure that would work
its a wrapper around the typed variable
Are you wanting your IDE to modify the code inside the for loop dovidas? I'm not really sure what you're asking for. Why should the code inside be different
Can you have multiple scoreboard tags of the same value
Like could I give someone the tag 'FAT' 5 times
monads have 3 laws that defines it: left identity, right identity and associativity. You can search them up, it takes a lot of time to explain clearly
but why would they named it monad it just sounds silly
it sounds like a greek god or smth
It sounds like they wanted to name it money and then had a stroke half way through typing it
Actually it is greek
The term "monad" in programming actually goes all the way back to the APL and J programming languages, which do tend toward being purely functional. However, in those languages, "monad" is only shorthand for a function taking one parameter (a function with two parameters being a "dyad", and so on).[19]
yea, but in java it is literally just a wrapper
Optional<T> is a monad
correction
Future<T> is a monad
it isn't, but close
why it is not
ExecutorService threadpool = Executors.newCachedThreadPool();
Future<Long> futureTask = threadpool.submit(() -> factorial(number));
while (!futureTask.isDone()) {
System.out.println("FutureTask is not finished yet...");
}
long result = futureTask.get();
threadpool.shutdown();
ooo
but how to do that with a bukkit runnable
it doesn't obey the identity laws, strictly speaking
WAIT
CompletableFuture<Long> completableFuture = CompletableFuture.supplyAsync(() -> factorial(number));
while (!completableFuture.isDone()) {
System.out.println("CompletableFuture is not finished yet...");
}
long result = completableFuture.get();
there's even an example on wikipedia using Maybe<Decimal> as an example:
fn divide(x: Decimal, y: Decimal) -> Maybe<Decimal> {
if y == 0 { return Nothing }
else { return Just(x / y) }
}
i dont need bukkit if i just use it like that
which corresponds in java to Optional<>
i can just do async tasks with that right
Maybe is a monad here because it can accept null
theres a method to get it as a string
Remove the TextComponent
ur casting textcomponent to a string
Should be able to, yes
Oh is this a Bungee plugin?
because you're using overloaded addition operator
Yes
that's why
it automatically parses your textcomponent as string
since internally StringBuilder is used
or StringBuffer
i dont remember
so i just remove Text Component
remove + discord_id and see if that would work temporarily
removing Text Comonent worked
🤷♂️
?paste
but you should really use components to send text nowadays
especially if you want to make hover tooltips
alr so
try {
return completableFuture.get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
return 0;
}
ok
is something like this possible in java?
int i = 65;
condition k = i == 65 ? (i < 63) : (i > -1);
or wait
i want to store the conditions themselves
Predicate?
@hasty prawn should I make my method a CompleteableFuture or do i just return the cf with .get()
like return completableFuture.get();
or
return completableFuture;
Don't use get() unless you want to freeze the Thread
so .get() in the main thread?
Return the CompletableFuture itself and then complete it once you have the Integer
oh ok
If you plan to freeze the entire server, sure 
Hi guys! I was struggling to find a packet to teleport an EntityPlayer to a location, can anyone please tell me how is that packet named? Thanks
THEN WHAT
sorry caps
i mean then where
Why don’t just use the api
Option A: Return the cf
i did
?
Bukkit run task async something
what you gonna do with it
send it in a message
wha
I tried using the teleportTo method, but it just doesn't work : (
Version? Error? Stacktrace?
Predicate<Integer> predicate = ((i == 65) ? ((k) -> k < 63) : ((k) -> k > -1));
Is this what you're talking about?
i also use it here:
preparedStatement.setInt(1, (getStat(player, statType).get() + value));
but its ran in async
No error, it just doesn't teleport at all
so it prob wont matter
?xy maybe you want to use nms to teleport instead of fixing the issue with the api?
Asking about your attempted solution rather than your actual problem
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
1.17
for example
CompletableFuture<String> message = database.getMessage(); // Whatever you did to get the future
message.thenAccept(str -> player.sendMessage(str));
int iq = 0
thenAccept(n -> i);
me:
will that work
i'm using this method
i'm not sure if the blockposition requires some sort of thing
no, thenAccept accepts a consumer, not a function
i'm using the location x y and z to make a new one
AtomicInteger i = new AtomicInteger();
getStat(player, statType).thenAccept(i::set);
u think this will work?
yes
pogger
if getStat returns CompletableFuture<Integer>
yes it does
then yes
no
ok
just need to know that these cfs operate silently and you won't even know if they fail, unless you do whenComplete to handle exceptions
but i think for now you don't have to care about that
Is There A Way To Make Strings Like This?
Guys can anyone help me please?
yes
ah
?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!
ty
I can wait, but I asked because I needed a quick answer, if I need to wait I can just search up myself... I'm already searching for this answer but an answer will be very liked as I don't really want to wait an entire day for an answer that maybe isn't even possible
Hey! Im currently making a custom coaster plugin. Im storing armorstands in a custom class. and im detecting when someone clicks the armorstand and then triggering a custom event. The problem is. once the armorstands get unloaded. my listener doesnt work anymore. i think this has to do with the armorstands changing identity. Is it better if I store the UUIDs of the armorstands instead?
whats the question
What do you even want
I'm trying to teleport an EntityPlayer to a certain location
but i'm struggling finding a packet or some method
ahhh
how do i do both a String and a Int in a public string
i'm relatively new to this server, how do i need to send it? like normal plain text?
player#teleportAndSync() ? @midnight shore
btw why do u do stuff like that
just
addLinked()
or variableName
only use _ when you're making constants
LIKE_THIS
//for(Player p : Bukkit.getOnlinePlayers()) {
//PlayerConnection connection = ((CraftPlayer)p).getHandle().b;
//npc.teleportTo(npc.getWorldServer(), loc);
//connection.sendPacket(new PacketPlayOutEntityVelocity(npc));
//}
npc.teleportAndSync(loc.getX(), loc.getY(), loc.getZ());
}
public static void rotateEntityAroundPlayer(EntityPlayer npc, Player p) {
final float radius = (float) 1.5;
final float radPerSec = (float) 10;
final float radPerTick = radPerSec / 20f;
new BukkitRunnable() {
int tick = 0;
public void run() {
++tick;
final Location center = p.getLocation();
Location loc = getLocationAroundCircle(center, radius, radPerTick * tick);
loc.setY(loc.getY() - 1);
moveEntityToLocation(npc, loc);
}
public Location getLocationAroundCircle(Location center, double radius, double angleInRadian) {
double x = center.getX() + radius * Math.cos(angleInRadian);
double z = center.getZ() + radius * Math.sin(angleInRadian);
double y = center.getY();
Location loc = new Location(center.getWorld(), x, y, z);
Vector difference = center.toVector().clone().subtract(loc.toVector()); // this sets the returned location's direction toward the center of the circle
loc.setDirection(difference);
return loc;
}
}.runTaskTimer(Main.getInstance(), 0L, 1L);
}``` this are called from an Event Move
?paste
you're not alone in this channel
I asked how to send it 😅
and you said like this
nvm i was stupid
never forced you to answer or flood
now its not ok? 🤣
Then? I pasted now?
and there are, I got one
thank you for giving me false information sir
in fact i found 2 websites that are really good
I found them by asking someone else btw
Actually it is your fault for being an asshole
your common sense is wrong
It's not common to help someone then go to them telling them "you ask stupid questions"
grow up
if you dont wanna help somebody, then dont
This deviates from the actual purpose of this channel guys.
now that i pasted this, what do i do?
some EntityPlayer precisely to a location
do i allways have to return from an sql query
OOPS
use ```java
```
public void tpNPC(EntityPlayer npc, double x, double y, double z) {
npc.setLocation(x, y, z, npc.yaw, npc.pitch);
PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport(npc);
for (Player p : Bukkit.getOnlinePlayers()) {
PlayerConnection connection = ((CraftPlayer)p).getHandle().b;
connection.sendPacket(packet);
}
}```
@midnight shore
here you go
ty trying rn
is it possible that at the moment you're looping over the online players, a player joins and so you dont pick him?
FINALLY!
:)
ty!!!
if he joins he will be added to the player list
and its unlikely that he will spawn in a location where the npc is rendered
and if he joins in that EXACT moment
then ig
idk
also to equip the EntityPlayer i need to use PacketPlayOutEntityEquip right?
yes
iirc it has changed between versions in the past
it’s ? extends Player to be precise
Since the underlying collection constructs the type CraftPlayer for the type parameter
Tho fourteen brush what r u trying to achieve
ok
nerd :O
i am
Sheesh
thing is, the notion of order was a bit ambiguous when the api was implemented
Should it represent chronological connection or by some alphabetical order?
not the guys who have a gf
🐮
do you have a gf 
very indeed much like that
the homies always there to give u a night kiss
in my distant past, ye
Uff
just you dont have **true **homies

right why do i hate mysql again
postgre is just better 
pretty good if we presuppose you use it justifiably (mongo)
also do i need an actual file object to get the absolute path from?
or is there some fancy trick with Files.idkWhat
toAbsolutePath 😌
Does SQLite need a driver?
i guess it dont bcs i never configured it
what is this number?
But you need extra library? cuz if use MySQL with JDBC i need a dependency called MySQL-Connector
That my dude
Files.toAbsolutePath? cant find it
What trying to do?
use this:
File file = new File(plugin.getDataFolder(), "database.h2");
if (file.existst()) {
file.createNewFile();
}
String url = "jdbc:sqlite://" + file;
Is there a diff between German and American Decimalformat?
i'm on 1.17 but it says int in the help menu so i think it is some type of amount, i guess?
, is US?
wha-
Read the whole code i sent
ah yo edited it
Path::toAbsolutePath
Yes i accidentaly press enter
German is . Too
h2 handles creating the file, i dont have to matter around that
The objectively superior interface to the File class
ty
Ahh allright
meh then i still have to make a file object
i guess there is no other way
i cant get the database file without making a file
wat
how can i get the absolute path if i dont have a file object to request it
?
Try this:
File file = new File(plugin.getDataFolder(), "database.h2");
if (!file.existst()) {
System.out.print("H2 file doesnt exists");
return;
}
String url = "jdbc:h2:file://" + file;
How to get dropped item number?
nvm i guess
Fix it?
fix what?
Your problem
thats what im trying to do yes
Try what i send
want to get which and how much items player has dropped on PlayerDropItemEvent
File::toString returns the path not sure if jdbc strings can handle that tho
?jd
getItemDrop().getItemStack().getAmount()
Read the docs about PLayerDropItemEvent
thanks
heh i think it wont work
@ivory sleet this should work
Idk why he doesnt try it
I have just test it and worked with Sqlite
That looks somewhat underdeveloped but perhaps
i was trying to get the absolute path without creating a file object 💀
h2 db file
?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!
when i .get() in an async thread
I have this config.
gameLocations:
1:
lobby:
x: 0
y: 0
z: 0
pitch: 0
yaw: 0
world: world```
I'm trying to read the 1: section (there will be multiple in the future). I can't work it out.
This returns []
```java
ConfigurationSection section = main.getConfig().getConfigurationSection("gameLocations");
Set<String> locations = section.getKeys(false);
System.out.println(locations);```
the connector handles creating the file so i dont have to worry about creating it
Ask all together dont send every message in dfferent line
ok
Stop spamming. You are not paying for getting support every time. You should be pacience
"spamming" said it twice
you're not closing your ps either
im getting database info async and iim using completable futures but when i .get() later in another async thread, it just says "CompletableFeature ..some gibberish [NotCompleted]"
wew
u prepare the statement and never execute it
any ideas for my problem?
i belive i waited enough time to repost. Thanks for your constructive opinion
wait fuck
Thanks ❤️
Hi guys! its still me! 😅. Any idea of how does this works?
CompletableFuture::join 😄
A questions is its possible to use T param without using it on ClassName<T> ?
how should it work? ._.
Talking to me right?
yo, u any good with configs?
ye verano
Me yes
nah just defualt spigot library
I have my own file handler, do you want it?
reading configs
I mean
i just wanna use spigot inbuilt
its rpretty basic, i thought anyway. im having a lot of trouble w it
I just usually just design some object relational mapping
Its really easy to use. And basically its an implementation of YamlConfiguration
this is my question if anyone has any ideas
anyways Verano are you aware of type erasure?
how do i get the top role a player has. Do i need to use luckperms api
yes they do
Im using this interface for my databases. And i wanna take the T out of ClassName<>
Wait photoshop doesnt open
This is. Im implementing it on MongoDB handler and Mysql handler
anyways verano point is
tell me 💀
Cuz if i take out ClassName<T> i cannot use T getModel() its tell an error
That why i was asking if there another way of doing it
man i just get ignored screw this server fr 💀
List<Map<String,Collection<Map.Entry<Boolean,Class<?>>>> list = new ArrayList<>();
that ^ becomes just
List list = new ArrayList();
when compiled
which is why we need sth like Class<T> to get the type awareness
since merely T gets erased
I dont have problems using it like that. I was only asking if there was another way
is there anyway to damage an entity with a source of player
ah right
LivingEntity::damage iirc
atomics?
im not talking about that tho
I need to provide a source
If you are asking why using T getModel()? its because MongoDB and MySQL return different objects. That why
i was making an atomicboolean and stuff
and I need that source to be a player without having a player
why would you need a source?
Guys how does the Pair thing works? https://paste.md-5.net/yapukutiyo.cs
hmm yeah that's justifiable arguably
because I need it so if the entity dies it will react like if a player killed it
specify "it will react"
for example
like dont use any java concurrent framework class unless you really need it, atomic reads and writes are expensive
if you kill a mob it will drop exp but if the mob dies by natural causes (fall damage etc) it wont
hm?
that's because your question/issue is a bit unclear
how do i get the roles a player has
cant find anything that makes sense on forum
go to luckperms discord
i am they are slow af lol
I was thinking maybe there is a way to create a fake player or smth
you told us you want a spigot config class jordie? there's a univocal answer to that, which is YamlConfiguration (but that didnt seem to be satisfactory to you)
Conclure this is how i implement the method in my mysql handler
interesting
I mean, personally I'd make a higher abstraction verano
but looks cool
so??
right i already wrote a lp impl
look use this and for the possiblegroups use their usermanager
https://luckperms.net/wiki/Developer-API-Usage#finding-a-players-group
So them i can just do:
Database<ResultSet> mysql = DatabaseFactory.getInstance().mysql();
mysql.insert("sql query here");
Database<T> = Interface for handling mysql and mongo
DatabaseFactory = Singleton that manages creations
mysql() = Method for getting and creating instance of mysql (if it doesnt exists)
mongo() = Method for getting and creating instance of mongo (if it doesnt exists)
oh right
i would have a static factory method which takes a db type (enum)
Id have sth else
to make a db class thing
Up to know this way its working
it doesnt work mongo
Im getting an error from logger api
idk it fuck me a lot that error
To check for an interaction with a sign. Should I use playerInteractEvent or is there a more efficient method?
PIE is correct
PIE isnt a an Abstract class?
Idk who tell me here that PIE its an abstract class and should not be used
Anyone know how I would change the Damage delay in 1.18 to be reverted to 1.8.9? Without hosting a 1.8.9 server available for newer versions to play?
basically be able to spam click on 1.18 ?
Yea
Without the decrease of damage
I wont lie i would do plugins using 1.17 api. But i cannot support using JDK 17 and the mappings are like bug
Idk I am use to Bedrock so I am just learning. ¯_(ツ)_/¯
So its your first time creating java plugins i suppouse
Basically yea. I made two, but tutorials. Changed it a bit but yea first time
I can understand what I did. I just don't know how to expand lol
I dont know about bedrock or mcpe. I dont know how you create plugins
But i have played mcpe servers
(I am on Java 1.18, I just came from Bedrock)
Ah allright
Java no, it will Spigot 1.18
well yea Spigot
Cuz java last version its Java 17
Its different
So i dont have any clue, i never worked with 1.8x spigot
yea
scary
I would use 1.8.9 but the movement is so garbage
thats with compiler optimizations?
How can I change the KB so it stops sucking players towards the ground?
u could use OldCombatMechanics plugin
so 16 seconds
ye
Link?
lmao
String.format is obv slow
Google your question before asking it:
https://www.google.com/
but thought + was acc optimized more
i'd like to see the difference with MessageFormat.format
maybe a little better as it doesnt care about types
format doesnt care either depending on how u use it
Any idea if this can be optimized?
optimized as?
Cause currently the check is made with any interaction. Would that be too costly?
yuh
well
we should make premature optimizations (mostly)
such as these ones
first try
if its slow, then optimize basically
Hey
I have a problem with my plugin, it starts and messages the console when ready and when unloading but it doesn't work until I use plugman to reload it
package playertracker.playertracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import playertracker.playertracker.utils.color;
public final class PlayerTracker extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
System.out.println(" ");
System.out.println(color.translate("&aPlayerTracker listo!!!"));
System.out.println(" ");
}
@Override
public void onDisable() {
System.out.println();
System.out.println(color.translate("&aAdiós D:"));
System.out.println();
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(color.translate("&e" + player.getName() + " ha entrado al servidor."));
}
@EventHandler
public void onLeave(PlayerQuitEvent event) {
Player player = event.getPlayer();
event.setQuitMessage(color.translate("&e" + player.getName() + " ha abandonado el servidor."));
}
}```
strange
Plugman 😦
it probably has already broken some stuff
you sure not display when close server?
try replace the System.out for the plugin logger
plugwoman 
Logger logger = Bukkit.getLogger();```
no
so offensive they haven't thought about woman
use your plugins logged
ok lemme try that
this.getLogger()
they have
there's another plugin for that?
wait what :kekw:
wth
Yes anyhow those types of plugins are notoriously known for causing weird, unpredictable behavior
well
not suprised as how 2022 is going
Tho I believe Red’s plugin is a bit better than plugman
use getLogger().info("moo") in your main class
yea
how to set color for particles (CLOUD)?
localhost 🌝
it's a localhost 🌝
my testing server is localhost 🌝
Red? the python not?
Doc
yeah not the python framework thing
any one?
he is i think
I was once a prime subscriber from conter
and I liked the server
he's a good dev from the user's pov
you sure?
Particle.DustOptions pdo = new Particle.DustOptions(Color.GREEN,1);
world.spawnParticle(Particle.REDSTONE, loc, 1, 0, 0, 0, 0,pdo);```
pdo = Particle Dust Options
lol
kk wait
world.spawnParticle( Particle, location , count, offsetX, offsetY, offsetZ, data);
it need to be something like that
the offsetx/y/z its like the movement of the particle
it is
do you know what's the problem?
or it's like one of those rare diseases
much better than sysout
why?
What are you trying to do crazy fish
Makes it hard to help you if you don't know what you're trying to achieve lol
i dont need help
just print cows to console
A question
Is Connection#preparedStatemetn#WhatMethod() for returning the updated line when executed sql code?
executeQuery returns a ResultSet with all the updated rows
Yeah but a friend told me that it was a method that return the amount of lines updated
Not the data from the table
I'm not sure what it's called if there is one, you'd have to look at PreparedStatement docs
or shall i return rs
yep
Yes
ExecuteUpdate = update without returning anything
ExecuteQuery = execute and return data
doesnt execute returns the amount of records affected?
And there was a method that return only the update rows numbers
Returns:
an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.```
do you know best way to do this
So executeBatch its used to update something on table right?
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The int elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeBatch may be one of the following:
A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
A value of SUCCESS_NO_INFO -- indicates that the command was processed successfully but that the number of rows affected is unknown```
wew CompletableFuture<Optional<ChatChannel>>
Wth
like users not being in database while they should
package playertracker.playertracker;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import playertracker.playertracker.utils.color;
import java.util.logging.Logger;
public final class PlayerTracker extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
System.out.println(" ");
System.out.println(color.translate("&aPlayerTracker listo!!!"));
System.out.println(" ");
}
@Override
public void onDisable() {
System.out.println();
System.out.println(color.translate("&aAdiós D:"));
System.out.println();
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(color.translate("&e" + player.getName() + " ha entrado al servidor."));
}
@EventHandler
public void onLeave(PlayerQuitEvent event) {
Player player = event.getPlayer();
event.setQuitMessage(color.translate("&e" + player.getName() + " ha abandonado el servidor."));
}
}
I have problems with this code
Or when a file does not exist and you try to open it
it won't work until I use /Plugman reload plugin
any one know how to YEET a player?
Stop using plugman 🥲
Oh no, java.util.logging.Logger
no 🥲
player.yeet()
They told me to use it above but I deleted it from my code
I want to fix the main problem first
As long as it does not include Logger.getLogger("Minecraft") it is fine, but it is a red flag for me
lol
I ain't using logger
I want to fix the issue
idk why it doesn't work when servers starts
I need to reload it with plugman for working
package playertracker.playertracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import playertracker.playertracker.utils.color;
public final class PlayerTracker extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
System.out.println(" ");
System.out.println(color.translate("&aPlayerTracker listo!!!"));
System.out.println(" ");
}
@Override
public void onDisable() {
System.out.println();
System.out.println(color.translate("&aAdiós D:"));
System.out.println();
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
event.setJoinMessage(color.translate("&e" + player.getName() + " ha entrado al servidor."));
}
@EventHandler
public void onLeave(PlayerQuitEvent event) {
Player player = event.getPlayer();
event.setQuitMessage(color.translate("&e" + player.getName() + " ha abandonado el servidor."));
}
}
better?
anyone know why the line is throwing me an error?
@ivory sleetcan you help me? (sorry for the ping :) );
error:
'runTaskTimerAsynchronously(org.bukkit.plugin.Plugin, long, long)' in 'org.bukkit.scheduler.BukkitRunnable' cannot be applied to '(me.rockorbonk.candor.laptevsorder.LaptevsCommands, int, long)'
stop using plugman
your this refers to your command class or something
hm
lemme check smth rq
._.
LaptevsOrder plugin;
public LaptevsCommands(LaptevsOrder laptevsOrder) {this.plugin = laptevsOrder;}```
you just have to check if your class extends JavaPlugin
guys what are your conventions on doing one line if statements
use plugin instead of this
ok but help with the actual error
I did
i switched to using {} now :C
why
whats the bungeecord version of
Bukkit.getServer().getPluginManager().getPlugin("name").getDataFolder(),"config.yml"
i thought it was bad practice
i feel like they're great if there's only one line of code inside it scope
if (clickedStackElement) return true;
else if (slotAmount == 0 && airSlot == -1) return false;
although smth like this feels weird
i especially like them for using as clause guards
return clickedStackElement ? true : slotAmount != 0 && airSlot != -1
kekw smth like that
yea
but there's code
below
that's just a guard
more like
optimisation
since i don't need to execute the code below in order to achieve my goal
aha
I did check for it
still an error
show me a screen
if you're using dependency injection to access your plugin's instance that would mean your class doesnt extends JavaPlugin
use plugin instead of this
but LaptevsOrder is the main class which does extend javaPlugin
just do what i said
yikes
i made my code longer
by saying that im gonna refactor this couple hours ago
but it should be faster
is the spigot website running super slow for anyone else?
still error
fast as a bullet
mm nop
1.1.1.1 
what.. is the error?
yeah now it's good
saw that
same error
1.1.1.1
1.0.0.1
?paste the class @hollow sand
best dns ever
used google dns before
cloudflares are faster
smh anything else?
i really don't like how microsoft buying out every game publishers rn
that's just monopoly
including mojang
but hey
they fucked it up with discord
imagine if they've turned discord into skype
they introduced the profile banner
that was the disaster already
🥶
you feel like there's a monopoly on game studios of all things?
skype's code is used my microsoft teams
didnt discord give them a flat out :bugsbunnyno:
than the rewrite
that's just ridicilious
you can't even change hotkeys
on skype
anymore
its just that trash
idk what that would mean 😊
im not a native speaker 😳
they declined it
nor am i 😐
because community was enraged
good on them
about acquisition
10 billion dollars
i would've taken the deal
if i was the ceo
that's more than Mojang was bought at that time
microsoft fucks up things, that's a fact
they haven't fucked up github yet
they dont dare
cuz their own people rely on it
they haven't fucked up java edition either
eeeh
if they ever take github im making my own
most 1.8 peeps would disagree
😔
Biggest disasters for microsoft were:
Windows ME, Windows Vista, Windows 8, Skype, Project Spartan (Edge Legacy), UWP (Deprecated already), Windows Phone, Windows 11 launch
i liked it when my file explorer
memory leaked
I wish my biggest disasters resulted in me still have multibillion dollar products at the end of the disaster
:whAT:
maybe you're using build system
?
do you use gradle or maven?
hmm
How can I detect right click on block?
PlayerInteractEvent
okok
?jd
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
this should work?
Looks good to me
HoverEvent si deprecated?
I am coding it everything in main.java
getServer().getPluginManager().registerEvents(this, this);
so this works for everyone
?main oh no
am I right?
you should create a class for each listener
waaaaaiiiit
It isn't named main.java
dont call your main class main
not really
why is that?
nah
thats just really inefficient storage wise
its a mess if youve just got listen this listen that in the main class
its totally unreadable imo
yeah ofc
It's a small plugin
i have a playerlistener, vault listener etc.
but you dont need to create a class for each listener
create a class for listeners
Storage wise? A listener class will be like a few kB at most
a listener class sure they said a class for each listener
So
so it could be a ton of classes
unless your stuff is closed source an no one's there to complain about it it's always better to do a class for each listener
I still need to clean up my listener system a bit
wouldn't that be better than having to look for the right one in tons of methods in the main class?
I mean yeah I just prefer to have a class for each system instead of each listener
since a system can have like a lot of listeners and its easy to just look for the system
can you check if player is opped on asyncpreloginevent?
No
You won’t have a player instance yet
You will have a uuid though, which you could manually compare against ops.json
yeah
u would think :sadge:
then
wait nvm my issue was with getLoginResult
how do i get uuid list from json
?paste
read the file
convert it to a json array
If it’s just a uuid list you can do it in one line with gson
https://paste.md-5.net/sociticoja.cs
lets say i have 2 for loops. Their contents are identical but iteration is not the same, how can i extract the inner contents of the for loop? Its a code smell because this shit breaks DRY principle (don't overthink the backwards for loop expression, it the way i write it, it looks weird)
Actually I think it’s two lines, whatever
Just copy the inner contents into a method?
imagine having three lines :O
The inner contents of the loop is like 10 lines?
i was thinking to do it like this
Copy it into it’s own method with an int param
i was thinking about the option to set the i, j, k values of a for loop too, but the middle expression needs to flipped and i cant find a way to do that algorithmically, since you can't save unevaluated conditions on the variables
int i = 0, j = 0, k = 0;
if (itemSlot < stackSlots.length) {
i = ...
j = ...
k = ...
} else {
i = ...
j = ...
k = ...
}
for (; i < j; i+=k) {}
smth like this
but i need i < j to be flipped in order for this work
anyone here knows about ChunkGenerator and smooth biome transitions?
im looking for a method that colorizes strings and doesnt care about if its either hex or normal chat colors
talking about colorization, i would love to to know why tf community invents new standards to specify the hex colors inside the configs
Like to set wellLocation to those coords
Can you guys help me with this?
to make it blend in with the existing color codes
it makes it ugly
;-;
?jd-spigot
Look at the location constructor
Or just remove all the stuff in brackets if you want a block location
Please just use components
whats the problem
yea use components in config files?
yes write parser or use a ready one
i have problems in the biome transition, i tried using Linear interpolation but i doesn't make any idea of how to use that
goodnight 
im trying for many hours, and nothing
do you want to get a "normal" looking biome placement ?
Yeah
what version ?
1.8.8
have fun
im using 1.8 for the faster, but the ChunkGenerator will be in 1.18.1
yeah, but my pc explodes when i use 1.18 🤯
yeah, has changed
so... what you recommend me to make smooth biomes transitions in 1.18?
adapt the vanilla biome noise generation
So I am using this code to detect when entity is destroyed when player goes out of rander distance
@Override
public void onPacketSending(PacketEvent e) {
Player p = e.getPlayer();
PacketContainer packet = e.getPacket();
Entity entity = manager.getEntityFromID(p.getWorld(),packet.getId());
p.sendMessage(entity.getName());
}
});```
works on armorstands but not player
players dont get destroyd maybe
I just noticed that
not even pigs
what packet I could listen for then
to detect when player is out of render distance
maybe no packets since its easy to do with api
well how
?runnable
Bukkit.getOnlinePlayers ?
I need to do that for every player
then check location: same world and distance
I mean I am doing it that way
but preformance
is a problem
I need to do it few times a second for every player
do you remove something when the player gets out of range ?
and thats needed 10 times a second ?
nms
why not check it every 10s
well to look smooth yes
but the player is out of the view anyway ?
if player goes out of range backpack gets droped
Is there a better way to add strings other than +
StringBuilder
and it look weird some entity sitting there
Well... what do you mean "better"
There are situations where a string builder is best but others where it's just nonsensical
but you cant see them since they are to far away or not ? ... if a player changes world or leaves there are also events
Depending on use case you can use a string formatter as well
do you maybe know how I could detect when player is out of view distance
by packets
View distance is determined on the client. Not really possible afaik, at least not off the top of my head
- server view distance as well
are u sure I think there is in spigot.yml option to set distance for players
@EventHandler
public void onWellClick(PlayerInteractEvent event) {
if (event.getAction() == RIGHT_CLICK_BLOCK) {
Player player = event.getPlayer();
World world = player.getWorld();
Location clickedLocation = event.getClickedBlock().getLocation();
Location wellLocation = new Location(world, -1197, 70, -1060);
System.out.println(clickedLocation + " | " + wellLocation);
if (clickedLocation == wellLocation) {
player.sendMessage("Chi");
}
}
}```
but players dont get removed i think ... they have to be there because of the TAB ... if no EntityDestroyPacket is sended there is probably no packet
?ban @nova pulsar
?kick @nova pulsar Compromised account
Oh
It isn't sending me "Chi"
Oh
Location{world=CraftWorld{name=world},x=-1197.0,y=70.0,z=-1060.0,pitch=0.0,yaw=0.0} Location{world=CraftWorld{name=world},x=-1197.0,y=70.0,z=-1060.0,pitch=0.0,yaw=0.0}
Although it's the same loc
are we merely kicking them? Choco, everyone handles these accounts differently
Lol I usually just kick because they're compromised 9 times out of 10
i ban them
Ah fair enough
if they recover their account they can appeal (my way of seeing it)