#help-development

1 messages · Page 1925 of 1

grim ice
#

why does this always return 0

#

no matter what

naive bolt
#

yes

hasty prawn
grim ice
#

shit

#

how do i fix it

hasty prawn
#

Use CompletableFutures

grim ice
#

um and how

wary harness
#

I would like to know how to use it to

#

xd

hasty prawn
wary harness
#

looks complicated 'CompletableFutures'

hasty prawn
hasty prawn
#

I don't know of any, just will have to look around probably.

wary harness
#

I hate yt is not showing

#

dislikes

#

You can't know which tutorials are good any more

#

😂

hardy swan
#

The official documentation gives more than enough information

#

that is, not enough information should be given

hardy swan
#

the thing about cf is

#

you shouldn't really know exactly how it works

wary harness
#

I need to know how multiverse is ticking

hasty prawn
hardy swan
#

You shouldn't know exactly what will happen to an operation, who will call it, etc.

hasty prawn
naive bolt
#

because i need the data thing dont i

hasty prawn
#

You do but you need the one from Main

#

Not a new one

naive bolt
#

so i need DiscordSync.data ?

hasty prawn
#

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

naive bolt
#

Unknown class: 'data'

#

but i defined it

hasty prawn
#

Yeah because it's not the type.

hardy swan
mortal hare
#
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

naive bolt
mortal hare
#

i have two for loops which do the same thing but for two different starting and endpoints

grim ice
hasty prawn
mortal hare
#

how can i refactor the second condition of for loop expression

hardy swan
# grim ice No

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

grim ice
#

can you explain it? its fine if you cant ill google it but you're a good teacher

hasty prawn
#

Nono, SQLGetter data = DiscordSync.getInstance().data;. SQLGetter is the type, the DiscordSync.getInstance().data is the value.

mortal hare
#

the code inside for loop

#

the code inside both of the for loops the same

#

only the for loop expression differ

hasty prawn
#

Yeah sure that would work

mortal hare
hasty prawn
#

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

restive mango
#

Can you have multiple scoreboard tags of the same value

#

Like could I give someone the tag 'FAT' 5 times

hardy swan
mortal hare
#

but why would they named it monad it just sounds silly

grim ice
#

it sounds like a greek god or smth

hasty prawn
#

It sounds like they wanted to name it money and then had a stroke half way through typing it

grim ice
#

Actually it is greek

mortal hare
#

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]

hardy swan
#

yea, but in java it is literally just a wrapper

mortal hare
#

Optional<T> is a monad

hardy swan
#

correction

mortal hare
#

Future<T> is a monad

hardy swan
#

it isn't, but close

mortal hare
#

why it is not

grim ice
#

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

mortal hare
#

it wraps around the typed variable

#

why it is not a monad

hardy swan
#

it doesn't obey the identity laws, strictly speaking

grim ice
#

WAIT

#

CompletableFuture<Long> completableFuture = CompletableFuture.supplyAsync(() -> factorial(number));
while (!completableFuture.isDone()) {
System.out.println("CompletableFuture is not finished yet...");
}
long result = completableFuture.get();

mortal hare
#

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) }
}
grim ice
#

i dont need bukkit if i just use it like that

mortal hare
#

which corresponds in java to Optional<>

grim ice
hardy swan
grim ice
#

theres a method to get it as a string

hasty prawn
#

Remove the TextComponent

grim ice
#

ur casting textcomponent to a string

hasty prawn
naive bolt
#

it says depreciated on one

#

but not the other

hasty prawn
#

Oh is this a Bungee plugin?

mortal hare
#

because you're using overloaded addition operator

naive bolt
#

Yes

mortal hare
#

that's why

#

it automatically parses your textcomponent as string

#

since internally StringBuilder is used

#

or StringBuffer

#

i dont remember

naive bolt
#

so i just remove Text Component

mortal hare
#

remove + discord_id and see if that would work temporarily

naive bolt
#

removing Text Comonent worked

hasty prawn
#

🤷‍♂️

mortal hare
#

I thought you're gonna use that textcomponent for a purpose

#

but ok

grim ice
#

?paste

undone axleBOT
mortal hare
#

but you should really use components to send text nowadays

#

especially if you want to make hover tooltips

grim ice
#

is this correct

#

uh

