#help-development

1 messages · Page 657 of 1

silent hound
#

they don't burn in lava

#

is there a check for that?

#

I'm just trying to check if it does burn

kind hatch
#

There's a file you can add items to for that.

#

Although that might be resource packs only.

silent hound
#

no that's not it

#

a wooden sword burns in lava

#

I'm trying to check if it will burn if i throw it in lava

#

so netherite items would return false and everything else would return true

eternal oxide
#

this should not work. Every Item is an Entity but not all Entities are Item

#

Item is a wrapper for a dropped Item Entity

quaint mantle
#

So in fact, it will work

#

I made a plugin about this, basically applying a shield to an item each time it got damaged

scenic onyx
#

I put the new version. I have to wait because it reload?

remote swallow
#

did you update the version number

remote swallow
scenic onyx
#

yes

#

but when you click

#

dowload

#

there is the first version

remote swallow
#

did you change the jar name

#

bc currently your version is the mc versions supported

scenic onyx
remote swallow
#

not plugin version

#

and your sure you uploaded that version

scenic onyx
#

@remote swallow now?

#

ok

remote swallow
#

now its 1.1

scenic onyx
#

ok

#

good

remote swallow
#

and the jar is 1.1

scenic onyx
#

is good 5 dowload in first 1 hour?

lilac dagger
#

meh

upper hazel
#

hцanyone knows how to get the desert fortress structure in the world?

scenic onyx
#

/locate

upper hazel
#

in code

scenic onyx
#

NMS but i am not good in this

upper hazel
#

Altranative?

scenic onyx
upper hazel
#

aaa

scenic onyx
#

I am verified!!

upper hazel
#

well, that's all, I will NEVER say the price for the plugin in advance

native bramble
#

how can i check if anvil is damaged from being used?

tall dragon
sterile breach
#

Hello, in bungeecord how i can make an inventory sync?

scenic onyx
#

you can in spigot

sterile breach
eternal oxide
#

Bungee has no idea what an Inventory is

sterile breach
#

Yeah i want make a plugin dor that

hazy parrot
#

I'm assuming you want to sync inventories between servers, in that case just save inventory somewhere on Leave and load it onJoin

eternal oxide
#

won;t work using bungee

hazy parrot
#

On backend servers ^

eternal oxide
#

as the server where the player exits won;t get teh disconnect event until after teh second server gets a join

#

Player will already be in the other server before the inventory is saved from the first

hazy parrot
#

Oh, right, didn't know

sterile breach
#

So how i can do ? Using database ? Pluginmessage ?

eternal oxide
#

moving inventories between servers is no simple task

smoky oak
#

args[0] == -1 ? Integer.MAX_VALUE : args[0]
there a way to do this without accessing args twice?

lilac dagger
#

is args[0] and integer?

smoky oak
#

yea

hazy parrot
#

Accessing array by index is O(1) action, it doesn't really matter

#

But save it in variable ig

smoky oak
#

thats the same thing with extra steps

native bramble
smoky oak
#

wasnt this what link is used for

remote swallow
#

#setAttributes iirc

smoky oak
#

👍

solid cargo
#

unsetSetAttributes would be more logical /s

quaint mantle
#

Hello,
I need help with interpolation for display entities. I want to create an item that rotate 90° on the X axis in 2s. In vanilla, you have to modify the nbt of the entity with your translation, then interpolation_duration:40, then start_interpolation:-1. I did this with Spigot assuming that interpolation_duration is set with Display#setInterpolationDuration and start_interpolation with Display#setInterpolationDelay but it doesn't work: the transformation is applied instantly.

Here's the code with a test command :

public boolean onCommand(@NotNull CommandSender sender,
                         @NotNull Command command,
                         @NotNull String label,
                         @NotNull String[] args) {

    if (!(sender instanceof Player player))
        return false;

    World world = player.getWorld();
    Location location = player.getLocation();
    ItemDisplay display = (ItemDisplay) world.spawnEntity(location, EntityType.ITEM_DISPLAY);

    display.setItemStack(new ItemStack(Material.DIAMOND_SWORD));

    Vector3f translation = new Vector3f();
    AxisAngle4f leftRotation = new AxisAngle4f((float) Math.PI / 2.0f, 1.0f, 0.0f, 0.0f);
    Vector3f scale = new Vector3f(1.0f, 1.0f, 1.0f);
    AxisAngle4f rightRotation = new AxisAngle4f();

    display.setInterpolationDelay(-1);
    display.setInterpolationDuration(40);

    Transformation transformation = new Transformation(translation, leftRotation, scale, rightRotation);
    display.setTransformation(transformation);

    return true;
}
tall dragon
native bramble
smoky oak
#

is there a default for Enum PDC or do i have to use alex library?

#

tried googling but ended up on his spigot page

#

by the way i know i can just store a string but i thought if theres a native way to store enum using that would be smarter

eternal oxide
#

if your Enum is never changing you can use the index

smoky oak
#

yea it aint changing, just maybe grow

#

oh wait

#

which would change index

#

string it is

tender shard
#

BlockGrowEvent

quaint mantle
#

Can someone tell me what this error means?

[23:34:28] [ForkJoinPool.commonPool-worker-2/ERROR]: Failed to encode map: {ItemStack{GRASS_BLOCK x 1}=0}
org.bson.codecs.configuration.CodecConfigurationException: An exception occurred when encoding using the AutomaticPojoCodec.
Encoding a ItemStack: 'ItemStack{GRASS_BLOCK x 1}' failed with the following exception:

An exception occurred when encoding using the AutomaticPojoCodec.
Encoding a CraftItemStack: 'ItemStack{GRASS_BLOCK x 1}' failed with the following exception:

Failed to encode 'CraftItemStack'. Encoding 'enchantments' errored with: Can't find a codec for CodecCacheKey{clazz=class org.bukkit.enchantments.Enchantment, types=null}.

A custom Codec or PojoCodec may need to be explicitly configured and registered to handle this type.

echo basalt
#

It means you're trying to encode things that can't really be encoded

#

So you need to make your own codec

#

Specifically for enchantments

tender shard
#

why are you creating a new Random everytime

#

no

#

that's not true

eternal oxide
#

only if you seed it

tender shard
#

no, i don't know what your issue is, probably you havent registered the listener at all

#

then debug it

#

is the listener called? is GG == 7?

#

I can see that

#

as said, debug your code, e.g. add System.out.println statements into the listener and inside the if block

#

then see if it gets called

#

sure, that works too

young knoll
#

You need to check for every type

#

Unless there is a tag for slabs

#

Yes

tender shard
#

Pretty sure there’s a tag for slabs and buttons

young knoll
#

There ya go then

tender shard
#

Tag.BUTTONS.isTagged(…) or sth

young knoll
#

You need to do material == for each one

#

But like Alex said use the tag

quaint mantle
#

on disconnect server

#

i can't rejoin and im getting this

young knoll
#

