#help-development

1 messages · Page 1355 of 1

wet breach
#

maven actually specifically looks for that variable

crude charm
#

o

#

m

#

h

#

o

#

m

#

g

#

I see somethimh

lost matrix
#

There you have the "Project" tab where your java version is displayed
And under the tab on the bottom there is "SDKs" where you can even download new ones

wet breach
#

I believe this change started around Java 9 btw

lost matrix
wet breach
#

so, if you install java 11 and higher, it won't make that variable and thus for development purposes you would need to go in make that variable yourself

crude charm
#

tal error compiling: invalid target release: 11.0.4 -> [Help 1]

#

yet

#

I have it all set to that version

formal ferry
#

if im using saveResource("config.yml", false), where does the config.yml file need to be? resources folder or src?

crude charm
#

resources

formal ferry
#

weird... its not creating the file oof

crude charm
#

do u create anywhere in your code?

#

otherwise you need to make it urself

formal ferry
#

lemme see

crude charm
#

@lost matrix

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project Core: Fa
tal error compiling: invalid target release: 11.0.4 -> [Help 1]
****
cinder thistle
#

```
content
```

#

use it

#

ty

wet breach
#

@formal ferry where the file is located is not relevant because the question you are asking involves two very different things

formal ferry
#

well it created the file but didn't copy the contents

wet breach
#

If you want to save the config.yml file into the src directory you most definitely can, just need to update the pom to reflect this so that when you compile, it is placed in the appropriate place inside the jar

#

otherwise, place it in the resources directory which is the default place to add resources you want in the root of the jar

formal ferry
#

well it is inside of resources right now

#

yeah

#

but it's not copying

wet breach
#

just use that

formal ferry
#

hmm

wet breach
#

not sure why you need to use saveResource(). The saveResource() api stuff is for more customized things that generally doesn't involve the config.yml

formal ferry
#

well yeah but i also use other files (not config.yml)

wet breach
#

Well, then use saveResource for those other things, as for the config.yml just use that as it will do it for you and fails silenty if config.yml already exists unless you tell it to overwrite anyways.

#

what does your code look like for saveResource()?

near kayak
#

but the custom model data won't just work

cinder thistle
#

what the heck

near kayak
#

ye

#

it is kinda

cinder thistle
#

wack

near kayak
#

Im trying to make a texture pack

cinder thistle
#

at least we can change the language we view it in

#

thats pretty nice

near kayak
#

with custom model data

cinder thistle
#

oh my god there's a popup

near kayak
#

and I don't know anything

cinder thistle
#

@jade perch lombok copypasta

#

idk what this file is

#

just had it for some reason

#

that's interesting

near kayak
#

pov it is fbi secret

#

codes

cinder thistle
#

oh this is from cyberstart america

#

gone are the days of ?paste

#

we now have this

#

actually probably not mobile users exist still

lost matrix
cinder thistle
#

idk

#

just something I had from cyberstart

#

gtg

#

first file I found

sour rampart
eternal oxide
#

Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml

sour rampart
#

ya but i have a plugin.yml...

eternal oxide
#

not in your jar

sour rampart
#

still doesn't work. new error: [Server thread/ERROR]: Could not load 'plugins/NetherOverworldTEST2.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:160) ~[minecraft_server.jar:3029-Spigot-79d53c2-e9ad7cb]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[minecraft_server.jar:3029-Spigot-79d53c2-e9ad7cb]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:382) ~[minecraft_server.jar:3029-Spigot-79d53c2-e9ad7cb]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:224) ~[minecraft_server.jar:3029-Spigot-79d53c2-e9ad7cb]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:918) ~[minecraft_server.jar:3029-Spigot-79d53c2-e9ad7cb]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[minecraft_server.jar:3029-Spigot-79d53c2-e9ad7cb]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 7 more

eternal oxide
#

same error

sour rampart
#

how do i fix

eternal oxide
#

your plugin.yml has be be included in your exported jar

sour rampart
#

it is tho...

eternal oxide
#

its not

#

open your jar with 7zip or any compression util

#

There will be no plugin.yml in the root.

opal juniper
#

as well as the different look

cinder thistle
#

conclure no respon y it no wok

#

??

cinder thistle
cinder thistle
#

actually it's been there

#

I like the popup

#

Imagine relying on conclure

#

Tooootally isn’t me

opal juniper
#

google it

daring sierra
opal juniper
#

exactly

daring sierra
#

exactly

eternal oxide
#

?services

