#help-development

1 messages · Page 544 of 1

undone axleBOT
thick gust
quaint mantle
#

ur is way to short

#

copy missing parts from this one

#

or at least necesarry parts

#

you dont need the luck perm repository

thick gust
#

which

quaint mantle
#

build for example

#

you need that i suppose

#

and it should say the plugin name right here

#

i feel like this is more work then just creating a new project honestly tho..

thick gust
#

why does my entire project contain errors??

#

can't find any classes of spigot api..

#

this is my pom file so far:

<?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>groupId</groupId>
    <artifactId>RPGPlugin</artifactId>
    <packaging>jar</packaging>
    <name>RPGPlugin</name>
    <version>1.0</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.12.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>
</project>
#

okay when editing it as you said

#

now I can click the run maven build button

quaint mantle
#

yh+

thick gust
#

idk where it's being exported right now though

quaint mantle
#

the default folder is next to the src folder

#

named target

#

i think

thick gust
quaint mantle
#

it will probally create it once you export

#

click thid

#

this

#

in lifecycle

young knoll
#

Just do package

#

Unless you need it in your local repo

eternal oxide
#

package not install, unless you want to bloat your local maven with multiple jars

thick gust
#

install:

#

package doesn't work either:

hazy parrot
#

seems like question for google

analog snow
#

chatgpt can answer you that

tardy delta
#

smh discord

#

i even more want to make my own client now to remove the bloat 🥺

quaint mantle
#

do it

ivory sleet
#

mc client or discord client

thick gust
#
import org.apache.commons.codec.binary.Base64;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;

These lines of code are highlighted as an error since I setup maven

young knoll
#

At least the games store is gone

hazy parrot
tardy delta
#

discord

young knoll
tardy delta
#

the last client i tried was able to see channels i didnt have access too 💀 (not contents tho)

worldly ingot
#

HttpClient with Java 11 is great

quaint mantle
young knoll
hazy parrot
#

its nothing specific to bukkit or spigot

tardy delta
#

i have no idea how their protocol works so gl ig

thick gust
tardy delta
young knoll
#

You can see members too

quaint mantle
young knoll
#

In hidden voice channels

tardy delta
#

no clue

quaint mantle
#

if you search it its normaly right at the top

shadow gazelle
#

What event do I need to use to stop an experience bottle from being thrown by a player?

worldly ingot
#

Either a ProjectileLaunchEvent or a PlayerInteractEvent would work fine

worldly ingot
#

If it's async it's whatever

#

Gotta do what you've gotta do

quaint mantle
#

well how often does someone join

worldly ingot
#

HttpClient in J11 has async-specific methods

hazy parrot
#

just curious, why you need it

thick gust
worldly ingot
#

Then you're all set

#

It gives an async example

young knoll
#

But that’s 20!!!!

quaint mantle
hazy parrot
#

yeah

worldly ingot
hazy parrot
#

oh, right

worldly ingot
#

I'll move to J21 Javadocs once it's generally available

young knoll
#

Mc on 21 when

worldly ingot
#

And then PES_SadGePray that Mojang updates in 1.21 or something

#

I mean come on. Please give us J21 on MC21

analog snow
#

specifically?

#

what do you want to verify?

tardy delta
#

when will we get mc 2.0

young knoll
#

They better not stay on 17 for a decade

quaint mantle
worldly ingot
#

I don't think they will

worldly ingot
#

I'd imagine they'll want to take advantage of some 21 features

young knoll
#

They stayed on 8 forever

tardy delta
#

im thinking about making a voxel game, minecraft seems a bit too ambicious

young knoll
#

But you can make minecraft in a week!

#

Haven’t you seen all those videos

tardy delta
#

those dudes know how to render, i cant even make pong 💀

#

well i nearly got it

#

im doing snake now 💀

young knoll
#

Trust me making a basic voxel engine in unity is definitely the same as making minecraft

tardy delta
#

ew unity

#

ill probably do it in c++, currently working in odin (yes thats a lang)

quaint mantle
#

@analog snow already did that

young knoll
#

What’s wrong with unity

analog snow
tardy delta
#

c#?

shadow gazelle
young knoll
#

What’s wrong with C#

analog snow
#

so what do you want to send in that request?

tardy delta
#

ehh lets just say i dont like it, been 3 years ago now since i last used it

analog snow
#

okey

young knoll
#

C# is basically just Microsoft java

tardy delta
#

does c# have operator overloading?

young knoll
#

And in some ways better java

analog snow
#

and you want to send that from a minecraft plugin to your own api?

tardy delta
#

it kinda is in some aspects but its also the more shitty version

#

but thats for every lang

#

anyways gn

analog snow
#

?paste

undone axleBOT
young knoll
analog snow
lavish robin
#

Is there an easy way to control how much damage a firework rocket deals? (I still want decreased damage from distance, etc, but I want to change the base damage from the explosion.)

tardy delta
#

what about expressions that compile at compile time?

analog snow
#

👍

quaint mantle
#

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>authlib</artifactId>
<version>1.6.0</version>
</dependency>

analog snow
#

I copied it out of my plugin lol, I got it from GPT, but it works

tardy delta
analog snow
#

lmk if you need help just @ me or dm me @rare aurora

compact haven
#

is ConfigurationSection#contains(String) case sensitive?

#

If I pass "type" and the config contains "TYPE" will it be true or false

worldly ingot
#

I believe so, yes

compact haven
#

alright, thank you

young knoll
#

Just use all lowercase

#

:p

worldly ingot
#

Actually, use mock case

#

jUsT uSe AlL lOwErCaSe

young knoll
#

Guess I gotta make a PR to VeinMiner

worldly ingot
#

I'm excited to drop Material from VM in 1.20

quaint mantle
worldly ingot
#

Gonna be so great

#

Alchema too

young knoll
#

But what about the legacy users!!

worldly ingot
#

Fuck them legacy users. They can use 2.0.0

#

It still works well

young knoll
#

Ur getting a 1 star review

worldly ingot
#

k

young knoll
#

😡

worldly ingot
analog snow
#

np

worldly ingot
#

bet u feel good about urself, 1 star reviewing a free plugin

#

nerd

wet breach
young knoll
#

It’s the only way I sleep at night

worldly ingot
#

I'd figured as much

wet breach
#

for doing away with the legacy

worldly ingot
#

New features take priority

#

When Bukkit API gets improvement, so do my plugins

quaint mantle
worldly ingot
young knoll
#

He’s bribing staff!

worldly ingot
#

IT'S NOT BRIBING

worldly ingot
#

It's just... giving me what I want

wet breach
thick gust
# quaint mantle <repositories> <!-- Maven Central Repository --> <repository> <id>centra...

@quaint mantle

<?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>groupId</groupId>
    <artifactId>RPGPlugin</artifactId>
    <name>RPGPlugin</name>
    <packaging>jar</packaging>
    <version>1.0</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.12.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>1.6.0</version>
        </dependency>
    </dependencies>

    <!--<repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>!-->
    <repositories>
        <!-- Maven Central Repository -->
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <!-- Mojang Maven Repository -->
        <repository>
            <id>mojang</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>
    </repositories>
</project>
#

this is my current pom.xml

quaint mantle
#

where did the old repository for spigot go

#

oh

#

its gray

#

you know that

#

well

thick gust
#

keep it as well or nah

quaint mantle
#

format it like that

#

hi guys which event can check village trade slots ?

worldly ingot
#

Spigot's repo hasn't changed at all. At least not since 1.8

young knoll
#

Aren’t you supposed to use like 3 repos for spigot

thick gust
worldly ingot
quaint mantle
worldly ingot
#

I mean unless you're counting transitive dependencies

quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

put it in here

young knoll
#

Oh it’s a gradle thing that it doesn’t automatically recognize them

thick gust
#

whats '?paste'

quaint mantle
thick gust
#

ah hastebin / pastebin