It does tell you the error

eternal oxide
#

Player has disconnected so there is no ProxiedPlayer

young knoll
#

Remember when nullpointers didn’t tell you what was null

#

Back in the Stone Age

#

Okay

#

What’s not working

quaint mantle
eternal oxide
#

thats going to try to apply a LOT of potion effects

quaint mantle
#

I want to get the uuid of the player that performed the disconnect event

eternal oxide
quaint mantle
#
    @EventHandler
    public void onLeft(PlayerDisconnectEvent e) {
        LocalDateTime now = LocalDateTime.now();
        PrettyTime p = new PrettyTime();
        String is = p.format(now);
        DatabaseVariables databaseSettings = new DatabaseVariables();
        ProxiedPlayer player = e.getPlayer();
        ManaObjects playerInfo = databaseSettings.findPlayerByUUID(player.getUniqueId().toString());
        playerInfo.setStatus(is);
        databaseSettings.updatePlayerVars(playerInfo);
    }```
#

im doing this

young knoll
#

Debug where it’s stopping

#

My bet is the tag check

eternal oxide
#

looks fine to me, so long as yoru database has a player for playerInfo

#

why are you creating a new DatabaseVariables?

#

if it's instanced surely it will be empty

quaint mantle
#

😕 wdym

eternal oxide
#

DatabaseVariables databaseSettings = new DatabaseVariables();

quaint mantle
#

i understand

#

but

#

i create for

#

get database methods

eternal oxide
#

new indicates it's a fresh instance, so by that logic it's empty with no data

quaint mantle
#

ah thats right

#

so i need use statics methods ?

eternal oxide
#

depends on your design

quaint mantle
#

databasevariables not variables

#

i mean not object class

eternal oxide
#

it sounds more like it's a DatabaseAccessor not settings/variables

quaint mantle
#

actuyally

eternal oxide
#

does yoru findPlayerByUUID return any data?

quaint mantle
#

yes

#

oh wait

#

im checking

#

yes returnning

eternal oxide
#

its saying it returned null

quaint mantle
#
    public ManaObjects findPlayerByUUID(String uuid) {
        try (PreparedStatement statement = getConnection().prepareStatement("SELECT * FROM variables WHERE uuid = ?")) {
            statement.setString(1, uuid);


            ResultSet resultSet = statement.executeQuery();
            if (resultSet.next()) {
                String name = resultSet.getString("name");
                long discordid = resultSet.getLong("discordid");
                String discordname = resultSet.getString("discordname");
                int crystals = resultSet.getInt("crystals");
                String status = resultSet.getString("status");
                String server = resultSet.getString("server");
                int friends = resultSet.getInt("friends");
                boolean friendrequests = resultSet.getBoolean("friendrequests");
                boolean privatemessages = resultSet.getBoolean("privatemessages");
                boolean mentions = resultSet.getBoolean("mentions");
                boolean teleportrequests = resultSet.getBoolean("teleportrequests");

                ManaObjects playerInfo = new ManaObjects(uuid, name, discordid, discordname, crystals, status, server, friends, friendrequests, privatemessages, mentions, teleportrequests);
                statement.close();
                return playerInfo;
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return null;
    }```
eternal oxide
#

you do not need statement.close(); in that code

quaint mantle
#

aight

#

i got this warning

#

after delete

#

.close

#

alright

#

main thread ?

worldly ingot
#

To be fair, no guarantee this is done on the main thread lol

#

Caller could be async

young knoll
#

Use maven

#

Or gradle

#

Okay

#

Add the dependency via maven and set scope to provided

#

And make sure your plugin.yml has citizens as a depend

#

What’s the error

eternal oxide
#

don;t add the jar, add it as a dependency in your pom/maven

#

use teh maven package option not artifacts to build

#

right side of screen, maven -> lifecycles -> package

quaint mantle
#

if i send my codes

#

can u check ?

undone axleBOT
quaint mantle
#

i didnt

young knoll
#

You need the citizens repo

quaint mantle
#

i ask to chat gpt

#

can't do it

#

actually

#

i ask this for my problem not u

#

😄

eternal oxide
#

you stopped using try with resources

quaint mantle
#

i tried with twr

#

not worked

quaint mantle
#

i did this

#

and now

#

im trying 1m

eternal oxide
#

then your player does not exist in your database

quaint mantle
#

no in my sql

#

and my other methods

#

work

#

like server

eternal oxide
#

looks fine to me then

quaint mantle
#

when i change my server

quaint mantle
eternal oxide
#

he doesn't really understand them

quaint mantle
#

i fix that

#

im using try with resources now

eternal oxide
#

he shoudl also have seperate variables in hsi twr for connection and statements

eternal oxide
#

delete the type entry and add the repository for it

young knoll
#

The link I provided

eternal oxide
#

always

#

yes

opaque scarab
#

How could I open the player's armor and 2x2 crafting inventory?

slate coral
#

[19:16:01 ERROR]: Error occurred while enabling ArenaCreation v0.1 (Is it up to date?) java.lang.NoSuchMethodError: 'com.fasterxml.jackson.core.StreamReadConstraints com.fasterxml.jackson.dataformat.yaml.YAMLParser.streamReadConstraints()' at com.fasterxml.jackson.dataformat.yaml.YAMLParser._parseNumericValue(YAMLParser.java:1109) ~[?:?] at com.fasterxml.jackson.core.base.ParserBase.getDoubleValue(ParserBase.java:746) ~[?:?] at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$DoubleDeserializer.deserialize(NumberDeserializers.java:671) ~[?:?] at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$DoubleDeserializer.deserialize(NumberDeserializers.java:655) ~[?:?] at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129) ~[?:?] at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313) ~[?:?] at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176) ~[?:?] at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:609) ~[?:?] at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:437) ~[?:?] at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:32) ~[?:?] at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129) ~[?:?] at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313) ~[?:?] at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176) ~[?:?] at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322) ~[?:?] at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674) ~[?:?] at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3494) ~[?:?]

Would anyone know how to fix this? I thought it might be related to SnakeYAML since my testing environment is Spigot 1.12.2

young knoll
#

Did you add it to your depends on plugin.yml

#

And is citizens on the server

#

Well it needs to be

#

No

#

depend: [Citizens]

#

That should work too, yes

lunar wigeon
#

just use java sockets to send packets from server A to client

quartz pendant
#

thank you! 🙂

river oracle
#

Is there anyway I can extract a list of all Items to a json file. I don't have access to NMS or Spigot /Bukkit I just need a raw list of all items. I don't really feel like pulling from a 3rd party website is there some mojang download I can pull from

young knoll
#

Don’t think so

#

If you have the client jar you can pull from the models/item folder

river oracle
#

I kind of want to automate the process which is why I'm wondering if there's something I can download to pull it from

young knoll
#

I mean

#

You can download the server jar and pull from that

river oracle
young knoll
#

Idk

river oracle
#