queen dragonBOT
opal juniper
#
ItemStack itemStack = new ItemStack(Material.DIAMOND_PICKAXE);
    ItemMeta itemMeta = itemStack.getItemMeta();
    itemMeta.spigot().setUnbreakable(true);
    itemStack.setItemMeta(itemMeta);```
daring sierra
#

i betcha the first link has the answer

eternal oxide
#

You need to learn java first

daring sierra
#

atleast a bit of java

eternal oxide
#

Learn Java first

paper viper
#

learn Java first

eternal oxide
#

You will not be able to do that without at least a BASIC understanding of Java

#

hang on... Essentials?

daring sierra
#

🧐

#

Bullshit

eternal oxide
quaint mantle
#

How can I open an inventory from a different class?

eternal oxide
#

add a getter to retrieve a reference to your inventory

quaint mantle
#

Whats that?

#

Oh wait

eternal oxide
#

getter/setter

quaint mantle
#

getters and setters

#

uuuuuh

sour rampart
eternal oxide
#

Not in your jar there wasn't

quaint mantle
#

I just solved it by an extremely disgusting way, by recreating the same inventory in another class, this is just disgusting

eternal oxide
#

You'd do better by creating an inventory/item store/manager

#

all your inventories and Items get created in your store

quaint mantle
#

Slow down, I have been coding for like not over 2 weeks in spigot

eternal oxide
#

literally create a class called InventoryManager

quaint mantle
#

yea

#

Huh

#

Oh shoot

#

yea I get it now

eternal oxide
#

in your plugin root you create an instance of it

quaint mantle
#

but its a little bit too late, I would have to recode alot of stuff

eternal oxide
#

then anythign that needs an inventory/item it just gets the store/manager and grabs the item

quaint mantle
#

Ok

#

thx for the idea

#

what?

#

Why does the constructor not work???

#

show what does not work

#

wait I think I fixed it

#

okaay

#

Oh no

#

So

#

xD

#

So I have put this in class menu,right?

#

menu plugin;

public menu(menu plugin) {
    this.plugin = plugin;
}
#

however since my dumbass got confused af

#

okay

#

I somehow need to summon this class from class clickevent

#

so I can use an inventory from class menu

eternal oxide
#

public menu(JavaPlugin plugin) or you are probably using Main

quaint mantle
#

nono

#

not main

#

leave main out of this

eternal oxide
#

plugin will not be an instance of menu inside the menu class

quaint mantle
#

English please I dont understand this

quaint mantle
eternal oxide
#

sorry, that was english

#

thats a constructor for a class called menu

quaint mantle
#

Yes

#

thats what I need

eternal oxide
#

a class called menu you are passing a menu object to

quaint mantle
#

to clickevent

eternal oxide
#

re-read yoru constructor. menu is not plugin

quaint mantle
#

How?

#

menu plugin;
public menu(menu plugin) {
this.plugin = plugin;
}

eternal oxide
#

plugin is yoru main class

sullen dome
#

what is the earliest event, where i can kick the player with a message he has to verify

quaint mantle
#

It cant be any other class?

sullen dome
#

PlayerLoginEvent?

paper viper
#

AsyncPlayerPreLoginEvent

eternal oxide
#

plugin is your MAIN class. The only class that extends JavaPlugin

paper viper
#

something like that

sullen dome
#

ty

#

how would i get the player there

eternal oxide
#

there is no player in the asyncpre event

sullen dome
#

yea

#

so...

eternal oxide
#

it doesn;t exist yet

paper viper
#

getUniqueId()

sullen dome
#

doesnt exist

quaint mantle
#

?

paper viper
#

no no no

#

i was talking to Real

sullen dome
#

ah

eternal oxide
#

@quaint mantle no

sullen dome
#

what no

paper viper
sullen dome
#

ahh confused

#

ah i see

#

true the uuid exists. ty

#

so i can just get the player from the uuid i guess?

eternal oxide
#
    main plugin;
    public menu(main plugin) {
        this.plugin = plugin;
    }```
#

There is NO player

quaint mantle
#

my main class is main so I just put instead of JavaPlugin main

eternal oxide
#

no, JavaPlugin

quaint mantle
#

what

eternal oxide
#

there, I fixed it to use main, Is your main class really lower case m?

quaint mantle
#

Yes

#

unfortunately

eternal oxide
#

Please learn about Java syntax and camel case.

narrow furnace
#

your plugin is called 'main'?

eternal oxide
#

a class shoudl always start capitolized

quaint mantle
#

I know whats camel case dont worry, I need to learn basic Java

quaint mantle
eternal oxide
#

so Main and Menu not main and menu

quaint mantle
#

ty

eternal oxide
#

methods and fields start lower cased

narrow furnace
#

please learn at least basic java before trying to make a spigot plugin

quaint mantle
#

Hah I tought everything starts lowercased

eternal oxide
#

nah most things, but Classes, Interfaces start upper

quaint mantle
narrow furnace
#

where did you start trying to learn it

eternal oxide
#

Everyone starts somewhere. You are getting there slowly

quaint mantle
# narrow furnace where did you start trying to learn it

I tried it half a year ago, didnt understand shit, tried spigot, also didnt understand shit, so I learned html, css, a very little bit of javascript, linux and amateur pentesting and now I came back to java/spigot after half a year, and I mostly understand stuff I work with, unless its something I have never worked with before.

sleek pond
eternal oxide
#

already covered

quaint mantle
#

Wellllll, now I dont know how to make it so I can use the menu inventory inside Clickevent class

#

plugin.menu?

eternal oxide
#

if you create yoru Menu instance in yrou Main class you do Menu menu = new Menu(this);

quaint mantle
#

so I can delete
public menu(JavaPlugin plugin) {

}

private final main plugin;
public clickevent(main plugin){
    this.plugin = plugin;
}
#

?

eternal oxide
#

stored as a Field you can either make it public so any class with access to Main can use plugin.menu, or the correct way is to make it private and add a getter so they use plugin.getMenu()

quaint mantle
#

OH

#

No I must have linked the classes in a wrong way

cinder thistle
#

I'm currently doing this:

this.banDAO = new OxideDAO<Ban>(Ban.class, this.datastore);

But I'd rather do this:

this.banDAO = new OxideDAO<Ban>(this.datastore);

I have this:

public class OxideDAO<T> extends BasicDAO<T, String> {
    
    public OxideDAO(Class<T> entityClass, Datastore datastore) {
        super(entityClass, datastore);
    }
}

How can I do that?

eternal oxide
#

Do you not get an error on that with a hidden type?

#

perhaps not

#

You probably won;t be able to do what you want like that due to type erasure

cinder thistle
#

I don't get an error from what I'm currently doing

#

oh that's sad

#

Would I be able to do new OxideDAO(Ban.class, this.datastore);?
I'd think not

eternal oxide
#

that should be possible

#

however no diamonds will warn?

cinder thistle
#

probably

#

hold on a sec

sullen dome
#

i guess this is the easiest way to give me a 6-digit random code?

ThreadLocalRandom.current().nextInt(100000, 999999)```
eternal oxide
#

no

sullen dome
#

what instead?

cinder thistle
#

nope nvm

eternal oxide
#

it won;t prefix zeros

#

use hex

sullen dome
#

how

cinder thistle
#

ways

#

google

eternal oxide
#

create three random ints (0 - 256), then Integer.toHexString(number)

#

concat and you have a 6 digit string

#

as its Hex it will always be 6

sullen dome
#

what is (number) in this case?

eternal oxide
#

each random int

#

simply converts it to a hex value

#

perhaps that won;t work. it also strips preceding zeros

sullen dome
#

found this on the internet, idk if that works tho

#
        int number = ThreadLocalRandom.current().nextInt(999999);
        String code =  String.format("%06d", number);```