hasty prawn
#

No

#

Thats gonna freeze

#

Return the completableFuture

grim ice
#

alr so

#

try {
return completableFuture.get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
return 0;
}

#

ok

mortal hare
#

is something like this possible in java?

int i = 65; 
condition k = i == 65 ? (i < 63) : (i > -1);
grim ice
#

or wait

mortal hare
#

but without evaluation

#

i don't want to evaluate condition values

grim ice
#

am i supposed to return the completeable future or the get

#

value

mortal hare
#

i want to store the conditions themselves

hasty prawn
#

Predicate?

grim ice
#

@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;

hasty prawn
grim ice
#

so .get() in the main thread?

hasty prawn
#

Return the CompletableFuture itself and then complete it once you have the Integer

grim ice
#

oh ok

hasty prawn
mortal hare
#

.get() would make the thread wait until the task was done

#

TPS = 0

hardy swan
#

for which you must as well not use cf

#

no, im wrong

#

but yea, don't

midnight shore
#

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

grim ice
#

sorry caps

#

i mean then where

hardy swan
grim ice
#

i did

midnight shore
quaint mantle
grim ice
#

but like

#

later when i get the value

#

i have to ALSO async it

#

??

hardy swan
#

what you gonna do with it

grim ice
#

send it in a message

hardy swan
#

no need to sync

#

#thenAccept(Consumer<String>)

grim ice
#

wha

midnight shore
quaint mantle
#

Version? Error? Stacktrace?

hasty prawn
grim ice
#

but its ran in async

midnight shore
grim ice
#

so it prob wont matter

quaint mantle
#

?xy maybe you want to use nms to teleport instead of fixing the issue with the api?

undone axleBOT
quaint mantle
#

?notworking

undone axleBOT
#

"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.

midnight shore
#

1.17

hardy swan
# grim ice wha

for example

CompletableFuture<String> message = database.getMessage(); // Whatever you did to get the future
message.thenAccept(str -> player.sendMessage(str));
grim ice
#

ok then

#

int i = 0;

hardy swan
#

int iq = 0

grim ice
#

thenAccept(n -> i);

grim ice
grim ice
midnight shore
#

i'm using this method

#

i'm not sure if the blockposition requires some sort of thing

hardy swan
midnight shore
#

i'm using the location x y and z to make a new one

grim ice
#

AtomicInteger i = new AtomicInteger();
getStat(player, statType).thenAccept(i::set);

#

u think this will work?

hardy swan
#

yes

grim ice
#

pogger

hardy swan
#

if getStat returns CompletableFuture<Integer>

grim ice
#

yes it does

hardy swan
#

then yes

grim ice
#

is there a shorter way

#

an extremely short way

hardy swan
#

no

grim ice
#

ok

hardy swan
#

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

grim ice
#

Is There A Way To Make Strings Like This?

midnight shore
#

Guys can anyone help me please?

hardy swan
grim ice
#

uhh what is it

#

please be short

hardy swan
#

commons lang

#

WordUtils is the one you want

grim ice
#

ah

quaint mantle
undone axleBOT
#

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!

grim ice
#

ty

midnight shore
#

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

thick tundra
#

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?

midnight shore
#

I'm trying to teleport an EntityPlayer to a certain location

#

but i'm struggling finding a packet or some method

thick tundra
#

ahhh

naive bolt
#

how do i do both a String and a Int in a public string

midnight shore
#

i'm relatively new to this server, how do i need to send it? like normal plain text?

undone axleBOT
thick tundra
#

player#teleportAndSync() ? @midnight shore

grim ice
#

btw why do u do stuff like that

#

just

#

addLinked()

#

or variableName

#

only use _ when you're making constants

#

LIKE_THIS

midnight shore
#
        
        //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
undone axleBOT
grim ice
#

you're not alone in this channel

midnight shore
#

I asked how to send it 😅

midnight shore
#

and you said like this

naive bolt
grim ice
#

never forced you to answer or flood

midnight shore
#

now its not ok? 🤣

grim ice
#

you dont want to answer -> dont answer

#

stop me :D

midnight shore
grim ice
#

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

quaint mantle
#

This deviates from the actual purpose of this channel guys.

grim ice
#

okay do not answer

#

I dont wanna bring this long

midnight shore
#