I wonder how WE does it

wet breach
#

because its in the client jar mojang should host some kind of resource so you can do something? lol

river oracle
#

which they do just not the resources I need which is fine

wet breach
#

unfortunately they do not except for dependencies

river oracle
#

they have their music tracks separate

wet breach
#

yeah that makes sense, otherwise the jar for the client would be super large XD

#

WE doesn't do anything special since it needs the server to run?

river oracle
wet breach
#

well there is like an item list json file somewhere

#

can't remember if it was in the client or the server jar

river oracle
#

yeah tryna find like something official and up to date

wet breach
#

for the loot generation stuff

river oracle
#

hmmm I haven't beenable to find it

#

clearly just looking in the wrong places

wet breach
#

maybe, but it wouldn't surprise me if WE just hardcoded it

#

I think there was a command you can do to output the items json

#

like you execute on the command line

river oracle
#

I think I'll just approach my API with a different approach

#

I wonder if its even worth it to improve ItemMeta in my own api rather than just work around how it just is

#

probably not tbh

river oracle
# livid dove Hear me out

I decided I'm going to just fuck around with the idea tonight and see if what I do is any worse or better than what we currently have

#

i don't really have any structure Ideas yet so its time to just fuck around and find out I guess

livid dove
#

Good lad

river oracle
# livid dove Good lad

I mean realistically I'd just wanna change ItemMeta I feel like fixing ItemStack would be way too much

livid dove
#

Go one step at a time

river oracle
#

i gotta come up with my dinner plans for the week first though, ig I'll just be up till 3 toinght fucking around xD

young knoll
#

Are you not at the point where you can just eat code?

#

Amateur

river oracle
slate coral
#

implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2'

Is in the dependencies section of my build.gradle file and I'm using shadowJar to build my jar. Am I missing something?

#

