#development

1 messages ยท Page 100 of 1

pulsar ferry
#

I mean when the food is low the player physically can't run

ocean raptor
#

^

leaden sinew
#

Doing World#toString() gives ServerLevel[world],
but I can't access WorldProperties#getLevelName()

pure crater
#

you cant sprint while eating something

#

so if someone eats like an apple or something

#

they will be slowed down slightly you know. mechanics

broken elbow
#

that's the problem. there's a bug that allows that

#

in 1.8

pure crater
#

Wow

#

1.8 user

#

smd

#

lol

tight junco
#

you know its pretty helpful

#

to say which error it is

#

also the itemstack is probably null

#

you could prob just put a

if (itemStack == null)
  return;
``` above the switch case assuming that's your error
high edge
#

that's yikes

#

Why not make a map which maps the input itemstack to the output, and just use that, or even better there's probably a much cleaner way of doing that

#

Not really lol

#

You're gonna have a shit ton of cases which is gonna look horrible, when you could basically do the repeatable logic in a single line

icy shadow
#

docdex bad

#

clearly

#

yeah

#

docdex bad

leaden sinew
#

Does deluxechat have an api?

broken elbow
#

yes

leaden sinew
#

Where do I find it?

broken elbow
#

you can also get it directly from the jar

leaden sinew
#

Thanks

marble nimbus
#

How do I modify the entitymetadata without having the Entity itself? I only have the EntityID (because the Entity is clientsided)

#

I need to make it invisible

sharp cove
#

What is a good alternative method for player.isOnGround()?

#

Its deprecated..

dusky harness
# sharp cove What is a good alternative method for player.isOnGround()?

you can just do ((Entity) player).isOnGround()
it won't change the outcome, all it does is remove the deprecation stuff
(basically the same thing as @SuppressWarnings)

the warning means that the client is the one that controls the value, not the server, so the client will be able to spoof it (also known as GroundSpoof)

#

unless the client is modified and affects the isOnGround value, it should work fine though

#

i mean.. unless you want to add a GroundSpoof check into your plugin and make it part anticheat ๐Ÿ™ƒ

cinder forum
#

how server checking if player is on grounf works? location?

sharp cove
#

If there is a block under the player i think.

dusky harness
sharp cove
#

So using it does the same for example xd

dusky harness
cinder forum
dusky harness
# cinder forum i mean how to make it check. how anticheats do it

well anticheats make it so that if the client says they're on the ground but the server detects it's not, they're hacking
this won't work for Jona's case (well depends on why he needs it) because it might not be exact because anticheats only have a client-is-not-on-ground check

sharp cove
#

Oh mine was just for a DoubleJump thingie

#

happily

dusky harness
#

yea using Entity#isOnGround should work for that

cinder forum
#

if the client says they're on the ground but the server detects it's not, they're hacking
thats what im asking how antichets detect that its spoofed

delicate fable
#

Hello guys, I have a question for a guild plugin, is there any develop api for it.

dusky harness
wintry grove
#

nothing kekwhyper

sharp cove
#

Not sure tho.

delicate fable
#

In my opinion, such api should be public, the person who bought this plugin asked me to make a plugin that would check if the placed block is in his guild area.

lyric gyro
#

closed source ๐Ÿคฎ

broken elbow
broken elbow
broken elbow
#

๐Ÿ‘

strange remnant
#

Hi there again,

Question of the day:

Class: Main, Problem: Can't get line 46 to 51 to work. (it needs to do when a player joins the vanished player is still hidden)
Second question
Class: Vanish, Problem: Can't get line 52 to 55 to work. (What it needs to do is. When a player is hidden but the other player has permissions to see him let him see him.)

Main: https://paste.helpch.at/yetovevizo.java
Vanish: https://paste.helpch.at/emobejaboh.java

dusky harness
#

and for the vanish class, canSee returns a boolean which you can use (ex putting in a variable) to see if a player can see another player

you have to use showPlayer

strange remnant
#

Imma change everything to UUID then

wintry grove
#

forget about it, but could you tell me where da part of registering in plugin.yml is? kekwhyper

pulsar ferry
#

It never registers in the plugin.yml

wintry grove
#

I have been searching for 3 hours in your code for nothing?

#

fuck off

pulsar ferry
#

I mean it registers straight to the command map, why would you want it to register to the plugin.yml?

wintry grove
#

why I didnt know about that

#

then which class does that?

strange remnant
pulsar ferry
#

Command Manager

#

You get the command map through reflection

brittle thunder
#

Matt

neat pierBOT
#
FAQ Answer:

Use codeblocks for formatting code or configuration files:
```<language name>
<your code here>
```

For example:
```yaml
test:

  • โ€œhiโ€
  • โ€œthereโ€
    ```

Produces:

test:
- โ€œhiโ€
- โ€œthereโ€```
brittle thunder
#

Did you complete the rewrite of triumphcmds?

pulsar ferry
#

The core is basically done, the jda implementation is usable

brittle thunder
#

ahh

strange remnant
#

I changed it to:


public ArrayList<UUID> getVanished() {
        return vanished;
    }```
pulsar ferry
#

It's looking really cool though, lots of awesome features

brittle thunder
#

๐Ÿ˜ฎ

wintry grove
#

noice

brittle thunder
#

Btw it uses reflection now right?

wintry grove
#

cant wait to see it shining in github kekwhyper

stuck hearth
wintry grove
#

jk

dusky harness
pulsar ferry
brittle thunder
#

ahhh

pulsar ferry
brittle thunder
#

Class generation PR??!!!

pulsar ferry
#

Class generation? blurryeyes

brittle thunder
#

Yasss

#

You have all thats required for routing at compile time with annotations right? ๐Ÿ˜ณ

pulsar ferry
#

Probably yeah ;o

wintry grove
#

giv link NOW

brittle thunder
#

Assuming I dont procrasticate a lot again, pr incoming

pulsar ferry
#

Noice noice

pulsar ferry
wintry grove
#

so

strange remnant
dusky harness
wintry grove
#

all I need to do is just use <CommandMap>.register("name", plugin, and the command?)

pulsar ferry
#

commandMap.register(commandName, plugin.getName(), bukkitCommand)

wintry grove
pulsar ferry
#

You don't instantiate the commandMap

wintry grove
#

initialize it*

#

really?

pulsar ferry
#

You should go look at the command manager class

wintry grove
#

I did lmao, just didnt get it at all

#

so thats it?

#

just a method and we done?

#

Anything hasnt been that easy to me lol

pulsar ferry
#

Line 55, 94, 241

wintry grove
#

ohhh thats what I meant

broken elbow
#

hmm. in JDA, I use EmbedBuilder to create an embed. how do I add a description to the embed and make part of it be a link redirect? like what you'd do in github markdown for example would be [text] (link)

dusky harness
#

im pretty sure its the same with a bot

#

[text](link)

broken elbow
#

oh. will try it

strange remnant
#

I can't unvanish anymore

dusky harness
#

show code

vagrant bobcat
#

Someone got experience setting up a Debis database?

#

And linking it to plugins

strange remnant
#

It could be the Main class tbh

dusky harness
#

wait a minute

#

in onPlayerJoin

#

you changed it to Bukkit.getOnlinePlayers()

#

which would probably hide every player

strange remnant
#

Ahh

#

Should I change it to getofflineplayers

dusky harness
#

and dont use deprecated

dusky harness
#

you can keep it as Bukkit.getOnlinePlayers() but check if player's uuid is in getVanished()

strange remnant
dusky harness
#

no

#

hidePlayer(this, player)

dusky harness
strange remnant
#

Alright

vagrant bobcat
#

Can someone help me setup a redis database?

wintry grove
#

Ok so I got the point of registering commands, now annotations, for getting the values, should I use a processor or directly getting the values?

#

I'm talking of tons and tons of commands tho

vagrant bobcat
#

Im sorry

wintry grove
#

dw

strange remnant
#

@dusky harness

    public void onPlayerJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (getVanished().contains(p.getUniqueId())) {
            p.hidePlayer(this, p);
            
            }

        }
    }
#

?

dusky harness
#

no

strange remnant
#

Omg

wintry grove
strange remnant
#

I was so happy when you said yes

#

๐Ÿ˜’

wintry grove
#

I get it

#

I get it

dusky harness
#

remember - the player variable exists too

strange remnant
#

yeah but it needs to check if the player is in the list

dusky harness
#

rn you're checking if p is in the list

strange remnant
#

and there are only UUID stored in the arraylist right?

dusky harness
#

then you're hiding p from p

strange remnant
#

so I should use player.getuniqueid

dusky harness
#

in certain locations, yes

strange remnant
#

it works

#

I don't care if it doesn't look nice

#

;s

#

now I know how to check if there is a player in the arraylist

#

learned another thing

#

๐Ÿ™‚

dusky harness
#

๐Ÿ‘

formal crane
#

how would i make my actionbar take priority over a other actionbar?

rigid mountain
#

Anyone have any ideas how to generate a single chunk at a time? inside a void world

lyric gyro
#

what does that even mean?

rigid mountain
#

So basically what i want to have is a void world where it basically creates similar to skyblock islands in a spiral with like 3x3 chunk areas for each team.

#

I have the spiral down

#

I believe johni said you helped him with something similar

marble nimbus
#

Yes Emily its like my Spiral Schematic placement you made for me. but he needs 3x3 chunks and I believe mine was 2x2 or 4x4

rigid mountain
#

Yeah basically

lyric gyro
rigid mountain
#

Ok, Ill look into that

#

I think the issue is right now since im generating a void world, when i generate that chunk its using the same generator

#

how can i change the generator>

strange remnant
#
                if(p.hasPermission("flipmc.vanish.see")){
                    p.showPlayer(plugin, p);
               
                } else {
                    p.hidePlayer(plugin, p);
                }
          
              }```


@dusky harness
#

I seriously don't know anymore

stuck hearth
#

What are you expecting and what's happening?

strange remnant
#

to me?

stuck hearth
#

Yes

strange remnant
#

I am trying to get the player with the permission "flipsmc.vanish.see" to see other vanished players

stuck hearth
#

Is that player in the getVanished list?

rigid mountain
#

Are you looping through players with the permission?

strange remnant
stuck hearth
#

Then it wouldn't check the permission

#
if(player isn't in list) {
  //do stuff
}```
strange remnant
rigid mountain
#

I did this with a hotels plugin to stop players from seeing each other, and iirc the way i did it was loop through all players with x permission and show B player to all players with x permission then hid them form all players without x permission

strange remnant
#

if(!plugin.getVanished().contains(p)) {

#

like this right?

stuck hearth
#

the ! implies NOT i.e the opposite of what returns

#

so if(!true) would actually be false

rigid mountain
#

Yeah

#

so if they are not in the list that code will run

#

Thats not how i did it

#

You could also loop through all online players and do it from there but then you run into issues with when a player joins

strange remnant
#

so what should I change

stuck hearth
#

Well if you want to check if the player is in the list, then don't use !

strange remnant
#

I did that

#

nothing changed

rigid mountain
#

Are you sure that plugin.getVanished() even has anything in it?

stuck hearth
#

From the looks of the code, you also changed it is so that it's checking if they don't have permission

rigid mountain
#

also

#

on line 51-60 you would want to show the player to the player with permission, when you are hding them from everyone else

dusky harness
#

or hide p to p

#

and you're also checking p's permission

#

not player's permission

rigid mountain
#

^

dusky harness
#

you want to check player's permission and hide player from p

#

tip: rename player to vanished and p to player

#

might help remove some confusion

#

and remove the !

rigid mountain
#

dkim do you have any idea how i could take a void world and generate specific chunks with a seperate generator? So like its a void world but the chunk at 0,0 is like a normal chunk

dusky harness
#

uh

#

no sorry, I haven't done anything relating to custom world generation :(

rigid mountain
#

ok

stuck hearth
#
if (!(sender instanceof Player)) {
    sender.sendMessage("[FlipsMC] Only For Players");
    return true;
}

Yeah also this for example

//If sender IS a player this will evaluate true in parentheses
//THEN, the ! will make it evaluate False
//So what you're actually checking is 
//if(sender NOT Player)
if (!(sender instanceof Player)) {
    sender.sendMessage("[FlipsMC] Only For Players");
    return true;
}```
dusky harness
#

no in that case it's correct

#

unless ur saying how ! works

stuck hearth
#

Oh I see I kinda goofed myself there, but it does make a good example as to what ! does

dusky harness
#

๐Ÿฅฒ

stuck hearth
#

Kotlin has spoiled me ๐Ÿ˜ฉ