eternal oxide
#

In that case use format

#

yep

lost matrix
#
  public int randomRgb() {
    final ThreadLocalRandom random = ThreadLocalRandom.current();
    final int r = random.nextInt(0xFF);
    final int g = random.nextInt(0xFF);
    final int b = random.nextInt(0xFF);
    return (((r << 8) + g) << 8) + b;
  }

Didnt test

cinder thistle
#

I hate bitwise operators

#

bits make no sense

eternal oxide
#

I remember when we wrote code using punch cards. Bits at a time

mystic lion
#

Wouldn't << 8 basically times the number by 64?

cinder thistle
#

lol

mystic lion
#

I find them operations confusing :/

cinder thistle
#

same

eternal oxide
#

its just twos compliment. 1 2 4 8 16 32 64

mystic lion
#

yeah

#

right..

rapid vigil
#
    public void Random(EntityDamageEvent e) {
        if (e.getEntity() instanceof ArmorStand) {
            e.setCancelled(true);
            if (e.getDamage(EntityDamageEvent.DamageCause.ENTITY_ATTACK)) ;
        }
    }
}
``` on the '(EntityDamageEvent.DamageCause.ENTITY_ATTACK)' It gives me an error.. The error is:
**'getDamage(org.bukkit.event.entity.EntityDamageEvent.DamageModifier)' in 'org.bukkit.event.entity.EntityDamageEvent' cannot be applied to '(org.bukkit.event.entity.EntityDamageEvent.DamageCause)'**
mystic lion
#

Can't you just check if e.getCause() == DamageCause.ENTITY_ATTACK?

sleek pond
#

did you actually do that

mystic lion
#

Just thought of that now

eternal oxide
#

yes

sleek pond
#

really?

#

how old are you

mystic lion
#

Who?

eternal oxide
#

in my 50's

cinder thistle
#

yike

#

oh you're that one guy

eternal oxide
#

lol yep 🙂

mystic lion
#

Elgar old af

cinder thistle
#

old ak

#

ak-47

mystic lion
#

interesting

sleek pond
#

mhm

lost matrix
mystic lion
#

hm...

cinder thistle
#

lol

mystic lion
#

maybe

rapid vigil
#

if(e.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK) {

#

You mean like this?

mystic lion
#

Yes

lost matrix
#

From what ive read so far in this dc more "probably" thant "maybe"

rapid vigil
#

Yeah but It gives me a warning: 'if' statement has empty body

#

Normaly when I get this warning the whole code doesn't work

mystic lion
#

...

rapid vigil
#

Should I really care about it?

eternal oxide
#

no body means you havn't put any code inside the { } yet

torn jewel
#

what is the most effecient way to check if a player is in a claimed chunk without lagging the server

rapid vigil
#

oh

mystic lion
#

check if the players chunk is equal to another chunk

#

or the coords

eternal oxide
#

@torn jewel what claim plugin?

torn jewel
#

making a custom one

mystic lion
#

Do you have claimed chunks in your plugin yet?

torn jewel
#

i want to check if a player is in a claimed chunk

torn jewel
eternal oxide
#

then check when they move between chunks

#

I posted some simple code to check that a couple of days back

mystic lion
#

Check the move event and check the chunk the player enters if equal to a claimed chunk... I think that would work...

#

Not sure if its most efficient

rapid vigil
#

Yeah but, Is there no way to do so It sends a message to the one who clicked the armor stand?

        if (e.getEntity() instanceof ArmorStand) {
            e.setCancelled(true);
            if(e.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK) {
                e.getEntity().sendMessage("Testing");``` e.getEntity is the armorstand
mystic lion
#

e.getEntity().getDamager

rapid vigil
#

There's no such a thing?

mystic lion
#

1 sec

eternal oxide
#

armorstands have their own interact events that may fire.

rapid vigil
#

It doesn't find something like "getDamager"

mystic lion
#

EntityDamageByEntityEvent

#

try use that?

#

then its e.getDamager

rancid raptor
#

so uh, I'm kinda confused about how knockback works with packets...

#

is PacketPlayOutEntityVelocity used to tell the client their knockback?

rapid vigil
#

Thanks a lot bro, Thanks for your time!

mystic lion
#

: ]

rapid vigil
#

But I have a question

lost matrix
# torn jewel that is why i want to know the best way

The best way to know if an action occurs in a certain chunk?
Checking if a player enters a certain chunk would look like this:

  @EventHandler
  public void onMove(PlayerMoveEvent event) {
    Location from = event.getFrom();
    Location to = event.getTo();

    int fromX = from.getBlockX() >> 16;
    int fromZ = from.getBlockZ() >> 16;
    int toX = to.getBlockX() >> 16;
    int toZ = to.getBlockZ() >> 16;

    if (fromX == toX && fromX == toZ) {
      return;
    }
    
    System.out.println("Player moved from Chunk " + fromX + "|" + fromZ + " to " + toX + "|" + toZ);
  }
rapid vigil
#

Where did you find that?

#

I mean did you check docs

#

or smth?

mystic lion
#

huh

rapid vigil
#

:p

mystic lion
#

Did I check docs?

rapid vigil
#

I don't know, You said brb then you knew it

#

so how :p

mystic lion
#

I just quickly launched intellij

#

and checked the events

#

for damage

rapid vigil
#

omg, Thanks a lot for your time!

mystic lion
#

: P

rapid vigil
#

:p

mystic lion
#

;p

rapid vigil
#

;p

mystic lion
#

UwU

rapid vigil
#

OwO

rancid raptor
#

rlly

mystic lion
#

oh no

rancid raptor
#