I tried gradle clean to no avail :(

river oracle
#

?paste your build.gradle

undone axleBOT
slate coral
simple schooner
#

wtf is happening

#

I cant run commands

#

it just types them in chat

slate coral
simple schooner
#

oh fuck

simple schooner
slate coral
#

no problem, had that problem today lol

tender shard
#

It prints whatever the „usage“ is set to in plugin.yml

quaint mantle
wet breach
#

o.o

quaint mantle
#

a few people here said there is no problem with my code

#

im sending 1m

wet breach
#

obviously there must be if its not doing what its supposed to

quaint mantle
#

this is code

#

this is warning

#

after disconnect event

#

i can't rejoin my server

#

hikariCP closing

#

and im getting this warning

#

printing to database btw

wet breach
#

obviously your query isn't producing results

#

and therefore it returns null

#

which is fine, but you don't test for null being returned either anytime you use that method

#

hence NPE being thrown

tender shard
#

you also never close the statement if something fails

wet breach
#

now, that doesn't necessarily fix your problem, but it does fix the NPE being thrown

tender shard
#

use a try-with-resources block

quaint mantle
#

actually i fixed to trywithresources

#

but what can i do ?

tender shard
#

null pointer exception

quaint mantle
#

ah

#

well am i check return if null ?

wet breach
#

well you returning null if the result fails, which means anything outside of your method that wants to use your method needs to check that it doesn't return null before using it further

tender shard
#

you return null if your SQL stuff fails. you should have a stacktrace in your console BEFORE the null pointer exception

wet breach
#

so that fixes the exception being thrown, however as for why its failing, you need to investigate why your query is not producing results

#

chances are you are not inserting properly

wet breach
#

the problem with your query is this line here

#

calling next() moves the cursor forward which will cause it to always miss the first row

#

since your query produces 1 result

#

when the cursor moves to the next result

#

there is no more thus its false

quaint mantle
#

well

wet breach
#

its an easy fix

quaint mantle
#

im watching video now for jdbc and database operations

#

what did I do wrong to refresh my knowledge again

#

I'll fix it based on what you said after I find out.

wet breach
#

all you need to do since your query produces 1 result or there should only be 1

#

you need to just check that ResultSet isn't null

#

if it isn't there is a result and just pull the info

#

you only need to check for more if you expect there to be more

quaint mantle
#

alright 👍

wet breach
#

Welp now you have gotten the info you finally sought for 😛

quaint mantle
#

yes 😄

#

ty

tender shard
#

frostalf what do you think of my fancy regex for Bukkit.getVersion()?

\(MC: (?<major>[\d]+)\.(?<minor>[\d]+)(\.(?<patch>[\d]+))?\)
wet breach
#

why does it need a regex?

tender shard
#

Because it returns sth like „git-spigot-8362ab74 (MC: 1.20.1)“

wet breach
#

ah

olive terrace
#

Im getting this error when placing/destroying a block (specifically Oraxen blocks)

#

No references to my code at all

#

Don't know what to do

wet breach
#

?whereami

olive terrace
#

damm

#

u right

#

i fully take back everything ive ever said

quaint mantle
#

how my resultset if wrong ?

#

i use my sql codes in other events

#

worked flawlessly

#

there is my other methods

#
    @EventHandler
    public void onJoin(LoginEvent e) {
        ManaObjects playerInfo = databaseSettings.findPlayerByUUID(e.getConnection().getUniqueId().toString());

        if (playerInfo == null) {
            playerInfo = new ManaObjects(e.getConnection().getUniqueId().toString(), e.getConnection().getName(),0, "yok", 0, "Çevrimiçi", "lobi-1", 0, true, true, true, true);
            databaseSettings.createPlayerVars(playerInfo);
        }
        else {
            playerInfo.setStatus("Çevrimiçi");
            databaseSettings.updatePlayerVars(playerInfo);
        }
    }

    @EventHandler
    public void onJoinGame(ServerConnectedEvent e) {
        ManaObjects playerInfo = databaseSettings.findPlayerByUUID(e.getPlayer().getUniqueId().toString());
        playerInfo.setServer(e.getServer().getInfo().getName());
        databaseSettings.updatePlayerVars(playerInfo);
    }```
true perch
#

Is there code in the SpigotAPI that stores which players are in a specific chunk? Or do I need to write code to track which players are in a particular chunk?

#

I found it:

for (Entity chunkEntity : chunk.getEntities()) {
    if (chunkEntity.getType() == EntityType.PLAYER) {```
#

Unfortunately it's going to do a bit more looping like this (due to looking at each entity in a particular chunk instead of just the players), however it may be better than tracking what chunk a player is in as they enter it 🤷‍♂️

tender shard
#

looping over that is not an issue

#

i wouldnt bother to keep track of that, just loop over the entities when you need it

#

or just loop over all online players and use getLocation().getChunk()

sterile breach
tender shard
#

you always need a player

#

the wiki article also mentions that

#

Remember, for the plugin messaging channel to work you need atleast 1 player online at the server.

true perch
#

Would anyone be able to explain what this error means?fix [10:37:33 WARN]: [7 Realms] Plugin Realms v1.0-SNAPSHOT generated an exception while executing task 32 java.lang.IllegalStateException: EntityDeathEvent may only be triggered synchronously.

tender shard
#

it means you have called an EntityDeathEvent from an async thread

true perch
#

Yeah sorry I meant to ask what's wrong with doing that 😅

tender shard
#

you have to call it from a synced thread, e.g. like this

Bukkit.getScheduler().runTaskLater(yourPlugin, () -> {
  Bukkit.getPluginManager().callEvent(myDeathEvent);
}
lilac dagger
#

plugins using entitydeathevent could propagate async in unsafe methods

onyx fjord
#

@true perch most of Bukkit API methods cannot be used in async threads

sterile breach
true perch
#

When I think about it logically, you wouldn't want the death event to be called async anyway.. You'd want it to happen on the main thread

#

makes sense, I'll need to rethink my code a bit

#
public void start() {
    new BukkitRunnable() {
        int healthRegenTimer = 20;
        int despawnAttempt = 600;
        @Override
        public void run() {
            if (realmMob.getEntity().isDead()) {
                this.cancel();
                return;
            }
            despawnAttempt--;
            if (realmMob.isInCombat())
                despawnAttempt = 600;
            else if (despawnAttempt == 0) {
                realmMob.attemptDespawn();
                despawnAttempt = 600;
            }
        }
    }.runTaskTimerAsynchronously(this.main, 0, 1L);
}```
lilac dagger
#

that method has no reason to be async

tender shard
#

yeah

#

in fact Entity#isDead() is probably not even thread safe

lilac dagger
#

that code no matter the system will take very little time

#

consider async when you're running with info over internet or disk

true perch
#

I was hoping adding it to an async thread would help with server performance since this will be added to every Mob that gets spawned.

#

I see now why that's a bad idea.

lilac dagger
#

or very expensive operations

#

nah

true perch
lilac dagger
#

will it take n^2 + time?

#

also you understand the concept of thread safe?

tender shard
#

you'll end up with thousands of scheduled tasks if you do it like this

true perch
#

I understand that overloading the main thread causes performance issues, and am under the impression that adding things to an async thread will prevent crashing.

true perch
tender shard
#

counting down an integer isn't exactly overloading the main thread

true perch
tender shard
#

like what?

true perch
#

I completely agree and understand that though

flint coyote
#

Lots of code doesn't necessarily mean it's heavy

tender shard
#

as I said, you are free to do your stuff async but you'll need to go back to a synced thread to call most of bukkit api

true perch
lilac dagger
#

i suggest it's best to keep in sync, if it runs poorly improve it and if it still runs poorly then consider async

true perch
tender shard
#
new BukkitRunnable() {

  @Override
  public void run() {
    // This runs async
    System.out.println("async");

    Bukkit.getScheduler().runTaskLater(myPlugin () -> {
      // This runs synced
      System.out.println("synced");
    }
  }
}.runTaskAsynchronously(myPlugin);
flint coyote
#

I mean you can always monitor how long your calls take. You should probably take care that a single plugin doesn't use 35 out of 50 available milliseconds each tick

true perch
#

I agree, that's very helpful guys thank you!

true perch
quaint mantle
#

is there any other event then the player click event being triggered when a player clicks on a fireplace

onyx fjord
#

people use it as marketing tactic

alpine urchin
#

or the devs are clueless when it comes to concurrency

simple schooner
#

if I save a text display's UUID will it also save the text displays text?

alpine urchin
#

and don’t realize that async used wrongly can be worse

simple schooner
quaint mantle
#

if i do block.setType(Material.CAMPFIRE); will it be lit on fire or not

shadow night
#

try it and see ig?

quaint mantle
#

dont wanna boot up a server for such a small thing but if no one knows ig have to

shadow night
#

I can try it

#

but that means I gotta create a plugin rq

quaint mantle
#

no worries im already on it

#

sure

#

what do you need help with

#

do you already have a method that changes the players hearts when he gets killed?

#

chatgpt ah code

#

well at the point were the player get his hearts removed just check if he will have any hearts left and ban him if not

#
if (newKilledPlayerHealth < 2 ) { 
//Ban the player
}

#

wait

#

no

#

more like this

#

sorry i just coppied ur code snipped and messed that part up xd

#

but yh that will work

#

or even

#

this nopw makes more sense regarding your existing code

#

why would you do that

#

this code is enough

#

you dont need this

#

well you still could put the entire thing in one class

#

or more like one event listener

twilit roost
#

hey guys
should I split my databases into their seperate file or just use one central databse for everything?

what makes more sense

quaint mantle
#

well its preety easy theres like 0 possibility for a bug with this plugin

#

if you have basic java knowledge at least

quaint mantle
#

My server crashes when there are fast queries in the database

#

When a player enters the server, I print the status online in database

#

but when I exit without connecting to the server and enter quickly, the server crashes

maiden kiln
#

Is there a reason the included bungee chat API version wasn't updated beyond 1.16? it's missing some important new features

maiden kiln
#

Will do, just wanted to make sure there wasn't any specific reason it's this way before opening one

maiden kiln
surreal spoke
#

How can i change the size of the BlockDisplay entities?

maiden kiln
surreal spoke
#

thanks

spare hazel
#

How to remove the item in yhe hand of the player

#

setType(Material.AIR); didnt work

remote swallow
#

Set it to null

quaint mantle
#

or yh thats probally the error

#

anyone have an idea to check if a item is a specific entchant book

mortal hare
#

guys how do you abstract your database calls?

#

do you have some kind of framework to execute queries agnostically or what

#

i cant think of good solution which works efficiently

#

agnostic wrapping can lead to performance issues imo

#

since with queries you can specify in what kind of way you want to store that object

#

and agnostic wrapping could lack some info, since it could depend on the context of object which is stored how it should be stored

sullen marlin
quaint mantle
pseudo hazel
pseudo hazel
tender shard
#

enchated books use EnchantmentStorageMeta and the enchant is inside getStoredEnchants()

errant dew
#

please help me how to make a fake time not in h,m,s and in ч,м,с I use a placeholder %statistic_time_played%

tender shard
#

what is a fake time

#

also, can't you just use String#replace to replace the symbols

errant dew
#

Oh, it's not fake time, but the time spent by the player in, I need to translate this into Russian

tender shard
#

as I said, String#replace

#
String replaced = myString.replace("h", "ч").replace("m", "м").replace("s","с");
mortal hare
#

☝️

errant dew
#

it will work for the placeholder %statistic_time_played%

tender shard
#

it will work for whatever string, obviously

mortal hare
#

you first of all get the placeholder

#

that returns you the result string

#

then you do replace on that string

errant dew
mortal hare
#

but it would replace all h's with ч and etc

#

take in note

errant dew
tender shard
#

is this even a java / coding question?

#

this channel is for programming / coding questions

errant dew
#

yes, I need to change the placeholder on the server, whatever it is ч,мс

mortal hare
#

are you a programmer

tender shard
#

obviously not

mortal hare
#

or you're trying to edit config files

pseudo hazel
#

so you are making the plugin then correct?

tender shard
#

why do people always think "development" means setting up a server

mortal hare
#

well development is a broad term

#

estate development for example isnt about programming 😄

tender shard
#
%statistic_time_played:hours%ч %statistic_time_played:minutes%м %statistic_time_played:seconds%с
errant dew
#

thank you!!

tender shard
# mortal hare estate development for example isnt about programming 😄

yeah but it's pretty obvious that when there are two channels, one is called "help-server", and one is called "help-development" which has a channel description of "Spigot and BungeeCord programming/development help" that it's neither about setting up a server nor about "estate development" 😛

quaint mantle
#

am i need connection pool ?
bcs when i use cp
cy server crashes when 2 queries occur at the same time

wide coyote
#

yeah I highly recommend using HikariCP if you are using mysql

#

and I don't think the crash has something to do with connection pool

#

maybe how you use

quaint mantle
#

can u come dm ?

mortal hare
mortal hare
#

hikari has its own properties file but i would like to read it from yml instead

wide coyote
scenic onyx
#

so the updateceker dont go

unreal quartz
#

It doesn't change for about 6 hours

scenic onyx
#

i have 1.1

unreal quartz
#

Cached

scenic onyx
eternal night
scenic onyx
#

wtf???

tall dragon
scenic onyx
#

my pc is sus??

unreal quartz
#

More like cloudflare

scenic onyx
unreal quartz
#

Well check again later today, it will have expired by then

scenic onyx
#

ok

#

@unreal quartz em

#

because if i write u in 11796 change

#

?

unreal quartz
#

Because the original URI is cached

true perch
unreal quartz
#

No leave your code alone

#

It will work for you eventually

#

Just wait until the cache expires

scenic onyx
tender shard
scenic onyx
tender shard
#

Use the new API

scenic onyx
tender shard
scenic onyx
#

i try

tender shard
#

%s = resource id

scenic onyx
#

@tender shard Just put the dependencies? because it says that the .jar is needed but where is it?

quaint mantle
#

Help
slot 13 is in the player's inv and in the gui inv, how can I fix it

    public void onClick(InventoryClickEvent e){
        Player p = (Player) e.getWhoClicked();


        if (p.hasMetadata("AflixUpgradeInv")) {


            if (p.getItemInHand().getItemMeta().getCustomModelData() == 69) {

                if (e.getSlot() == 13) { }```
pseudo hazel
#

use getRawSlot\

#

the raw slot will be unique across the whole view

lunar wigeon
#

wtf is this gif

quaint mantle
lunar wigeon
#

just use java sockets to send packets from server A to client

scenic onyx
#

@tender shard tanks it go!

tender shard
distant wave
#

whne using Material.getMaterial will it look only in minecraft namespace or in every?

#

would this work if its on server which support forge mods as well?

#

so there are custom items

obsidian plinth
#

is their a way i can set item durability so a leather helm as the same amout as a diamond one

eternal night
#

spigot does not support custom items

#

nor does it support mods

tender shard
tender shard
obsidian plinth
#

effort unbreaking it is

cunning crater
#

Hey, I'm coding a spigot plugin for 1.8.8.

In config lists in yaml, it doesn't properly read the permissiosns I save for my rank system because they contain dots and aren't enclosed in ''.

If i manually enclose them with '' in the config.yml, copydefaults and safeconfig just remove them on plugin enable, so they aren't enclosed in '' anymore.

How can i make spigot save these strings in '' so I can properly load them?

remote swallow
#

You should use saveDefaultConfig on enable not copy defaults

tender shard
#

how does your config look like?

#

and why are you using an 8 year old MC version

tender shard
#

ah yeah pvp in 1.8 is just "who can spam click faster". yeah it makes sense to use it if the players aren't good enough to actually time their attacks

cunning crater
#

and parkour also. Parkour is usually done in 1.8, but ig that's mostly client side

eternal oxide
#

I'm bad at combat so 1.8 was good for me, but I never PVP so I was just panic clicking to kill mobs

cunning crater
#
ranks:
  default:
    name: default
    display-name: default
    prefix: '&7'
    suffix: ''
    chat-color: §f
    priority: 0
    permission-priority: 0
    allow-permissions: []
    deny-permissions: []
    inherits: []
    allowPermissions:
    - bukkit.command.help
    - core.worlds.world
    - essentials.help
    - essentials.msg
    - essentials.rtoggle

^ for example. as you can see the permissions aren't enclosed in ''

tender shard
#

what's the problem about the missing quotes?

cunning crater
cunning crater
tender shard
#

why do you even have allowPermissions and allow-permissions ?

remote swallow
#

Copy default wont readd that stuff, if they remove something and it breaks direct them to support somewhere

cunning crater
#

I'm just stupid then, i'm sry for wasting your time i didn't see that. I used a script to convert luckperms json to my config and accidentally used wrong name. Thanks for the help though. (replying to @tender shard )

tender shard
#

np

eternal oxide
#

copyDefaults() does nothing other than tell you the settings. copyDefaults(true) only adds sections if they are missing, IF you actually add some defaults.

quaint mantle
#

after query am i need to close connection ?

upbeat fog
#

Hi! I need some help implementing world guard into my plugin. When I try to build my plugin it says " package com.sk89q.worldguard does not exist ", but IntelIj was able to recognise world guard when I imported stuff from world guard to my plugin.

livid dove
#

Before i bash my head up the wall, anyone know of open source attempts to do custom xp orbs?

lilac dagger
tidal robin
#

Hi ! I'm trying to set negative amount on an itemStack but when im opening player inventory, no item is showing up, Im using spigot 1.20.1

lilac dagger
#

do you use maven to build?

tidal robin
#

and preventing him to buy again, its like for UI

livid dove
upbeat fog
tidal robin
livid dove
#

1.8 is 8 years old homie

#

times have changed and so has the api

tidal robin
#

Yeah i know but maybe someones already done it in 1.20

livid dove
#

Never heard of it personally

tidal robin
#

Also do u have any idea to show player that he already bought the item ? Like a visual thing

river oracle
#

NOOOO support 1.8 or you'll lose 7% of all servers

upbeat fog
#

When I tried to add it as a dependency there

lilac dagger
#

well, you've done something wrong then

#

try to understand the error

upbeat fog
#

the " Example: Configuring a Maven pom.xml "

lilac dagger
#

this also?

upbeat fog
#

Yes and I have no issue with that part

#

only with the dependency part

lilac dagger
#

VERSION

upbeat fog
#

7.0.9

lilac dagger
#

did you change this to the latest version?

upbeat fog
#

yes

#

okay I changed the version to LATEST and i have no issue with it

#

but the groupid and the artifactid still shows error

lilac dagger
#

there is no 7.0.9 here

upbeat fog
#

yeah thats why I put LATEST

boreal sparrow
#

What does ```java
sign.getSide(Side.FRONT).getLines();

Return if some of the lines are empty?
lilac dagger
#

try 7.08

upbeat fog
#

lmao it magicly fixed itself

boreal sparrow
#

Does an empty line return an empty string in the array?

lilac dagger
#

you probably didn't reload

boreal sparrow
#

Like if all are empty would it be {"","","",""}

north nova
#

what

#

what does why would they be mean

#

why would they be what

boreal sparrow
#

Well in server console I get [1, 2, , ]

#

so it could be an empty string ig?

north nova
#

what exactly is the issue you're facing?

boreal sparrow
north nova
#

it always returns an array of length 4

#

and you can know which one is missing since arrays are indexed

#

size is always 4

#

i still dont get the problem lol

boreal sparrow
#

No?

slender elbow
#

yes?

boreal sparrow
#

wait huh

north nova
#
Deprecated
in favour of lines()
Returns:
Array of Strings containing each line of text```
slender elbow
#

mfw paper javadoc

north nova
#

w/e

#

its the same except for the deprecated part

boreal sparrow
north nova
#

yeah

slender elbow
#

where is our dearest paper representative

remote swallow
#

asleep

north nova
#

bro why do u even care its the exact same javadoc it'

#

it's just annotated with deprecated

slender elbow
#

i don't

north nova
#

ah oke

#

i know this isn't paper bla bla bla

north nova
#

or just iterate through

#

or just check manually

simple schooner
remote swallow
#

my nitro ran out

sterile breach
remote swallow
#

it uses a players connection to send the message

simple schooner
slender elbow
limpid lily
sterile breach
remote swallow
#

im pretty sure it is

vital sandal
#

How to add advancement to player without experience reward

#

I got something like this

quaint mantle
# remote swallow im pretty sure it is

When the player into the server, I print online to the database offline when out
If the player constantly rejoin the server or 100 player
Will there be too many queries in this database?

eternal needle
#

Hi i am trying to make it so player cant make a claim insde a town and a town inside of a claim. But i cant figur out how to find out if it exspands the town or are making a new one, this has much to say beacus it does take the money even tho i am cancelig it. so i am trying to give the player money back but it does not give the right amount to the player if it does create a new town

    public void onTownCreate(TownPreClaimEvent event) {
        Player player = event.getPlayer();
        Chunk chunk = player.getLocation().getChunk();

        // Check for overlapping GriefPrevention claims in the chunk
        boolean hasClaim = false;
        for (int x = 0; x < 16; x++) {
            for (int z = 0; z < 16; z++) {
                int blockX = chunk.getX() * 16 + x;

                int blockZ = chunk.getZ() * 16 + z;
                Location location = new Location(chunk.getWorld(), blockX, 0, blockZ);
                Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, true, null);
                if (claim != null) {
                    hasClaim = true;
                    break;
                }
            }
            if (hasClaim) break;
        }


        if (hasClaim) {
            event.setCancelled(true);
            if (event.getTownBlock() == null) {
                // New town is being created
                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "eco give " + player.getName() + " 250000");
            } else {
                // Town is being resized
                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "eco give " + player.getName() + " 25");
                event.getPlayer().performCommand("town deposit 25");
            }
        }
    }