strange remnant
#
            for (Player player : Bukkit.getOnlinePlayers()) {
                if (player.hasPermission("flipmc.vanish.see")) {
                    player.showPlayer(plugin, p);

                } else {
                    player.hidePlayer(plugin, p);
                }
            }

        }```
#

This?

dusky harness
strange remnant
#

I don't know

#

i'm gonna sleep

graceful hedge
#

Good night and sleep tight

strange remnant
#

nvm forza 5 downloaded

#

gonna play a bit

graceful hedge
#

Wym by that?

#

Like using ap api thingy?

#

Or just some getAnnotation thingies?

pulsar ferry
#

Directly get the value thonking

wintry grove
rigid mountain
#

Ok, so im still quite confused on how to go about this. This time im trying to add something else. I want to have a void world, and starting at (0,0) create like a 2x2 - 5x5 chunk area. For now well say a 3x3. So at (0,0) i want to generate 9 total chunks in a 3x3 with the chunk at (0,0) being the center. and then move out x blocks and do it again to form something like this http://prntscr.com/1z7qmlh. Now inside each chunk i want to have increased or spawn. I was told to use a block populator but i havent seen any decent examples. Any suggestions on how to go about this?

pulsar ferry
pulsar ferry
#

Well that's processing

wintry grove
formal crane
#

how would i add a jar as an import in gradle again?

pure crater
#

like implementation(files(...))?

forest jay
#

is anybody familiar with MongoDB and how to get it running on Java?

#

I keep getting class not found errors, even though I have all 3 jars that it requires

#

in my classpath and build.gradle

pure crater
#

or using some dependency management thing that can load the classes into runtime

forest jay
#

ummm, idk

pure crater
#

cause it seems that they are present during compile time, but not runtime

forest jay
#

I just added the compileOnly 'org.mongodb:mongodb-driver:3.12.10' to my build.gradle and put the other 2 .jars in the classpath

#

how would I load it into runtime?

pure crater
#

You need to either shade it into your final jar

#

or use something like slimjar to download the dependencies at runtime and load into classjar

#

to shade it in, using the shadow plugin and set your dependencies to be implementation

forest jay
pure crater
#
plugins {
  id 'com.github.johnrengelman.shadow' version '7.1.0'
}

to add the plugin

#

then set your dependency implementation 'org.mongodb:mongodb-driver:3.12.10'

#

then run gradlew shadowJar

forest jay
pure crater
forest jay
#

issue still same issue

pure crater
#

you arent using the correct jar

#

use the jar with -all

forest jay
#

ye

pure crater
#

can i see your full build.gradle

#

use ?paste

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
โ€ข HelpChat Paste - How To Use

forest jay
#

wait

#

I restarted the server

#

and now it works

#

it just filled the console with logs

pure crater
#

mhm

formal crane
#

why is io.netty not a thing?

pure crater
#

are you including netty as dependencies?

formal crane
pure crater
#

thats a repository

#

not a dependency

formal crane
#

i wouldnt know then

pure crater
#

and make sure to have mavenCentral() in your repositories

formal crane
#

oh implementation i see

pure crater
#

no no...

#

you dont add that as a dependency

#

visit the site, find the artifact you need

#

click on it

#

and it will show how to add it

formal crane
#

implementation 'io.netty:netty-all:5.0.0.Alpha2'

#

its working ty

#

do you know by any chance what dependency/repo i would need to get these errors gone?

pure crater
#

netty is already included techincally

#

so you dont need to shade it in

pure crater
#

you need to run buildtools or run paperclip

#

and remove the -api part

formal crane
#

what is buildtools?

pure crater
#

are you using paper api for spigot api?

formal crane
#

spigot

pure crater
dusky harness
formal crane
#

where do i add mavenLocal() ?

#

(where in the build.gradle)

lyric gyro
formal crane
#

oh okay

#

ty

dusky harness
# formal crane where do i add mavenLocal() ?

before: gradle repositories { // other stuff } dependencies { compileOnly 'org.spigotmc:spigot-api:VERSION-R0.1-SNAPSHOT' }after:```gradle
repositories {
mavenLocal()
// other stuff
}
dependencies {
compileOnly 'org.spigotmc:spigot:VERSION-R0.1-SNAPSHOT'
}

formal crane
#

i have this now

pure crater
#

Yes

#

that is normal

formal crane
#

is it automaticly last version?

#

i just pressed the jar

lyric gyro
#

you didn't read the buildtools wiki page, did you?

pure crater
#

You clearly did not read

#

the wiki

#

lmfao

formal crane
#

yea i already released that wasnt right

#

rn i used java -jar BuildTools.jar --rev 1.12.2

#

is it normal to take so long building?

lyric gyro
#

yes

#

spigot is dog food

formal crane
#

what do i do after building it?

formal crane
#

dont i need to put nms in the project?

#

or something from buildtools

dusky harness
lyric gyro
#

buildtools installs spigot (server, not api which is what is normally exposed) into mavenLocal
you add it in your gradle file

dusky harness
formal crane
#

bukkit stopped working?

dusky harness
#

show build.gradle

formal crane
lyric gyro
#

did buildtools finish running?

#

it takes a while

dusky harness
#

compileOnly 'org.bukkit:craftbukkit:v1_12_R1' you don't need this

#

and make sure u finished buildtools

#

that was really quick

#

๐Ÿ‘€

formal crane
#

it says its finished

dusky harness
formal crane
#

its working ty

lyric gyro
#

nice

dusky harness
#

implementation 'com.github.LabyMod:labymod-server-api:Tag'

Tag

formal crane
#

yea

leaden sinew
#

Does anyone who has made a fabric mod before know how I would add SQLite?
I'm trying to use it with shadowJar, and I get https://paste.helpch.at/wovufonavu.coffeescript.
When I try remapJar, I get Unsupported class file major version 60.

lyric gyro
#

no shadow

#

include(modImplementation("..."))

#

shading is one of the worse solutions for including other jars in the classpath

#

fabric-loom to the rescue prayga

hard wigeon
#

so if changeRate is a vector of (1, 0, 1), why does this do nothing?

                    armorStand.setVelocity(changeRate.normalize());

it's an armorstand that I'm riding with no gravity, but I don't get why it doesn't work

#

the code definitely runs

#

a sysout next to it works

lyric gyro
#

read the documentation for Vector::normalize()

hard wigeon
#

without it also didn't work

#

normalize was for a test

lyric gyro
#

no gravity as in armorStand.setGravity(false)? potentially irrelevant

#

Is the armor stand set as a marker? setMarker(true)

leaden sinew
hard wigeon
#

and it's not invis atm

#

so that doesn't effect anything

leaden sinew
#

Sorry, last question, how would I access the mods folder?
Just Path.of("mods", "mymod")?

lyric gyro
#

FabricLoader.getInstance().getConfigDir().resolve("my-mod-id");

#

the mods folder should be exclusive to mod files, and their configs in the provided config folder

leaden sinew
#

Thanks

hard wigeon
#

hm, teleporting also doesn't work

#

for moving my armor stand

#

I'm so confused

#

the armor stand is definitely there (no NPEs)

#

but

#

it just

#

doesn't work?

lyric gyro
#

I presume you're running paper/paper fork and not base spigot?

hard wigeon
#

yes

#

purpur iirc

#

and paper api

lyric gyro
#

make sure in the paper config armor stand ticking is set to true

hard wigeon
#

yeah

#

forgot about that

#

yup, set to true

#

;-;

lyric gyro
#

yeah i'm out of ideas lol

hard wigeon
#

;-;

#

idk what to do lol

#

nothing works

#
                    System.out.println("yo from the armorstand");
                    armorStand.setVelocity(new Vector(1, 0, 1));
#

#1 works

leaden sinew
#

You canโ€™t set velocity to things with no gravity

#

I think

dusky harness
#

u can

#

at least from when i was messing around with holograms

#

it did

hard wigeon
leaden sinew
#

Oh yeah

formal crane
#

Anyone here experienced with labymod api?

void orchid
#

no but from what I remember, seems quite straight forward

strange remnant
#

Would this work then?

#

because then i was even to tired to find the problem

molten wagon
#

I has start to work with events (custom) and it is pretty fun to finally understand how bukkit events works/idea behind it. But I has a issue (the event works but I want to add one extra data in the event).

The problem is it only update next time it run the code, if I shall has option to use cancel. Do I have to set up two events (one like more monitor the task some executed and one some you can cancel the event and do your own stuff with)?

prisma briar
molten wagon
molten wagon
prisma briar
#

I don't know exactly what you want.

molten wagon
# prisma briar I don't know exactly what you want.

Alright was some testings so that was not right code too 100%. whole method
https://paste.helpch.at/meratulihi.java

Alright first of it try add items to a container (teleport items) and if you cancel you can get the item and location it try add item to, look on HopperTeleportListener class part.

I what to add also if it has add the item or if it are still in the hopper to the event, but seams in that case I has to make a new event.

#

what I mean if it has successful move the item or if it are still in the hopper

dusky fox
#

hi i am wondering if someone could help or make me a fairly simple plugin

broken elbow
icy shadow
#