now that i pasted this, what do i do?

grim ice
#

so you want to teleport somebody

#

to somewhere

midnight shore
naive bolt
#

do i allways have to return from an sql query

midnight shore
grim ice
#

OOPS

tardy delta
#

use ```java
```

grim ice
#
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

midnight shore
#

ty trying rn

tardy delta
#

is it possible that at the moment you're looping over the online players, a player joins and so you dont pick him?

midnight shore
#

FINALLY!

grim ice
#

:)

midnight shore
#

ty!!!

grim ice
#

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

tardy delta
#

what kind of collection is Bukkit.getOnlinePlayers?

#

ordered?

midnight shore
#

also to equip the EntityPlayer i need to use PacketPlayOutEntityEquip right?

ivory sleet
#

However that’s an implementation detail

ivory sleet
#

iirc it has changed between versions in the past

tardy delta
#

hmm yea but it wouldnt cause any problems i guess

#

._. are you kidding me

ivory sleet
#

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

midnight shore
tardy delta
#

nothing, i was just thinking

#

good for the brain 🤓

grim ice
tardy delta
#

i am

quaint mantle
#

Sheesh

ivory sleet
#

thing is, the notion of order was a bit ambiguous when the api was implemented

grim ice
#

arent we all considered nerds somehow?

#

Not everyone

ivory sleet
#

Should it represent chronological connection or by some alphabetical order?

tardy delta
#

not the guys who have a gf

ivory sleet
#

gfs are overrated

tardy delta
#

🐮

grim ice
#

homies are enough :O

tardy delta
#

do you have a gf uwu

ivory sleet
#

very indeed much like that

grim ice
#

the homies always there to give u a night kiss

ivory sleet
quaint mantle
grim ice
#

just you dont have **true **homies

ivory sleet
tardy delta
#

right why do i hate mysql again

ivory sleet
#

postgre is just better shrug

tardy delta
#

ah because its slow and it has problems

#

what about mongo

#

i didnt say anything

ivory sleet
#

pretty good if we presuppose you use it justifiably (mongo)

tardy delta
#

also do i need an actual file object to get the absolute path from?

#

or is there some fancy trick with Files.idkWhat

ivory sleet
#

toAbsolutePath 😌

sterile token
#

Does SQLite need a driver?

tardy delta
#

i guess it dont bcs i never configured it

midnight shore
#

what is this number?

sterile token
#

But you need extra library? cuz if use MySQL with JDBC i need a dependency called MySQL-Connector

#

That my dude

tardy delta
sterile token
tardy delta
#

not making a file object for just getting the absolute path

sterile token
# tardy delta

use this:

File file = new File(plugin.getDataFolder(), "database.h2");
if (file.existst()) {
   file.createNewFile();
}
String url = "jdbc:sqlite://" + file;
quaint mantle
#

Is there a diff between German and American Decimalformat?

midnight shore
#

i'm on 1.17 but it says int in the help menu so i think it is some type of amount, i guess?

quaint mantle
#

, is US?

sterile token
#

Read the whole code i sent

tardy delta
#

ah yo edited it

ivory sleet
sterile token
quaint mantle
#

German is . Too

tardy delta
#

h2 handles creating the file, i dont have to matter around that

ivory sleet
#

The objectively superior interface to the File class

midnight shore
#

ty

tardy delta
#

i guess there is no other way

ivory sleet
#

no you dont?

#

Path has static factory methods

tardy delta
#

i cant get the database file without making a file

ivory sleet
#

wat

tardy delta
#

how can i get the absolute path if i dont have a file object to request it

paper viper
#

?

sterile token
#

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;
warm light
#

How to get dropped item number?

tardy delta
#

nvm i guess

sterile token
tardy delta
#

fix what?

sterile token
tardy delta
#

thats what im trying to do yes

sterile token
warm light
#

want to get which and how much items player has dropped on PlayerDropItemEvent

tardy delta
#

File::toString returns the path not sure if jdbc strings can handle that tho

hasty prawn
sterile token
#

Read the docs about PLayerDropItemEvent

warm light
ivory sleet
#

FourteenBrush

#

I'm still utterly bemused what you're actually trying to do here

tardy delta
#

heh i think it wont work

sterile token
#

Idk why he doesnt try it

#

I have just test it and worked with Sqlite