quaint mantle
#

yh

#

i have a question if i prevent craft if paper has modeldata after if i create custom repice with model data paper
my custom repice will work ?

young knoll
#

What

quaint mantle
#
    @EventHandler
    public void get(PrepareItemCraftEvent e) {
        CraftingInventory test = e.getInventory();
        for (ItemStack stack : test.getMatrix()) {
            if (stack == null || stack.getType().isAir()) continue;
            ItemMeta meta = stack.getItemMeta();
            if (meta != null && meta.hasCustomModelData() && stack.getType() == Material.PAPER) {
                test.setResult(null);
            }
        }
    }``` i do this
undone axleBOT
quaint mantle
#

read and if i create custom repice with paper with model data

#

this repice will work ?

#

alright i try

#

i have 1 question more

#

which event control village trade slots ?

#

inventory click ?

thick gust
quaint mantle
#

actually no, i wanna prevent some trades

#

how can i do ?

young knoll
#

You cancel any recipe with paper that has modeldata

#

Custom or not

thick gust
#

still same error for the lines of code @quaint mantle

quaint mantle
#

idk anymore honestly @young knoll you do this idk

#

im getting brain damage from this

young knoll
#

Uhh

quaint mantle
#

😄

young knoll
#

I don’t use maven 🙃

thick gust
#

lol

lavish robin
#

How can I change the damage that a firework does?

quaint mantle
young knoll
#

Listen for the damage event and modify it there

quaint mantle
#

or well thest if the dmg cause is firework

#

i have a problem i create custom items with paper modeldata
but if player trade to villager with my custommodeldata paper item
this trade will work i wanna prevent this but which event do this ?

lavish robin
young knoll
#

There’s a gradle plugin for it

#

Idk about maven

eternal night
#

for gradle ^

#

which, if you are coming from fabric, would be your build system of choice anywa-

carmine mica
eternal night
#

😏

quaint mantle
eternal night
#

progress 🆙

thick gust
#

@quaint mantle

quaint mantle
#

no i still love maven

eternal night
#

you are presumably missing the mojang repo

quaint mantle
#

Live Love Laugh Maven <3333

#

fr i always get hated here when talking aobut 1.8

eternal night
young knoll
#

Good

#

1.8 succ

lavish robin
young knoll
#

Let’s update it to just rm -rf when you start the server

quaint mantle
#

get the current dmg and decrease or increase it by ur wanted amount

lavish robin
#

Do I have to raytrace to figure out if there is a block in the way?

young knoll
#

Just multiple the damage

quaint mantle
young knoll
#

Yes the damage event should already reflect that reduction

quaint mantle
#

yep

lavish robin
#

Oh okay

#

What if I want to increase the range of the explosion howerver?

quaint mantle
young knoll
#

Idk you’d have to test it

eternal oxide
#

increase explosion yield

young knoll
#

Afaik it’s after the reduction

#

Fireworks aren’t an explosion

#

So you can’t increase the yield

eternal oxide
#

ah fireworks

quaint mantle
#

well

young knoll
#

Afaik the only way to change the size is to change the shape of the firework

quaint mantle
#

you could spawn an exploding tnt on explosion

young knoll
#

Or make your own firework system

quaint mantle
#

and change its yield

young knoll
#

You could

#

But at that point just use World#createExplosion

lavish robin
quaint mantle
#

you could pass the dmg from the firework into your new explosion

#

and basically do what ever you want with it

young knoll
#

Explosions don’t have a way to control damage

#

Minus manual intervention via the event

quaint mantle
#

well yh you could make a second event for when the explosion accours couldnt you

#

and change the dmg there

lavish robin
#

I guess, is the max damage of an explosion known so I can scale from that? or is it random?

young knoll
#

I believe it’s based on difficulty

thick gust
#

@quaint mantle isn't there a way to recreate the pom.xml without editing it manually

#

cuz that doesn't seem to work at all to fix the issue i am experiencing

#

bruhg

#

I was refering to the spigot wiki

#

I got it fixed

#
<repositories>
    <!-- This adds the Spigot Maven repository to the build -->
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>

<dependencies>
    <!--This adds the Spigot API artifact to the build -->
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.19.4-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
</dependencies>

This was all u had to add @quaint mantle

wooden owl
#

Im knew I have question about the plugin i made, when loading up the server i keep getting the error with the plugin.

<Cannot find main class `org.invchest.spotify'>

the main class in the plugin.yml file is correct and spelled correctly

thick gust
#

@quaint mantle why the heck is the package though not available although I got the pom.xml correct and all libs added?

wooden owl
#

yes

#

you want me to send ss or the acutal code

#

ok it wont let me copy my ss to disc

young knoll
undone axleBOT
wooden owl
wooden owl
#

oh thankyouy

#

ok ty

thick gust
eternal oxide
#

you should not need authlib unless you are using nms

young knoll
#

Or ur doing custom player heads on an old version

#

😩

rotund ravine
#

😢

#

?update

eternal oxide
#

Most uses of authlib in plugins are due to using GameProfile for setting textures on skulls

rotund ravine
#

?update

eternal oxide
#

You shoudl use PlayerProfile now

young knoll
#

Iirc they are on 1.12

#

-_-

eternal oxide
#

oh 😦

#

Pascal for classes, camel for methods and variables

river oracle
#

is the world's uid.dat just the World UUID?

young knoll
#

Use whatever case the conventions say

#

If you are making your own language then you get to choose what you like best :p

#

But only then

rotund ravine
#

we call it lowerCamelCase for methods, variables and functions (with some exceptions) and UpperCamelCase for class namees.

young knoll
#

And C# is the same

#

Except it isn’t because it likes to fuck with me

rotund ravine
#

i don't read

#

ur welcome

thick gust
rotund ravine
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

thick gust
#

I don't get why I got errors while hitting "package" on maven although all packages are imported it tells me they aren't found.

thick gust
eternal oxide
young knoll
#

Do you still have old dependencies

#

Like, depending on the jar

thick gust
thick gust
eternal oxide
#

It's clearly not but, depend on spigot not spigot-api as you need authlib and apache commons

thick gust
#

@eternal oxide wanna see my pom.xml file?

eternal oxide
#

sure

thick gust
eternal oxide
#

change the artifactId to spigot instead of spigot-api

rain patio
#

Hello, I am trying to save variables for when the server reloads to a json file, and I keep getting this error and idk how to fix it:
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 4 path $

I'll provide the snippet of code I'm using

hasty prawn
#

What does the JSON look like?

quaint mantle
#

how can i delete item in inventory i use removeItem method but this deleting even itemstacks i only want delete 1 item

hasty prawn
#

setAmount(item.getAmount() - 1)

rain patio
hasty prawn
#

ok yeah thats not

rain patio
#

it wont generate what I need in the file? ik it's empty but it wont save any values to it?

hasty prawn
#

Well, you should be writing a JsonElement, not the HashMap and Sets directly. You probably want to use JsonObject, set the properties with values as the Map and Sets, and then write that JsonObject

rain patio
thick gust
#

ayo actually export worked now

hasty prawn
thick gust
#

I get a console error though @eternal oxide "invalid plugin.yml"

eternal oxide
#

you are building using artifacts in your IDE not maven

hasty prawn
#

Player#openBook() ?

rain patio
#

wait would i use the same object for all of them or would I make 4 separate objects?

hasty prawn
#

Yes. You just pass in the book ItemStack

rain patio
#

oh okay cool

hasty prawn
#

You could make them separate I suppose, probably would look weird though (and may actually be invalid, depends how Gson handles that)

thick gust
#

I use package with maven

eternal oxide
#

show me

rain patio
hasty prawn
#

Save

rain patio
#

ohh ok

#

was my load method correct the first time then?

hasty prawn
#

You'll have to modify it slightly so that it grabs the Map and Sets from the key you set in save.

#

Sure, depends on what version you're using.

#