Looks like you don't have the right opus library / bindings installed or something

sudden sand
#

for example the player yaw is 45 and how can I get the location of 2 blocks forward and 1 block left of him

ionic panther
#

yaw of 45 is northwest

sterile hinge
#

Donโ€™t use yaw/pitch but the direction vector instead

molten wagon
#

I has always have problem when commit a existing project (code changes). github will take whole class when make a small code change and i see this when i commit the change.

#

Only way i has go around the issue is to use wordpad, but that are not a good way to fix it.

marble nimbus
#

how would I go ahead and make a Class that takes a Type Parameter of an Enum?
I am doing a AnimationSystem which uses a Ressourcepack to replace Unicode Symbols with Pictures which we then use to make Animations.
there will be one class that will be nearly Identical for every single Animation, this class will handle the actual playing of the Animations aka the scheduler and stuff like that.
in order for that System to work I need a reference to an Enum how would I do that?

#

aka I need a Type parameter which is an enum

warm steppe
#

Just make an enum

#

and use it's name as type

#

ezpz

marble nimbus
#

thats not what I mean

#

and its not really helpful

#

we are making Animations which all need 1 Class which handles the actual Playing of the Animations

#

and Instead of making that Class for every single Animations, we wanted to make 1 Class which we just give the Enum and the rest works flawlessly

warm steppe
#

yes

marble nimbus
#

aka AnimationFrame<GameLoadingFrames> animation = new AnimationFrame<>();

#

GameLoadingFrames being the enum

#

and then i can animation.start() and all the other methods

#

the only downside being I will need reflection to access methods inside the Enum

leaden sinew
#

Is there any way to get an entity by ID?

#

Not UUID

#

For the packet PacketType.Play.Server.ENTITY_EQUIPMENT, I need to get the player whose armor is being changed

#

I'm just looping through online players, packets use entity id's not player uuids

proud pebble
#

entities still have an uuid

#

you would have to loop through all the entities till you find id of the player you want to modify

leaden sinew
#

The id is anint in this case

leaden sinew
grim oasis
#

i think you might have to loop through all entities till you find the id

leaden sinew
#

Well I just need players, so I guess that's what I'll stick with

grim oasis
leaden sinew
#

Thanks

grim oasis
#

๐Ÿ˜‚

#

#shitpostingdevelopment

patent zephyr
#

Hi, can someone please help me and explain me something step by step?

neat pierBOT
#
FAQ Answer:
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait

Source

patent zephyr
#

so, I have int stage in class1 and I need to transfer it to the class 2. I heard about getters, but I dont get it

formal crane
#