ivory sleet
#

That looks somewhat underdeveloped but perhaps

tardy delta
#

i was trying to get the absolute path without creating a file object 💀

ivory sleet
#

thats very possible

#

or well what file specifically?

tardy delta
#

h2 db file

grim ice
#

im getting database info async and iim using completable futures

#

but

undone axleBOT
#

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!

grim ice
#

when i .get() in an async thread

sinful kelp
#

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);```
tardy delta
#

the connector handles creating the file so i dont have to worry about creating it

grim ice
#

when i get in async thread

#

therit

#

then it

sterile token
grim ice
#

ok

sterile token
#

Stop spamming. You are not paying for getting support every time. You should be pacience

naive bolt
#

"spamming" said it twice

tardy delta
#

you're not closing your ps either

grim ice
#

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]"

ivory sleet
#

yikes get

#

I'd honestly advocate join

tardy delta
#

wew

sinful kelp
#

u prepare the statement and never execute it

sinful kelp
naive bolt
grim ice
#

wait fuck

naive bolt
grim ice
#

i forgot to .get()

#

im a complete idiot

sterile token
#

Haha

#

Dont worry Hex

#

It doesnt only happens to you

midnight shore
#

Hi guys! its still me! 😅. Any idea of how does this works?

ivory sleet
sterile token
#

A questions is its possible to use T param without using it on ClassName<T> ?

tardy delta
#

how should it work? ._.

ivory sleet
#

yuh

#

basically a type token

sterile token
sinful kelp
ivory sleet
#

ye verano

sterile token
ivory sleet
#

good configs?

#

like libraries?

sinful kelp
#

nah just defualt spigot library

sterile token
sinful kelp
#

reading configs

ivory sleet
#

I mean

sinful kelp
#

i just wanna use spigot inbuilt

#

its rpretty basic, i thought anyway. im having a lot of trouble w it

ivory sleet
#

I just usually just design some object relational mapping

sterile token
sinful kelp
ivory sleet
#

anyways Verano are you aware of type erasure?

naive bolt
#

how do i get the top role a player has. Do i need to use luckperms api

ivory sleet
#

not necessarily

#

depends of they use luckperms obviously

naive bolt
#

yes they do

sterile token
#

Wait photoshop doesnt open

#

This is. Im implementing it on MongoDB handler and Mysql handler

ivory sleet
#

anyways verano point is

tardy delta
sterile token
#

That why i was asking if there another way of doing it

sinful kelp
#

man i just get ignored screw this server fr 💀

ivory sleet
#
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

sterile token
#

Okay so theres no solutionm

#

Im ogblised to use like that righ?

ivory sleet
#

yes

#

tho its not an issue?

#

I mean every instance of the class Class is a singleton

sterile token
#

I dont have problems using it like that. I was only asking if there was another way

red sedge
#

is there anyway to damage an entity with a source of player

ivory sleet
#

ah right

red sedge
#

but without having a player

#

so it will be a non existing player?

tardy delta
#

LivingEntity::damage iirc

grim ice
#

pog

ivory sleet
#

atomics?

red sedge
#

I need to provide a source

sterile token
# ivory sleet ah right

If you are asking why using T getModel()? its because MongoDB and MySQL return different objects. That why

grim ice
#

i was making an atomicboolean and stuff

red sedge
#

and I need that source to be a player without having a player

tardy delta
#

why would you need a source?

midnight shore
ivory sleet
ivory sleet
#

for what purpose?

red sedge
tardy delta
#

specify "it will react"

red sedge
#

for example

ivory sleet
#

like dont use any java concurrent framework class unless you really need it, atomic reads and writes are expensive

red sedge
#

if you kill a mob it will drop exp but if the mob dies by natural causes (fall damage etc) it wont

tardy delta
#

ah

#

is there no way to overwrite that?

red sedge
#

hm?

ivory sleet
naive bolt
#

how do i get the roles a player has

tardy delta
#

cant find anything that makes sense on forum

tardy delta
naive bolt
#

i am they are slow af lol

red sedge
#

I was thinking maybe there is a way to create a fake player or smth

tardy delta
ivory sleet
#

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)

sterile token
#

Conclure this is how i implement the method in my mysql handler

ivory sleet
#

interesting

#

I mean, personally I'd make a higher abstraction verano

#

but looks cool

tardy delta
#

right i already wrote a lp impl

sterile token
#

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)

ivory sleet
#

oh right

tardy delta
#

i would have a static factory method which takes a db type (enum)

ivory sleet
#

Id have sth else

tardy delta
#

to make a db class thing

ivory sleet
#

but yeah

#

whatever u prefer tbf

#

time will tell

sterile token
#

it doesnt work mongo

#

Im getting an error from logger api

#

idk it fuck me a lot that error

elder oyster
#

To check for an interaction with a sign. Should I use playerInteractEvent or is there a more efficient method?

ivory sleet
#

PIE is correct

sterile token
#

PIE isnt a an Abstract class?

#

Idk who tell me here that PIE its an abstract class and should not be used

proper marlin
#

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?

sterile token
proper marlin
#

Without the decrease of damage

sterile token
#

I wont lie i would do plugins using 1.17 api. But i cannot support using JDK 17 and the mappings are like bug

proper marlin
sterile token
proper marlin
#

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

sterile token
#

I dont know about bedrock or mcpe. I dont know how you create plugins

#

But i have played mcpe servers

proper marlin
sterile token
sterile token
proper marlin
#

well yea Spigot

sterile token
#

Cuz java last version its Java 17

#

Its different

#

So i dont have any clue, i never worked with 1.8x spigot

proper marlin
#

yea

tardy delta
proper marlin
#

I would use 1.8.9 but the movement is so garbage

ivory sleet
tardy delta
#

yea

#

how many ms are there in a second again?

ivory sleet
#

1000

#

m = 1/1000

#

or well

proper marlin
#

How can I change the KB so it stops sucking players towards the ground?

buoyant viper
tardy delta
#

so 16 seconds

ivory sleet
#

ye

proper marlin
tardy delta
#

lmao

ivory sleet
#

String.format is obv slow

dusk flicker
#

?google

undone axleBOT
ivory sleet
#

but thought + was acc optimized more

tardy delta
#

i'd like to see the difference with MessageFormat.format

#

maybe a little better as it doesnt care about types

ivory sleet
#

format doesnt care either depending on how u use it

elder oyster
ivory sleet
#

optimized as?

elder oyster
#

Cause currently the check is made with any interaction. Would that be too costly?

ivory sleet
#

no

#

just use an if statement

#

that'll stop code execution

elder oyster
#

Yes yes, just wanted to confirm

#

Thanks a lot

ivory sleet
#

yuh

#

well

#

we should make premature optimizations (mostly)

#

such as these ones

#

first try

#

if its slow, then optimize basically

terse ore
#

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."));


    }
}```
shy wolf
#