Does use https://www.spigotmc.org/resources/towny-advanced.72694/ and https://www.spigotmc.org/resources/griefprevention.1884/ got both apis and is stuck

pls tag me 😄

eternal oxide
#

?nms

dusk cipher
#

hi guys, I've tryed to get player head like this:

public static ItemStack getPlayerHead(String playerName) {
        ItemStack skullItem = new ItemStack(Material.PLAYER_HEAD, 1, (short) SkullType.PLAYER.ordinal());
        SkullMeta skullMeta = (SkullMeta) skullItem.getItemMeta();

        OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);

        skullMeta.setOwningPlayer(offlinePlayer);

        skullItem.setItemMeta(skullMeta);
        return skullItem;
    }

it's working when im placing the head, but in the inventory, the head doesn't show up player's skin

Do u know how to do that ?

buoyant viper
#

pretty sure u dont need to use SkullType.PLAYER.ordinal() thonk

#

not that i know/think itll have an effect that may lead to skins not showing up, but try just new ItemStack(Material.PLAYER_HEAD, 1); @dusk cipher

north nova
#

In computer programming, a magic number is any of the following:

A unique value with unexplained meaning or multiple occurrences which could (preferably) be replaced with a named constant
A constant numerical or text value used to identify a file format or protocol; for files, see List of file signatures
A distinctive unique value that is unlik...