Is there a way to make these shorter?

        Bukkit.getServer().getPluginManager().registerEvents(new DamageListener(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new DispenseListener(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new EntityExplodeListener(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new ExplosionListener(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new IgniteListener(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new PlayerBreakEvent(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new PlayerPlaceEvent(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new DeathListener(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new AsyncChatEvent(), this);
        Bukkit.getServer().getPluginManager().registerEvents(new PlayerConnectEvent(), this);```
dense drift
#

Stream.of(events here).forEach(listener -> registerEvents(listener, this))

patent zephyr
#

thank you

#

ok

#

ill try

slate crescent
#

How do I add depenencies when I building a open source plugin?

dense drift
#

maven / gradle, there's nothing special, you just have to avoid dependencies from your local maven repo

slate crescent
molten wagon
cinder forum
#

Hi, guys, what is easiest way to get data from Java stuff (plugin) in another language?
Basically I want to make user profiles on web

delicate fable
#

you think about database like mysql?

cinder forum
#

yes I thought just curious if there are some better methods without saving stuff into db

delicate fable
#

yy

#

i think no, you need take the data

#

for optimization instead of mysql it may be redis

cinder forum
#

To be more specific:
I want to show current data = save data into DB when HTTP request is sent (user search)

little surge
#

How do you currently store data xdd?

#

Im assuming the plugin is already half written?

cinder forum
#

nop, didnt start
user data is like playtime, some data from plugins (saved in mongo/postgre) etc

little surge
#

Easiest method would be through a database, otherwise you'd have to allow the plugin/server to accept incoming http requests which I'd guess most hosts deny unless it's a player although I'm not sure on that

cinder forum
#

Easiest method would be through a database
What database? Redis?
you'd have to allow the plugin/server to accept incoming http requests which I'd guess most hosts deny
Shouldnt be problem on VPS right

little surge
#

Database type is irrelevant, that's your choice so long as it's accessible by a website. As for your last question, I'd do a few google searches, probably depends on your host

#

I'm sure you can configure the server & its ports for example. Pretty sure votifier does something like this

cinder forum
#

okay, ty, I just don't understand why it should be problem when website is just HTTP requests

little surge
#

Well you could always try accepting http requests and see where it gets you but id imagine hosts block that

formal crane
delicate fable
#

do you have any errors?

formal crane
#

none

#

[01:21:34 ERROR]: [MTKluizen] Database not connected! is the only thing

delicate fable
#

and to all try catchs e.printStackTrace(); and show error

formal crane
delicate fable
#

Your base link is wrong

formal crane
#

wdym

#

its correct i think

delicate fable
#

You have to do it like that ?user=user&password=password

#

here MySQL.classconnection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=false", username, password);

formal crane
#

it still says not connected for some reason

delicate fable
#

give error

formal crane
#

same one as before

delicate fable
#

and show your mysql.class now

formal crane
delicate fable
#

bro, you need to replace connection = DriverManager.getConnection("jdbc:mysql://" +
host + ":" + port + "/" + database + "?useSSL=false",
username, password); to ?user=user&password=password

formal crane
#

the whole thing?

delicate fable
#

yes

#

Your link have only host, port, database and usessl

#

so how is it supposed to connect

formal crane
#

like this?

                            host + ":" + port + "/" + database + "?useSSL=false",
                    username=username, password=password);```
delicate fable
#

DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database + "?user=" + username + "&password=" + password);

formal crane
#

it turns out i cant even connect to the database using heidisql

molten wagon
#

Should you post your db password @formal crane ?

#

I recommend you remove that if it your real one

formal crane
formal crane
#

Anyone got an idea how i get the region where the player is in?
rn i tried:

        final RegionManager rgm = worldGuard.getRegionManager(loc.getWorld());
        final ApplicableRegionSet ars = rgm.getApplicableRegions(loc);
        return ars.getRegions();
    }```
and to get:  `PlotInfoMenu.openGUi(p, getRegions(p.getLocation()));` but it returns a set not a region
dusky harness
#

there is a method to check if a flag is active

formal crane
#

he is 100% in one region

dusky harness
formal crane
wintry grove
formal crane
wintry grove
#

is bc the method returns boolean

#

remember that ternarys are:
boolean ? return this if true : return this if false

#

you get the point

#

u there lel?

#

so the point is

#

you want a region right?

formal crane
#

Yes i want to get the region of the player

wintry grove
#

then store it in a variable

#

what dkim showed u was the way to get it

formal crane
#

yea but that didnt work

wintry grove
#

because you need to return a fucking boolean aaaaarghh

#

sorry sometimes I go brrrr

formal crane
#

i understand that

wintry grove
#

so then give me a sec

#

you should do it this way:

ProtectedRegion[] regions = <yourregionskekw>.toArray(new ProtectedRegion[0]);
ProtectedRegion playerRegion = regions.length == 0 ? null : regions[0];
#

or so

#

so the point is, you have command, for opening GUi right?

formal crane
#

yes

wintry grove
#

ok

#

then you get the region using dkim code up

#

store on variable

#

like

ProtectedRegion region = getRegions(params)
#

then for checking if player is in region you do the if thing you have

#

do ur code and if nothing return false and if good return true

#

basic damn bukkit commands

#

get it or I need to do a graphic representation?

formal crane
#

So like:

            ProtectedRegion b = regions.length == 0 ? null : regions[0];

            PlotInfoMenu.openGUi(p, b);```
wintry grove
#

facepalm near

#

the code that dkim gave u is for getting a especific region

#

ohhhh wait

#

I'm dumb

#

you should be good

#

lol I got confused af

formal crane
wintry grove
#

noice

hard wigeon
#

Yo, I'm getting an NPE saying Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.put(Object, Object)" because "this.data" is null, which is confusing me, since well... this.data = Map<t, UUID> data = new HashMap<>();

#

I set it even outside the constructor

lyric gyro
#

lowercase t ๐Ÿ’€

hard wigeon
#

oops

#

my bad

lyric gyro
#

make it final fingerguns

hard wigeon
#

I'm doing this quickly so I can go to sleep lmao

lyric gyro
#

this is why final whenever possible is good smh

hard wigeon
#

fair

#

let me try that

lyric gyro
#

I see it's package private, if it's being modified somewhere else then making it final will yield a compile error

formal crane
#

Anyone that knows how to get a player skull?

lyric gyro
#

๐Ÿ’€

lyric gyro
#

what line exactly is the npe happening on?

hard wigeon
hard wigeon
#

well, it's wierd

#

look at the error

#

oh wait

#

it has a line

#

I'm

#

dumb

#

ignore me ._.

lyric gyro
#

mhm yep, it's another data map

#

xD

hard wigeon
#

lmfao

#

and this is why I need sleep

wintry grove
formal crane
#

i tried:


        SkullMeta meta = (SkullMeta) skull.getItemMeta();
        meta.setOwner(p.getName());
        skull.setItemMeta(meta);``` but got a skeleton head
wintry grove
#

dont really know tho, I havent touched that yet

lyric gyro
#

what version is this on?

formal crane
#

1.12.2

lyric gyro
#

uh

#

I know in 1.12 you have to set the data (I think it's with the durability?), uuh.. idk how that is exactly

formal crane
#

ty

#

skull.setDurability((short) 3); works

lyric gyro
#

oh awesome

hard wigeon
#

probably another me being tired moment, but why does this code:

            for(int i = 0; i < entryList.size(); i++) {
                Map.Entry<T, ItemStack> entry = entryList.get(i);
                GuiItem guiItem = ItemBuilder.from(Material.RED_STAINED_GLASS_PANE).name(MessageUtils.miniMessage("<red>Not Selected</red>")).asGuiItem();
                guiItem.setAction(g -> {
                    g.setCancelled(true);
                    onChange.accept(entry.getKey(), true);
                });
                gui.setItem(2 + 3 * i, 2, guiItem);
            }

Throw Slot 37 is not valid for the gui type - CHEST and rows - 4!?
the EntryList (an entryset as list), is only 3 items long

formal crane
#

maybe 3 * i, i am not sure

hard wigeon
#

3 * 2 = 6

formal crane
#

oh okay

hard wigeon
#

even 3*9 + 2 + 7 only equals 30

#

and I have no idea where it'd get 9 from

tight junco
#

why are you doing 2 + 3 * i in that

#

why not just do 5 * i

hard wigeon
#

order of operations

tight junco
#

cause it could be doing 2 + (3 * i)

hard wigeon
#

that's the point

#

I want it to do that

tight junco
#

then type that in then

#

i guess

hard wigeon
#

@pulsar ferry, this is your library flooshed
any clue why I get me.fredthedoggy.mckingscore.triumph.gui.components.exception.GuiException: Slot 37 is not valid for the gui type - CHEST and rows - 4! when running

gui.setItem(2 + 3, 2, guiItem);
```?
#

doing setItem(10 + 3, guiItem) works

#

but not that

winged pebble
#

If rows = 4 that's 36 slots

limber hedge
#

If I wanted to allow chat input to change a GUI, for example player clicks button A and types "Test1" button B's name would be "Test1", would I need to store it in a database or can I use hashmaps or something?

hard wigeon
#

(since I'm not)

winged pebble
hard wigeon
#

the error is thrown when i = 1 however, not the last which is two

#

also

                GuiItem guiItem = ItemBuilder.from(Material.LIME_STAINED_GLASS_PANE).name(MessageUtils.miniMessage("<green>You Selected This</green>")).asGuiItem();
                guiItem.setAction(g -> {
                    g.setCancelled(true);
                    onChange.accept(data, false);
                });
                System.out.println("Lime");
                System.out.println(10 + (3 * this.data.get(data)));
                gui.updateItem(10 + (3 * this.data.get(data)), 2, guiItem);

prints out lime, and 10, but doesn't update the item

pulsar ferry
hard wigeon
#

Oooh

#

Wrong order then

#

I thought it was column row flooshed

#

But that one I found a fix for, it's the update one that's glitchy

pulsar ferry
#

What exactly is supposed to change on that item?

hard wigeon
#

And the action

#

And name

pulsar ferry
#

Is the slot correct?

hard wigeon
#

Yes

#

10

#

Same slot I put it in originally

#

And well I got no other slots changing

rancid bronze
#

is it possible to register a listener after the plugin is enabled

dense drift
#

Why not

lyric gyro
#

Any Admins available for a moment?
One your users here Pengwing2df3 has had their account breached and is sending out mass DM's with ransomware links attached.

lyric gyro
#

ty

forest jay
#

my ServerConnectEvent event isnt being triggered, it is registered in my onEnable, I dont understand the issue. java @EventHandler public void onPlayerJoin(ServerConnectEvent e) { System.out.println("onPlayerJoin triggered"); String type = CustomConfigFile.getConfig().getString("config.join-type"); ProxiedPlayer pp = LobbySystem.getInstance().getProxy().getPlayer(e.getPlayer().getUniqueId()); // DatabaseUtils.initialJoin((Player) e.getPlayer()); ServerInfo sv; if (type.equals("RANDOM")) { sv = LobbySystem.getInstance().getRandomLobby(); } else { sv = LobbySystem.getInstance().getProxy().getServerInfo("LOBBY2"); } System.out.println(ChatColor.AQUA + "[LobbySystem] >> " + ChatColor.GOLD + "New Player Connected. Sending them lobby " + sv.getName()); e.setTarget(sv); }

#

getProxy().getPluginManager().registerListener(this, new OnPlayerConnect());

#

thats how I register it ^^

warm steppe
#

implements Listener

#

add this to your class

#

ezpz problem solved

forest jay
#

I have that

#
public class OnPlayerConnect implements Listener {
    @EventHandler
    public void onPlayerJoin(ServerConnectEvent e) {
        System.out.println("onPlayerJoin triggered");
        String type = CustomConfigFile.getConfig().getString("config.join-type");
        ProxiedPlayer pp = LobbySystem.getInstance().getProxy().getPlayer(e.getPlayer().getUniqueId());
        // DatabaseUtils.initialJoin((Player) e.getPlayer());
        ServerInfo sv;
        if (type.equals("RANDOM")) {
            sv = LobbySystem.getInstance().getRandomLobby();
        }
        else {
            sv = LobbySystem.getInstance().getProxy().getServerInfo("LOBBY2");
        }
        System.out.println(ChatColor.AQUA + "[LobbySystem] >> " + ChatColor.GOLD + "New Player Connected. Sending them lobby " + sv.getName());
        e.setTarget(sv);
    }
}```
#

thats the whole class

warm steppe
#

also put your plugin in to your bungeecord plugin folder

forest jay
#

ye

#

I did that

warm steppe
#

restarted proxy?

forest jay
#

duh, and I see the outputs from my onEnable in the console

robust flower
#

is there a relatively easy way of modifying string constants of my own project (during/after compile)? I'd use that to create unique placeholders for my plugin name and version, for example, so I don't have to modify them each time I change the version of my plugin

broken elbow
#

if you're on gradle you can use ReplaceTokens

dense drift
#

I've seen someone using gradle to create a class with constants for versio and shit

robust flower
dense drift
formal crane
#

What would be the best version to run my lobby on? Or should i just pick the last version (because some of my gamemodes arent on the latest version)

graceful hedge
#

minestom maybe

formal crane
#

never heard of it

broken elbow
#

you either run latest with via backwards or oldest with via version

formal crane
#

i think i amma put it on 1.12.2

lyric gyro
hard wigeon
#

Any good APIs for custom items without lots of janky listeners?

#

Eg. Register an item with an attack consumer

lyric gyro
#

I never thought I would say this but you might want to look into RedLib

hard wigeon
#

Hm okay, thanks.
If I find nothing I'll just make my own, since this is for a core plugin for smth else

lyric gyro
#

I think it can be shaded now as well

icy shadow
# lyric gyro I never thought I would say this but you might want to look into RedLib

๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก ๐Ÿ˜ก

lyric gyro
#

not entirely sure

icy shadow
#

.

pulsar ferry
#

What about EmilyLib ๐Ÿ˜”

lyric gyro
#

soontm

hard wigeon
#

Ah yeah no that's just for enchantments

icy shadow
hard wigeon
#

I mean new items from scratch

lyric gyro
#

ah, yeah I don't know of any for that

hard wigeon
#

Okay.
Ig I'll make my own

icy shadow
#

yes, you will

hard wigeon
#

I'm done jankily adding them all

lyric gyro
#

lol

hard wigeon
#

This is for smth that can't mess up, so I need a more fool-proof way

#

(Me being the fool)

#

I already an using mf-commands for foolproofness, and I gotta say it's very nice

pulsar ferry
#

Just wait till the rewrite is done

hard wigeon
#

No can do. We're running a test event in like 12 days lol

#

And I gotta finish the core and a bunch of custom items

#

And textures

#

And I'm like... super busy

surreal lynx
#

How do I setup a build tool (maven or gradle, don't have much experience with gradle though) for a decompiled plugin?

hard wigeon
pulsar ferry
hard wigeon
#

Ah

#

How so?

surreal lynx
#

To find the libraries I can just look at imports right?

hard wigeon
#

Mhm

#

@pulsar ferry will mf-gui updating items ever be more streamlined? :D

pulsar ferry
#

Lots of new features and improvements

#

And maybe one day, updates are a pain in the ass

hard wigeon
#

Why?

hard wigeon
#

The best part is the included tab competition

#

That's the real reason I did it

pulsar ferry
hard wigeon
#

Because of publishing?

#

Or just writing code

pulsar ferry
#

I'm talking about updating gui

hard wigeon
#

Oooh

#

Yeah

#

I get that

surreal lynx
hard wigeon
#

Yeah, unfortunately that's the only good way iirc

surreal lynx
#

Alright thanks anyways

dusky harness
#

https://paste.helpch.at/ayewogabex.bash
(Jetbrains Exposed)
Anyone know how to fix this error? :/

DatabaseManager:74: ```kt
transaction(database) { StaffData.findById(player) }

Other code: ```kt
class StaffData(id: EntityID<UUID>) : UUIDEntity(id) {
    companion object : UUIDEntityClass<StaffData>(StaffTable)
    // code
}

object StaffTable : UUIDTable("staff", "players") {
    // code
}
#

oh wait

dusky harness
#

nvm

#

new issue: ```
Caused by: java.sql.SQLSyntaxErrorException: Table 'testing.table' doesn't exist

#

how do i create a table?

#

I tried ```kt
SchemaUtils.createMissingTablesAndColumns(StaffTable)

#

and i couldn't find anything on google about this

#

nvm new issue

lyric gyro
#

tf is that ๐Ÿ’€

#

jooq ๐Ÿ˜Œ

dusky harness
#

aaaaaaaaaaaa

lyric gyro
dusky harness
#

why skull D:

#

aaaaaaaaa

#

D:

dusky harness
lyric gyro
#

because kotlin bad

dusky harness
#

where is kotlin.Any??

hushed badge
#

I had this before I think

#

I dont think exposed likes kotlin being relocated or smth

dusky harness
#
java.lang.ClassNotFoundException: org.jetbrains.exposed.dao.id.EntityID
```๐Ÿค” (https://paste.helpch.at/xivuzedire.cs)
#

it's relocated

#

but why doesn't exposed know that

#

uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

hushed badge
#

kotlin bad exposed bad

#

just don't relocate

dusky harness
#

wait exposed has a gradle plugin?

#

btw sorry for ping @robust flower but how far did you get with this?

#

i might just not relocate

#

๐Ÿค”

dusky harness
#
val data = transaction(database) { StaffData.findById(player) }
if (data != null) {
    transaction {
        data.groupsSet = (groups as? Set<String>) ?: groups.toSet()
    }
    return
}
transaction(database) {
    StaffData.new(player) { // this line
        groupsSet = (groups as? Set<String>) ?: groups.toSet()
    }
}
```anyone know why the line with the comment throws a "Duplicate entry" error?
#

even though I check (lines 2 - 7) if it contains in the database

#

Other code: ```kt
class StaffData(id: EntityID<UUID>) : UUIDEntity(id) {
companion object : UUIDEntityClass<StaffData>(StaffTable)
// code
}

object StaffTable : UUIDTable("staff", "players") {
// code
}

pulsar ferry
#

How tf do you get so many issues in the first go
If you check the docs it explains everything

dusky harness
#

๐Ÿคฉ

brittle thunder
lyric gyro
#

Minecraft 1,8 api repo?

robust crow
lyric gyro
#

Thats docs, I mean repo

#

/depend

wheat carbon
#

minecraft itself isn't available in any repo as it doesn't have an api

#

what api do you mean?

lyric gyro
#

compileOnly 'com.destroystokyo.paper:paper-api:1.12.2-R0.1-SNAPSHOT'
This is Paper 1.12.2 API
I want the 1.8.8 one

wheat carbon
#

simply change 1.12.2 to 1.8.8

lyric gyro
#

Not working

#

ยฏ_(ใƒ„)_/ยฏ

wheat carbon
#

org.github.paperspigot:paperspigot-api:1.8.8-R0.1-SNAPSHOT

#

@lyric gyro

lyric gyro
#

Ahh Thank You Soo Much

#

๐Ÿ˜„

wheat carbon
#

np

warm steppe
brittle thunder
icy shadow
#

๐Ÿค—

robust flower
dusky harness
#

o

robust flower
#

The solution unfortunately is just don't use it for when we need to relocate libs

icy shadow
#

Kotlin bad

dusky harness
#

do u know a good alternative?

robust flower
#

I tried to find an alternative, ended up just using low level stuff. In my next projects I might test some other jdbc wrapper libs, if I find them I'll send you the link, but for now I recommend you just remove Exposed from your plugin and go raw (low level) or use some jdbc wrapper lib

icy shadow
#

๐Ÿ’€

dusky harness
#

๐Ÿ’€

#

do u think not relocating would cause issues? ๐Ÿฅบ

#

ยฏ_(ใƒ„)_/ยฏ

#

since atm im relocating kotlin but not relocating exposed

icy shadow
#

the issue is kotlin

dusky harness
icy shadow
#

you relocate for a reason lol

dusky harness
icy shadow
dusky harness
icy shadow
#

no kotlin

#

nuff said

sudden sand
#

I'm trying to make an entity rotate but It doesn't work:

Location loc = vehicle.getDriverPlace().getLocation().clone();
loc.setYaw(vehicle.getDriverPlace().getLocation().getYaw()+20);
vehicle.getDriverPlace().teleport(loc);```
#

also my code reach those lines

#

and also nothing is equal to null

hard wigeon
#

Is there an event on a bow's loading?

formal crane
#

How do i check if an itemstack is a tool?

dense drift
#

make a set with materials that are tools ๐Ÿคท

sudden sand
ocean raptor
#

you dont need teleport and Location#clone

#

just set the yaw

sudden sand
#

ok trying rn

ocean raptor
#

how does placerholderapi works? i mean, how can i change a server-side string in client-side

sudden sand
#

still not working

sudden sand
#

not client side

ocean raptor
#

but isnt it still %some_placeholder% in serverside?

sudden sand
#

for example to add a placeholder support on your plugin you do Player#sendMessage(PlaceholderAPI.parse(mystring))

ocean raptor
#

ah i just realize how stupid my question is

#

lmao

#

aight thanks

sudden sand
#

np

ocean raptor
sudden sand
ocean raptor
#

rotation is about the pitch iirc

#

not yaw

lyric gyro
#

Yaw is left to right, pitch is up/down

ocean raptor
#

^

broken elbow
#

you can use the ChatColor#stripColors method to remove the colors from your string and then see the length

sly spindle
#

Hey!
How can I format a number via Vault like 1T or 10B?

proud pebble
#

try all the vault eco placeholders till you find the one that works

#

i know one of them does it

sly spindle
#

I need it in code

#

not as a placeholder

proud pebble
#

it has a section that shows how to format it

#

from line 222

sly spindle
#

ah nice, I see, thanks

proud pebble
#

atleast an example of how to format a number like you want

robust flower
#

I'm experimenting with Arrow KT, and I wanted to do something like kt // example of expected input for string: "10 -55 99" private fun parseLocation(location: String, dungeonName: String): Location? { val args = location.split(' ', limit = 3) if (args.size != 3) { logger.warning("Invalid location '$location' for dungeon '$dungeonName', skipping this location for now") return null } val x = args[0].toIntOrNull().toOption() val y = args[1].toIntOrNull().toOption() val z = args[2].toIntOrNull().toOption() // use x y and z to create a location } everything is fine up to the last line, how can I combine those three options into something (since Applicative got removed)

icy shadow
#

WHY

#

anyway

#

Monads are applicatives still

#

maybe there isn't liftA2 (or the equivalent) but you can still use flatMap

robust flower
icy shadow
#

Applicative f => (a -> b -> c) -> f a -> f b -> f c

#

i assume it's what you were using before

#

or

#

the other one

#

idk arrow

graceful hedge
#

Cap

hard wigeon
#

so I have access to adventure (I'm depending on paper), and I'm wondering what the best way to use add colors to my placeholders is

#

should I just let the plugin that reads them parse it?

#

or what

robust flower
#

I ended up discovering Nullable.zip which worked for that case pretty well

leaden sinew
hard wigeon
#

it's inherently part of it

#

and wdym do the color myself?

hard wigeon
leaden sinew
hard wigeon
#

I'm not the one parsing them

leaden sinew
#

Wdym?

hard wigeon
#

the plugin that I'm giving them to does not parse placeholders with minimessage

#

so it won't work with just raw minimessage strings

leaden sinew
#

Iโ€™m assuming your using PAPI?

hard wigeon
#

yes

leaden sinew
#

You can parse the color inside the method that provides the placeholders

hard wigeon
#

wait I can return a Component?

leaden sinew
#

You can use the Serializer

hard wigeon
#

ah, okay

#

so parse it to color codes

leaden sinew
#

Yeah

#

Only the placeholders have color codes in them normally though

hard wigeon
#

yup

robust flower
rigid mountain
#

How can i clone a chunk from one world to another, ping me if you can help ๐Ÿ™‚

cerulean birch
#

loop thru blocks in chunk

#

replace

wintry grove
molten wagon
#

Yeah, some management some keep track of time i use.

I use a special class, when run little heavier tasks some limit amount Ms it use.

icy shadow
#

Yeah I realise that doesn't explain much lol

#

What were you using before?

icy shadow
floral beacon
#

Hello,
so I am trying to material from 1 list, so it can't be placed in {x} radius of another material list

  @EventHandler
  public void on(BlockPlaceEvent e) {
    Player player = e.getPlayer();
    if (player.hasPermission("antiraidspawner.bypass"))
      return;
    List<String> materials = (List<String>)getBlocks(player.getLocation().getBlock(), this.antiRaidSpawner.getConfig().getStringList("Prevent-Block-Placement-Near-Blocks-Placing").getInt("block-radius")).stream().map(Block::getType).map(Enum::toString).collect(Collectors.toList());
    e.setCancelled(this.antiRaidSpawner.getConfig().getStringList("Prevent-Block-Placement-Near-Blocks-Placed").stream().anyMatch(string -> materials.contains(string.toUpperCase())));
    if (e.isCancelled())
      this.antiRaidSpawner.getConfig().getStringList("Message").forEach(player::sendMessage); 
  }

Now the error here that happens is
"The method getInt(String) is undefined for the type List<String>"
and it happens where ".getInt("block-radius")" is

If i remove ".getStringList("Prevent-Block-Placement-Near-Blocks-Placing")" from that line, this will work, but it won't have ability to check for the material that will be placed from that other list (other than already placed blocks/material)

graceful juniper
#

There isnt a getInt() function for a List

#

What exactly are you trying to do?

#

im assume your yaml looks something like this:

Prevent-Block-Placement-Near-Blocks-Placing:
  block-radius: int
#

if so

#

you can grab that block-radius int like:

this.antiRaidSpawner.getConfig().getInt("Prevent-Block-Placement-Near-Blocks-Placing.block-radius");
floral beacon
floral beacon
floral beacon
floral beacon
# graceful juniper What exactly are you trying to do?

I have 2 lists, which you can edit in config

Prevent-Block-Placement-Near-Blocks-Placed
``````yml
Prevent-Block-Placement-Near-Blocks-Placing

Everything you put in
"Prevent-Block-Placement-Near-Blocks-Placing",
will be prevented/restricted from placement in
"block-radius" value (of blocks)
but only if you are trying to place a material from that list, near to a block from
"Prevent-Block-Placement-Near-Blocks-Placed" list

#

Example:

block-radius: 5
Prevent-Block-Placement-Near-Blocks-Placing:
  - "PISTON"

Prevent-Block-Placement-Near-Blocks-Placed:
  - "MOB_SPAWNER"

So this will make that you can't place PISTON near MOB SPAWNER, in the radius of 5 from MOB SPAWNER

graceful juniper
#

I see, so u want to get blocks in a radius, check if its the specified block then cancel the place event? @floral beacon

floral beacon
#

both blocks found from different lists

graceful juniper
#

So u want 2 separate String Lists

#

Not all in 1

#

then compare when the right conditions are met

#

List<String> materials = (List<String>)getBlocks(player.getLocation().getBlock(), this.antiRaidSpawner.getConfig().getStringList("Prevent-Block-Placement-Near-Blocks-Placing").getInt("block-radius")).stream().map(Block::getType).map(Enum::toString).collect(Collectors.toList());

I have no clue what you're trying to accomplish with this line thou

#

Pseudo:

on place
grab placed and placing lists
grab the nearby blocks, check if that list has a block thats in the placed list, if not return
check if the placing block is in the placing list, if not return.
cancel

#

I might be forgetting something but thats the general idea

#

what is your getBlocks() function

#

What i can gather is you give it a block and a radius and it grabs the blocks around?

#

Given by a string list

#

(Just gathering information for other people to help as well)

#

If its getBlocks(Block, int) then you putting getStringList() there doesnt make sense unless you .size(); it

#

which wont make sense for the thing youre trying to do

#

separate getBlocks and .getStringList("Prevent-Block-Placement-Near-Blocks-Placing")

#

then compare the strings in a loop or something

#

(If im understanding this properly)

#

If im not please say what im doing wrong lmao

thorn cape
#

Does the speed potion effect player velocity?

floral beacon
#

ok sorry i was trying something out

List<String> materials = (List<String>)getBlocks(player.getLocation().getBlock(), this.antiRaidSpawner.getConfig().getStringList("Prevent-Block-Placement-Near-Blocks-Placing").getInt("block-radius")).stream().map(Block::getType).map(Enum::toString).collect(Collectors.toList());

I have no clue what you're trying to accomplish with this line thou
A string list that contains all placing blocks

Pseudo:

on place
grab placed and placing lists
grab the nearby blocks, check if that list has a block thats in the placed list, if not return
check if the placing block is in the placing list, if not return.
cancel
-on place
-grab placing block list and block-radius size in which they can't be placed near placed block list
-if a player placed a block from placing block list list in a block-radius of placed block list block, it will cancel

what is your getBlocks() function
below the code i've sent above:

  private Set<Block> getBlocks(Block start, int radius) {
    if (radius < 0)
      return Sets.newHashSetWithExpectedSize(0); 
    int iterations = radius * 2 + 1;
    Set<Block> blocks = Sets.newHashSetWithExpectedSize(iterations * iterations * iterations);
    for (int x = -radius; x <= radius; x++) {
      for (int y = -radius; y <= radius; y++) {
        for (int z = -radius; z <= radius; z++)
          blocks.add(start.getRelative(x, y, z)); 
      } 
    } 
    return blocks;
  }
graceful juniper
#

Alr we can start by removing getStringList("Prevent-Block-Placement-Near-Blocks-Placing") as that with getInt() doesnt make sense

#

that'll fix the function

floral beacon
graceful juniper
#

now you need to grab the placing blocks from the config

#

then compare lists

#

but i don't understand how to make it that it checks placing list
You got to do it manually with a for loop

#

or idk if lists has a compare function

#

but you can see the java docs

floral beacon
#

how do you exactly mean here to compare them

graceful juniper
#
for (String string : placed) {
  for (String string2 : placing) {
    if (string == string2) // pass
    else continue;
  }
}

if all continue then return;
if pass then cancel event
floral beacon
#

yes but

#

i am not sure that will work how i want

graceful juniper
#

You can always try

floral beacon
graceful juniper
#

As far as you worded it, thats exactly how you want this to go, just with spawners and things listed

sand bane
#

Please cache enum values

#

Use an enumset and such

floral beacon
sand bane
#

Performance

#

Less garbage collection, less cpu consumption

floral beacon
sand bane
#

When loading from config

#

Add objects to an enumset

#

And such

#

I'm not here to code for you

warm steppe
#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

crimson knoll
#

Can someone help me with GSON for java?

#

I have this list of Users
and I want to get all the playernames

[
  {
    "playerUUID": "00771abe-246a-46b9-80e2-e7232a8e1b96",
    "PlayerName": "_D2TZ",
    "reason": "Kill Aura",
    "proof": "No Proof Added",
    "ID": 18114
  },
  {
    "playerUUID": "bbb460c4-bcaf-4444-9a7a-7b7c12c5b941",
    "PlayerName": "_DITZ",
    "reason": "Kill Aura",
    "proof": "No Proof Added",
    "ID": 50791
  },
  {
    "playerUUID": "bbb460c4-bcaf-4444-9a7a-7b7c12c5b941",
    "PlayerName": "_DITZ",
    "reason": "X-Ray",
    "proof": "e",
    "ID": 44358
  }
]
lyric gyro
#

So why donโ€™t you just map your list of users into a string holder

#

Did you not make this yourself?

high edge
#

I mean have you even tried anything yet?

crimson knoll
#

But that didnt work

robust flower
# icy shadow What were you using before?

I was using this before, and "something" is because I don't remember the exact method names kt Option.applicative().something(option1, option2, option3).something { o1, o2, o3 -> // enters only is all three Option (Maybe) are Some (Just), else don't do anything }

high edge
#

Get the entire thing, then just get that attribute

#

Can't remember what the actual methods are called, but I'm sure there's a tutorial somewhere

icy shadow
#

anyway

#

for a monad you can replicate it with flatMap although it's not quite as elegant

crimson knoll
#

I have no clue how to get it

#
    public static void getPlayers() throws IOException {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        File file = new File(plugin.getDataFolder().getAbsolutePath() + "/Reports.json" );
        Reader reader = new FileReader(file);


        Reports[] n = gson.fromJson(reader, Reports[].class);
        System.out.println(Arrays.toString(n));
    }
robust flower
icy shadow
#

Lift works on applicatives, not monads but yeah effectively

#

It's more abstract than that really

#

but in the context of optional / Maybe, then yeah

#

It's the same as a.flatMap { a1 -> b.flatMap { b1 -> c.flatMap { c1 -> f(a1, b1, c1) }}}

graceful hedge
#

that looks interesting

icy shadow
#

Indeed

icy shadow
#

Option.applicative().tupled(profileService(), phoneService(), addressService()).fix()

#

Found that on arrow docs

#

Actually map is probably better

#
Option.applicative().map(profileService(), phoneService(), addressService(), { (name, phone, addresses) ->
  Profile(name, phone, addresses)
})
#

Vs liftA3 Profile profileService phoneService addressService

#

Anyway

#

Idk what the point of that was

robust flower