strange

ivory sleet
#

Plugman 😦

tardy delta
#

it probably has already broken some stuff

late sonnet
opal juniper
#

plugwoman chefskiss

shy wolf
terse ore
opal juniper
#

use your plugins logged

terse ore
#

ok lemme try that

tardy delta
#

this.getLogger()

opal juniper
terse ore
opal juniper
shy wolf
#

wait what :kekw:

tardy delta
#

wth

terse ore
#

wait what x2

#

wth x2

ivory sleet
#

Yes anyhow those types of plugins are notoriously known for causing weird, unpredictable behavior

terse ore
#

well

opal juniper
#

it’s redempts

#

yeah for sure

terse ore
#

not suprised as how 2022 is going

ivory sleet
#

Tho I believe Red’s plugin is a bit better than plugman

terse ore
#

going to the logger thing

#

what does it work for?

tardy delta
#

use getLogger().info("moo") in your main class

terse ore
#

1 sec

#

on enable should be fine?

tardy delta
#

yea

shy wolf
#

how to set color for particles (CLOUD)?

terse ore
#

compiling 🟢

#

firck my pterodactyl wants to make some trouble

#

cries

tardy delta
#

localhost 🌝

terse ore
#

it's a localhost 🌝

shy wolf
#

my testing server is localhost 🌝

late sonnet
opal juniper
#

lol no

#

redempt

terse ore
opal juniper
#

yeah not the python framework thing

terse ore
#

You sound me from smt

#

idk if it's you but are you conterstines developer?

shy wolf
terse ore
#

srry man

#

no

opal juniper
#

dust particles

#

you can’t for that