dusk cipher
buoyant viper
#

weird, i have nearly the same code in my plugin (minus SkullType.PLAYER) and it works fine..

eternal oxide
#
 public ItemStack getHeadByOfflinePlayer(OfflinePlayer player) {

    ItemStack head = new ItemStack(Material.PLAYER_HEAD);
    SkullMeta headMeta = (SkullMeta) head.getItemMeta();
    
    headMeta.setOwningPlayer(player);
    head.setItemMeta(headMeta);

    return head;
}```
dusk cipher
buoyant viper
#

yes

dusk cipher
#

mmmh

#

maybe its because my server is offline mode

#

Like crack version allowed

buoyant viper
#

idk how heads behave in offline

ivory sleet
north nova
#

it is 100% the problem lol

dusk cipher
# ivory sleet 💀

Yeah 10 players on my server and that 1 friend who doesnt want to buy the game ruin my life

north nova
#

@dusk cipher

#

what does setOwningPlayer return

dusk cipher
north nova
#

what does

#

it return

#

the value of the boolean

#

is it true or false

dusk cipher
#

true

hybrid turret
#

I got a lil problem. I'm trying to get the config from the yml file and it config.get(<path>) obv returns an Object that it won't allow me to cast to Inventory though. How do I get around that?

north nova
#

its gotta be offline mode then

dusk cipher
#

the strange behavior here is that when im placing the head, the skin show up correctly

dusk cipher
north nova
#

middle click the method

#

and see

north nova
#

use gson

hybrid turret
#

well okay

dusk cipher
hybrid turret
#

i feel kinda embarresed but how do i add gson to the project?

north nova
#

Returns:
true if the owner was successfully set

north nova
#

add a type adapter for itemstack

#

have an object SerializedInventory or something

#

store the data there then serialize it with gson

#

and deserialize it into the object and have an adapter to convert it back to inventory

dusk cipher
wary topaz
#

How would I make this work? (I'm new to SQL)

hybrid turret
#

well okay ill try that

north nova
#

also

#

ur uuid field

wary topaz
#

well I dont know if this works and testing it takes like an hour (more like 3 minutes each test)

north nova
#

why does it take 3 minutes each test what

#

ur uuid field is of type uuid, so I dont think u can check it against hi

wary topaz
#

bhecause the database is hosted on pterodactyl

north nova
#

show your code

#

ethan

wary topaz
#

got it

north nova
wary topaz
north nova
#

do u not have the credentials?

wary topaz
#

line 75 to 79

north nova
#

i am so confused

wary topaz
#

im trying to get a players language using mysql

buoyant viper
#

EthanNetwork DogJA nice

wary topaz
#

and its used in a bungeecord plugin messaging

north nova
#
    private String getPlayerLanguageFromDatabase(UUID uuid) {
        try {
            PreparedStatement statement = connection.prepareStatement("SELECT Lang FROM Players.PlayerData WHERE UUID = " + uuid);
            ResultSet resultSet = statement.executeQuery();
            if (resultSet.next()) {
                return resultSet.getString("Lang");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "en"; // default language if not found or error
    }
wary topaz
north nova
#

the query is a string

dusk cipher
#

Also I just wanna know how you guys design your Listeners ?
Are you settings Listeners in concerned class, or you settings all your listeners in same Class ?

Like if you need listeners for a custom Player Class and for a Custom Mob Class How u done that ?

wary topaz
north nova
#

if it's an uuid then no

#

that's why the type is called uuid

wary topaz
#

but are minecraft uuids technically uuids?

north nova
#

yeah?

#

what else would they be lol

wary topaz
#

alr

north nova
#

also @wary topaz

#

that's not right usage of

#

parameter binding i think it's called

#

the statement.setString

dusk cipher
#

Yes but when u got lot of custom Inventory for exemple, listeners on Players Click is gonna be very very fat

north nova
#

for that to actually work u'd need to do something like this

#
        statement.setString(1, uuid);```