so about knockback... is PacketPlayOutEntityVelocity used to tell the client that or is it something else?

daring sierra
#

ùwú

rapid vigil
#

Yeah but, how do I do so It will equip the damager armor?

#

There's no "e.getDamager.setHelmet()"

rancid raptor
#

check on getDamager().getPlayer()

rapid vigil
#

That doesn't work

#

It doesn't find .gePlayer

#

.getPlayer*

torn jewel
#

should i just loop through all claimed chanks and just see if the player is in one of them

cinder thistle
#

no

#

get the player's location

#

get the chunk at that location

torn jewel
#

then what

cinder thistle
#

idk

#

do whatever you're trying to do with it

#

oh I c

torn jewel
#

i am trying to figure out if a player is in a claimed chunk

cinder thistle
#

check if that chunk is a claimed chunk or whatever

rancid raptor
#

@rapid vigil

        if (event.getDamager().getType() == EntityType.PLAYER) {
            Player player = (Player) event.getDamager();
            player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
        }
cinder thistle
#

yeah get the player's location and then get that chunk. check if that chunk is claimed or not and then you have your answer

rapid vigil
#

Thanks a lot for your time!

rancid raptor
#

yw

rapid vigil
#

Thanks again.

rancid raptor
#

now would anyone have any information to share on my knockback question?

rapid vigil
#

Maybe me

rancid raptor
#

so about knockback... is PacketPlayOutEntityVelocity used to tell the client that or is it something else?

cinder thistle
rancid raptor
#

I already have...

cinder thistle
rancid raptor
#

I'm getting some sort of velocity packet, but when I send a PacketPlayInFlying.PacketPlayInPosition back, nothing happens and the player stays in place

lunar schooner
#

Hey there, does anyone know if there is an api equivalent to the locatebiome command?

rancid raptor
#

probably not (the api I mean probably does not exist)

dense eagle
#

Hi! Im having quite a bad time wrapping my head around this problem I have: I need to call a sync class from an async one?

lunar schooner
lunar schooner
eternal oxide
#

Bukkit.getScheduler().runTask

rancid raptor
#

ugh...

#

no matter what I do, using PlayerConnection.a(PacketPlayInFlying packetplayinflying) never moves the player

rapid vigil
#

Guys, can anyone help me with a command to remove all the armor stands in the world?

rancid raptor
#

srsly

#

now thats something you can google

rapid vigil
#

I already tried

#

Multiple times

#

but okay

#

Let me try for the last time

rancid raptor
#

doesn't matter it says all worlds, cause there's code in the second message for one world

rapid vigil
#

thank :p

rancid raptor
#

then just check each entity to see if its an armor stand and kill it if it is

rapid vigil
#

I disable the event of killing armor stand by lef tclick

#

left click*

eternal oxide
#

kill @e[type=armorstand] perhaps?

rapid vigil
#

I have a /kill command already

#

It won't work for me

eternal oxide
#

thats vanilla MC

rapid vigil
#

Yeah I know

rancid raptor
#

/minecraft:kill

eternal oxide
#

You did ask for a command to kill all armorstands in the world

#

or world#getEntitiesByClass(ArmorStand.class).forEach(

lunar schooner
#

Anyone know if there's a generic way of getting a nms Entity from a CommandSender?

dense eagle
rapid vigil
#

Thanks, Justsnoopy30, That helped.

rancid raptor
#

oh my gosh

#

the thing actually moved

#

finally

#

lmao it b-hopped to the edge of the map at turbo speed 😂

deft sedge
#

How would I scan the player inventory for an item and if they have said item i want to take the item

stone sinew
deft sedge
#

ok

#

is there a way for me to get the meta of that item

#

@ me if replying pls

stone sinew
#

first​(ItemStack item).getItemMeta()

#

@deft sedge

deft sedge
#

ok

hidden oak
#

Hello!

#

What is the alternative of onServerCommand with bungee?

deft sedge
stone sinew
deft sedge
#

does that get the first slot?

stone sinew
#

Yeah it gets the slot sorry so need to do Inventory.getItem(slot) after

eternal oxide
#

?jd look it up

deft sedge
#

ok so I do the frist thing which is just get inventory and then how do I get the slot number of the item if I find it

#

sorry if i'm being slow @stone sinew

stone sinew
#
Inventory i = Player.getInventory();
ItemStack item;
int slot = i.first(ItemStack);
if(i.first(ItemStack) != -1) 
    item = i.getItem(slot);

// or

if(i.contains(ItemStack, 1))
    item = i.getItem(slot);
#

@deft sedge

deft sedge
#

ok

#

y do u do i.first doesn't that just check the first slot

stone sinew
#

?

#

i is the inventory object

deft sedge
#

ok yea but u do i.first

#

or does that not mean first slot

stone sinew
#

It means the first slot that contains that item

deft sedge
#

OHHH

sullen dome
#

question:
how can i remove 1 key from a config? looks like this:

homes:
  keys:
    <uuid>:
      - key1
      - key2
      - key3```
and i only want to remove for example key1
wet breach
#

just make it empty or set it to null

fathom timber
#

?api

#

whats the command again

#

?docs

wet breach
#

for lists you will need to grab the entire thing as a list and then remove what it is, then re-save the list

stone sinew
#

Read wrong sorry...

List<String> s = YamlConfiguration.getStringList(<key>);

s.remove(s.indexOf(string));
YamlConfiguration.set(<key>, s);
wet breach
#

and theres the code for you in what I stated 🙂 ^

eternal oxide
#

?jd

dense eagle
#

Anyone knows how to get the "plugin" arg in an external class?

eternal oxide
#

google java dependency injection

opal juniper
dense eagle
opal juniper
# dense eagle yeah

How i sometimes do it is

Plugin plugin = (Bukkit.getPluginManager().getPlugin("<Name_Of_Plugin>"));
#

However i imagine there are better ways

young knoll
#

Dependency injection

dense eagle
opal juniper
#

Yes

dense eagle
#

Thanks!

young knoll
#

Please use DI or a static singleton

cinder thistle
#

static singleton pog

#

I don't like DI for events

#

it's code smell but idgaf it's my code

fickle helm
cinder thistle
#

yes.

fickle helm
#

yes it is possible?

cinder thistle
#

if there was they would've done it

#

instead of making a suggestion

#

There is no configurable range for this, it is a hard-coded range built into Minecraft.

#

it's a client-side thing

fickle helm
#

dang, just thought I'd check

mortal hare
#

are netty's player's channel pipeline threads synced with NMS main thread?

#

or you need to schedule a task through scheduler in order to get the code functionality synced with thread?

#

i guess not

deft sedge
#

does || return true if both of the tings being compared are true?

eternal oxide
#

either

mortal hare
#

**and **returns true if both are, or returns if either are true

deft sedge
#

but can or return true if both things are true?

eternal oxide
#

its basic logic. You already have the answer

deft sedge
#

ok

mortal hare
#

if first expression is true it returns, no matter if the second expression is false

#

trueBool || falseBool -> trueBool

deft sedge
#

yea ik how it works

#

i was just worried it wouldn't return true if both of the tings are true

#

but i guess so

mortal hare
#

it wouldn't even reach that if first condition is true and second condition even is condition is true or false

eternal oxide
#

if either of these things are true, return true

deft sedge
#

OHH ur right

#

@mortal hare

eternal oxide
#

nothing in there says but don;t return true if both are true

deft sedge
#

i didnt' think of that

#

ok thanjks guys

mortal hare
#

np

deft sedge
#

srry for dumb question

mortal hare
#

np

rose tundra
#

How can I send the user a message with tabs?

maiden briar
#

I know it sounds weird, but I want to render my city into minecraft. I want to use openstreetmap, but the problem is: how can I check the height, if it's a home, a road or a park.... so somebody knows?

quaint mantle
rose tundra
#

"---Kill Count----"
"Players 0"
"Zombies 0"

#

The space normally generated by the tab key

near kite
quaint mantle
quaint mantle
#

dunno

lost matrix
rose tundra
#

I understand, thank you very much

spring fog
#

why does my PlayerInteractEvent go off twice? im checking for a right-click on a block, and i already have a check for if the hand is off hand yet it still goes off twice 🤔

spring fog
#

plugin.getServer().getPlayer(string)

blazing slate
#

Question is there a reason why getConfig() always loads defaults?

eternal oxide
#

if you make changes you have to save them

upper vale
#

How do I prevent players hotkeying items into the crafting table in their inventory?

#

Cancelling InventoryClick doesnt work

eternal oxide
#

InventoryClickEvent

blazing slate
#

Wdym if you make changes?? You edit config some time but I don't see reason for that being set to default

upper vale
eternal oxide
#

If you make changes via code you have to save those changes

upper vale
#

hotkeying into crafting table isnt actually clicking any item

#

you're just clicking air

blazing slate
#

I do have that:

       try {
            ConfigUpdater.update();
            saveConfig();
        } catch (IOException e) {
            Logger.error("Failed to update config.yml");
            e.printStackTrace();
        }

        FileConfiguration config = this.getConfig().options().copyDefaults(false).configuration();

        // Settings
        HopperSettings.load(this, config);
        ParticleSettings.load(config.getConfigurationSection("particles"));
        Messages.load(config);
deft sedge
#

How do i convert a uuid into a player object?

#

please @ me if responding

eternal oxide
#

Bukkit.getOfflinePlayer(UUID)

#

from there you can check if they are online

deft sedge
#

Ok but I need to convert the uuid to player object

#

I already have it

eternal oxide
#

get the offline (safest). Check if online in the offline object, then it has a getPlayer.

deft sedge
#

K

eternal oxide
#

isOnline() and getPlayer()

deft sedge
#

But is there not a way to get the player object from a uuid

eternal oxide
#

not directly

deft sedge
#

K

eternal oxide
#

you have to make sure there is a Player object

#

only players who are online have a player object

deft sedge
#

Well I am storing player uuids to a map list

eternal oxide
#

good, UUID rather than player

deft sedge
#

Ok I’ll ask later gtg

eternal oxide
#

you could call Bukkit.getPlayer(UUID) but you'd have to check the return as it may not be available (null)

vital swift
#

[18:21:11 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'COINS' in 'field list'

#

does someone knows how to fix this?

#

im new to SQL

onyx shale
#

well the error its pretty descriptive

quaint mantle
onyx shale
#

you dont have coins column in ur table

vital swift
#

how i make one?

eternal oxide
#

Is this your plugin?

vital swift
#

yea

#

i watched some SQL tutorials from TheSourceCode

#

and i made my own version but didnt work so i had to copy..

#

SQL connects perfectly

eternal oxide
#

Your table create statement is wrong then

#

and you need to watch more tutorials

vital swift
#

is it like this?

onyx shale
#

Yep

#

that New should be COINS or w/e the name

vital swift
#

java.sql.SQLException: Illegal operation on empty result set.

#

sec

#

System.out.print(results.getInt("COINS"));

onyx shale
#

how exactly

#

you create that table

#

and what statement you use to get the coins field

vital swift
#

sec

#

this is not a virus

warm cloak
#

how can i setup database and tables from my plugin?

onyx shale
#

why is everything static?

#

also you never check if if results.next is true

#

you just go to the value

#

also does the player have a coins value? (not null)

#

should have a value of 0 by default

onyx shale
#

sqlite*

vague oracle
warm cloak
onyx shale
#

methods are sync at base,if you want extra performance you can async them

#

with completeablefutures/bukkitrunnables

#

but its eh eh... its a sqlite so its rather fast af

woven coral
onyx shale
#

for new version if i remember right

#

you need to grab the bossbar instnace

#

from the player

fathom timber
#

For permissions in plugin.yml

#

do you need quotations around them?

vital swift
#

WHAT?

#

Im new to SQL

onyx shale
#

if you want to use a sqlite you have a template above

vital swift
#

SQLLITE?

#

I meant im new to MySQL

onyx shale
#

its same syntax,just changed getconnection

#

however someone mentioned the problem and i also mentioned it

#

you never check if the result is a valid one

#

result.next returns a boolean beside loading the next result

#

in your case result is invalid

vital swift
#

i now understand

onyx shale
#

also things should always have a value if they dont allow nulls

#

in your case you should preset a player to 0 coins

#

also the 2nd problem you will face

#

as your using mysql

#

you need async interaction

dusty herald
#

I wish it were

onyx shale
#

in a way.. not that much changed

#

ik there are some null rules

#

for mysql or sqlite

#

so you cant do everything on both

rugged topaz
#

instead of static abusing, r u meant to call a static instance of the class or sumn?

dusty herald
#

dependency injection

onyx shale
#

i usually go with a class holding everything related to sql then OOP

dusty herald
#

OOPs shrug_panda

onyx shale
#

i have a handler for sql then i use it in a storage class

#

there i make the async stuff

onyx shale
#

what you mean?

#

what you store in the hashmap

quaint mantle
#

guys, how do you create GUIs in abstract way?

#

i've got an abstract class GUI that other gui classes extend

onyx shale
#

abusing inventoryholder

quaint mantle
#

but idk how to manage that

#

why inventoryholder if you've got player

onyx shale
#

HashMap.get(uuid)

#

will retreive the int stored

#

so... you can use how much they have to... check if they have another amount...

#

not rly sure... i get the question

#

HashMap.get(uuid)>500

#

well in your case

#

=amount

eternal oxide
#

@quaint mantle I'm going to guess you haven't explained very well. Are you talking about finding if a player has more than X amount of an item?

onyx shale
#

not rly hes talking about a hashmap with uuid/int

#

HashMap.get(uuid)>=5

eternal oxide
#

^

onyx shale
#

posted a link above with java operators

young needle
#

is it possible to stop players from holding right click on a button and making them press it manually every time(1.16)

#

?

eternal oxide
#

buttons? Ingame buttons only single click activate

young needle
#

you can hold right click on a button and it will click every time

#

wighout pressing it manually

#

you can just hold it

eternal oxide
#

are you talking about things like stone buttons?

young needle
#

yes

eternal oxide
#

odd, I've never known any auto repeat on a button

young needle
#

try it out. Place a stone button and hold right click on it

eternal oxide
#

ah I see

#

The answer would be no. thats client side would be my guess.

#

No way on the server to detect if a click was a press click or a repeating click

young needle
#

The thing is I saw a server fix it somehow. That was on 1.8 though.(The issue is also present on 1.8 so its not like its a new feature). They patched it somehow and I don't know how

eternal oxide
#

modded server?

young needle
#

vanilla

eternal oxide
#

I don;t see it would be possible on vanilla

#

unless there is some packt that signifies the click type, in which case you'd have to look at ProtocolLib

heavy mason
#

Anyone know why dependecnies don't work after adding them through project stuctures > libraries > Java > Adding jar file

young needle
#

internal or external dependencies?

#

(in server jar or external)

eternal oxide
#

exporting jar or using maven or gradle?

heavy mason
young needle
#

he is probably using export when he is not modifing the pom/build.gradle

heavy mason
eternal oxide
#

as I thought 🙂

young needle
#

then you need to add it to your pom.xml

eternal oxide
#

when using Maven you add dependencies to yoru Pom, never in your libs

heavy mason
#

But it's a jar file

eternal oxide
#

then you find a repo for it, or install it to your local maven

#

what jar is it?

heavy mason
#

SiegeWar XD

eternal oxide
deft sedge
#

I have a bunch of uuids stored to a map. I want to convert the uuids back into player objects. How would I do that?

deft sedge
#

Please @ me if responding

eternal oxide
#

goto the Towny discord and they'll give you all the help you need

deft sedge
#

ok bukkit.getPlayer and then the uuid?

young needle
#

yep

deft sedge
#

thx

vital ridge
#

Sup, anyone knows how to edit bats pathfindergoals or make them attack players?

#

Cuz they are different from normal ones

#

normal mobs*

young needle
#

paper? Then you can use their pathfinderapi. If not you need to use nms

vital ridge
#

Im using nms

#

on spigot

#

But I nms pathfindergoals wont work on bat

young needle
#

why wouldn't they?

vital ridge
#

I dont know 😄

#

cant make them attack players

#

Ive made pigs attack players etc

#

but cant do the same with bats

young needle
#

they are an entityinsentient so it should work

vital ridge
#

you can try it

#

4real

#

it doesnt work

#

meleeattack pathfinder goal

#

does not work

#

even clearing all their pathgoals wont work

young needle
#

1.16?

vital ridge
#

mhm

young needle
#

im looking into spigots code right now.

vital ridge
#

ignore the fox-speed

#

just need to change that to bat

#

but that works with all the other mobs

#

not with bat

young needle
#

the bat doesn't seem to have any pathfinders?

#

in vanilla

vital ridge
#

I dont know

#

If it does

#

or doesnt

#

Just this piece of code does not work

#

gives this error

#
The constructor PathfinderGoalMeleeAttack(CustomBat, int, boolean) is undefined
young needle
#

PathfinderGoalMeleeAttack is a custom goal right?

vital ridge
#

nope

#

Its spigots goal

#

or minecraft's goal

#

i mean whatever yea xd its not done by me

#

its built in

young needle
#

ah found it

#

EntityBat is not an EntityCreature

#

that is why it wont wokr

vital ridge
#

Ookay. So what should I do?

young needle
#

create your own goal and copy paste the code from minecrafts. I don't know if all methods are there in the bat class though

vital ridge
#

So

#

create my own goal and try using that pathfindergoalmeleeattack on my custom goal_

#

?

slim magnet
#

How do I make something fall faster
Like increase gravity

vital ridge
#

get the block

#

and set the y velocity

young needle
slim magnet
#

it's an armorstand

vital ridge
#

just take the armorstand and set the y velocity

#

to -something

vital ridge
#

but as thats my only chance

#

ill try it

slim magnet
vital ridge
#

Create a variable of your armorstand

#

check if its not on the ground

slim magnet
#

then?

vital ridge
#

and set the velocity to 0 -1 0

#

that should make it fall a bit faster

#

not sure how much

slim magnet
#

u sure?

#

Okay

vital ridge
#

Not 100%

#

but thats the most logical way i can think of

#

I mean

#

also check

#

if its not onground

#

so if armorstand.!isOnGround

#

ofc you add parantheses and everything

gaunt eagle
#

Hi,

#

Main:

#

plugin.yml

#

and the config:

young needle
#

annnnd?

gaunt eagle
#

The server sees the /config command. Likewise, the folder of the plugin comes to the plugins folder and the config is created there. But the message does not come when I type /config from the game -_-
any idea?

young needle
#

you renamed the onCommand method

#

and you should move your command to a seperate class

candid galleon
#

tf is yaniKomut

young needle
#

thinking the same thing

gaunt eagle
#

Can't we give the name we want?

candid galleon
#

No

young needle
#

you are overriding a method so: no

candid galleon
#

It overrides the method

#

Event methods Can because you’re using the @brave glenhandler annotation

gaunt eagle
#

oh

#

thanks a lot of

eternal oxide
#

your config command is also not valid in your config. It needs at least a description or useage child to be valid

hushed spindle
#

hi. is there a way, to stop an invisible entity spawned with packets (which is the passenger on your head) hiding your nametag?

pulsar schooner
#

🚰

#

From the spigot

daring sierra
#

how

pulsar schooner
#

That's not possible

young needle
#

put a paper on it

pulsar schooner
#

No paper allowed

#

Paper makes things bad

#

Only fuels the fire

daring sierra
#

put some p u r p u r powder on it

young needle
#

or some tunitied paper that cant burn

pulsar schooner
#

Wait, is your computer actual in fire tho?

#

Ok good

cloud berry
#

did any1 say 🚰

pulsar schooner
#

YES

#

Finally

#

Backup

cloud berry
#

😄 🚰

hollow arch
#

Heya - At the moment, I just do this to manage GUIs so people can't take or put items inside. For some reason though, they can still use their hotkeys to put items in

        if (!e.getInventory().equals(inv)) return;
        if (e.getClickedInventory() == null) return;
        if (e.getClickedInventory().getType().equals(InventoryType.PLAYER)) { e.setCancelled(true); return; }
        if (e.getCurrentItem() == null) return;
        if (e.getCurrentItem().getItemMeta() == null) return;
        e.setCancelled(true)
pulsar schooner
#

It's the water department 🚰

cloud berry
#

i live and die for 🚰 🚰 🚰

steep nova
#

🚰

pulsar schooner
#

If i couldn't drink 🚰 water, i would die

#

Lol

eternal oxide
#

Peeps, OT is not OK when there are active questions in chat

cloud berry
#

o god a world without 🚰 without water? ;-; noooooo

pulsar schooner
cloud berry
#

o shit i thought i was in general lol, caught in 4k

hushed spindle
shy wolf
#

HI guys, i need help!
how to change horse settings?

#

like how is the owner

#

or staff like that

eternal oxide
#

cast to Tameable?

shy wolf
#

waht

#

no

hushed spindle
#

the horse interface has that method too

shy wolf
#

not get owner

#

set owner

eternal oxide
#

same

shy wolf
#

oh

#

kk

hushed spindle
#

do you have any idea on my problem? @eternal oxide

eternal oxide
#

Afraid not. I've never used packets

hushed spindle
#

:/

shy wolf
#

error

#

Player p = (Player) sender;
Entity horse = Bukkit.getWorld("TrestiaMap").spawnEntity(new Location(Bukkit.getWorld("TrestiaMap"), 229, 44, -340), HORSE);
horse.setCustomName(ChatColor.GREEN + plugin.getConfig().getString("horse name:"));
horse.setGlowing(true);
horse.setGravity(false);
horse.setOwner("danos360");

eternal oxide
#

setOwner doesn't take a name

shy wolf
#

nop

hushed spindle
#

what api-version do you use?

eternal oxide
#

((Tameable) horse).setOwner(p);

shy wolf
#

1.16.4

#

oh

shy wolf
sick ravine
# hushed spindle bump ⬆️

hey
is there something similar in 1.8? no
or any workarounds? fixes? no
how can i restore the nametag of the player over the entity which is blocking it? < - ?

eternal oxide
#

Can you not set the custom name visible after you set the riding entity?

hushed spindle
eternal oxide
#

in that case could you set the name on the riding entity to the same as the player?

sick ravine
#

do you modify the player name tag somehow?

eternal oxide
#

then set that visible

hushed spindle
hushed spindle
sick ravine
#

maybe it's a matter of receiving client packets?

hushed spindle
#

already checked. didn't found a way of returning or cancelling it

#

& also mineplex did it somehow, so it have to be possible.
see here -> http://prntscr.com/111x7m2
you can see, that the player name doesn't bend, because it's the normal nametag.

topaz cape
#
            String rankname = getRankName(p);
            PermissionAttachment attach = p.addAttachment(this);
            rankattachment.put(p.getUniqueId(), attach);
            //rank.put(p.getUniqueId(), rankname);
            FileConfiguration file = RanksFile.getFile();
            for(String perm : file.getStringList(rankname + ".Permissions")) {
                rankattachment.get(p.getUniqueId()).setPermission(perm, true);
                p.sendMessage(perm);
            }```