#

but you can use dust particles

opal juniper
terse ore
#

I was once a prime subscriber from conter

#

and I liked the server

#

he's a good dev from the user's pov

shy wolf
#

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

shy wolf
#

cant

#

its have to be an obj

tardy delta
shy wolf
#

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

terse ore
#

or it's like one of those rare diseases

tardy delta
#

much better than sysout

terse ore
#

why?

shy wolf
#

nop

#

wait

#

i cant stream ther

hasty prawn
#

What are you trying to do crazy fish

shy wolf
#

idk

#

lol

hasty prawn
#

Makes it hard to help you if you don't know what you're trying to achieve lol

shy wolf
#

i dont need help

tardy delta
#

just print cows to console

shy wolf
sterile token
#

Is Connection#preparedStatemetn#WhatMethod() for returning the updated line when executed sql code?

hasty prawn
#

executeQuery returns a ResultSet with all the updated rows

sterile token
#

Yeah but a friend told me that it was a method that return the amount of lines updated

#

Not the data from the table

hasty prawn
#

I'm not sure what it's called if there is one, you'd have to look at PreparedStatement docs

young knoll
#

executeUpdate iirc

#

Return an array or some class that contains multiple values

naive bolt
#

or shall i return rs

shy wolf
#

yep

sterile token
#

ExecuteUpdate = update without returning anything
ExecuteQuery = execute and return data

tardy delta
#

doesnt execute returns the amount of records affected?

sterile token
#

And there was a method that return only the update rows numbers

tardy delta
#
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.```
naive bolt
sterile token
tardy delta
#
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>>

ivory sleet
#

Wth

tardy delta
#

imma leave that optional behind

#

still better than throwing exceptions i guess

ivory sleet
#

I mean

#

Exceptions are better when it comes to exceptional cases

tardy delta
#

like users not being in database while they should

terse ore
#
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

ivory sleet
terse ore
#

it won't work until I use /Plugman reload plugin

shy wolf
#

any one know how to YEET a player?

ivory sleet
#

Stop using plugman 🥲

quiet ice
shy wolf
hasty prawn
terse ore
#

I want to fix the main problem first

quiet ice
#

As long as it does not include Logger.getLogger("Minecraft") it is fine, but it is a red flag for me

shy wolf
terse ore
#

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?

hollow sand
#

anyone know why the line is throwing me an error?

shy wolf
hollow sand
tardy delta
#

stop using plugman

tardy delta
hollow sand
#

lemme check smth rq

tardy delta
#

._.

hollow sand
#
LaptevsOrder plugin;

    public LaptevsCommands(LaptevsOrder laptevsOrder) {this.plugin = laptevsOrder;}```
tardy delta
#

you just have to check if your class extends JavaPlugin

mortal hare
#

guys what are your conventions on doing one line if statements

tardy delta
#

use plugin instead of this

terse ore
tardy delta
mortal hare
#

why

naive bolt
#

whats the bungeecord version of
Bukkit.getServer().getPluginManager().getPlugin("name").getDataFolder(),"config.yml"

tardy delta
#

i thought it was bad practice

mortal hare
#

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

tardy delta
#

return clickedStackElement ? true : slotAmount != 0 && airSlot != -1

#

kekw smth like that

mortal hare
#

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

tardy delta
#

aha

hollow sand
#

still an error

torn shuttle
#

always cancel early

#

or exit early in general

tardy delta
hollow sand
tardy delta
#

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

hollow sand
tardy delta
#

just do what i said

mortal hare
#

yikes

#

i made my code longer

#

by saying that im gonna refactor this couple hours ago

#

but it should be faster

torn shuttle
#

is the spigot website running super slow for anyone else?

hollow sand
mortal hare
#

fast as a bullet

mortal hare
#

for me

#

check your dns

torn shuttle
#

yeah

#

rerouting now

#

I guess it's just being racist against portuguese connections

tardy delta
#

1.1.1.1 uwu

tardy delta
torn shuttle
#

yeah now it's good

tardy delta
#

saw that

hollow sand
mortal hare
#

1.1.1.1
1.0.0.1

tardy delta
#

?paste the class @hollow sand

undone axleBOT
mortal hare
#

best dns ever

tardy delta
#

used google dns before

mortal hare
#

cloudflares are faster

