#help-development

1 messages · Page 1803 of 1

drowsy helm
#

lol dont apologise

unreal quartz
#

i doubt there is an easy way

sullen marlin
#

pretty impossible I think

#

I mean you could probably check if theyre in water

#

but idk, what are you trying to do actually

quaint mantle
#

definitely possible to do but you'd be editing the server jar to accomplish this properly

#

can prob do some halfassed way by checking for specific blocks/entities around them

#

actually I guess even water movement wouldn't work nicely with server jar

#

forgot all movement is clientside 🙂 working on diff games is weird

smoky oak
#

how do i get the plugin via the plugin manager again?

sullen marlin
#

getPlugin ?

quasi flint
sinful matrix
#

How can i build my Plugin with Maven, I only know the variant with build -> artifacts

smoky oak
#

i meant the full code line... i cant access spigotmc atm

#

okay correction of my question

#

how do i do getServer() in a static method

vital sail
#

how i add java codes to server

ivory sleet
rough basin
#

Is it possible to extend an existing vanilla mob and call it from within code before spawning the entity?
I just want to spawn a husk that remember Who spawned it :(

ivory sleet
#

Believe spawnEntity method takes a callback which runs before the entity actually gets spawned

sinful matrix
#

I don't know that much about maven :D

ivory sleet
#

Terminal presumably or if you use the ui intellij offers

blazing scarab
#

there should be a maven interface on the left side

sinful matrix
#

This is what I see

blazing scarab
#

ui i mean

karmic grove
#

so i want to make only a certain item drop when i mine a block i know if it was an entity its event.getDrops().clear(); but idk what blocks are on blockbreak event

karmic grove
#

.clear

#

right

smoky oak
#

thats intellij. click on the top right part to the right of the hammer symbol

#

then edit config

sinful matrix
smoky oak
#

then the first option to add should be maven

karmic grove
smoky oak
#

you need to cancel the event

sinful matrix
smoky oak
#

yes, but add the arguments to the command line

#

ie

#

clean

blazing scarab
hybrid spoke
karmic grove
#

ok

#

i think i got it working now

#

nvm didnt work

#

event.getBlock().getDrops().clear(); i did that

#

and it changed nothing

hybrid spoke
#

more context please

#

what event?

karmic grove
#

BlockBreakEvent

#

then

#
if(material.equals(material.GRASS_BLOCK)) {
            event.getBlock().getDrops().clear();
            block.getLocation().getWorld().dropItem(block.getLocation(), new ItemStack(material.DIAMOND));

        }```
sinful matrix
smoky oak
#

try deploying

#

you wont know until you do and your ui is a bit different than mine

sinful matrix
hybrid spoke
smoky oak
#

hit run

sinful matrix
sinful matrix
hybrid spoke
quaint mantle
#

if(material == material.GRASS_BLOCK)

smoky oak
#

i do clean verify and it still works... question, do you already have any methods/a plugin.yml? Because iirc compiling an empty project returns nothing

karmic grove
smoky oak
#

for me the result ends up in the target folder so i am unsure why it wouldnt work for you

karmic grove
#

you have to do it in the artifact

hybrid spoke
#

not on an enum

#

even the JLS recommends to use == on enums

sinful matrix
#

It returns this error if I build the project

quasi flint
#

wrong language level

#

lang level 7

#

2 line of error says it all

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

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

shove that into your pom.xml

quasi flint
#

mnom

smoky oak
#

could be the start of the file tho

<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">
quasi flint
#

i dont know how u got so many errors

#

with just basic maven

#

intellij mod dev plugin has templates for that

hybrid spoke
#

its the phenomenon of doing something for the first time

quasi flint
#

i thonk

quasi flint
#

ironie here btw

hybrid spoke
#

bad irony

quaint mantle
#

Ye maven can be confusing sometimes.

quasi flint
#

:c

quaint mantle
#

intellij is very weird with mavens jdk setting

hybrid spoke
#

imagine not using notepad

quasi flint
#

sometimed

quaint mantle
#

it'll definitely incorrectly think you're using java 5 in first setups

quasi flint
quaint mantle
#

despite having a proper jdk value in pom

chrome beacon
#

Pretty sure you can fix that

hybrid spoke
smoky oak
#

the editor aint the impressive part

sinful matrix
#

It worked

smoky oak
#

now for the next wave of error as you morph into a pull stack developer

echo hound
#

is there an event triggered when an egg is hitting something

#

like ground or player

grim ice
#

ProjectileHitEvent

echo hound
#

thank you 🙂

grim ice
#
       if(event.getEntity() instanceof Egg egg){
         // you can call methods on egg now
}```
#

lol

#

btw check if the shooter is a player

echo hound
#

what else could shoot=

grim ice
#

probably a chicken

#

wait nvm

echo hound
#

never saw a chicken shoot an egg

#

maybe your chickens are agressive?

grim ice
#

the Shooter method doesnt exist anymore either way

granite burrow
#

where is p.hasPlayedBefore stored on a server

#

I wanna clear that data

grim ice
granite burrow
#

do you know where the server stores the day count?

pastel stag
#

is there an event that can be captured for the breaking of a torch that is attached to a block a player breaks?

grim ice
pastel stag
#

as in the player breaks a block with a torch on it and the torch also breaks, i want to capture the torch break event

granite burrow
brisk estuary
#
@EventHandler
public void onHitByFluSword(EntityDamageByEntityEvent e){
  if(e.getDamager() instanceof Player){
    Player damager = (Player)e.getDamager();
    if(damager.getInventory().getItemInMainHand().equals(FluPotion.FLU_SWORD)){
      if(e.getEntity() instanceof LivingEntity) {
        FluPotion.FLU_POTION_EFFECT.apply((LivingEntity)e.getEntity());
      }
    }
  }
}
#

someone told me that it would break once the item durability decrease and that I should create a PDC tag for my custom item

#

how can I do it?

grim ice
#

@granite burrowworld.getFullTime() * 86400000L

pastel stag
#

the spacing in that code is triggering me heh

grim ice
#

@Override
public long getFullTime() {
return world.getDayTime();
}

#

nms killed my last cells

grim ice
#
String key = "insert key here lol";
NamespacedKey nk = new NamespacedKey(pluginInstance, key.toLowerCase());
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getPersistentDataContainer().set(nk, PersistentDataType.STRING, "what-u-wanna-put-here");
itemStack.setItemMeta(itemMeta);```
hybrid spoke
grim ice
#

my bad

#

why though

#

should u make it on enable then? just a guess

hybrid spoke
#

since its for intern purpose only and should never change, to detect your NSK's, they should be constants directly instantiated

grim ice
#

either way to retrieve it you do:

if(meta.getPersistentDataContainer().has(nk, PersistentDataType.STRING)) {
    value = meta.getPersistentDataContainer().get(key, PersistentDataType.STRING);
}```
pastel stag
#

is there an event that can be captured for the breaking of a torch that is attached to a block a player breaks? as in the player breaks a block with a torch on it and the torch also breaks, i want to capture the torch break event

brisk estuary
#

I must use PersistentDataType.DOUBLE if i want to store a durability value right?

vague oracle
#

Never mind entity event

grim ice
#

?paste

undone axleBOT
grim ice
#

this will cancel the event

eternal oxide
grim ice
#

oh

pastel stag
#

hmm

grim ice
#

nvm its gonna work well

pastel stag
#

@eternal oxide fired once for the block you break that drops and a second time for the torch that also dies?

grim ice
#

use this event as well as the piston thing i listed

pastel stag
#

sweeeeet this is exactly what i needed thanks homie

brisk estuary
grim ice
#

no

echo hound
#

how can i disable block explosion for some blocks

grim ice
#

plugin instance is ur plugin instance

eternal oxide
#

do you actually mean block explosion, or blocks being blown up?

hybrid spoke
# grim ice can you make an example?
    private final NamespacedKey arrow_amount_key;
    
    public MyClass(JavaPlugin yourMain) {
        arrow_amount_key = new NamespacedKey(yourMain, "arrow-amount");
    }
    
    public void addArrowsToQuiver(ItemStack itemStack) {
        
        if(itemStack.getType() == Material.AIR)
            return;
        
        ItemMeta meta = itemStack.getItemMeta();
        meta.getPersistentDataContainer().set(arrow_amount_key, PersistentDataType.INTEGER, 2);
        itemStack.setItemMeta(meta);
    }
#

thats how i would do it

#

or with a Util class which contains every namespacedkey of your plugin

grim ice
#
@EventHandler
    public void onExplode(BlockExplodeEvent event) {
     
             Material mat = Material.getMaterial("ur material here in upper case please";
            for (Block block : event.blockList().toArray(new Block[event.blockList().size()])){
                if(block.getType() == mat)
                event.blockList().remove(block);
                }
            }```@echo hound

with this, the item u specify wont blow up.
you can use blockList().removeAll(ur collection); if u want multiple blocks to not explode
hybrid spoke
#

but i would mark creating a new one everytime your code runs as an "ew" in a code-review

grim ice
hybrid spoke
#

glad to

static crane
#
        ItemStack Item = new ItemStack(Material.DIAMOND_AXE, 1);
        ItemMeta meta = Item.getItemMeta();


        Objects.requireNonNull(meta).setDisplayName("§4Warrior Axe");
        List<String> lore = new ArrayList<>();
        lore.add("An axe for hero's and warriors");
        meta.setLore(lore);
        meta.addEnchant(Enchantment.DAMAGE_ALL, 6, true);
        meta.addEnchant(Enchantment.DURABILITY, 4, true);

        Item.setItemMeta(meta);

        return Item;
``` ```    @EventHandler
    public static void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_AIR) {
            if (event.getItem() != null) {
                if (Objects.equals(event.getItem().getItemMeta(), ItemManager.warriorAxe.getItemMeta())) {
                    Player player = event.getPlayer();
                    player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 1));
                    player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 0));
                }
``` My event doesn't work if the durability from my custom item is changed can someone help me?
grim ice
#

why is ur event static

#

best to avoid it when you can, static makes shit hard while testing

#

just avoid it

static crane
#

oh yeah that makes sense

grim ice
#

learn implicit else btw

static crane
#

tnx

spiral light
#

if (Objects.equals(event.getItem().getItemMeta(), ItemManager.warriorAxe.getItemMeta())) {

istn this the same like
item1.isSimilar(item2) ?

grim ice
#

also

grim ice
#

ur comparing item meta

#

and item meta has durability

#

the item createAxe

#

has a durability of perfect

#

after damaging it its not perfect anymore

#

Use PDCs

#

aka persistent data containers

#
String key = "insert-key-here-lol";
NamespacedKey nk = new NamespacedKey(pluginInstance, key.toLowerCase());
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.getPersistentDataContainer().set(nk, PersistentDataType.STRING, "what-u-wanna-put-here");
itemStack.setItemMeta(itemMeta);```
#
if(meta.getPersistentDataContainer().has(nk, PersistentDataType.STRING)) {
// then the item with the ItemMeta "meta" is your axe.
}```
#

might be complicated at first but u just learn it, u can ask questions here about it.

#

btw dont create the namespacedkey everytime ur code runs

#

what i did here is wrong but works
this is the correct way:

#
 private final NamespacedKey nk;
    
    public MyClass(Plugin mainClass) {
        nk = new NamespacedKey(mainClass, "insert-key-here-lol");
    }```
#

then when u make an instance of ur class in ur main class you do MyClass(this)

#

fun fact i learnt the correct way today by cipher lol

static crane
#

Well i am gonna try to learn it, it's alot of new information i kinda think i should rework my code, so i am gonna finish this project because i also want to look in to hashmaps and cooldowns. But after this project i am defenetly gonna look in to it. it was very helpful tnx.

grim ice
#

no problem

#

for now u can just make ur item unbreakable if u want

#

so ur code doesnt break when the item is damaged

static crane
#

oh yeah indeed tnx

rough basin
#

What should I Declare custom entity Which is extend by vanilla mobs?

#

I expected like Entity entity = new Entity , but i have no idea what should i do now :(

hoary pawn
#

is it possible to make itemstack.setitemmeta to default to non italic text but still possible to add italics with §o

tardy delta
#

you mean the lore?

hoary pawn
#

no the name

tardy delta
#

i saw it somewhere

hoary pawn
#

forgot to upload pic xd

tardy delta
#

its possible but i'm not sure if it is the meta

#

mayeb &r works?

hoary pawn
#

well name was added in meta

summer scroll
#

maybe add ChatColor.RESET at the start of setting the display name

mortal hare
#

yo

#

these new switch cases are sick

hoary pawn
#

yo

#

#general lol

summer scroll
mortal hare
#

you dont need to use break everytime

#

just case 1 -> "bloop"

peak gulch
#
public class mongodb {
//    private MongoCollection players;
    private MongoDatabase collection;
    private MongoClient client;
    public boolean connect(){
        try {
            client = MongoClients.create("mongodb://localhost:27017");
        } catch (Error e) {
            //When you end up here, the server the db is running on could not be found!
            System.out.println("Could not connect to database!");
            e.printStackTrace();
            return false;
        }
        //Get the database called "mcserver"
        //If it does not exist it will be created automatically
        //once you save something in it
        collection = client.getDatabase("Rola");
        //Get the collection called "players" in the database "mcserver"
        //Equivalent to the table in MySQL, you can store objects in here
//        collection.getCollection("players");
        return true;
    }``` This is my function and why it alwasy return this error?
hoary pawn
peak gulch
summer scroll
timid spear
#

How do I import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack; from spigot-1.18?

#

Or from where?

stone sinew
#

I hate maven. (Or any dependency manager.)
If you remember my issue with Files.copy that I kept asking about and no one can figure it out. The cause was maven. I just kept creating new maven projects. Then tried java projects converted to maven etc... After a few days I finally got it to work. No more BS error of the file being open in another process lol.

timid spear
#

Can someone help? I can't import PlaceHolderAPI into the Java Maven Project

grim ice
#
<repositories>
        <repository>
            <id>placeholderapi</id>
            <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
         <groupId>me.clip</groupId>
          <artifactId>placeholderapi</artifactId>
          <version>{VERSION}</version>
         <scope>provided</scope>
        </dependency>
    </dependencies>```
timid spear
#

May I have to reload/restart the IDE or project?

grim ice
#

reload maven

#

there is a little maven button

#

on ur ide screen

#

screenshot

#

ur screen

timid spear
#

Ah yes, I found it

#

In the top right corner

grim ice
#

uh

#

screenshot

timid spear
#

Nevermind, now it seems to work 🙂

#

No red lines or else

#

Never used maven before. Seems a little weird tbh

#

Do you know, if 1.18 spigot still has NMS support?

grim ice
#

probably

native gale
#

Afik, there are mappings, but Mr. md_5 highly discourage using nms in plugins

eternal oxide
#

only use NMS if there is no other way of doing it via the API

next fossil
#

I'm having some trouble with the Vault API dependency for Maven

#
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Compilation failure: Compilation failure: 
[ERROR] Main.java:[55,26] cannot find symbol
[ERROR]   symbol:   class Vault
[ERROR]   location: package net.milkbowl.vault```
#

I tried other maven imports for Vault, the main Vault itself, the VaultAPI all kinds it doesn't compile

brisk estuary
frail gale
#

hey i have found something weird so i have made one thing in my plugin which will allow the players to be able to color every animal name if it have a name so for example: player have named Cow with the name of Cowky and the default name color is &f so white and if he holds a blue dye and right-click on the mob the name will be set &1Cowky so blue which is nice working. But if the player wants to change color of the name on the same animal to other it will not work it just works only once for every mob

#

and i didn't know why it happens

rough basin
#

How should I Declare custom entity Which is extend by vanilla mobs?
I expected like Entity entity = new Entity , but i have no idea what should i do now :(

brisk estuary
#
public class SupremeAxe {

    private short maxDur;
    private int lostDur;
    private int totalDur;
    private final NamespacedKey supreme_axe_nk;
    public static ItemStack supremeAxe;


    public static void initialize(){
        createSupremeAxe();
    }

    private static void createSupremeAxe(){
        ItemStack item = new ItemStack(Material.NETHERITE_AXE);
        ItemMeta meta = item.getItemMeta();

        meta.setDisplayName("§a§lSupreme Axe");

        List<String> lore = new ArrayList<>();
        lore.add(0,"§fThe most powerful axe");
        lore.add(1,"§ffor the strongest warrior!");
        meta.setLore(lore);

        meta.addEnchant(Enchantment.DAMAGE_ALL, 7, true);
        meta.addEnchant(Enchantment.FIRE_ASPECT, 4, true);
        meta.addEnchant(Enchantment.MENDING, 2, true);

    }

    public SupremeAxe(Plugin myPlugin){
         this.supreme_axe_nk = new NamespacedKey(myPlugin,"supreme_axe_durability");
    }

    public void supremeAxeDurability(ItemStack itemStack){
        if(!(itemStack.equals(supremeAxe))){
            return;
        }
        ItemMeta itemMeta = itemStack.getItemMeta();
        this.maxDur = itemStack.getType().getMaxDurability();
        if(!(itemMeta instanceof Damageable)){
            return;
        }
        this.lostDur = ((Damageable) itemMeta).getDamage();
        this.totalDur = (int)maxDur - lostDur;
        itemMeta.getPersistentDataContainer().set(supreme_axe_nk, PersistentDataType.INTEGER, totalDur);
    }
}
brisk estuary
next fossil
#

You forgot to add the ItemMeta to the item itself at the end of the method

#

item.setItemMeta(meta);

stone sinew
#

In 1.18 anyone know what GameProfile and Property was changed to? Or is this just another useful class spigot removed? https://pastebin.com/dwZG6hiW

next fossil
#

GameFile and Property is the same in 1.18 still works for me

gray comet
#

Spigot cannot remove GameProfile

next fossil
#

Make sure to use Maven, if not your imported external jars won't function right

brisk estuary
smoky finch
#

How do I go about cancelling LightningStrikeEvent based on the player who caused it with a trident?

next fossil
#

How do I get Maven to obfuscate the new NMS? I compiled mine in Maven but it still shows up as the original wording

timid spear
#

I am having problems importing those:

stone sinew
next fossil
#

Import the Shaded-API and Mojang-Mapped Server one

stone sinew
#

I did

#

Wait not the mojang one

keen spindle
#

Hi guys

next fossil
#

Add this to your dependency for your pom.xml

#
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.18-R0.1-SNAPSHOT</version>
            <classifier>remapped-mojang</classifier>
            <scope>provided</scope>
        </dependency>
keen spindle
#

I have some trouble

next fossil
#

Don't we all? xD

stone sinew
next fossil
#

That's why you're having import issues

keen spindle
#

I made a plugin that like renders a welcome message to the user when they join, but it doesn't seem to work

next fossil
#

Cause you're NOT using maven

keen spindle
#

It does render a message

next fossil
#

Having maven solved all the import issues

#

Saajith, show the code

stone sinew
#

Or because like I just said... I didn't add the remapped jar to my build path lol

next fossil
#

No but even so

#

I added both jars, the remapped and mojang mapped ones but some imports still won't work

#

I even got desperate and added ALL the new 1.18 jars still didn't work

#

Maven is more organised and is much better, painstaking to setup yes, worth it tho

#

@keen spindle Make sure to register the JoinEvent listener in your Main class too

brisk estuary
#

PDC and events with custom items

timid spear
next fossil
#

It's in the pom.xml file paste it in there

#

If you are using Maven, that is

#

If not, go to: BuildTools\Spigot\Spigot-API\target\spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar

#

and

#

BuildTools\Spigot\Spigot-Server\target\spigot-1.18-R0.1-SNAPSHOT-remapped-mojang.jar

#

Import those 2

timid spear
#

@next fossil If I can ask you something;

#

How can I solve this?

eternal oxide
#

did you run buildtools with the --remapped flag?

timid spear
#

No, as I have written all inside the pom file. Here: https://pastebin.com/VeizrDnL

#

Maybe I am missing something important?

eternal oxide
#
@echo off
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
java -jar BuildTools.jar --generate-source --generate-docs --rev %Input% --remapped```
#

run buildtools with the remapped flag to generate the jars you need

next fossil
#

Wait why are they dependencies? @timid spear

#

They're external libraries

#

You're importing them as dependencies. That's why. Put as them external libraries

radiant ice
#

{
"enabled": true,
"shaped": true,
"outputAmount": 1,
"recipe": [
"GDG",
"TNT",
"GDG"
],
"items": {
"G": {
"item": "minecraft:gold_block"
},
"D": {
"item": "minecraft:diamond_block"
},
"T": {
"item": "minecraft:totem_of_undying
},
"N": {
"item": "minecraft:nether_star
}
}
}

#

why tis not work

timid spear
eternal oxide
#

don;t do any manual imports, let teh maven pom do it all

timid spear
#

How? xD

eternal oxide
#

How?

#

you fill in teh pom and don;t manually import yourself

#

I'll ask again, have you run BuildTools with the --remapped flag?

#

if not

#

?bt

undone axleBOT
timid spear
#

I have @eternal oxide

#

I now see the remapped jar file

eternal oxide
#

update your pom and the error shoudl vanish

#

shoudl be an update/reload/refresh button top right somewhere

#

if intelij

#

if Eclipse, right click pom -> maven -> update project, then select force update snapshots

timid spear
#

I had to restart entire IntelliJ

#

But now the red text is gone. Nice

#

Okay, my last issue is this here:

#

Did it change?

eternal oxide
#

probably net.minecraft.nbt.CompoundTag

timid spear
#

Okay, I'll try renaming

sullen dome
timid spear
#

I imported the newly CompoundTag

normal isle
#

how can i send messages and imageS?

#

loaded class 0 from 1 which is not a depend soft depend or load before or this plugin spigot

timid spear
#

But I stumbled upon a problem. I can't set a boolean anymore... :/

#

Goddamnit

young knoll
#

And make sure you declare your depdencies

normal isle
#

ok

normal isle
young knoll
normal isle
#

i still dont understand

#

i am still dumb

restive tangle
#
    at com.wife.clans.ServerData.connect(ServerData.java:21) ~[WifeClans-1.0.jar:?]
    at com.wife.clans.WifeClans.onEnable(WifeClans.java:13) ~[WifeClans-1.0.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-391]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-391]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-391]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:561) ~[patched_1.17.1.jar:git-Paper-391]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:475) ~[patched_1.17.1.jar:git-Paper-391]
    at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:733) ~[patched_1.17.1.jar:git-Paper-391]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:317) ~[patched_1.17.1.jar:git-Paper-391]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-391]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-391]
    at java.lang.Thread.run(Thread.java:831) ~[?:?]
Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClient
    at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[patched_1.17.1.jar:git-Paper-391]
    at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[patched_1.17.1.jar:git-Paper-391]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
    ... 12 more```
#

    MongoClient client;
    MongoDatabase database;


    private String uri;

    public ServerData(String uri){
        this.uri = uri;
    }

    public void connect(){
        this.client = new MongoClient(new MongoClientURI(uri));
        this.database = client.getDatabase("WifeDB");
    }

    public MongoCollection<Document> getClanCollection(){
        return this.database.getCollection("clans");
    }
}```
#

I have been stuck on this NoClassDefFoundError, I don't know what to do.

#
    public void onEnable(){
        serverData = new ServerData("mongodb+srv://");
        serverData.connect();

        sendConsoleMessage("&a<< Wife clan plugin has been enabled >>");
    }```
#
    <repositories>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

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

        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-java-driver</artifactId>
            <version>3.12.10</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

Here's the pom.xml

rough basin
#

What should I Declare new entity That is extend by vanilla mobs?
I expected like Entity entity = new Entity ..... , but i have no idea what should i do now :(

summer scroll
normal isle
#

loaded class 0 from 1 which is not a depend soft depend or load before or this plugin spigot?

timid spear
#

Any help with the nbt.CompoundTag ?

I cant set any boolean :/

pastel mauve
#

Hey, i got a question to my world generator. Right now its really laggy and it takes a while to load just one chunk :/

Code:
World world = creator.createWorld();

PlotPopulator populator = new PlotPopulator();
world.getPopulators().add(populator);

static class PlotPopulator extends BlockPopulator {
@Override
public void populate(final World world, final Random random, final Chunk chunk) {
for(int x = 0; x<16; x++)
for(int z = 0; z<16; z++)
for (int y = 1; y < 64; y++)
chunk.getBlock(x, y, z).setType(Material.GRASS_BLOCK, false);
}

I would appreciate your help! 😄

young knoll
#

Why are you filling the chunk with a populator

static crane
#
    public void onRightClick(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_AIR) {
            Player player = event.getPlayer();
            if (event.getItem() != null) {
                if (Objects.equals(event.getItem().getItemMeta(), ItemManager.warriorAxe.getItemMeta())) {
                    if (cooldownRight.containsKey(player.getName())){
                        if(cooldownRight.get(player.getName()) > System.currentTimeMillis());
                        {
                            long timeleft = (cooldownRight.get(player.getName()) - System.currentTimeMillis() / 1000);
                            player.sendMessage(ChatColor.GOLD + "Ability will be ready in " + timeleft + " seconds");
                            return;
                        }
                    }
                    cooldownRight.put(player.getName(), System.currentTimeMillis()/1000 + 5 );
                    player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200, 1));
                    player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 200, 0));
                }``` If my cooldown activates it wont go run again it stays in this in my if statement```if (cooldownRight.containsKey(player.getName())){
                        if(cooldownRight.get(player.getName()) > System.currentTimeMillis());
                        {
                            long timeleft = (cooldownRight.get(player.getName()) - System.currentTimeMillis() / 1000);
                            player.sendMessage(ChatColor.GOLD + "Ability will be ready in " + timeleft + " seconds");
                            return;``` so in game it will say "ability will be ready in -5 seconds" so i can do the event ones but never again if my cooldown is running
young knoll
normal isle
#

and its dosent work

pastel mauve
timid spear
young knoll
#

?pdc

timid spear
#

äh

pastel mauve
sullen dome
# timid spear äh

it's kind of a config where all data about entities, blocks and stuff is saved

#

just that it's kind of inside the entity/block

#

the thing that you access ingame with /data

young knoll
#

No idea what you are talking about with /data

#

Pdc is just a wrapper around NBT

#

I guess you can probably access it with /data then, idk

sullen dome
#

well

#

/data accesses it afaik

#

contains the stuff i save with spigot's pdc at least

pastel mauve
#

@young knoll can u add me as a friend on dc, in matter to write you ;D I cant send pictures in this chat

sullen dome
#

this is where pdc saves it

pastel mauve
quaint mantle
sullen dome
young knoll
#

It’s literally a wrapper around NBT tags

quaint mantle
#

ok true

timid spear
#

I dont get it

#

Never worked with those things really

drowsy helm
#

its just spigot's api for nbt

young knoll
#

I mean the link has a full guide

drowsy helm
#

?pdc

timid spear
#

May I ask someone of you for help in implementing this.

#

If you can, please message me directly

red sedge
#

how can i loop through all blocks around a player

restive tangle
#

Players is going to be a list in a document, would querying it like this work?

    public boolean isInClan(){
        Document query = serverData.getClanCollection().find(eq("Players", uuid)).first();
        if(query != null){
            return true;
        }
        return false;
    }
summer scroll
peak gulch
#

but i fix this now i hade this:

summer scroll
#

perhaps you need to shade the mongodb.

peak gulch
#
public class mongodb {
//    private MongoCollection players;
    private MongoDatabase collection;
    private MongoClient client;
    public boolean connect(){
        try {
            MongoClientURI connectionString = new MongoClientURI("mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false");
            MongoClient mongoClient = new MongoClient(connectionString);
        } catch (Error e) {
            //When you end up here, the server the db is running on could not be found!
            System.out.println("Could not connect to database!");
            e.printStackTrace();
            return false;
        }
        //Get the database called "mcserver"
        //If it does not exist it will be created automatically
        //once you save something in it
        collection = client.getDatabase("Rola");
//        MongoCollection<Document> collection = collection.getCollection("test");
        //Get the collection called "players" in the database "mcserver"
        //Equivalent to the table in MySQL, you can store objects in here
//        collection.getCollection("players");
        return true;
    }```
summer scroll
#

you're getting CNF exception right?

peak gulch
summer scroll
#

doesn't matter

#

your plugin still doesn't recognized what is MongoDatabase after compiled

#

because the class isn't exist on the plugin

peak gulch
#

It always return me "Data baze not foumd"

#

So what I need to do

summer scroll
#

as i told you 3 times, you need to shade the mongodb

restive tangle
#

How do I get a JSONObject from query, doing JSONObject jsonObject = new JSONObject(query.toJson()) does not work.

ivory sleet
#

what does toJson() return?

#

also what json lib?

buoyant viper
ivory sleet
#

org json?

#

you mean json simple

quaint mantle
#

Imagine using org.json

ivory sleet
#

or no?

buoyant viper
#

i just knew it as json tbh

noble lantern
#

That special moment when you realized spigot comes compiled with gson

ivory sleet
#

oh that obsolete one

noble lantern
#

no?

#

99% sure its compiled with it

quaint mantle
#

Yeah, spigot don’t have it, but vanilla do

noble lantern
#

My BurchAPI lib uses Gson and doesnt actually import it, it just borrows spigots

buoyant viper
quaint mantle
#

And spigot import vanilla

noble lantern
#

so then spigot includes gson....

#

xD

quaint mantle
#

Yeah…

#

Lol then

buoyant viper
#

honestly yeah id just use gson since its provided

noble lantern
#

not to mention it has amazing serialization/deserialization

vagrant edge
#

?

noble lantern
#

So basically

#

You need a plugin.yml and a bungee.yml

quaint mantle
#

Hmmm do you use intellj + its minecraft development plugin?

#

If you do then you can tick both spigot + bungeecord box

noble lantern
#

and you need 2 diff classes, one class extending JavaPlugin, another class extending Proxy of whatever Bungeecord extends

ivory sleet
# vagrant edge ?

use bungee.yml as your plugin manifest for bungee, plugin.yml as your plugin manifest for spigot, then make sure no bungee classes import spigot stuff and vice versa for the spigot classes of yours

red sedge
quaint mantle
#

Wait jar is basically a zip file, then do it compress the size of the files?

#

Like zip?

buoyant viper
red sedge
buoyant viper
late sonnet
red sedge
#

restart

buoyant viper
#

medic..

red sedge
#

hm?

buoyant viper
#

i should play tf2

late sonnet
# red sedge restart

hmm try check the JAR if has the .class for this PlayerBlockPlaceEventListener

if this class is not then try rebuild the plugin

red sedge
#

oki

#

oi

#

the package name is Events.player.PlayerBlockPlaceEventListener

#

in the jar

late sonnet
#

and the orbrpg?

red sedge
#

idk how to change the package name tho

#

tried rebuilding

late sonnet
#

depend of IDE...

red sedge
#

hm?

late sonnet
#

in intelliJ i use CTRL+R in the package for rename

red sedge
#

i did rename the package in intellij tho

#

it shows events

#

in the ide

#

but in the jar it shows Events

late sonnet
#

hmmm can you show this in the IDE?

red sedge
#

cant upload images

#

but it is

#

orbrpg>events>player>PlayerBlockPlaceEventListener

#

in the ide

#

but orbrpg>Events>player>PlayerBlockPlaceEventListener in the jar

quaint mantle
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

quaint mantle
#

Verify when?

red sedge
#

i refuse

#

okay i think i fixedi t

visual tide
#

does PreLoginEvent still get called if the player gets kicked for whitelist?
also does it trigger with invalid session kick? i assume no, but still asking

patent wadi
#

I'm having a strange issue with a project since updating. One of the classes is showing errors, one being not being able to import or.bukkit.Material but in other classes it is fine. The whole class object is showing an error "cannot access Object" saying "bad class file Object.class" everything compiles and build correctly and the code that is in that class is being executed.

fast onyx
#

There is an event for when a player adds an item to his 2nd hand?

patent wadi
#

maybe use inventory change and just track what is in the slot, if new item isn't old item, it changed

fast onyx
#

Oki thanks

patent wadi
pastel mauve
#

Hey, i got a question to my world generator. Right now its really laggy and it takes a while to load just one chunk :/
I would like to do it using ChunkData but i dont know how :/ A piece of code would be really helpful!

Code:

World world = creator.createWorld();

PlotPopulator populator = new PlotPopulator();
world.getPopulators().add(populator);

static class PlotPopulator extends BlockPopulator {
@Override
public void populate(final World world, final Random random, final Chunk chunk) {
  for(int x = 0; x<16; x++)
    for(int z = 0; z<16; z++)
      for (int y = 1; y < 64; y++)
        chunk.getBlock(x, y, z).setType(Material.GRASS_BLOCK, false);
}

I would appreciate your help! 😄

patent wadi
#

threadding it would help

#
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
  public void run() {  
      //code 
  },2};

buoyant viper
#

if ur on intellij id try invalidate caches and restart

patent wadi
buoyant viper
#

oh

#

idk then

patent wadi
#

nb has the same which I have done, if i switch to 15 or 16 its fine

buoyant viper
#

hmm

patent wadi
#

something could have changed or I haven't got the platform set up right perhaps

#

I'm using the boxed version (zip) which I just added as a platform. I installed it systemwide but for some reason NB isn't seeing them but thats not unusual

buoyant viper
#

hmm

smoky oak
#

Nice name

crimson terrace
#

Anyone know a way to hide a players name?

#

ive tried setCustomNameVisible(false)

patent wadi
#

set a custom name of "" and make visible

fast path
crimson terrace
smoky oak
#

deprecated but might just work

#

requires messing with teams tho

patent wadi
pastel mauve
#

Hey, I have a problem with my Worldgeneration but i dont know, how to apply my ChunkData

public void createPlotworld(String displayName) {

  WorldCreator creator = new WorldCreator(name);
  World world = creator.createWorld();

  // generating chunks using generateChunkData(world, null, 0, 0); but idk how lol

}

public ChunkData generateChunkDate(World world, Random random, int ChunkX, int ChunkZ) {
  ChunkData data = createChunkData(world);

  for(int x = 0; x <16; x++)
    for(int z = 0; z <16; z++) {
      data.setBlock(x, 100, z, Material.AMETHYST_BLOCK);
    }

  return data;
}```
I appreciate your help 😄
fast path
crimson terrace
#

ok Ill try all of that 😄

#

thanks for the ideas guys

smoky oak
pastel mauve
spiral light
#

i believe this changed in 1.17 already

smoky oak
#

oh right, how do you view the api for an older version?

pastel mauve
spiral light
#

ok, and now you want what ?

pastel mauve
#

i want to know, how to apply the chunkdata to the chunks in my world

spiral light
#

i guess you need to check out the methods from the link i send you and apply the data out of the ChunkData there

#

could be easier to generate the World with the provided Methods instead

pastel mauve
#

yeah but how can i add my plots and the default height levels to this world?

buoyant viper
#

ok yeah idk i just set my jdk and what not to J17 in my IDE and it worked just fine @patent wadi

#

might be a netbeans issue

smoky oak
#

when should i use configuration files and when a database to permanently store per player data? Or can I attach data to players directly?

crimson terrace
#

you can attach data to a player directly by editing their PersistentDataContainer

smoky oak
#

ok thanks

#

that makes this a lot easier

crimson terrace
#

?paste

undone axleBOT
crimson terrace
#

https://paste.md-5.net/hatitegehi.java So ive tried this with all of the Team.OptionStatus and it doesnt work for any of them. any ideas? im trying to make the players name invisible and this is the entire plugin so far.
everything runs but the names just wont become invisible

tardy delta
#

boo

crimson terrace
#

D:

#

ive never worked with teams before

hoary pawn
#

would it be possible to have a folder with java classes in the server folder, that could be used by the plugin

#

so the user could edit the java classes without having to edit the plugin itself

spiral light
candid galleon
#

That’s what configuration is for

#

You’d have to jump through a lot of hoops to compile Java at runtime

hoary pawn
candid galleon
#

Why not use configs?

hoary pawn
#

because then i would have to hard code all the stuff in

hoary pawn
#

like so maybe a player could make a sword teleport someone 2 blocks forward get their angle summon a custom armor stand 10 blocks forward and make it explode

candid galleon
#

Aren’t you basically asking users to edit your plugin for you at that point then?

#

Do you think your users know how to write Java?

#

Better yet, why not make it an API and allow other devs to expand on it?

hoary pawn
smoky oak
#

actually, I'd recommend making very general functions that can take and digest a lot of parameters, just do it in a sensible way (speak, do the opposite of yanderedev), then allow the creation of action sequences

#

also configs can be manipulated fairly easily. They would be a good idea for what you're planing

#

on another tangent what's the maximum amount of data you can fit into a players PersistentDataContainer ?

hoary pawn
smoky oak
#

ah no. I meant writing the code but in a way that it can do the stuff you want, given the right parameters. Runtime compiliation may be possible in java, but its definitively a very bodge-y story in minecraft

hoary pawn
#

i more want it to be like all those custom item plugins (aka uberitems) because i think i can do it much better and those there already are there suck and i dont like thirtyvirus

smoky oak
#

thats kind of what those plugins do. You have a function that can generate it and tell the plugin when to run that code, depending on what the player does

hoary pawn
#

yes

smoky oak
#

cant tell you much more

#

also can someone PLEASE tell me how to properly import bukkit javadoc into intellij?! I'm only getting the method signatures

tender shard
smoky oak
#

yes

tender shard
#

spigot or spigot-api?

#

which one?

smoky oak
#

both

#

wait

#

api

tender shard
#

should work fine then

smoky oak
#

it doesnt

#

i only get method signatures

stuck nacelle
#

hi, since 1.18 update I can't compile my new module. Should I import every lib one by one? It was working on 1.17

mortal hare
#

question about skins. Does notchian minecraft client require Mojang generated signature key to render the skin properly?

smoky oak
#

running 'download sources and documentation' did not change anything

tardy delta
#

if there is no javadoc?

smoky oak
#

there is

smoky oak
#

i did import the spigot-1.18-javadoc in the context menu

quaint mantle
#

isnt signature optional

tender shard
#

skulls work fine without, but players require a valid signature

mortal hare
#

how does that make sense

#

Skulls work without, player skins aren't lol

misty current
#

how can I make entities spawned in with packets respawn when a player goes too far and then comes back?

sinful matrix
#

Hey Guys
I programmed a one way Elytra Plugin for 1.18. It works perfect. But only on my local server...
If i try to run the plugin on my public server, which I'm hosting with Ramshard, it dowsn't work properly. To test if the Plugin even gets loaded I coded a Message which replys "test" in the console when the Plugin is loaded. This works on both server but the rest of the Plugin only works on my local Server

This is the code:

package lenotex.onewayelytra;

import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityToggleGlideEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.plugin.Plugin;

import java.util.ArrayList;
import java.util.List;

public class OneWayElytra implements Listener {
    private final int radius;
    private final int boost;
    private final List<Player> flying = new ArrayList<>();
    private final List<Player> boosted = new ArrayList<>();
    public OneWayElytra(Plugin plugin){
        this.radius = plugin.getConfig().getInt("radius");
        this.boost = plugin.getConfig().getInt("boost");
        Bukkit.getScheduler().runTaskTimer(plugin, () -> {
            Bukkit.getWorld("world").getPlayers().forEach(player -> {
                if(player.getGameMode() != GameMode.SURVIVAL) return;
                player.setAllowFlight(isInSpawnRadius(player));
                if(flying.contains(player) && !player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().isAir()){
                    player.setAllowFlight(false);
                    player.setGliding(false);
                    boosted.remove(player);
                    Bukkit.getScheduler().runTaskLater(plugin, () -> {
                        flying.remove(player);
                    }, 5);
                }
            });
        },0,3);
    }

    @EventHandler
    public void onPlayerToggleFlight(PlayerToggleFlightEvent event){
        if(event.getPlayer().getGameMode() != GameMode.SURVIVAL) return;
        if(!isInSpawnRadius(event.getPlayer())) return;
        event.getPlayer().sendMessage("Elytra");
        event.setCancelled(true);
        event.getPlayer().setGliding(true);
        flying.add(event.getPlayer());
    }

    @EventHandler
    public void onDamage(EntityDamageEvent event){
        if(event.getEntityType() == EntityType.PLAYER && (event.getCause() == EntityDamageEvent.DamageCause.FALL || event.getCause() == EntityDamageEvent.DamageCause.FLY_INTO_WALL) && flying.contains(event.getEntity()))
            event.setCancelled(true);
    }

    @EventHandler
    public void onSwapHandItems(PlayerSwapHandItemsEvent event){
        if(boosted.contains(event.getPlayer()) || !event.getPlayer().isGliding())
            return;
        event.setCancelled(true);
        boosted.add(event.getPlayer());
        event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().multiply(boost));
    }

    @EventHandler
    public void onEntityToggleGlide(EntityToggleGlideEvent event){
        if(event.getEntityType() == EntityType.PLAYER && flying.contains(event.getEntity()))
            event.setCancelled(true);
    }

    private boolean isInSpawnRadius(Player player){
        if(!player.getWorld().getName().equals("world")) return false;
        return player.getWorld().getSpawnLocation().distance(player.getLocation()) <= radius;
    }
}
quaint mantle
misty current
#

it would just keep spawning them

#

can i detect if the client can see an entity with a certain id

crimson terrace
#

when did they add persistent data? what minecraft version is the earliest that uses it?

smoky oak
#

it says 2017

crimson terrace
#

ok thanks

quaint mantle
#

1.13 actually but in 1.14 its name got changed

young knoll
#

You’ll need to depend on brigadier and authlib separately

grim ice
#

i made my jar file into a exe

#

with launch4j

#

but i keep getting

#

no main manifest attribute, in C:\Users\pcc\Desktop\my app name

tardy delta
#

what doesnt work?

#

also dont store a List<Player> use a Set<UUID> instead

red sedge
#

is there anyway to add a method in a class from the api

#

for that plugin

red sedge
#

like

#

can I add my own method under idk player class

spiral light
#

for everyone or just for your uses ?

red sedge
#

my uses

spiral light
#

no

red sedge
#

mk

tardy delta
#

you cant modify code from the api

red sedge
#

yeah but maybe I can override smth

#

idk what i was thinking tbh

tardy delta
#

if you extend the class

red sedge
#

hm?

#

im listening

spiral light
#

you would need to extend CraftPlayer but this is awful

tardy delta
#
public class PlayerExtension extends CraftPlayer {
  @Override
  String getName() {
    return "meh";
}
}```
#

craftplayer i dunno

#

just an example

red sedge
#

okay but will i be able to access that from Player

tardy delta
red sedge
#

k

tardy delta
#

you will be able to access player method from your class

spiral light
#

Player is just an interface.... if you extend CraftPlayer and somehow overwrite everything in the API that stored the old player-object you would get your player object but you have to cast it to your customplayerobject every time

red sedge
#

okay

tardy delta
#

ah it is an interface

#

i dunno just an example

spiral light
#

but why the hell is this an option that you wanne use 😄

tardy delta
#

can't you create create a wrapper class?

#

which stores an player's uuid

#

not the actual player :kek:

tardy delta
#

jar into an exe brr run

spiral light
grim ice
#

wait thats right

spiral light
#

i think it was the manifest

tardy delta
#

i thought only dotnet uses .exe extensions

grim ice
#

how to do it tho

tardy delta
#
public static void main(String[] args) {
  // main entry point of your program
  System.out.println("started!");
}```
spiral light
tardy delta
#

i dunno where that is going to be printed but yea 😄

tardy delta
#

if you just use a ide?

ivory sleet
#

should have used gradle

grim ice
#

i do

#

i had the worst experience with gradle

#

pls no

vale ember
#

gradle vs maven for spigot plugin development?

tardy delta
#

maven 🪕

ivory sleet
tardy delta
#

why though

ivory sleet
#

faster

quaint mantle
#

gradle

#

faster & less verbose

tardy delta
#

you mean for compilation?

spiral light
grim ice
#

my resource directory is empty

#

pog

quaint mantle
tardy delta
#

ah

grim ice
#

wait

tardy delta
#

blueJ :kek:

grim ice
#

I DONT HAVE META INF AT ALL

spiral light
#

maven needs 6s .... thats fast enought

grim ice
#

😭

spiral light
copper scaffold
#

im creating a /vanish command. is there any way that i can fake disconnect a player? that the message player disconnectet is comming?

quaint mantle
#

when gradle needs only 1s

tardy delta
copper scaffold
#

how can i send a quit message?

spiral light
ivory sleet
quaint mantle
#

hopefully never had a multimodule maven project

ivory sleet
#

yuh

spiral light
#

hmm just got into maven ... i will not try to figure out how gradle will work xD

tardy delta
#

smh how do i set a github repo public?

#

ah found it

tender shard
#

multi module maven saved my life when 1.18 came out

quaint mantle
#

@ivory sleet

tender shard
# ivory sleet faster

not really. it takes ages for the initial setup. when I'm cloning a gradle project, gradle is still doing things after 5 minutes, while with maven, I would have already been done meanwhile lol

tardy delta
#

and then i made something like this

noble spire
#

If you have a map as a yaml value (for example):


keyset:
  key: value
  key1: value1

anotherkeyset:
  key: value
  key1: value1

You can obviously get that as a YamlConfiguration. The only method I found that seems to be able to deal with this is YamlConfiguration#getMapList which returns a List<Map<String, ?>>.

  1. Is that the right method?
  2. How would you convert that to a Hashtable? Why is it a list of maps rather than a single map? I've never used Map in java before - is it a single key value pair or multiple, or is it the same as a Hashtable - what's the difference?
tender shard
tardy delta
#

uhh what is a hashtable

noble spire
#

like a hashmap

#

key value pairs

tender shard
grim ice
#

fuck me now

#

😭

ivory sleet
tardy delta
#

whats wrong with a map?

noble spire
#

I've never used them xD - are they literally just a set of key value pairs?

tardy delta
#

yessss

tender shard
# noble spire yeah

You can do sth like this:

Hashtable<String,Object> map = new Hashtable();
for(String key : yourYamlConfig.getKeys(true)) {
  map.put(key.yourYamlConfig.get(key));
}
ivory sleet
noble spire
#

Ig Hashmap, Hashtable, and map are all similar things with different implementationx

tender shard
ivory sleet
#

uh it takes maybe 10 seconds

#

+-

smoky oak
#

Conclure do you know how to properly add javadoc to intelliJ? Nobody's been given me useful answers all day

tardy delta
# noble spire Ig Hashmap, Hashtable, and map are all similar things with different implementat...
Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
#

whoa the bible

quaint mantle
#

damn i tried cloning advneture

#

and it installed me a dozen of gradle plugin

#

s

#

well if project is complex it would take time

grim ice
#

bro what shit is this

#

is this becuz i used jnativehook

noble spire
smoky oak
#

maven

grim ice
#

my app

smoky oak
#

thing is

ivory sleet
#

idk about maven sry

spiral light
grim ice
smoky oak
#

everything i tried including what the intellij website says just gives me the method signautres

#

i want the frigging docs

#

i want to know more than where the method is declared

ivory sleet
smoky oak
#

also i think its some dumb intelliJ thing not a maven one

#

i could be wrong on that one tho

grim ice
#

now i get this

#

when using the jar

#

najguauwebfawuegfabhwefubewf

noble spire
#

Yeah that works for me

#

Then (for example) you can view the source with this button

quaint mantle
#

my .gradle folder takes 5,1 GB 😎

cloud axle
#

Hello, is anyone familiar with Maven, and the whole remapping thing?

#

I'm kind of stuck

tardy delta
#

what is remapping?

#

_<

cloud axle
#

The "renaming" of Minecraft's code so it is no longer obfuscated

smoky oak
#

that did exactly squat

#

nothing happened

noble spire
noble spire
quaint mantle
grim ice
#

I used cmd to run my jar, and this is what i found

#

help pls

smoky oak
#

ExCUUUUSE me??? wth is now included in the docs and what not?

#

also i do not have done anything to get the actual javadoc into that project

#

so im a bit curious how its working at all

cloud axle
noble spire
cloud axle
#

And I don't know how to do either of that

quaint mantle
#

Show your pom

tardy delta
#

i think it'll show up there

cloud axle
#

Take a look at the thread

#

The pom is posted there

smoky oak
#

how do i go there? super.enable() in code just gives an error

tardy delta
#

ctrl click on your onenable

quaint mantle
tardy delta
#

ah didnt work but its this

smoky oak
#

'no usages found in project files'

tardy delta
#

JavaPlugin.class

#

ctrl click on JavaPlugin and search for it xd

smoky oak
#

theres not a single fucking line of javadoc in that

#

that might explain it

tardy delta
#

Plugin.class

smoky oak
#

WHAT.

#

thats mine

tardy delta
#

it overrides the method from its super class

smoky oak
#

yes but

#

my version has no javadoc in it

#

yours does

#

what the actual fucks going on here

grim ice
#

C:\Users\pcc\Desktop\pmmp>java -jar AutoM-1.0-SNAPSHOT.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/kwhat/jnat
ivehook/keyboard/NativeKeyListener
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.github.kwhat.jnativehook.keyboa
rd.NativeKeyListener
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 7 more```
tardy delta
#

in which class are you?

grim ice
#

help

smoky oak
#

JavaPlugin.class

tardy delta
#

go further

quaint mantle
# cloud axle ??

PacketPlayOutChat is not Spigot mappings, on mojang its ClientboundPlayChat or smrh

tardy delta
#

check the class it extends

smoky oak
#

no javadoc in that either

#

and that class contains only liek 4 methods

tardy delta
#

and then one more

smoky oak
#

no javadoc either

#

there's just a bunch of I's on the left that tells me where its implemented

#

I'm in Plugin.class rn

tardy delta
#

i dunno why this one is in comments and this one doesnt seem to

smoky oak
#

yea mines just empty void there

#

ofc there's no javadoc to show when there's no javadoc to begin with

#

but the javadoc for JAVA stuff is there

#

thats why the .log message shows its javadoc

gaunt frigate
#

How do I check the region where the player broke the block with the worldguard API

smoky oak
#

I've got one more idea and if that doesnt work ill just go die

#

OH COME ON

#

I'm done

#

Ill try again tomorrow but i got enough for today

ivory sleet
#

gradle :3

smoky oak
#

might be a idea tbf

#

i reset my codebase anyways

ivory sleet
#

🙏

rancid hare
#

Hey why can't I

import Bukkit.***

With the spigot 1.18 library?

ivory sleet
#

not promising it will work with gradle but at least I know how it should be done with gradle lol

ivory sleet
#

if it should ignore already discovered ones

rancid hare
#

I meant Bukkit.anything

ivory sleet
#

yuh

ivory sleet
rancid hare
quaint mantle
#

(use a proper build tool)

tardy delta
#

cute doggo

ivory sleet
#

jupiter those are not loading for me

quaint mantle
#

LoL

tardy delta
#

the keys :/

fringe perch
#

I used to be able to post plugin reviews but I noticed on October 16 all of my reviews were deleted and I couldn't make reviews. I sent a support email but never got a response so I'm here now looking for help.

spiral light
fringe perch
#

Where can I ask for help on it ?

rancid hare
#

But I added the spigot 1.18 jar to the libraries

#

Can someone help me?

#

I just try to import Bukkit with the spigot-1.18.jar in the libraries but it isn't working

noble spire
#

?paste

undone axleBOT
noble spire
#

@rancid hare use this^

spiral light
rancid hare
#

omg

#

import org.bukkit.Bukkit;
THAT IS ALL THE CODE

#

But it isn't working

noble spire
#

okok

rancid hare
#

Cannot resolve symbol 'Bukkit'

noble spire
#

What ide are you using?

eternal night
#

reading the release thread on the forums for 1.18 might help

rancid hare
#

?

eternal night
#

the server is now a bundler

rancid hare
#

What?

eternal night
#

the libraries are not inside of it as classfiles but rather the plain jars

#

yea read the forum post

rancid hare
#

Can you give me the link? :/

tardy delta
#

hehe christmas

spiral light
eternal night
#

or use a build tool to handle this for you

#

like a sane developer

rancid hare
#

Oh ok

noble spire
#

maven is nice :)

rancid hare
rancid hare
quaint mantle
#

Gradle is nicer 😀

rancid hare
#

Ok thank you!

eternal night
#

the forum post you just "read" also goes over how to use NMS

quaint mantle
spiral light
#

maven would be easier but i understand you

rancid hare
#

Hmmm

quaint mantle
#

im pretty sure maven would be easier only because you can ignore everything and just copy paste

slim cairn
#

How would I get the location of a block then display it on the Scorebord R4 plugin?

#

Basically, the distance from that block

#

I know that, however how do I show it on a scoreboard

floral pier
#

Why do you use #

tardy delta
#

it's a class method

floral pier
#

Intellij says that's not real code

quaint mantle
#

To not mess non static methods with static ones

eternal night
#

it isn't

#

it is just notation

#

you will find it in javadocs too if you write them

quaint mantle
#

i believe so

floral pier
#

Ah, fair enough. I've never seen that outside this Discord.

slim cairn
quaint mantle
#

honestly i just do foo.bar() for non static and Foo.bar() for static

slim cairn
#

That's your preference 🤷‍♂️

tardy delta
#

dont you need an objective for that?

#

to set text on scoreboard

slim cairn
#

No Idea, I have never made or used a scoreboard

tardy delta
#

google is your best friend

slim cairn
#

Google brought me here

tardy delta
#

uhh :kek:

slim cairn
#

I originally just took a Scoreboard plugin, then added the line ```js
Location#distance(0,64,0)

#

So now I'm here 😄

tardy delta
slim cairn
#

Isn't that C#?

#

That looks too close to C#

tardy delta
#

nah its java

#

c# basics look the same as java

slim cairn
#

Damn are java and C# That Similar?

#

that'll make it a lot easier

tardy delta
#

mwoa in syntax

quaint mantle
#

Yes c# is a java clone

slim cairn
tardy delta
#

it has many stuff java doesnt have

quaint mantle
#

ikr

#

A "Microsoft java" if you want

slim cairn
#

Shut up 🙂

tardy delta
#

that's just microsoft

quaint mantle
#

Microsoft didnt liked that java was able to run on every platform so they made an alternative that works on Windows only

#

nothing but "microsoft java"

tardy delta
#

they have linq uwu

slim cairn
tardy delta
#

what are you looking for?

slim cairn
#

I don't need scoreboard teams, I just want to display the distance from a block

tardy delta
#

setting scores?

#

on a scoreboard?

slim cairn
slim cairn
#

However I'm a total idiot on all things Java 🙂

tardy delta
#

start with creating a scoreboard

slim cairn
#

I already did

grim ice
#

Exception in thread "main" java.lang.NoClassDefFoundError: com/github/kwhat/jnativehook/NativeHookException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632) Caused by: java.lang.ClassNotFoundException: com.github.kwhat.jnativehook.NativeHookException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 7 more

#

help

neon storm
slim cairn
#

I already have, like stated before I just need to know how to display the distance to a specfic block on that scroeboard

tardy delta
#

uhh too long ago

#

i should look it up

#

you need to get a Score object

mortal hare
#

Pro tip who are messing with packets. If you want to send packet in order, instead of delaying the code execution via scheduler use built in method in PlayerConnection in which you can provide FutureListener

#
connection.a(new PacketPlayOutNamedEntitySpawn(spawnSerializer), future -> connection.sendPacket(PacketPlayerEntity.this.infoRemovePacket));```
for example *(this snippet sets the skin of player NPC. And in order to hide the player from tablist you need to delay the remove info packet)* by utilising this, you're executing this as soon as the packet was sent, rather than guessing that at that provided time packet probably was received.
neon storm
slim cairn
#

ye I have no idea what I'm doing

tardy delta
#

Objective#getScore(string)

grim ice
neon storm
#

Oki, don't know then

cobalt elm
#

does anyone got the new mappings for java.lang.ClassNotFoundException: net.minecraft.v1_18_R1.nbt.NBTTagCompound?

slim cairn
#

I dont fully understand

tardy delta
#

there are definataly tutorials on youtube

#

look for them

#

im going to take a nap uwu

slim cairn
#

Sadly there arent

#

Have a good day

frail gale
#

Hey guys so i have one player interact at entity event and i made only to interact on the OFF_HAND so i made event.gethand() == EquipmentSlot.OFF_HAND but it's not firing in the off_hand which is very strange

#

and i don't know why it cannot be fired in the OFF_HAND it fires fine in the MAIN_HAND

mortal hare
#

this could sound strange

#

but do you have any protocol hacking plugins (viaversion, viabackwards, viarewind) on your server?

#

it could be that these plugins are messing with player's protocol packets before it gets to bukkit event api

frail gale
#

@mortal hare i have only viaversion

mortal hare
#

can you try removing that plugin for a bit

#

and see if that's the problem

#

but i doubt it is

frail gale
#

alright i will remove it right now

mortal hare
#

im a chad

#

i dont use mappings

#

because im too lazy to setup it

#

and im fine researching the nms by myself 😄

quaint mantle
frail gale
#

@mortal hare same thing without via version

quaint mantle
#

im sorry

#

What

frail gale
#

is there some other way to check if player hand is off_hand

quaint mantle
#

What do you mean by read

frail gale
#

please guys does someone here know how to check if hand is OFF_HAND without event.getHand() cuz it's not working for some reason on OFF_HAND

quaint mantle
#

thsts not possible

frail gale
#

but why then event.gethand() is not working for OFF_HAND

pastel mauve
#

Hey, i got a little problem with my ChunkGenerator. After I restart the Server, the ChunkGenerator won't exist anymore. My question is how to add the ChunkGenerator again to a world.

Code:

WorldCreator creator = new WorldCreator(name);
creator.generateStructures(false)
  .type(WorldType.FLAT);

ChunkGenerator chunkGen = new CustomGenerator();
creator.generator(chunkGen);

World world = creator.createWorld();
frail gale
#

hmmmm for a very weird reason the event is working for other entites but it's not working for armorstand which is very strange

#

like i can fire for armorstands only with the MainHand

slim cairn
#

Does anyone know how I can display ```js
Location.distance(0, 64, 0)

On a scoreboard
#

I want to show the distance from spawn on a scoreboard

tender shard
#

@next fossil

next fossil
#

Yeah

tender shard
#

let me know once you changed 1.17 to 1.18 everywhere in your pom

next fossil
#

Ok

zealous osprey
#

Is there a way to generate the loot table of a mob with it's type instead of an entityDeathEvent ?

tender shard
#

do you know how to get the loot table in the event?

zealous osprey
#

I dont have an event

tender shard
#

if yes, let me know how, and I'll check the NMS to see if you can also do so in NMS without the event

#

yeah I know

zealous osprey
#

ah

slim cairn
#

Could you elaborate...?

zealous osprey
#

ev.getDrops() ig

tender shard
zealous osprey
#

yes

tender shard
#

alrighty lemme check