#

perms doesnt work

#

but gets sent in the chat

#

what did i do wrong

young knoll
#

You should probably use the Vault API

eternal oxide
topaz cape
#

uh

#

i see

#

ty

topaz cape
sage swift
#

is it possible to find everything but a certain string in regex? i have \\[Staff\\].* and it finds everything that starts with [Staff], but i would like to find everything that doesn't

eternal oxide
#

do a split on Staff

eternal night
#

Tho I'd highly recommend implementing the negation logic in code 😅

opal sluice
#

Hi, what are the armor slots id ?

deft sedge
#

Hello, I want to scan a player inventory for an item, and then delete said item. How would I go about doing that?

opal sluice
eternal night
deft sedge
#

This is my code

#

is there a simpe change to make it work

opal sluice
eternal night
#

these ?

#

I mean

#

oh you want to modify from spigot ??

opal sluice
#

yup

eternal night
#

since when do you modify these in spigot lol

#

through id

#

they all have their setters/getters

opal sluice
#

I need it to check if the player clicks on the head slot

#

If you have a SlotType#HEAD

#

that would be cool

#

But there is only the ARMOR slot type

#

So, I need the slots id ^^

#

And there are so much screens with different numbers that I don't know which one to believe ^^'

eternal night
#

I think they are just followed up from inventory in spigots case