If you're using latest, which you should be, openBook is the way to go.

#

If you're using outdated server software, then yes, you'll have to use packets.

thick gust
#

@eternal oxide how should I show u it lol xD

eternal oxide
#

what IDE is that?

hasty prawn
#

Use openBook then dinkdonk

thick gust
eternal oxide
#

using an eclipse workspace?

#

ok

thick gust
#

transfered recently

eternal oxide
#

show me your plugin.yml and an SS of your project structure for the resources folder

thick gust
#
name: Rpg
version: '1.0'
author: Proudyy
main: net.rpg.main.Rpg
description: Rpg in Minecraft.
commands:
  tank:
    description: abc
  warrior:
    description: abc
  mage:
    description: abc
  witch:
    description: abc
  priest:
    description: abc
  hunter:
    description: abc
  getequip:
    description: abc
    aliases: [equip, kit]
  removeclass:
    description: abc
  removeclasses:
    description: abc
  resetclasses:
    description: abc
  classesinventory:
    description: abc
    aliases: [classesinv, cinv]
  rpgsettings:
    description: abc
  spawnclassvillager:
    aliases: [scv]
  spawnweaponvillager:
    aliases: [swv]
  build:
    description: abc

@eternal oxide

hasty prawn
eternal oxide
#

ss of your project structure. Is your plugin.yml in a resources folder in /src/main

thick gust
#

No its in /src/main/java

eternal oxide
#

it should not be

thick gust
#

so move both plugin.yml and config.yml from /src/main/java to /src/main

#

and its fixed?

eternal oxide
#

to src/main/resources

rain patio
thick gust
#

works fine now exporting, thank you so much @eternal oxide

hasty prawn
#

I'm not going to give you the code again, but I can point you in the right direction. Check the JsonParser class. It has what you need to get the JsonObject back.

rain patio
#

Thank you

rain patio
#

alright, well I figured out how to json parser I think, but how would i get the information from the json object back to the hashmaps and hashsets

thick gust
#
    @EventHandler
    public void onSpawnArmy(PlayerInteractEvent e) {
        Player p = e.getPlayer();

        System.out.println("a0");
        if (WitchCommand.witches.contains(p.getUniqueId().toString())) {
            System.out.println("a1");
            if (e.getAction() == Action.RIGHT_CLICK_AIR) {
                System.out.println("a2");
                if (e.getItem().getType().equals(Material.FLOWER_POT_ITEM)
                        && e.getItem().getItemMeta().getDisplayName().equals("§1Armee, los!")) {
                            System.out.println("a3");
                            for (int s = 0; s < 5; s++) {
                                Entity slime = p.getWorld().spawnEntity(p.getLocation(), EntityType.SLIME);
                                passiveSlimes.add(slime);
                            }
                }
            }
        }
    }

    @EventHandler
    public void onTarget(EntityTargetLivingEntityEvent e) {
        Player p = (Player) e.getTarget();

        System.out.println("0");
        if (passiveSlimes.contains(e.getEntity())) {
            System.out.println("1");
            if(ClassManager.getClass(p).equals(Classes.WITCH)) {
                System.out.println("2");
                e.setCancelled(true);
                e.setTarget(null);
            }
        }
    }

why do the slimes still attack me? xD

young knoll
#

Try another entity

#

Iirc that event is weird with slimes

thick gust
#

lol so there's no way to avoid slimes attack a specific target/player? XD

#

I could use magma slimes but I guess it'll be the same result

young knoll
#

You can make a bug report about it

fierce salmon
rain patio
#

I also could not for the life of me figure out how to use json parser and the json object stuff so I gave up on that

thick gust
#

@young knoll well magma cube also not working

#
    ArrayList<Entity> passiveMinions = new ArrayList<Entity>();

    @EventHandler
    public void onSpawnArmy(PlayerInteractEvent e) {
        Player p = e.getPlayer();

        System.out.println("a0");
        if (WitchCommand.witches.contains(p.getUniqueId().toString())) {
            System.out.println("a1");
            if (e.getAction() == Action.RIGHT_CLICK_AIR) {
                System.out.println("a2");
                if (e.getItem().getType().equals(Material.FLOWER_POT_ITEM)
                        && e.getItem().getItemMeta().getDisplayName().equals("§1Armee, los!")) {
                            System.out.println("a3");
                            for (int s = 0; s < 5; s++) {
                                Zombie zombie = p.getWorld().spawn(p.getLocation(), Zombie.class);
                                zombie.setBaby(true);
                                passiveMinions.add(((Entity) zombie));
                            }
                }
            }
        }
    }

    @EventHandler
    public void onTarget(EntityTargetLivingEntityEvent e) {
        Player p = (Player) e.getTarget();

        System.out.println("0");
        if (e.getEntity().getType().equals(EntityType.ZOMBIE)
            && passiveMinions.contains(e.getEntity())) {
                System.out.println("1");
                if(ClassManager.getClass(p).equals(Classes.WITCH)) {
                    System.out.println("2");
                    e.setCancelled(true);
                    e.setTarget(null);
                }
        }
    }
#

Using baby zombies works.

young knoll
#

Yeah like I said the cube mobs are weird

rain patio
hasty prawn
#

Sorry, use Gson#toJson for that

ancient plank
#

squiggly characters

fierce salmon
young knoll
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

fierce salmon
#

Ok so I expect it to send the player the message "Nice Clutch", remove some blocks, teleport them to a certain area, play a sound, and set their inventory to the first slot being a water bucket, but instead, it just sends the message "Nice Clutch"

sullen marlin
#

wtf is a water bucket clutch

grand otter
#

Im testing out protocollib and I know you have to instantiate the protocol manager in an onEnable function, but it looks kinda messy. Is there a better way to do it?

fierce salmon
#

oh ok

young knoll
#

What’s a mc

fierce salmon
#

Ok that's got to be sarcasm lmao

grand otter
#