buoyant viper
#

separate ur listeners how u deem fit

north nova
#

im not sure if im allowed to say this here

#

but lucko has a nice helper

#

with a bindings system and event handling system

buoyant viper
#

how could u do this to us

#

we trusted you

north nova
#

😭 im sorry

#

(you trusted me)

#

(no one knows me)

north nova
#

u can

wary topaz
#

but this statement will work? PreparedStatement statement = connection.prepareStatement("SELECT Lang FROM Players.PlayerData WHERE UUID = ?");

#

seeing the mysql phpmyadmin setup

north nova
#

have ur inventory object as bindable, then when u load it u cache it and bind the listener to the inventory

dusk cipher
#

Interresting.. You have a link or something ?

buoyant viper
#

but yeah no u if u thonk they can benefit from using an api or service then u should absolutely recommend it

buoyant viper
#

no gatekeeping here

eternal oxide
eternal oxide
#

Listeners have to be re-baked every time you add or remove

north nova
#

not if you have your own event handler

#

🙂

wary topaz
#

Cannot resolve method 'setString' in 'ResultSet'

north nova
#

i dont use bukkit event handler it sucks

buoyant viper
eternal oxide
#

have a generic listener then pass off to your own accept methods.

buoyant viper
#

.toArray()

north nova
#

have the uuid in the query string directly

#

u dont need the wildcard

#

i was just showing what that method would be for, i assumed it existed

#

i guess it doesn't

dusk cipher
#

How u bind a listener to an itemStack ?

north nova
buoyant viper
#

very carefully

wary topaz
#