#

so given that 0-35 are main inventory

#

36-39 are your armor slots

opal sluice
#

Ok thanks, I'll give it a try ^^

eternal night
#

note that offhand is then 40 xD

#

and a quickbar slot again

#

because legacy

opal sluice
#

ok ^^

EDIT: It's 36 - 39 ^^ Thanks @eternal night

silent vigil
#

how would I set the color of a leather piece of armor?

#

I got the item meta but .setColor doesnt work

eternal night
#

you casted it ?

silent vigil
#

wdym?

#

.setColor isnt a method i even see

eternal night
#

Well yes

#

because not every item can by dyed

#

so, just like with skulls or banners or anything that has special values

#

you have to cast the item meta instance

#

in your case LeatherArmorMeta

silent vigil
#

ty

eternal night
#

^ just make sure that the item can actually be coloured

#

else you'll enjoy some errors

silent vigil
#

ok

jaunty epoch
#

hello

deft sedge
#

I know this is a noob question but how do i get a function to return data back to the function caller

#

ik u can use return

jaunty epoch
#

idk\

deft sedge
#

but from the caller hod do you then get what the function returned

jaunty epoch
#

sry

#

I need help

#

to

#

if u can help me

#

pls

deft sedge
#

ill try

jaunty epoch
#

so my plugin is not downloading