torn shuttle
#

inb4 cloudflare gets bought out by google

#

then killed

tardy delta
#

smh anything else?

mortal hare
#

i really don't like how microsoft buying out every game publishers rn

#

that's just monopoly

#

including mojang

#

but hey

tardy delta
#

they fucked it up with discord

mortal hare
#

imagine if they've turned discord into skype

tardy delta
#

they introduced the profile banner

mortal hare
#

that was the disaster already

tardy delta
#

🥶

torn shuttle
tardy delta
#

skype's code is used my microsoft teams

mortal hare
#

Estonia's version of Skype go brrrrrrrr

#

older version of skype had more features

visual tide
mortal hare
#

than the rewrite

#

that's just ridicilious

#

you can't even change hotkeys

#

on skype

#

anymore

#

its just that trash

tardy delta
visual tide
#

that

mortal hare
#

yea

#

they did

tardy delta
#

im not a native speaker 😳

mortal hare
#

they declined it

visual tide
#

nor am i 😐

mortal hare
#

because community was enraged

visual tide
#

good on them

mortal hare
#

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

tardy delta
#

microsoft fucks up things, that's a fact

mortal hare
#

they haven't fucked up github yet

tardy delta
#

and they should stop doing that 😂

#

oh god no

visual tide
#

cuz their own people rely on it

torn shuttle
#

they haven't fucked up java edition either

visual tide
#

eeeh

tardy delta
#

if they ever take github im making my own

visual tide
#

most 1.8 peeps would disagree

tardy delta
#

😔

mortal hare
#

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

torn shuttle
#

I wish my biggest disasters resulted in me still have multibillion dollar products at the end of the disaster

visual tide
mortal hare
#

maybe you're using build system

visual tide
#

?

mortal hare
#

do you use gradle or maven?

visual tide
#

gradle

#

im trying to build jd-gui

mortal hare
#

hmm

terse ore
#

How can I detect right click on block?

tardy delta
#

PlayerInteractEvent#getAction

#

write a listener for it

visual tide
terse ore
#

okok

visual tide
#

?jd

visual tide
terse ore
#

this should work?

young knoll
#

Looks good to me

tardy delta
#

yes dont forget to register it tho

#

also early returns 👊

red sedge
#

HoverEvent si deprecated?

terse ore
#

I am coding it everything in main.java

#

getServer().getPluginManager().registerEvents(this, this);

#

so this works for everyone

tardy delta
#

?main oh no

terse ore
#

am I right?

visual tide
#

you should create a class for each listener

terse ore
#

waaaaaiiiit

visual tide
#

and

#

please

terse ore
#

It isn't named main.java

visual tide
#

dont call your main class main

terse ore
#

it's just for you to know it is the main file :p

red sedge
terse ore
#

why is that?

tardy delta
#

nah

red sedge
#

thats just really inefficient storage wise

visual tide
#

its a mess if youve just got listen this listen that in the main class

#

its totally unreadable imo

red sedge
#

yeah ofc

terse ore
#

It's a small plugin

tardy delta
#

i have a playerlistener, vault listener etc.

terse ore
#

I have 2 listeners

#

no more

red sedge
#

but you dont need to create a class for each listener

red sedge
young knoll
#

Storage wise? A listener class will be like a few kB at most

red sedge
young knoll
#

So

red sedge
#

so it could be a ton of classes

visual tide
#

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

young knoll
#

I still need to clean up my listener system a bit

visual tide
red sedge
#

since a system can have like a lot of listeners and its easy to just look for the system

terse ore
#

How can I set a variable to a block

#

like to give some coords and get a block loc

onyx fjord
#

can you check if player is opped on asyncpreloginevent?

young knoll
#

No

#

You won’t have a player instance yet

#

You will have a uuid though, which you could manually compare against ops.json

onyx fjord
#

yeah

buoyant viper
#

u would think :sadge:

onyx fjord
#

then

buoyant viper
#

wait nvm my issue was with getLoginResult

onyx fjord
#

how do i get uuid list from json

mortal hare
#

?paste

undone axleBOT
buoyant viper
#

convert it to a json array

young knoll
#

If it’s just a uuid list you can do it in one line with gson

mortal hare
#

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)

young knoll
#

Actually I think it’s two lines, whatever

#