private String getPlayerLanguageFromDatabase(String uuid) { try { PreparedStatement statement = connection.prepareStatement("SELECT Lang FROM Players.PlayerData WHERE UUID = " + uuid); ResultSet resultSet = statement.executeQuery(); if (resultSet.next()) { return resultSet.getString("Lang"); } } catch (Exception e) { e.printStackTrace(); } return "en"; // default language if not found or error }

north nova
#

remove the .setString u dont need it

wary topaz
#

where is the .setString

north nova
#

in your code

wary topaz
#

oh

dusk cipher
north nova
#

well

north nova
#

^

wary topaz
#

ah thanks

north nova
#

u dont need the + "" at the end

#

cause it's a string concat

wary topaz
#

Empty string used in concatenation

eternal oxide
wary topaz
#

so the code works now?

north nova
#

or make your own

#

what i do is

dusk cipher
north nova
#

have a custom implementation of inventoryholder and in the constructor u register it in a static map, by uuid

#

and then you use the menu's uuid to handle clicks

#

there's many ways to achieve that

eternal oxide
#

Don;t use teh InventoryHolder

#

use the Inventory Instance

north nova
#

?

#

wat

#

inventoryholder is just an interface

eternal oxide
#

unless you want the Block that has the Inventory you shoudl not use the holder

north nova
#

that has getInventory

#

what are u saying wait im confused

wary topaz
eternal oxide
#

every time you use InventoryHolder and getInventory it clones so much it should not be used

wary topaz
north nova
#

why would it clone

eternal oxide
#

It shouldn;t but it does

north nova
#

really

eternal oxide
#

avoid InventoryHolder

north nova
#

i didn't know that

#

sorry

eternal oxide
#

The Inventory Instance is perfect for a Map

#

just somethign along the lines of Map<Inventory, Consumer> or whatever you want to parse the event

north nova
#

cant u just extend inventory and have the consumer inside?

hybrid turret
eternal oxide
#

No need, but extending Bukkit Objects is frowned upon

north nova
hybrid turret
#

then i'm blind

#

sorry

north nova
#

read the documentation

wary topaz
#

`private void setupDatabase() {
try {

        String url = "jdbc:mariadb://" + "172.18.0.1" + ":3306/Players";
        String username = "*";
        String password = "*";

        connection = DriverManager.getConnection(url, username, password);
    } catch (SQLException e) {
        e.printStackTrace();
        getLogger().severe("Failed to connect to the database or load the configuration!");
    }
}`

Why is this erroring?

glossy venture
#

sendthe error

wary topaz
#

17:52:46 [SEVERE] java.sql.SQLException: No suitable driver found for jdbc:mariadb://172.18.0.1:3306/Players 17:52:46 [SEVERE] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:706) 17:52:46 [SEVERE] [Bungeemanager] Failed to connect to the database or load the configuration! 17:52:46 [SEVERE] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) 17:52:46 [SEVERE] at me.bungeemanager.Bungeemanager.setupDatabase(Bungeemanager.java:31) 17:52:46 [SEVERE] at me.bungeemanager.Bungeemanager.onEnable(Bungeemanager.java:21) 17:52:46 [SEVERE] at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:266) 17:52:46 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:295) 17:52:46 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67) 17:52:46 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

glossy venture
wary topaz
#

citizens supports that version I think

wary topaz
glossy venture
wary topaz
hybrid turret
remote swallow
#

(use hikari cp)

wary topaz
# glossy venture did you shade it

`dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.7.2</version> <!-- Make sure you use the latest version -->
</dependency>

<dependency>
      <groupId>net.md-5</groupId>
      <artifactId>bungeecord-api</artifactId>
      <version>1.20-R0.1-SNAPSHOT</version>
      <scope>provided</scope>
  </dependency>

</dependencies>`

#

yes citizens is paid

remote swallow
#

you can get it off jenkins for free

north nova
#

isn't it open source?

#

i'm pretty sure it is opensource

wary topaz
#

citizens2 is opensource

remote swallow
north nova
#

ah

remote swallow
#

its on their jenkins

wary topaz
#

they have a support discord server

north nova
#

or maven

#

spigot people say spigot is made for maven so maven

hybrid turret
#

oh well, just gonna do 3 years of work in a new project again?

glossy venture
#

i think

#

never used maven so idk

wary topaz
#

its on their spigot page

remote swallow
#

most likely

#

Tag.something.isTagged(material)

wary topaz
#

<dependency> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.5.0</version> <type>maven-plugin</type> </dependency>

works

eternal oxide
#

if you are on a current Spigot build use the libraries feature of plugin.yml so you don;t need to shade mariadb

#

you didn't register the listener

wary topaz
#

18:00:29 [SEVERE] java.sql.SQLException: No suitable driver found for jdbc:mariadb://172.18.0.1:3306/Players 18:00:29 [SEVERE] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:706) 18:00:29 [SEVERE] [Bungeemanager] Failed to connect to the database or load the configuration! 18:00:29 [SEVERE] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229) 18:00:29 [SEVERE] at me.bungeemanager.Bungeemanager.setupDatabase(Bungeemanager.java:31) 18:00:29 [SEVERE] at me.bungeemanager.Bungeemanager.onEnable(Bungeemanager.java:21) 18:00:29 [SEVERE] at net.md_5.bungee.api.plugin.PluginManager.enablePlugins(PluginManager.java:266) 18:00:29 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:295) 18:00:29 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67) 18:00:29 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

I installed the shade plugin but im still getting this error

remote swallow
#

do you Class.forName the driver

wary topaz
#

let me get the code link again

#

but here is a picture of my output

north nova
#

what class are u doing this in

remote swallow
#

also this should be done async and rather with a connection pool

north nova
#

why are u casting to Plugin

#

that's wrong

remote swallow
north nova
#

which extents JavaPlugin?

wary topaz
eternal oxide
#

yes, no need to cast either object

north nova
#

if his ide doesn't grey up the casts then something else is wrong

remote swallow
eternal oxide
#

no

north nova
#

that's not the problem

#

send both of your classes

#

the main class and the listener class

wary topaz
wary topaz
north nova
#

i meant rafin

wary topaz
#

the bungee only has one class

remote swallow
#

you still dont Class.forName the driver

eternal oxide
#

your if is indented which makes me think you cut some code out which you are not showing us

wary topaz
#

ill brb

north nova
#

send both classes

#

what is the command

#

for the thing

eternal oxide
#

?paste

undone axleBOT
north nova
#

i knew that

mortal hare
#

its so hot... 35 degrees

#

cmon

#

its unbearable

north nova
#

get an industrial freezing room and sit inside it

tender shard
#

yeah like in "the 100 year old who climbed out of the window and disappeared"

mortal hare
#

i got an deja vu

north nova
#

why is there a wikipedia page about that

tender shard
#

because it's a book

north nova
#

oh its a book

#

LOL

#

nevermind HAHAHA

tender shard
#

it's a great book, can recommend

north nova
#

i only read minecraft guide books

tender shard
#

i read forrest gump today, book is meh

north nova
#

wait i know the author

remote swallow
#

is it forest gump

tender shard
#

nah

#

winston groom

north nova
#

are u gonna send ur code or is it top secret

#

oh no

#

oh my god

remote swallow
#

MY EYES

north nova
#

omg

remote swallow
#

AHHHHHHHHHHHHHHHHHHHHHHH

north nova
#

man

#

there's so many

#

wrong things

#

in there

north nova
#

im sorry

#

but

#

okay so

remote swallow
#

this class should not be a thousand lines long

#

?stacktrace

undone axleBOT
tender shard
#

Wtf

north nova
#

man

#

even so tho

#

the listener should work

#

even with this atrocious class

barren pumice
#

hello how can I make armorstend pet plugin so it will be following player using velocity?

north nova
#

the casts are unnecesary

eternal oxide
#

theres a lot in your main class which needs removing, but the Listener looks fine

north nova
#

but it should work

#

are you sure the material is tagged?

eternal oxide
#

it needs optimizing so it only runs when you actually move, but the code is fine

north nova
#

🤦‍♂️

tender shard
#

Look at it with f3

eternal oxide
#

have you tried placing slabs and walking on them? Lower slab, not upper

tender shard
#

It shows the tags in f3

north nova
#

@quaint mantle

#
    public void OnMove(PlayerMoveEvent event) {
        final Player player = event.getPlayer();
        final Block block = player.getLocation().getBlock().getRelative(0, -1, 0);
        final Material groundType = block.getType();

        if (!Tag.PREVENT_MOB_SPAWNING_INSIDE.isTagged(groundType)) {
            System.out.println("Block is not tagged");
            return;
        }

        player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 2 * 20, 5));
        player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 2 * 20, 5));
        player.addPotionEffect(new PotionEffect(PotionEffectType.LEVITATION, 2 * 20, 100));
        player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 10 * 20, 5));
    }```
#

change ur event handler to this

#

and see if the print is in the console

#

if it is, then the material is not tagged

#

and then also think about optimizing this

#

cause this event is fired every single time the player moves

#

and includes pitch and yaw

hybrid turret
#

i'm so stupid... i'm trying to convert my project to a maven project. i added the spigot 1.19.2 api but it can't find any of the bukkit imports anymore..

eternal oxide
#

your IDE shoudl have a feature for convert to Maven

#

?paste your pom.xml

undone axleBOT
north nova
#

that main class is gonna mark the rest of my week 💀

#

and also a useful thing u can do with listener classes is

#

use dependency injection

hybrid turret
north nova
#

pass ur main class as a parameter in the constructor, then inside the constructor u can do

#

mainClass.getPluginManager().getEventHandler().registerEvent(this, mainClass)

#

and in ur main class u only do new ListenerClass()

hybrid turret
# hybrid turret from the new project?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>ServerSystem-1.19</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>19</maven.compiler.source>
        <maven.compiler.target>19</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>20.1.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

</project>
north nova
#

u dont have the spigot dependency

eternal oxide
#

you need teh spigot repository and dependency in that pom

hybrid turret
#

lmao okay

eternal oxide
#

?maven

undone axleBOT
quaint mantle
#

whats the best way to detect durability change

#

i cant find any event thats close to that

north nova
#

PlayerItemDamageEvent

eternal oxide
#

damage

#

ewvents

north nova
#

i think its called

hybrid turret
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>ServerSystem-1.19</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>19</maven.compiler.source>
        <maven.compiler.target>19</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>20.1.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>
#

like this?

north nova
#

teag

#

yeah

quaint mantle
hybrid turret
#

cuz rn the dependency is displayed red

north nova
#

refresh maven