#

it is stuck at this Building plugin...
Generating build directory...
Generating source code...
Generating pom.xml...
Generating plugin.yml...
Executing maven tasks...

#

even if I wait for 3hrs

deft sedge
#

what code software do u use

jaunty epoch
#

the Visual bukket

deft sedge
#

I've never heard of that one

#

I'm sorry

#

I have no idea

jaunty epoch
#

it is ok

#

it is on spigot tho

#

idk

#

but ty

deft sedge
#

I've never even heaerd of said ide

jaunty epoch
#

for trying

paper viper
#

its not an ide...

#

its a block dragging site thing

deft sedge
#

o

opal sluice
#

Mmmmh is that normal that in gamemode 1 the inventory click event isn't fired ^^' ?

eternal oxide
#

creative has its own events

deft sedge
#

I know this is a noob question but how do i get a function to return data back to the function caller
ik u can use return but how do i get the actual return value back to the snder

#

and sotre that to a var

opal sluice
deft sedge
#

@eternal oxide u provbably know

eternal oxide
#

a method definition has a return type ie public void or public boolean

opal sluice
#

Mmmh there is still the same problem even with the InventoryCreativeEvent. When I click on an empty slot, it doesn't fire the event :/

deft sedge
#

k

eternal oxide
#

void means there is no return type

deft sedge
#

ok so if i'm gonna return something then i need a boolean

eternal oxide
#

@opal sluice do you have @Eventhandler? is the event registered?

#

a boolean you can only return a boolean

jaunty epoch
#

does anyone know how to fix my problem?

opal sluice
#

Yeah, the event fires when there is something in the clicked slot

eternal oxide
#

you can return any type you need

opal sluice
#

But if the slot is empty it doesn't

#

Which is kinda annoying ^^'

jaunty epoch
#

so my plugin is not downloading
it is stuck at this Building plugin...
Generating build directory...
Generating source code...
Generating pom.xml...
Generating plugin.yml...
Executing maven tasks...
even if I wait for 3hrs

eternal night
#

creative client is known to not send all interact packets I believe o.O

jaunty epoch
#

hello

unreal quartz
#

what are you trying to do?

eternal oxide
#

clicking on an empty slot will not fire the event as it has no action

deft sedge
#

What i'm not understanding though is , say I call a function in a class. That function runs and produces the output I do return <output>; then how do I get that return value back into the class that I called it from

jaunty epoch
#

I am trying to make it so that

eternal night
#

I mean empty slots fire events in survival xD

jaunty epoch
#

when u right click on wool

#

it makes like a fire work noice

unreal quartz
deft sedge
#

ok thanks

jaunty epoch
#

I use visual bukkit

#

u guys heard of that?

eternal night
#

omg

unreal quartz
#

you should probably find a more dedicated support channel for that

eternal night
#

yeah

#

I.

#

wow

paper viper
#

yes we know visual bukkit, but its not supported here

eternal night
#

it is like scratch

jaunty epoch
#

ok

eternal night
#

I have never seen this

unreal quartz
#

people here only know about actual java

paper viper
#

this is for straight up coding

opal sluice
#

Wow first time I see someone using it hahaha

paper viper
#

not scratch

#

or blocks

jaunty epoch
#

I know java

deft sedge
#

ya'll are mean XD

jaunty epoch
#

fine

#

lol I only know

#

python

eternal night
#

I mean no shame in using it

eternal oxide
#

even skript is better than that 🙂

eternal night
#

just never saw it

deft sedge
#

@jaunty epoch try using intellij

#

for me it's the esiest acutal coding

#

I mean if u wanna actually kode

paper viper
jaunty epoch
#

I know script is better