Just copy the inner contents into a method?

tardy delta
#

imagine having three lines :O

mortal hare
#

that's inside the switch case

#

its a big method

#

to be exact - 155 lines

young knoll
#

The inner contents of the loop is like 10 lines?

mortal hare
young knoll
#

Copy it into it’s own method with an int param

mortal hare
#

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

final monolith
#

anyone here knows about ChunkGenerator and smooth biome transitions?

tardy delta
#

im looking for a method that colorizes strings and doesnt care about if its either hex or normal chat colors

terse ore
#
Location wellLocation = block.getLocation(100, 90, 100);```
#

How can I make this?

mortal hare
#

talking about colorization, i would love to to know why tf community invents new standards to specify the hex colors inside the configs

terse ore
#

Like to set wellLocation to those coords

mortal hare
#

some use xml like styling

#

some use &#FFFFFF

#

some {FFFFFF}

tardy delta
#

i do #ffffff

#

why putting a & infront thp

mortal hare
#

to make it obvious

#

for noobs

terse ore
mortal hare
#

to make it blend in with the existing color codes

tardy delta
#

it makes it ugly

terse ore
#

;-;

young knoll
#

?jd-spigot

undone axleBOT
young knoll
#

Look at the location constructor

#

Or just remove all the stuff in brackets if you want a block location

young knoll
#

To be fair the spigot one is wack

#

&#rrggbb or <#rrggbb> is better

mortal hare
blazing scarab
#

yes write parser or use a ready one

final monolith
tardy delta
#

goodnight uwu

final monolith
spiral light
final monolith
#

Yeah

spiral light
#

what version ?

final monolith
#

1.8.8

spiral light
#

have fun

final monolith
#

im using 1.8 for the faster, but the ChunkGenerator will be in 1.18.1

spiral light
#

well 1.8 is slower in chunk generation

#

and also the methods get "invalid" in 1.18

final monolith
#

yeah, but my pc explodes when i use 1.18 🤯

final monolith
#

so... what you recommend me to make smooth biomes transitions in 1.18?

spiral light
#

adapt the vanilla biome noise generation

wary harness
#

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

spiral light
#

players dont get destroyd maybe

wary harness
#

not even pigs

#

what packet I could listen for then

#

to detect when player is out of render distance

spiral light
#

maybe no packets since its easy to do with api

wary harness
#

well how

spiral light
#

?runnable

wary harness
#

get players in range

#

?

spiral light
#

Bukkit.getOnlinePlayers ?

wary harness
#

I need to do that for every player

spiral light
#

then check location: same world and distance

wary harness
#

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

spiral light
#

O.O

#

because you do what ?

wary harness
spiral light
#

do you remove something when the player gets out of range ?

wary harness
#

yep back pack need to be destroyed

#

but backpack is fake entity armorstand

spiral light
#

and thats needed 10 times a second ?

wary harness
#

nms

spiral light
#

why not check it every 10s

wary harness
#

well to look smooth yes

spiral light
#

but the player is out of the view anyway ?

wary harness
#

if player goes out of range backpack gets droped

red sedge
#

Is there a better way to add strings other than +

spiral light
wary harness
#

and it look weird some entity sitting there

worldly ingot
#

Well... what do you mean "better"

#

There are situations where a string builder is best but others where it's just nonsensical

spiral light
worldly ingot
#

Depending on use case you can use a string formatter as well

wary harness
#

by packets

worldly ingot
#

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
wary harness
terse ore
#
    @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");
            }

        }
    }```
spiral light
#

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

ivory sleet
#

?ban @nova pulsar

worldly ingot
#

?kick @nova pulsar Compromised account

undone axleBOT
#

Member "@nova pulsar" not found.

#

Done. That felt good.

worldly ingot
#

Oh

terse ore
#

It isn't sending me "Chi"

ivory sleet
#

Oh

terse ore
#

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

ivory sleet
#

are we merely kicking them? Choco, everyone handles these accounts differently

worldly ingot
#

Lol I usually just kick because they're compromised 9 times out of 10

quaint mantle
#

i ban them

ivory sleet
#

Ah fair enough

worldly ingot
#

Suppose it doesn't really matter either way.

#

They aren't coming back lol

quaint mantle
#

if they recover their account they can appeal (my way of seeing it)