Is there anything noticeably wrong with this code?

ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.POSITION) {
            @Override
            public void onPacketReceiving(PacketEvent event) {

                PacketContainer packet = event.getPacket();
                Player player = event.getPlayer();
                player.sendMessage("YOU moved");


            }
        });```
young knoll
#

?di

undone axleBOT
wet breach
#

Well some probably do, its just you are not very likely to see many devs play on popular mc servers or whatever

#

and if they do, they typically use different names or are very lowkey about it

#

I meant in general that there is devs that do play mc

#

I play MC, but I don't play on public servers

river oracle
#

I find MC base so boring

#

and most servers are so annoying and repetative

#

or your just bad :P

wet breach
#

I like to play just almost pure vanilla mc

river oracle
wet breach
#

a couple of QoL plugins and I am good

river oracle
#

its a new strat trust

wet breach
river oracle
#

I like to make farms nd stuff but it takes so long and you never use the resources

wet breach
#

why would I use a mod

#

when I prefer vanilla

river oracle
#

Create is awesome, you should atleast check it out

wet breach
#

sounds like something from BK

river oracle
wet breach
#

close

#

BK is a mod developer

#

and a really good one

#

he had a couple of mods for trains specifically

#

but as far as I know, no one else has come up with a decent trains mod like BK did

#

while I got to see some trains, that video didn't seem particularly about trains

#

considering they were just riding a converor belt the entire time lol

#

that is fine, but that tells me it isn't specifically for trains which is still fine but it just means to me there is a lot that is going to be missing in terms of functionality

#

yeah but now I need an additional mod just for that lol

#

anyways I might check it out, idk. I am still thinking BK had the best mod for trains

#

BK = bergerkiller in case anyone doesn't know

thick gust
#

is there a way to add multiple splash potion effects while they are being thrown?
In this code snippet, I set a main effect twice, but I'm unsure if the weakness effect type just gets overwritten by the slow effect type...

    @EventHandler
    public void onThrown(PotionSplashEvent e) {
        ThrownPotion pot = e.getPotion();
        pot.setGlowing(true);
        pot.setCustomNameVisible(true);
        pot.setCustomName("§2Potionrausch");

        ItemStack potion = ItemBuilder.createItem(Material.SPLASH_POTION, "§2Potionrausch", null, null, 1);
        PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
        potionMeta.setDisplayName("§2Potionrausch");
        potionMeta.setMainEffect(PotionEffectType.WEAKNESS);
        potionMeta.setMainEffect(PotionEffectType.SLOW);
        potion.setItemMeta(potionMeta);

        pot.setItem(potion);
    }
carmine mica
#

Can’t you set other effects?

warm light
#

I have a custom textured skull.
and I want to make it to work on other plugins.
like I want to add the textured skull on DeluxMenu's GUI

how can I make that on my plugins?

#

I am not good at english. idk if I can explain correctly

lavish robin
#

Hello, after adding <classifier>remapped-mojang</classifier> to my pom.xml as detailed here https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/#post-4184317, and running build tools with --remapped (I verified the new jars were created inside the local maven repo) The nms classes are no longer recognized, if I remove the <classifier>remapped-mojang</classifier> tag, it compiles fine, but everything is obfuscated.

thick gust
#

came up with this idea now with a single event, but this error appears, although parameters of the method are met.

weak wasp
#

Thats happening because potions are not entities you can spawn via the world. Try Player.launchProjectile instead

thick gust
#

Why does this event never occur although a splash potion hits an area as described in spigot wiki?

    @EventHandler
    public void onBlockThrows(PlayerInteractEvent e) {
        Player p = e.getPlayer();
        
        if (WitchCommand.witches.contains(p.getUniqueId().toString())) {
            if (e.getAction() == Action.RIGHT_CLICK_BLOCK || e.getAction() == Action.RIGHT_CLICK_AIR) {
                if (e.getItem().getType() == Material.SPLASH_POTION
                        && e.getItem().getItemMeta().getDisplayName().equals("§2Potionrausch")) {
                            e.setCancelled(true);
                            Projectile proj = p.launchProjectile(SplashPotion.class, p.getLocation().getDirection());
                            ((Entity) proj).setCustomNameVisible(true);
                            ((Entity) proj).setCustomName("§2Potionrausch");
                            ((Entity) proj).setGlowing(true);
                            ((Entity) proj).setVelocity(p.getLocation().getDirection());
                            potions.add(proj.getUniqueId().toString());
                }
            }
        }
    }

    @EventHandler
    public void onThrown(PotionSplashEvent e) {
        ThrownPotion pot = e.getEntity();

        System.out.println("pot0");
        if(potions.contains(pot.getUniqueId().toString())) {
            System.out.println("pot1");
            for(Entity ent : e.getAffectedEntities()) {
                System.out.println("pot2");
                PotionEffect slow = new PotionEffect(PotionEffectType.SLOW, 20 * 10, 1);
                PotionEffect slowDig = new PotionEffect(PotionEffectType.SLOW_DIGGING, 20 * 10, 1);
                PotionEffect weakness = new PotionEffect(PotionEffectType.WEAKNESS, 20 * 10, 1);
                Bukkit.getPlayer(ent.getUniqueId()).addPotionEffect(slow);
                Bukkit.getPlayer(ent.getUniqueId()).addPotionEffect(slowDig);
                Bukkit.getPlayer(ent.getUniqueId()).addPotionEffect(slowDig);
                System.out.println("pot3");
            }
            System.out.println("pot4");
        }
        System.out.println("pot5");
    }
wet breach
#

I don't know anything about your list for potions or how it is created or obtained

#

I don't see how the uuid of the thrown potion would be in the list if the entity isn't created until then

thick gust
wet breach
#

that tells me nothing

thick gust
thick gust
wet breach
#

and you are absolutely certain it is in fact in the list?

thick gust
#

even if it wouldn't be in the list, the event doesn't trigger

#

the splash potion gets thrown and the event is registered correctly in the plugins main class.

#

although all the conditions are met, the event does not occur. no console output...
"pot0" never appears as a message in console

weak wasp
#

Potion has the correct name and the player is in your list?

wet breach
weak wasp
#

I would put some debug code after your if statements. For example player is contained within witchcommands, action is right click, display name matches then you can see which if statement is stopping the event from triggering.

#

If it doesn't even get that far its got to be something with your registered event listener

#

Hmm maybe throwing a potion is not a right click action?

lavish robin
wet breach
#

since its as if it didn't

wet breach
#

there is another post in that post you need to read as well

#

odds are you didn't generate the remapped jar for your pom to use

#

well after reading seems you did, are you using the correct one ?

lavish robin
lavish robin
#

I will look for a longer log.

wet breach
#

using intelliJ?

lavish robin
#

Copyed the code from the ?nms link.

wet breach
#

have you tried clearing caches?

#

typically something you need to do every once in a while with intellij

lavish robin
#

Will try that.

normal thicket
#

yo guys just wanted to try out making plugins I downloaded mcdev on intelliJ but it show this any idea?

#

is it even neccesary?

#

or I can just go with Maven

jagged bobcat
#

Maven works or gradle even server jar

normal thicket
#

ok

thick gust
wet breach
thick gust
#
Players:
  Hunter:
  - 791cace2-edf9-4fdd-b498-6978bda9401f
  Priests: []
  Tanks: []
  Warriors: []
  Witches: []
  Mages: []
    public static boolean hasClass(Player player) {
        /*return TankCommand.tanks.contains(player.getUniqueId().toString())
                || WarriorCommand.warriors.contains(player.getUniqueId().toString())
                || MageCommand.mages.contains(player.getUniqueId().toString())
                || WitchCommand.witches.contains(player.getUniqueId().toString())
                || PriestCommand.priests.contains(player.getUniqueId().toString())
                || HunterCommand.hunter.contains(player.getUniqueId().toString());*/

        return playersCfg.getStringList("Players.Tanks").contains(player.getUniqueId().toString())
                || playersCfg.getStringList("Players.Warriors").contains(player.getUniqueId().toString())
                || playersCfg.getStringList("Players.Mages").contains(player.getUniqueId().toString())
                || playersCfg.getStringList("Players.Witches").contains(player.getUniqueId().toString())
                || playersCfg.getStringList("Players.Priests").contains(player.getUniqueId().toString())
                || playersCfg.getStringList("Players.Hunter").contains(player.getUniqueId().toString());
    }

hasClass strangely always returns false, even when trying "Hunter".
The code snippet which is in comment segment didn't work either to check.

agile hollow
thick gust
echo basalt
#

Instead of having a bunch of collections

#

Let's rewrite it as such

#

Start by creating a Role / Class enum

#
public enum Role {
  TANK,
  WARRIOR,
  MAGE,
  WITCH,
  PRIEST,
  HUNTER;
}
#

And then instead of having a collection for each role, we use a map

#
private final Map<UUID, Role> roleMap = new HashMap<>();

public Role getRole(UUID playerId) {
  return roleMap.get(playerId);
}

public void setRole(UUID playerId, Role role) {
  roleMap.put(playerId, role);
}

public boolean hasRole(UUID playerId) {
  return roleMap.containsKey(playerId);
}

public Collection<? extends Player> getAllPlayers(Role role) {
  Set<Player> players = new HashSet<>();

  for(Map.Entry<UUID, Role> entry : roleMap.entrySet()) {
    UUID playerId = entry.getKey();
    Role playerRole = entry.getValue();

    if(role != playerRole) {
      continue;
    }

    Player player = Bukkit.getPlayer(playerId); 

    if(player == null) { // Make sure you remove players onQuit
      continue;
    }

    players.add(player);
  }

  return players;
}
#

feel free to make methods for the player too that just call getUniqueId

#

On your methods you could do something like

#
if(getRole(playerId) != MAGE) { // We only want to run this for mages
  return;
}
#

For saving, the most obvious approach would be <playerid>: <role>

#

but you can do like a uhh

#

reverse map where you have a Map<Role, List<UUID>> for saving but seems like a waste of performance

#

and that's pretty much it

small holly
#

Hey this is gonna be quite the odd question

#

I have added Lua support for my plugin for custom mob mask effects and I need a way to spawn an entity with custom pathfinder goals (I have used the build tools to get access to nms in my plugin but I can't seem to access it in lua)

normal thicket
#

guys stupid question what archetype should I choose for plugin development?

#

in intellJ

small holly
#

I know I can do it in Java and call the method from Lua but I need the pathfinder goals to be able to be edited in the lua script

#

because if the Lua had access to it then Id be able to do CraftWorld.cast(world)

wet breach
#

not sure if it has one for graddle

#

but if it does and prefer gradle choose that instead

thick gust
# echo basalt ```java public enum Role { TANK, WARRIOR, MAGE, WITCH, PRIEST, HUNTE...

Already got such an enum:

public enum Classes {
    TANK("Tank", "§8Tank", "Stecke so gut wie alles weg, was dir zugefügt wird!", 1, new ItemStack(Material.SHIELD)),
    WARRIOR("Warrior", "§7Warrior", "Stürze dich mit deiner Geschicklichkeit in gewagte Schlachten!", 2, new ItemStack(Material.STONE_SWORD)),
    MAGE("Mage", "§1Mage", "Verursache gewaltigen Schaden und bekomme die Oberhand!", 2, new ItemStack(Material.GOLDEN_CARROT)),
    WITCH("Witch", "§dWitch", "Mittels alten Zaubern gehen dir deine Tränke nie leer!", 2, new ItemStack(Material.POTION)),
    PRIEST("Priest", "§4Priest", "Lehre deine Verbündeten SAFE zu spielen!", 3, new ItemStack(Material.INK_SACK, 1, (short) 1)),
    HUNTER("Hunter", "§2Hunter", "Schleiche als Meister der Schützen herum!", 2, new ItemStack(Material.BOW));

        // Rest of class (private vars, constructors, etc.)...
}
echo basalt
#

Yeah so just

#

use a map

thick gust
echo basalt
#

no clue but it's a bad idea regardless

#

and adding more classes just means you'll have more lists to check

#

so I'll stop you right there

thick gust
#

lol

grim oak
#

Hi what would be the best way to store the my data with SQL. I have users and each user can do ‘quests’ and I want to store the xp of all of the quests, should I just store it like uuid quest1_xp quest2_xp …
Considering there may be 50+ quests eventually, or is there a better method i could use (I’d like to use SQL for storing my data)

hazy parrot
#

Do you need to access xp of offline players?

#

Also does quests have additional info?

echo basalt
#

have a table for each quest

#

and assign each quest an id

#

then a table where it's like

#

<playerid> | <questid> | progress

thick gust
#

already tried googling this, but no success. how to make a snowball invisible (perhaps with some packets)?

#
    public void shootParticlev2(Player player, EntityEffect entityEffect) {
        Location location = player.getEyeLocation();
        Vector direction = location.getDirection();
        Snowball snowball = player.launchProjectile(Snowball.class, direction);
        snowball.playEffect(entityEffect);
        snowball.setShooter(player);
        snowball.setSilent(true);
        snowball.setBounce(false);
    }
echo basalt
#

player.hideEntity is a thing

#

in older versions you can just send a single packet, yeah

thick gust
#

There's only a hidePlayer() function.

echo basalt
#

maybe hideEntity is a paper thing and I'm stupid

thick gust
#

Snowball != Player 😉

echo basalt
#

do you not have eyes

thick gust
livid atlas
#

hi guys, i'm getting a "Cannot resolve symbol" error on FieldUtils here? Pretty sure this has something to do with the protocollib stuff, no idea what the cause is or anything.. this all happens near but not at the top of the file :P

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.events.PacketListener;
import com.comphenix.protocol.injector.BukkitUnwrapper;
import com.comphenix.protocol.injector.PacketConstructor;
import com.comphenix.protocol.reflect.FieldAccessException;
import com.comphenix.protocol.reflect.FieldUtils; //here is the line with the error
import com.comphenix.protocol.reflect.FuzzyReflection;
#

protcol lib is in the dependencies and whatnot

echo basalt
#

probably a util that's no longer there?

livid atlas
#

wdym

#

like it doesn't exist in protocol lib anymore?

#

or?

echo basalt
#

probably

livid atlas
#

huh

#

well

#

now what...

hazy parrot
#

just access fields using standard reflection ig

livid atlas
#

the only time it's used is like

#

once

hazy parrot
thick gust
#

How can I check if a snowball reached ground respectively gone?
I tried this but it doesn't work at all:

    public void shootParticlev2(Player player, Particle particle) {
        Location location = player.getEyeLocation();
        Vector direction = location.getDirection();
        Snowball snowball = player.launchProjectile(Snowball.class, direction);
        int taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(Rpg.getInstance(), new BukkitRunnable() {
            @Override
            public void run() {
                //player.getWorld().spawnParticle(particle, snowball.getLocation(), 1);
                player.playEffect(snowball.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
                Location snowballLocation = snowball.getLocation().subtract(0, 1, 0);
                if(snowball.isDead() || !snowball.isValid() || snowball.isOnGround()
                    || snowballLocation.getBlock().getType() != Material.AIR) {
                        snowball.remove();
                        this.cancel();
                }
            }
        }, 1, 1);
        snowball.setShooter(player);
        snowball.setSilent(true);
        snowball.setBounce(false);
        PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(snowball.getEntityId());
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
    }
echo basalt
#

ProjectileHitEvent

grim hound
#

How can I get a custom player head knowing the skull id?

ocean hollow
#

chatGPT gave me that method, but it doesn`t work. I changed "+" to "-", and i want it to rotate the other way. regardless of +, - it spins in one direction

ocean hollow
#

4.5

grim hound
#

it spins in one dir regardless of '+' & '-'?

ocean hollow
#

yeah

grim hound
#

then try getting the location, setting the yaw and teleporting

#

like this

#
        Location loc = armorStand.getLocation();
        loc.setYaw(loc.getYaw() + degrees);
        armorStand.teleport(loc);
#

if this doesn't work, something else it interrupting

ocean hollow
grim hound
#

How can I get a custom head (an ItemStack variable) knowing the skull id?

hard lion
#

How can I get the original block that was changed by a Falling Block in EntityChangeBlockEvent?

mild tundra
#

Hey can someone help me making a plugin for a server

grim hound
grim hound
mild tundra
#

shall i send it here on DMS?

grim hound
hard lion
#

though the event shoud fire before the block turns into the other one

grim hound
#

what do you exactly mean by changed by a Falling Block?

#

Like grass getting replaced or smthg?

hard lion
grim hound
#

Then I dunno

#

getBlock() should be the from block, and getTo() should be the changing to material

hard lion
#

i'll see what happens

glossy venture
#

would this be faster than doing pos / 8?

calm robin
#

how can i find the cardinal direction a player is facing? im currently trying to use player.getEyeLocation().getDirection and splitting that vector into its x and z components. issue is that it only gives me -1, 0, or 1 in the x and z components and its impossible to determine which direction they are facing

glossy venture
#

217,340,386 moves generated per sec

#

ez

glossy venture
#

which would apply to player too

calm robin
#

thanks

eternal oxide
#

getFacing is only for Entities which are Directional, not Players

eternal oxide
#

it is not an x,y,z location, it's a unit vector

calm robin
#

ive got a thing that parses x and z and finds cardinal from there

eternal oxide
#

parses x and z?

calm robin
#

gets x and z from that vector then if abs(x) > abs(z) and x positive its north

eternal oxide
#

do you mean you want to know if the player is facing more North than East?

calm robin
#

or whatever

#

like

#

i need the block on the ground next to them in the direction they are facing

glossy venture
#

its in the Entity class

eternal oxide
glossy venture
#

so i assume it works for any entity

calm robin
#

well its working for me now

glossy venture
#

the getFacing?

#

or your own math

calm robin
#

all of it

glossy venture
#

lmao aight nice

calm robin
#

im getting what i need

eternal oxide
#
loc = player.getLocation();
direction = loc.getDirection();
block = loc.add(direction).getRelative(BlockFace.DOWN);```
#

that is going to work on Player location, if you want to use EyeLocation you need to setY(0), then .normalize() to make it a unit vector again

eternal oxide
#

I've never even seen that method 🙂

#

other than for things like Hanging

glossy venture
#

its in Directional block data too

eternal oxide
#

Yep, thats where I've used it before

tardy delta
glossy venture
#

speed

eternal oxide
#

unless you are doing millions of calculations per tick

glossy venture
tardy delta
#

hardware is fast and i dont think bitwise operations will do much of a dif

glossy venture
#

nah this is for a chess engine

tardy delta
#

how are you measuring?

glossy venture
#

running shit a lot

#

looking at passes

tardy delta
#

ideally should run a benchmark cuz just running smth and measuring the elapsed time is inaccurate

#

like gc starting takes away some ms

glossy venture
#

isnt a benchmark running shit a lot and measuring the elapsed time

#

and i think / 8 is basically as fast as the bitwise shit but just to be sure ill use bitwise

#

because maybe on other platforms division is slow

tardy delta
#

🤷‍♂️

glossy venture
#

or smth

tardy delta
#

lmao

glossy venture
#

i left in debug

tardy delta
#

well ye they are true about the branch prediction misses

glossy venture
#

now its crashed my gralde daemon

young knoll
#

Is this the new stockfish

tardy delta
#

gradle 💀

glossy venture
tardy delta
#

imagine not knowing how to chess but making a chess game 💀

glossy venture
#

i play chess

#

im bad

#

but i do play it

tardy delta
#

ye just imagine it

pseudo hazel
#

any decent compiler will optimize divisions or multiplications with powers of 2 to bitshifting anyways, there is no need to outsmart the compiler

glossy venture
#

yoooo 10,000,000 passes/sec

tardy delta
#

also depends on what the cpu is doing

#

i used to do the same crazy optimisations to my math parser and its nuts

pseudo hazel
#

yes, testing these kinds of things will 9/10 times be useless or lead to incorrect results

hazy parrot
pseudo hazel
#

probably, thats what I was saying

hazy parrot
#

smh, was scrolled up again

pseudo hazel
#

i would be surprised if it didnt

glossy venture
#

sucks java doesnt have forced inline

tardy delta
#

@ForceInline buts thats jvm internals

#

unfortunatly

glossy venture
#

yeah

#

also got 10.2 mil passes/sec

#

array access really slow

tardy delta
#

you storing objects in an array?

glossy venture
#

the board

#

as an array of bytes

echo basalt
#

why not a couple longs?

glossy venture
#

probably slower

echo basalt
#

look at you brute-forcing stuff

glossy venture
#

first get the applicable long, then do 500 bitshifts

glossy venture
#

thats how chess computers work

pseudo hazel
#

if you want to be super optimized, java is probably not the language you would choose anyways

echo basalt
#

well

glossy venture
#

nah true id rather use C++ but i made an attempt and got a couple segfaults so im never doing that again

echo basalt
#

there's still the concept of weighting

glossy venture
#

yeah thats for the evaluation

ivory sleet
#

rust :D

glossy venture
#

you search till a certain depth

#

and then you evaluate the position

#

with weights

tardy delta
ivory sleet
#

yea sadly

glossy venture
#

but if you dont brute force a couple positions you cant find tactics

tardy delta
#

the moment i say the word rust people already start attacking me

pseudo hazel
#

why, rust is fine

echo basalt
#

sure but there are still a huge amount of moves that are just plain bad

ivory sleet
#

o

#

why is my 🥲 yellow

glossy venture
tardy delta
#

discord their fancy reactions ig

ivory sleet
#

ohhh

#

wtf

pseudo hazel
#

lmao you used a super reaction

glossy venture
#

which try to exclude those moves as efficiently as possible

pseudo hazel
#

rip

tardy delta
#

just write raw x86 :)

ivory sleet
tardy delta
#

month ago?

#

maybe

ivory sleet
#

oh im just becoming a boomer then :<, thought it was a recent patch

pseudo hazel
#

longer than a month

#

but you only get like a few super reactions per week or some shit

tardy delta
#

whatever i dont have access to it anyways 💀

#

goddamn discord

pseudo hazel
#

why not?

tardy delta
#

nitro?

pseudo hazel
#

I thought you just get some every week

tardy delta
ivory sleet
#

ah I ran out of them now

pseudo hazel
#

oh I see

tardy delta
#

just wasted all of them 💀

pseudo hazel
#

lmao time to delete my message

tardy delta
#

atleast those bastards made stickers public

ivory sleet
#

fr

echo basalt
quiet ice
glossy venture
#

yeah true

#

but i didnt understand how to set up jmh

#

and this seems to work kind of fine

#

dont think a NOP would take 89 ns to execute

coarse galleon
#

I am building spigot using build tools. how can I embed external library into the spigot jar itself?

quiet ice
chrome beacon
quiet ice
#

Furthermore some JIT optimisations don't take effect if the application stays in the method

coarse galleon
quiet ice
#

What exactly do you hope to accomplish by adding the library?

#

Chances are there are better ways to do what you want

#

However if you are absolutely sure that adding a lib is the correct way it probably is as simple as changing the pom.xml of the cb maven project

coarse galleon
#

what's the process of doing that? I just finished running the build tool with default settings

#

I also have some patch files I would like to apply

chrome beacon
#

?contribute

chrome beacon
#

^^ follow this without the CLA part

quiet ice
#

Yep

coarse galleon
#

Thanks

#

How do I add a library at a specific path like: org.bukkit.craftbukkit.libs.com.google.common.base.Optional?

quiet ice
#

By configuring relocations in the Shading plugin

coarse galleon
quiet ice
#

You'd need to look at the documentation, but I'd guess mvn clean install should do the trick

coarse galleon
#

tbh I am completely new to mvn and I am just trying to get a pre-compiled plugin to work. I checked the output which is Installing D:\BuildTools\Spigot\Spigot-Server\target\spigot-1.8.8-R0.1-SNAPSHOT.jar to C:\Users\Administrator\.m2\repository\org\spigotmc\spigot\1.8.8-R0.1-SNAPSHOT\spigot-1.8.8-R0.1-SNAPSHOT.jar but it doesn't contain the thing.

quiet ice
#

I am just trying to get a pre-compiled plugin to work
I sense that you accidentally picked the hard way

chrome beacon
#

Yeah

coarse galleon
#

what would be the easier way?

chrome beacon
#

You should have told us that earlier

#

Modify the plugin

coarse galleon
#

I can't

#

it's pre-compiled

chrome beacon
#

You can still modify it

coarse galleon
#

how

chrome beacon
#

Is the plugin even designed to run on 1.8.8

coarse galleon
#

yes

quiet ice
chrome beacon
#

If it's just missing a dependency you can make your own plugin providing it

quiet ice
#

Better question would be whether the the plugin is even designed to run on 1.8.8 SPIGOT

chrome beacon
#

No need to modify anything

coarse galleon
#

yes, it is designed to run on spigot

quiet ice
#

Then that plugin has a serious bug

#

I guess alternatively one could write a small .tiny file to remap everything from using org.bukkit.craftbukkit.libs.com.google to using com.google instead

quaint tapir
#

I want to make a skeleton walk in a straight line
I've done setAI(false) but I don't know how to make it manually walk in a set direction for a set amount of time
any help would be great

coarse galleon
#

you may want a custom path finder to make it walk to a specific point?

quiet ice
#

Source code of the generator:

import java.io.*;
import java.nio.file.*;
import java.util.jar.*;

public class TinyGenerator {

    public static void main(String[] args) throws IOException {
        try (BufferedWriter bw = Files.newBufferedWriter(Paths.get("gson.tiny"))) {
            bw.write("v1        official    named");
            try (JarInputStream jis = new JarInputStream(Files.newInputStream(Paths.get("bukkit-1.8.8-R0.1-20160221.082532-43-shaded.jar")))) {
                for (JarEntry e = jis.getNextJarEntry(); e != null; e = jis.getNextJarEntry()) {
                    System.out.println(e.getName());
                    if (e.getName().startsWith("com/google") && !e.isDirectory()) {
                        String name = e.getName().substring(0, e.getName().length() - ".class".length());
                        bw.write("\nCLASS " + "org/bukkit/craftbukkit/libs/" + name + " " + name);
                    }
                }
            }
            bw.write("\n");
        }
    }
}
grave kayak
#

I'm making a plugin with a series of GUI's. there are a number of listener classes with e.setcancelled(true) in them to stop items being moved around. but now only the first couple of classes I'm registering are actually working the rest I am able to move items around in. is there a way around this, thanks

eternal oxide
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

eternal oxide
#

?paste

undone axleBOT
eternal oxide
#

First mistake, do not compare inventories by name

grave kayak
tardy delta
eternal oxide
#

compare inventories by instance

#

if (clickedInventory == yourInventory)

#

also do not close an inventory you are currently in the event for. use the scheduler to close it one tick later

#

?scheduling

undone axleBOT
grim oak
grave kayak
eternal oxide
#

probably because you are not correctly matching the inventory

#

It won;t cancel if you try to match by name and fail

grim oak
small current
#

What is the event for frost walker

quiet ice
#

BlockFormEvent?

small current
#

I will test it

#

Because in spigot it said blockcanbuild

worldly ingot
#

It would be a form event, yeah

small current
#

And i cant get the player in blockformevent

small current
#

Thanks

grim oak
#

Hi can anyone help with how I should structure my database.
I have users that can do quests, and each of the quests have several requirements and I've represented the requirements as an integer which is just their 'completion' towards the requirement. So how would I store the quest for each user, whether they have the quest activated and their completion towards the requirements of the quests.

#

Im using SQL btw

worldly ingot
#

Just a simple table there should work fine, no?

CREATE TABLE IF NOT EXISTS player_quests (
    id          INT UNSIGNED    NOT NULL AUTO_INCREMENT,
    uuid        CHAR(36)        NOT NULL,
    quest_id    VARCHAR(64)     NOT NULL,
    progress    SMALLINT        NOT NULL,
    UNIQUE INDEX player_quest(uuid, quest_id),
    PRIMARY KEY (id)
);
tardy delta
#

im thinking that most people that use sql dont need it because of the relational part they dont need

young knoll
#

Boo storing uuid as a char

worldly ingot
#

Depending on how complex your questing system, you can absolutely make it relational

grim oak
tardy delta
#

create a dif table for the progress

#

then link it to the quest

worldly ingot
#

Yeah, separate table with a foreign key to the player_quests table

tardy delta
#

probably also a requirements table or smth but idk what you would put in there

#

what does UNIQUE INDEX even do, that some kind of weird sql dialect?

worldly ingot
#

It ensures that the combination of those two columns are unique

#

e.g. you can have (uuid1, "first") and (uuid1, "second"), but not two (uuid1, "first")s

tardy delta
#

what the index for, arent indices created automatically on unique columns? 👀

worldly ingot
#

Yeah but you don't want uuid and quest_id to be unique independently

#

Else a player wouldn't be able to have more than one quest active

young knoll
#

I thought you could just do UNIQUE

worldly ingot
#

Possible design could look something like this:

CREATE TABLE IF NOT EXISTS player_quests (
    id          INT UNSIGNED    NOT NULL AUTO_INCREMENT,
    uuid        CHAR(36)        NOT NULL,
    quest_id    VARCHAR(64)     NOT NULL,
    UNIQUE INDEX player_quest(uuid, quest_id),
    PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS quest_progress (
    quest_id    INT UNSIGNED         NOT NULL,
    progress    SMALLINT UNSIGNED    NOT NULL,
    -- Optionally include a category for the type of progress to be made?
    FOREIGN KEY (quest_id) REFERENCES player_quests(id)
);```
#

Maybe an "active" BIT column as well (or BOOLEAN, which is an alias)

quiet ice
#

Let's just ignore that primary keys cannot be null anyways

worldly ingot
#

Habbit

#

I like the explicitness of it

#

monkaS For what?

quiet ice
#

No. It is 90% the wrong way

#

If needed use different event listener instances for different events

#

But don't use a constructor to store all your logic

worldly ingot
#
public final class MyPlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(new MyListener(), this);
    }

}

public final class MyListener implements Listener {

    @EventHandler
    private void onChat(AsyncPlayerChatEvent event) { }

}```
quiet ice
#

I mean it probably works, but you don't want to do that

grim oak
tardy delta
#

whats confusing about it?

grim oak
#

Well a quest could have multiple different progresses

#

Varies depending on the quest

tardy delta
#

different progresses per quest for one player?

grim oak
#

So they might have to kill 10 players and break 20 blocks for example

#

For a single quest

quiet ice
#

then you'd need to have another table for that

tardy delta
#

im thinking that you could just create another quest progress record but im not really thinking straight now

quiet ice
#

Or just add a progress_type column or something

grim oak
#

?

worldly ingot
#

The most recent schema I sent has two tables

#

You would be able to create two entries in the progress table that refer to one quest table entry

quaint mantle
#

how can i cancel cactus growth ?

    @EventHandler
    public void cropGrowth(BlockGrowEvent e) {
        if (e.getNewState().getType() == Material.CACTUS) {
            e.getNewState().setType(Material.AIR);
            e.setCancelled(true);

        }
    }``` this not working
grim oak
quiet ice
grim oak
#

I see what choco sent, that should work

quiet ice
#

But uh, you can just add that to the quest_progress table

quaint mantle
quiet ice
#

Basically your constructor invocation

quaint mantle
young knoll
#

Probably the wrong event

#

Ah no it is that event

#

I thought it was different for cactus and sugarcane my bad

quaint mantle
#
            e.setCancelled(true);

        }```
#

i try this too

#

and i try cancel the age growth btw

eternal oxide
#

do nto call getBlock on getNewState

#

you are just getting the current block

eternal oxide
#

why set the newState to AIR and then cancel? you are undoing what you just did

quaint mantle
#

i did only with e.cancelevent

young knoll
#

There’s no reason to set the new state

#

Just cancel

eternal oxide
#

a BlockState is a snapshot of what the block was or is to be.

quaint mantle
#

actuyally i cancel the all block growth event

#

still growing

#

😄

eternal oxide
#

if you make changes to teh BlockState then cancel the BlockState will never be used

young knoll
#

Did you register your event

#

Add debug prints

quaint mantle
#

i forgot the register events

#

OMG

#

CYA

#

wtf

#

im stupid 😢

rain patio
grim oak
# worldly ingot Possible design could look something like this: ```sql CREATE TABLE IF NOT EXIST...

So if the quests have a type, should i do:

CREATE TABLE IF NOT EXISTS player_quest_types (
    id          INT UNSIGNED    NOT NULL AUTO_INCREMENT,
    uuid        CHAR(36)        NOT NULL,
    quest_type_id  VARCHAR(64)     NOT NULL,
    UNIQUE INDEX player_quest(uuid, quest_type_id),
    PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS quests (
    quest_type_id  VARCHAR(64)     NOT NULL,
    quest_id    VARCHAR(64)     NOT NULL,
    active      BIT             NOT NULL
    PRIMARY KEY (quest_id)
    FOREIGN KEY (quest_type_id) REFERENCES player_quest_types(id)
);

CREATE TABLE IF NOT EXISTS quest_progress (
    quest_id    INT UNSIGNED         NOT NULL,
    progress    SMALLINT UNSIGNED    NOT NULL,
    FOREIGN KEY (quest_id) REFERENCES quests(id)
);

or

CREATE TABLE IF NOT EXISTS player_quests (
    id          INT UNSIGNED    NOT NULL AUTO_INCREMENT,
    uuid        CHAR(36)        NOT NULL,
    quest_id    VARCHAR(64)     NOT NULL,
    quest_type  VARCHAR(64)     NOT NULL,
    UNIQUE INDEX player_quest(uuid, quest_id),
    PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS quest_progress (
    quest_id    INT UNSIGNED         NOT NULL,
    progress    SMALLINT UNSIGNED    NOT NULL,
    FOREIGN KEY (quest_id) REFERENCES player_quests(id)
);

Or something else?

worldly ingot
#

Well what does a quest type do?

#

Also, probably do want a progress_type column in the quest_progress table to distinguish which progress is for which

grim oak
#

Well some quests will be 'levellable' but some youll just be able to do once, for example

worldly ingot
#

Do you need that stored persistently though?

#

That should just be something available in the Quest object in code, no?

grim oak
#

Yeah, but how would I store what level the quest is on

rain patio
#

Hello, I am trying to write some data from hashmaps and hashsets to a json file, and the methods I have write fine, but the load method somehow wipes the file and gives me a whole malformed json error and disables my plugin, so can anyone point me towards a good resource to figure it out, or help me code the method? I'll provide a ss of my code

worldly ingot
#

Given that not all quests are levelable, perhaps an additional table

grim oak
#

Okay

worldly ingot
#
CREATE TABLE IF NOT EXISTS quest_level (
    quest_id    INT UNSIGNED         NOT NULL,
    level       SMALLINT UNSIGNED    NOT NULL,
    FOREIGN KEY (quest_id) REFERENCES player_quests(id)
);
#

Should be easy enough to do this

grim oak
#

Ty

remote swallow
#

Small int

worldly ingot
#

Yeah, equivalent of a Java short. -32k to 32k

#

Unsigned gives you ~65k

remote swallow
#

Sus

worldly ingot
#

I can't possibly imagine a level being higher than that

young knoll
#

Not with that attitude!

worldly ingot
#

If, however, it can go higher than 65k, you can use a regular unsigned int to give a little over 4 billion

remote swallow
#

My in game level is the int limot

grim oak
#

Okay thats all for now tysm choco

worldly ingot
#

If you want to pull all of this data in a single query (which you can do!), you'll want to look into JOINs

young knoll
#

I never use smaller data types in my code

#

Maube I should

worldly ingot
#

In SQL is especially important because you're storing potentially millions of entries and for each entry, you're including 2x the amount of bytes for each entry

#

At least for a SMALLINT vs an INT

#

It's the difference between 2 million bytes and 4 million bytes for the exact same data

young knoll
#

Yeah

#

I guess it matters less in code

worldly ingot
#

(granted that's 2MB vs 4MB, but still important lol)

#

In a garbage collecting language like Java it's less important, yeah. Still nice to restrict the scope of your integer values where obviously necessary, but yeah...

remote swallow
#

Im now only ever gonna use bigint

rain patio
worldly ingot
tardy delta
#

oh man dont create five new gson objects

#

their constructor is hell

worldly ingot
#

That's why people create static instances of them that they re-reference KEKW

young knoll
#

I'm currently tracking an index with an int even though a byte is probably plenty

#

Now my plugin is gonna OOM servers

tardy delta
#

also that code is full of deprecated stuff

rain patio
#

I'm really new to the minecraft side of java I've never used gson or anything

young knoll
#

The problem with smaller types in java is that you have to be explicit with them

rain patio
echo basalt
#

watch me delete 12k duplicates of the same image because some ps3 game developer back in '08 decided it was good idea to put a default image with every save

echo basalt
#

?code

#

!code

#

idfk

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
echo basalt
#

that

rain patio
#

thank you

young knoll
#
SELECT * FROM yourmom
#

Okay yeah SQL is the right name

rain patio
#
public void saveData(Map<UUID, ChatColor> primaryRoleplayColors, Map<UUID, ChatColor> secondaryRoleplayColors, Set<UUID> localChatPlayers, Set<UUID> staffChat) throws IOException {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        File file = new File(RPChat.getPlugin(this).getDataFolder().getAbsolutePath() + "/data.json");
        FileWriter writer = new FileWriter(file, false);
        gson.toJson(primaryRoleplayColors, writer);
        gson.toJson(secondaryRoleplayColors, writer);
        gson.toJson(localChatPlayers, writer);
        gson.toJson(staffChat, writer);
        writer.flush();
        writer.close();
    }

This is what I have that I feel like is better than making json objects and does work to save to a json file, but my problem is whenever I try to use a load method of any sort, it clears the json file and then gives me a malformed json error

echo basalt
#

instead of passing all these params

#

What's stopping you from doing a

#
public class PlayerData {

  private final UUID playerId;
  
  private ChatColor primaryColor;
  private ChatColor secondaryColor;

  private boolean staffChat;
  private boolean localChat;
}
#

couple setters

#

constructor n all

rain patio
#

I've got them set and declared up top, but they're all private

echo basalt
#

yeah but like

#

why so many maps

rain patio
#

Lowkey was just like following youtube tutorials and going off of what worked, this is my first like functioning plugin cause it works fine before the saving of the data

young knoll
#

Can't Gson just like

#

Handle POJO's automagically

echo basalt
#

yeah

#

it can

rain patio
#

It saves just fine, I don't know how to get it to the read the file

tall furnace
#

I'm setting up a scoreboard display under each player's name. Only issue is the score integer value is displayed as white, and always displayed first. As I understand it, it will always be displayed before the objective name, but can I at least change the color of the score?

rain patio
echo basalt
#

I should probably write a search index entry for uhh

#

data objects

#

lma

young knoll
#

An ImIllusion smearch smindex

echo basalt
#

yeah

#

but it's so basic that like

#

I don't think it's worth it being up there

young knoll
#

Get alex to make a blog on it

young knoll
#

Afaik you can't change the score color

#

Without core shader magic

lavish robin
robust pebble
#

Error occurred while enabling DeathClock v1.0.1 (Is it up to date?)

how do I fix this?

young knoll
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

robust pebble
#

?paste Error occurred while enabling DeathClock v1.0.1 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
at me.creepinson.plugin.Main.onEnable(Main.java:73) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugin(CraftServer.java:534) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugins(CraftServer.java:448) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:589) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:414) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:250) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3744-Spigot-d1bd3bd-a7cfc77]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:106) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at me.creepinson.plugin.listener.PlayerJoined.<clinit>(PlayerJoined.java:25) ~[?:?]

undone axleBOT
quaint mantle
#

Hi ppl can u guys help me?

hybrid spoke
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

quaint mantle
#

bruh ik

#

and it wasnt a question

young knoll
#

You are trying to make a namespaced key with a null plugin

quaint mantle
#

im making a plugin for my server, its basically so; a player does /call and the ppl who have "operator" permission gets "player" is calling, its like a telephone switchboard, u cant use /msg directly but through /call u can, but the operator will need to connect u

#

can u guys check the code? thx

robust pebble
#

oh

quaint mantle
#

?paste

undone axleBOT
quaint mantle
hybrid spoke
#

bro just AI generated his whole class

quaint mantle
#

yea thats why i ask

#

and also an extension thing

#

does it look legit?

hybrid spoke
#

wont help with that

#

ask chatgpt

quaint mantle
#

bruh

quaint mantle
hybrid spoke
#

start coding by yourself

robust pebble
young knoll
#

Maake sure the plugin instance is not null

robust pebble
#

ok thanks