#help-development

1 messages · Page 1436 of 1

sturdy venture
#

me and redempt are besties

wraith rapids
#

do you write half of your plugins in .txt files too

waxen plinth
#

You don't have to like it but you can drop it already

#

It's been who knows how long and you won't stop bringing it up like it's the only thing I've ever written

wraith rapids
#

no

ivory sleet
#

It’s fine red I only write Skript

quiet ice
#

The author of Skript must be pretty disturbed of the hate against his creation

quaint mantle
#

lol

ivory sleet
#

Yeah it’s underrated

#

Like honestly Skript isn’t that slow

quaint mantle
#

Only issue with script is that it’s kinda of a bad way to code

ivory sleet
#

Elaborate

#

It’s perfectly fine for small things

eternal oxide
#

Skript was probably fun to write, but if you are going to use Skript you may as well learn full Java and write your own plugin.

wraith rapids
#

👀 why is there a player command preprocess event listener here listening for "/enchant "

#

🙉 what is this for, why is it not a command executor

ivory sleet
#

Thought you were able to inject custom cmd executor in that event nny, no?

wraith rapids
#
    @EventHandler
    public void onCommand(PlayerCommandPreprocessEvent event) {
        if (event.getMessage().startsWith("/enchant ")) {
            boolean customEnch = !CustomEnchantment
                    .getEnchants(event.getPlayer().getInventory().getItemInMainHand(), event.getPlayer().getWorld(), null)
                    .isEmpty();
            Bukkit.getScheduler().scheduleSyncDelayedTask(Storage.plugin, () -> {
                CustomEnchantment.setGlow(event.getPlayer().getInventory().getItemInMainHand(), customEnch,
                        Config.get(event.getPlayer().getWorld()));
            }, 0);
        }
    }
#

i see no reason for this not to be a command executor

ivory sleet
#

Yeah looks sloppy

wraith rapids
#

is this to like listen to other plugins adding/removing enchants

quiet ice
#

This is original zenchantments code, no idea what this does

wraith rapids
#

kinda looks like it's checking whether an item has an enchant before using the command and if that is the case afterwards

#

and if it changes, it's modifying the glow

quiet ice
#

My assumption is that it handles removing the artifical enchantment glow to prevent issues with the 0-dura + enchantments hidden flag

high turret
#

Hey, is it a bad idea to have more than 1 command executor in a single class?

wraith rapids
#

for super small and trivial commands, likely not

#

though i'm not sure if you mean what you say you mean

high turret
# wraith rapids though i'm not sure if you mean what you say you mean

What I meant is, I set the executor for multiple commands to a single class while registering
Then differentiate them and produce different results based on the label
They are pretty small commands, the only reason I'm doing this is because I couldn't find a good way to share data with the setup I have

#

Thanks for the help!

wraith rapids
#

mmmmaybe

high turret
wraith rapids
#

i would probably have several inner classes each being command executors that then call on shared logic from the outer class

quaint mantle
#

?paste

#

$paste

#

!paste

#

/paste

#

?paste

wraith rapids
#

unverified users can't use the bot

quaint mantle
#

how

wraith rapids
#

get verified scrub

quaint mantle
#

oh ok

high turret
wraith rapids
#

or just use hatebin or pastebin or whatever

quaint mantle
wraith rapids
#

i'm sure you can find a paste site online

high turret
quaint mantle
wraith rapids
#

define "doesn't work"

quaint mantle
#

it doesn't appear

#

on join

#

I got an error

#

do you need it?

wraith rapids
#

obviously

quaint mantle
wraith rapids
#

nullpointerexception

#

you are calling a method on a variable or a field that is empty

#

in xyz.lammetaling.lamabuild.user.FirstJoin.onJoin(FirstJoin.java:16)

#

FirstJoin class, line 16

#

i have no clue what it is because you didn't include line numbers

quaint mantle
#

ye that's where it sets

#

it's the set()

wraith rapids
#

well something there is null, then

#

make it not null

quiet ice
#

I recommend Java 15+ as they will literally tell what is null

hoary tiger
#

I wrote a method world.addEntity(creature); the creature class is this https://paste.md-5.net/axejovefam.java and there a major error that I can not put in here. but any ways is there some thing wrong or that I am missing?

wraith rapids
#

paste the error somewhere and link it here

quaint mantle
#

this is better ig

wraith rapids
#

either getInstance return value or the ScoreBoard field is null

#

make them not null

hoary tiger
quaint mantle
#

ok

wraith rapids
#

you are spawning an entity in your entity spawn listener

#

which fires your entity spawn listener

#

which spawns an entity

#

which fires your entity spawn listener

hoary tiger
#

hmm ok I get that but then why isn't my if statement event.getEntity() is Creature not working? Does it look for the super class or...

#

Or does it just not work like that

wraith rapids
#

where is this if statement

hoary tiger
#

line 30

#

o wait

wraith rapids
#

the class you linked only has 28 lines

hoary tiger
#

sorry

wraith rapids
#

check the instanceof of getHandle

#

i'm not sure what bukkit does with custom entity types

#

the LivingEntity object you get from event.getEntity() is a Bukkit wrapper over the nms entity

#

the Creature class extends the nms EntityCreature class

#

so bukkit will wrap it with something

quaint mantle
#

@wraith rapids I don't really understand! You said it returns null, but I pasted the code from my other plugin, which works completely fine! No difference

wraith rapids
#

possibly the type obtained from EntityTypes

#

well nullpointerexception means that something is null

#

it doesn't lie

quaint mantle
#

ik

#

but what

wraith rapids
#

split the method call over several lines and see which deference throws it

quaint mantle
#

ok

wraith rapids
#
LamaBuild
    .getInstance()
    .ScoreBoard
    .set(p);
tulip lodge
#
package me.mrs.mykit;

import java.util.ArrayList;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

import net.md_5.bungee.api.ChatColor;

public class MyKit extends JavaPlugin{

    public void onEnable() {
        saveConfig();
    }
    
    public void onDisable() {
        
    }
    
    public void starterKit(Player player) {
        for (String displayLore : this.getConfig().getStringList("Starter.Item-1.Lore")) {
            String displayName = this.getConfig().getString("Starter.Item-1.Display-Name");
            Material material = Material.valueOf(this.getConfig().getString("Starter.Item-1.Type"));
            int amount = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Amout"));
            int slot = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Inventory-Slot"));
            this.createKit(player, slot, displayName, displayLore, material, amount);    
        }
    }
    
    public void createKit(Player player, int slot, String name, String lore, Material material, int amount) {
        ItemStack item = new ItemStack(material, amount);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
        ArrayList<Object> lorelist = new ArrayList<Object>();
        lorelist.add(lore);
        item.setItemMeta(meta);
        player.getInventory().setItem(slot, item);
    
}

==
I wrote this code and set it to command. It does not receive an error from the command class. It seems that this plugin does not receive any information from the config file. Can you help?

wraith rapids
#

saveDefaultConfig

quaint mantle
#
    public void set(Player p) {
        Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
        Objective ob = board.registerNewObjective("main", "dummy");
        ob.setDisplaySlot(DisplaySlot.SIDEBAR);
        
        ob.setDisplayName("§b§lLamaBuild");
        
        //Team level = board.registerNewTeam("level");
        //Team online = board.registerNewTeam("online");
        //Team tokens = board.registerNewTeam("tokens");
        
        ob.getScore("§0§9").setScore(12);
        ob.getScore("§8➢ §7Dein Rang:").setScore(11);
        //ob.getScore("§e" + RANK.getRank(p)).setScore(10);
        ob.getScore("§1§3").setScore(9);
        ob.getScore("§8➢ §7Dein Level").setScore(8);
        ob.getScore("§d").setScore(7);
        ob.getScore("§8➢ §7Deine Tokens").setScore(6);
        ob.getScore("§d§e").setScore(5);
        ob.getScore("§1§2").setScore(4);
        ob.getScore("§8➢ §7Online").setScore(3);
        ob.getScore("§e").setScore(2);
        ob.getScore("§1").setScore(1);
        ob.getScore("§b§lLamaBuild.NET").setScore(0);
        
        //level.addEntry("§d");
        //level.setPrefix("§e" + LEVEL.getLevel(p));
        //online.addEntry("§e");
        //online.setPrefix("§e" + Bukkit.getOnlinePlayers().size() + "§8/" + "§e" + Bukkit.getMaxPlayers());
        //tokens.addEntry("§d§e");
        //tokens.setPrefix("§e" + TOKENS.getTokens(p));
        
        p.setScoreboard(board);
    }```
@wraith rapids this is my code now and it still throws error
wraith rapids
#

yes, but what is the error

quaint mantle
#

null pointer exception

wraith rapids
#

FirstJoin.java:22)

#

what is this line

tulip lodge
#
package me.mrs.mykit;

import java.util.ArrayList;

import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

import net.md_5.bungee.api.ChatColor;

public class MyKit extends JavaPlugin{

    public void onEnable() {
        saveDefaultConfig();
    }
    
    public void onDisable() {
        
    }
    
    public void starterKit(Player player) {
        for (String displayLore : this.getConfig().getStringList("Starter.Item-1.Lore")) {
            String displayName = this.getConfig().getString("Starter.Item-1.Display-Name");
            Material material = Material.valueOf(this.getConfig().getString("Starter.Item-1.Type"));
            int amount = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Amout"));
            int slot = Integer.valueOf(this.getConfig().getInt("Starter.Item-1.Inventory-Slot"));
            this.createKit(player, slot, displayName, displayLore, material, amount);    
        }
    }
    
    public void createKit(Player player, int slot, String name, String lore, Material material, int amount) {
        ItemStack item = new ItemStack(material, amount);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
        ArrayList<Object> lorelist = new ArrayList<Object>();
        lorelist.add(lore);
        item.setItemMeta(meta);
        player.getInventory().setItem(slot, item);
    
}

==
I wrote this code and set it to command. It does not receive an error from the command class. It seems that this plugin does not receive any information from the config file. Can you help?

quaint mantle
#

scoreboard.set

#

LamaBuild.getInstance().ScoreBoard.set(p);

wraith rapids
#

the ScoreBoard field is null

tulip lodge
#

I also tested config save and config intervention save

wraith rapids
#

to listen to commands you need to implement CommandExecutor

wraith rapids
#

by overriding onCommand

tulip lodge
#

?

#

i user cmd executor

wraith rapids
#

you are receiving no information because you are not listening to any information

tulip lodge
#

i created class command

wraith rapids
#

you haven't set it as the executor of any of your commands

tulip lodge
#

yes

#

i have configurable the config
yml

wraith rapids
#

you aren't setting the class you created as the executor of any commands

#

the class you created is unused

#

you are literally doing nothing in your onEnable

#

your plugin does nothing

tulip lodge
#

This code you see is from yesterday

#

i was today changed this code

wraith rapids
#

well then I can't help you

#

you have given me no information

tulip lodge
#

I wrote this code and set it to command. It does not receive an error from the command class. It seems that this plugin does not receive any information from the config file. Can you help?

wraith rapids
#

again, you aren't doing anything

tulip lodge
#

give kit with command

wraith rapids
#

your plugin does literally nothing other than reload its own config

tulip lodge
#

ommmm ok

fringe imp
#

hey, I'm having some issues with the LivingEntity.getTargetBlock() method. The javadocs say that the maxDistance 'may be further limited by your server.' What server setting controls this?

wraith rapids
#

probably view distance

#

as in loaded chunks

fringe imp
#

hmm. I've got my max server render distance at 12 chunks, but it's still restricting me to about 120 blocks

gaunt oyster
#

hi how i can setup my server?

wraith rapids
#

in the #help-server channel

gaunt oyster
#

okay thanks

quaint mantle
#

Hey I'm currently working on a very simple command and it used to work but doesn't work anymore...

package cypphi.randomitemskyblock.commands;

import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class info implements CommandExecutor {

    public RandomItemSkyblock main = null;
    public info(RandomItemSkyblock main) {
        this.main = main;
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (label.equalsIgnoreCase("randomitemskyblock")) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
                return true;
            }
            else {
                sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
                return true;
            }
        }

        return false;
    }
}
wraith rapids
#

define doesn't work

#

don't compare the label

#

the label is not under your control

#

the label may be anything

#

compare cmd.getName()

quaint mantle
wraith rapids
#

(label.equalsIgnoreCase("r

#

the label is the alias of the command used

#

which can be configured by the end user

lilac bane
#

Hello, a question on a spigot server can mods be added

wraith rapids
#

for example, I may alias your randomitemskyblock command to /risk

#

and then label would be equals to "risk", rather than randomitemskyblock

#

and your command executor would fail

#

compare the command's actual name instead, cmd.getName()

#

that cannot be changed by the end user

quaint mantle
#

ohhh so it would be if (cmd.getName("randomitemskyblock")) {

wraith rapids
#

cmd.getName() returns a String

#

you can then compare this string to another string

#

cmd.getName().equalsIgnoreCase("randomitemskyblock")

quaint mantle
#

oh woops, lemme try that

brisk vessel
lilac bane
#

Hello, a question on a spigot server can mods be added

fringe imp
wraith rapids
#

that tutorial looks very horrible

#

try another tutorial

wraith rapids
#

that tutorial is trash

#

it's probably incorrect to begin with

#

try a better tutorial

quaint mantle
#

hmm, I updated the code and built it but whenever I use the command I dont get the expected message response, but no error either

package cypphi.randomitemskyblock.commands;

import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class info implements CommandExecutor {

    public RandomItemSkyblock main = null;
    public info(RandomItemSkyblock main) {
        this.main = main;
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("randomitemskyblock")) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
                return true;
            }
            else {
                sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
                return true;
            }
        }
        return false;
    }
}
wraith rapids
#

have you declared a command named "randomitemskyblock" in your plugin.yml

quaint mantle
#
@Override
    public void onEnable() {
        // Plugin startup logic

        getCommand("randomitemskyblock").setExecutor(new info(this));
    }
wraith rapids
#

you can drop the command name comparison entirely

#

since you are only setting that as the executor of one command, it will only be called when that particular command is used

#

meaning the command name will always be the same

lilac bane
#

Hello, a question on a spigot server can mods be added???

wraith rapids
#

no

brisk vessel
#

Either you choose a modded server or spigot, can't mix both

rotund ravine
#

Magma

wraith rapids
#

well there are some hybrid implementations but they are generally pretty shit and unstable

wispy fossil
#

mohist?

rotund ravine
#

Sortof hacky and inbetween

quaint mantle
#

im starting to doubt if this is even correct because it still doesn't work 😔

    @Override
    public void onEnable() {
        // Plugin startup logic

        getCommand("randomitemskyblock").setExecutor(new info(this));
    }
wraith rapids
#

did you drop the name comparison

quaint mantle
#

yes it's this rn

package cypphi.randomitemskyblock.commands;

import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class info implements CommandExecutor {

    public RandomItemSkyblock main = null;
    public info(RandomItemSkyblock main) {
        this.main = main;
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;
            player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
            return true;
        }
        else {
            sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
            return true;
        }
    }
}
wraith rapids
#

well

#

call info Info

#

and add some System.out debug messages i guess

#

see if it's getting called at all

#

also you don't need to check and cast to player

#

all CommandSenders have the sendMessage method, so it doesn't matter which kind of CommandSender it is

quaint mantle
#

oh yeah right

dusty herald
#

do u ever speak in other channels NNYa

quaint mantle
#

ok so I got this now

package cypphi.randomitemskyblock.commands;

import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class Info implements CommandExecutor {

    public RandomItemSkyblock main = null;
    public Info(RandomItemSkyblock main) {
        this.main = main;
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player player = (Player) sender;
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
        return true;
    }
}
#

this doesnt look very right

#

(i gtg real quick ill be back in like 5 ish minutes)

dusty herald
#

there isn't a reason for it to be declared as null exp since it gets defined during the classes construction

wraith rapids
#

other than the null assignment, it looks fine

#

declaring a field or variable but not assigning anything in it is the same as declaring it and assigning null to it

#

because null is the absence of anything

quaint mantle
#

oh im back

wraith rapids
#

now you're casting the sender to player without checking that it's a player

quaint mantle
#

what do i do with that null thingy? Do i just remove it? (i kinda dont know what im doing, but thats why im learning)

wraith rapids
#

drop the cast

quaint mantle
#

I think I fixed it all

package cypphi.randomitemskyblock.commands;

import cypphi.randomitemskyblock.RandomItemSkyblock;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class Info implements CommandExecutor {

    public RandomItemSkyblock main = null;
    public Info(RandomItemSkyblock main) {
        this.main = main;
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
        return true;
    }
}
wraith rapids
#

looks fine

quaint mantle
#

do I now just remove that null thing?

wraith rapids
#

you can remove it or leave it, either way it does the exact same thing

#

assigning it as null may be more verbose for a beginner and be easier to realize that it indeed is naturally null until you assign something else there

quaint mantle
#

so just this is also fine?

public class Info implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lThis server is running a custom plugin recreation of the RandomItemSkyblock datapack and is used as core of the server!"));
        return true;
    }
}
quaint mantle
wraith rapids
#

i'm talking about this = null; exclusively, for the record

#

public RandomItemSkyblock main = null;
and
public RandomItemSkyblock main;
are the same thing

#

you should make the field private, however

muted idol
#

hey there anyone that knows about pub/sub with jedis/redis? i have created a basic jedis pool with a listener which extends jedispubsub, how would i go about continuing? i want to be able to run public void's on for example server 2 while a player is on server 1. and this would not work with the bungee plugin messaging system since there are no players on server 2

quaint mantle
#

if I make it private it shows errors tho

wraith rapids
#

what errors

quaint mantle
wraith rapids
#

don't make the constructor private

#

make the field private

quaint mantle
#
public class Info implements CommandExecutor {

    private RandomItemSkyblock main = null;
    public Info(RandomItemSkyblock main) {
        this.main = main;
    }

this?

wraith rapids
#

yes

quaint mantle
#

this is now highlighted tho, does that mean anything

wraith rapids
#

read the warning and it'll tell you why it's highlighted

quaint mantle
wraith rapids
#

you are never using that field

#

did you write it yourself or did you copy it from somewhere

quaint mantle
#

I got that thingy from someone else, im not even sure what it does tbh lol (i asked for help and he gave me this and it was still broken)

wraith rapids
#

you can just delete it then

#

do some of these

quaint mantle
#

hm okay

#

now i'd end up with this though

wraith rapids
#

you removed the constructor so now it doesn't take any parameters, but you are trying to give it 1 parameter

quaint mantle
#

oh what do I do there?

wraith rapids
#

you learn java

quaint mantle
#

fair enough, im tryna learn java through using it instead of watching 10 tutorials and copying code while still not knowing what im doing

wraith rapids
#

you should still read up on some things that explain what things are and what they do

#

what a constructor is, how to call one, what a method is, what parameters are

#

fields and what they're used for

#

just the absolute basics

quaint mantle
#

yeah, I'll do that and come back on it when I know more about it

muted idol
#

hey there how would i go about using remote method invocation to run public void's over servers? (bungeecord)

wraith rapids
#

have you tried googling

#

i'm sure at least one guide for jedis/redis/pubsub exists on the internet

#

this is like day 5 of you asking this in this channel

muted idol
wraith rapids
#

maybe look into sockets

#

at least those are straight forward

#

well, straight forward-er

muted idol
# wraith rapids maybe look into sockets

well let's say that i want to continue with redis pubsub. how would i go about making a database. i went to the official redis page on how to set up a database and it looks like i need linux to do that

wraith rapids
#

you need something to host the database on

#

you can host it from a plugin

#

or more specifically, you can host it on the same system the minecraft server is on, and run it through the plugin

acoustic token
#

error: package org.bukkit.entity does not exist
import org.bukkit.entity.Player;

how do you fix this error im using gradle as a bulid tool

#

having a bunch of similar errors as well

sage swift
#

you dont have dependency set up correctly

acoustic token
#

how do i set that up

sage swift
#

has the link to intellij if needed

acoustic token
#

this uses maven is it possible to set it up with gradle

wraith rapids
#

google "spigot gradle tutorial"

acoustic token
wraith rapids
#

in the future I expect you to be able to use google without aid

hollow arch
#

Hey hey! 👋 - Has anyone used Toml before? I can't seem to find an easy /native way to update values

ivory sleet
#

what lib r u using?

chilly meadow
#

so how hard would a custom vault plugin which only accepts certain approved items be? I am considering making this

ivory sleet
#

can you give more concrete context, how is the approval of the items going to work for instance

hollow arch
ivory sleet
#

do you want to update a Toml object or a file?

hollow arch
#

a value in the file

#

ah wait nvm I'm dumb

ivory sleet
#

TomlWriter?

#

define normal ai

#

Idk what u mean with "the normal AI"

#

assuming its not "the default one"

cedar zinc
#

I'm trying to create a plugin which displays a video for a player. This is the concept

The player gets a link from a sector, like /sendvideo @e[region=regio]

The player needs to open the link, when he opened the link, the controller gets to see which players are connected. And the controller can start the video at once so everyone gets to see it in sync

Could this be possible, and how? And do you guys maybe have some link for getting started into this way?

paper viper
#

have you gotten the video part done?

#

cause the video part itself.. is not easy at all

ivory sleet
#

just use pulses media lib

paper viper
#

lol

#

still in development tho

ivory sleet
#

true

paper viper
#

but it works for windows and mac

#

i just need to add linux support

hoary tiger
#

Ans sorry for the repost

chilly meadow
#

I've recently been getting into Fabric modding, though

sage swift
#

please help how do i _ _ _ _ _ _ _ _ ?

quaint mantle
#

can someone help me ?

wispy fossil
#

does anybody know how to _ _?

onyx shale
#

anyone got the offset for a perfectly centered armorstand arm for blocks?

#

nvm think i nailed it

stuck stream
#

Hello anyone around to answer questions?

#

Not sure why this is happening ;-;

sage swift
#

what version are you using

stuck stream
#

Of Minecraft? 1.16.5

#

Whatever the latest is

cold tartan
#

how do you summon new entities?

#

like in the context of:
addPassenger()

#

got it

stuck stream
#

;-;

cold tartan
#

i cant figure out why this gives an error on loading:

[tutorial] tutorial v1.0 attempted to register an invalid EventHandler method signature "public static void com.defiantburger.tutorial.events.tutorialEvents.onDismount(org.spigotmc.event.entity.EntityDismountEvent,org.bukkit.entity.Entity,org.bukkit.entity.LivingEntity)" in class com.defiantburger.tutorial.events.tutorialEvents
dense kestrel
sage swift
#

you cant have any other arguments in the method

#

only the event

dense kestrel
#

change public static void to public void

sage swift
#

no

#

cant have (Event, other)

#

just make it EntityDismountEvent evt

#

then you can use the event itself to get the entities

dense kestrel
#

i didnt notice that part XD

#

either way, it shouldnt be static...

sage swift
#

oh yeah its static too

#

:]

dense kestrel
#

XD

#

thats what i noticed first, didnt even see that comma

#

@cold tartan

@EventHandler
public void onDismount(EntityDismountEvent event) {
      //code
}
#

use that

sage swift
#

then from there you can use getEntity and getDismounted

dense kestrel
#

yea, then youll be good to go 🙂

digital plinth
#

im moving my intellij plugin projects onto a new drive

#

any idea how to find all of them

#

i think they are in different folders

hoary tiger
#

this Listener ```@SuppressWarnings("unchecked")
@EventHandler
public void onSpawn(EntityDeathEvent event) {

    EntityTypes<? extends EntityCreature> type = 
            (EntityTypes<? extends EntityCreature>)
            ((CraftEntity)event.getEntity()).getHandle().getEntityType();
    
    Creature creature = new Creature(type, event.getEntity().getLocation());
    Creature creature2 = new Creature(type, event.getEntity().getLocation());
    WorldServer world = ((CraftWorld)event.getEntity().getWorld()).getHandle();
    
    world.addEntity(creature);
    world.addEntity(creature2);
    
    return;
}``` is throwing a million errors or reapeat is there anything wrong with the code?
quaint mantle
#

yeah maybe a small tip

#

show the errors

young knoll
#

Why is that nms

hoary tiger
young knoll
#

I would still like to know why you’re using NMs

hoary tiger
#

I really don't know I was just altering other people's code trying to understand it along the way

#

I'm sorry

young knoll
#

I would switch to the API

#

Looks like all you are doing is spawning mobs

hoary tiger
#

Yes but I need a way to diffrenciate between the normal mob and the mob I spawned

young knoll
#

Give it pdc data

hoary tiger
#

Alright I'll look into that Thanks!

unkempt peak
#

If a player falls into the void how can i get the position they fell from?

#

like the block they where standing on before they fell

young knoll
#

You’ll have to store the last block they stand on in a map

unkempt peak
#

like just constantly store the player's last stood on block?

young knoll
#

Pretty much

unkempt peak
#

ok makes sense

#

thanks

neon nymph
#

Just to be clear, the AsyncPlayerPreLogin Event keeps the player in "Connecting to server..." until it's returned, right?

hallow willow
#

vali

opal juniper
neon nymph
#

Gotcha, thanks

tulip lodge
#
 mrsadeghi1385 issued server command: /gamemode survival
[10:52:32 INFO]: [mrsadeghi1385: Set own game mode to Survival Mode]
[10:52:36 ERROR]: Could not pass event PlayerDeathEvent to MyKit v1.0
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:308) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at org.bukkit.craftbukkit.v1_13_R2.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:434) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at net.minecraft.server.v1_13_R2.EntityPlayer.die(EntityPlayer.java:493) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at net.minecraft.server.v1_13_R2.EntityLiving.damageEntity(EntityLiving.java:1055) [spigot-1.13.1.jar:git-Spigot-f6a273b-a639ae4]
        at net.minecraft.server.v1_13_R2.EntityHuman.damageEntity(EntityHuman.
#

how to fix this

#

?

eternal oxide
#

you only posted half the error

#

?paste

queen dragonBOT
tulip lodge
#

?paste

queen dragonBOT
tulip lodge
eternal oxide
#

post the FULL error

tulip lodge
#

ok

eternal oxide
#
    The method getPlayer() is undefined for the type PlayerDeathEvent

    at me.mrs.mykit.MyKit.onJoin(MyKit.java:54)```
tulip lodge
#

ok

limber harbor
#

Hello, what is name of plugin, which making big doors, i mean he make door from blocks ? I think I saw this plugin somewhere, but I dont know, whats his name

tacit drift
#

isworld.spawnParticle(Particle.BLOCK_CRACK,block.getLocation(),10, 1, 0.1, 0.1, 0.1,block.getType().getData());

#

🤔

eternal oxide
#

The error tells you exactly what you did wrong

#

well, I assume it does as you cut off your screenshot. Use paste for text not screenshots

tacit drift
#

i don't understand how to use materialdata

drowsy helm
#

whats the rest of the error

tacit drift
eternal oxide
#

thats not even the same error

drowsy helm
#

it is

#

just the end of it

#

got a raw class

#

huh

eternal oxide
#

oh, sorry I was confused by the first part

drowsy helm
#

it returns a Class that extends MaterialData

eternal oxide
#

what is your UpgradeCelll.java:111

tacit drift
#

oh wow, just now i see that i did a typo in the class name

#

kek

drowsy helm
#

lol

eternal oxide
#

use createBlockData not getData

drowsy helm
#

thats the method i was looking for

cosmic fjord
#

how can I check if a player changes his armor?

#

for example if he wars gold armor he gets a message

worn tundra
#

There is no complete event is spigot to check whether a player changes his armor. You can check the ways to equip armor though (inventory clicks & player interaction)

#

But I believe something like Paper had an event for this

onyx shale
#

Yep no event here either use existing libraries or make ur own

hollow sand
#

How do i make it so, when a player dies, It drops a specific item

#

a player head for an example

hollow sand
#
@EventHandler
public void onPlayerDeath(PlayerDeathEvent death) {
//code
}``` ?
gusty gorge
eternal oxide
#

You didn't provide an error, but your code can be simplified by using serialized objects properly. java config.set("spawn", player.getLocation()); //to retrieve Location loc = config.getLocation("spawn");

gusty gorge
#

yh ok makes sense, thank you

eternal oxide
#

You need to return true if your command was processed correctly. returning false results in the command syntax being displayed

limpid drum
#

why is setMaxHealth deprecated and what do i use instead

sullen marlin
#

Did you try reading the docs

grim sage
#

Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() were dragonBattle is the battle linked to my World but it doesn’t work

onyx shale
#

??? dragonBattle.respawn wut

young knoll
#

Perhaps try setting setRespawnPhase

onyx shale
#

lol its actually a api method

grim sage
grim sage
royal trout
#

Hey guys so I'm working on a crate for my server, the plugin I'm using is CrateReloaded. I am trying to implement the custom cards I have made in Xen's trading cards plugin into the prize system of the crates. I have been trying to use both item prizes ie. "item:(tradingcards.Blazeborn 1" line for the code similar to the example crates as well as the command line ie "cmd:(/cards givecard Common Blazeborn (cards.givecard)) but every time I use any code line to do with the cards the whole plugin stops working entirely. any thoughts on what I can do to get this to work? I can send ss of code if u want TIA

modern glacier
#

Someone know a way to send a fake player in plugin development ? like sendblockchange() but for player to send a fake location

young knoll
#

Use the citizens API

modern glacier
#

ok thx

young knoll
#

Or manually set up the PacketPlayOutNamedEntitySpawn

quaint mantle
#

What the falues at the end means? ```java
fireblock.setFlammable(Blocks.BROWN_CARPET, 60, 20);

onyx shale
#

whats fireblock

quaint mantle
#

FireBlock is fire

#

It's literally the fire

#

in Minecraft

#

When you set something on fire, you technically place fire block

onyx shale
#

are you sure ur using spigot

quaint mantle
#

Yes

#

I am trying to make plugin

onyx shale
#

show the code

quaint mantle
#

I don't have the code containing fireblock

#

That's imported from vanilla

onyx shale
#

it doesnt exist in the spigot doc

quaint mantle
#

fireblock is vanilla thing

onyx shale
#

you mean nms

quaint mantle
#

Yeah

#

Basically I am trying to make fire infinite

onyx shale
#

in that case its up for you to find out,the code is obfuscated so its more of a eyeball

#

post how you get fireblock

quaint mantle
#

import net.minecraft.block;

onyx shale
#

thats not how you get it

#

you are casting something

quaint mantle
#

What do you mean?

modern glacier
#

for example

Location from = event.getFrom();

the cast is Location
is the type of your variable

sleek pond
#

wait

#

ehh

#

fair I guess

onyx shale
#

if its that hard to post how you got to fireblock i wont bother looking into source to see the values,fairly simple

quaint mantle
#

I see it

#

I don't have anything like it

#

I just did import net.minecraft.block; and fireblock now can be used in the class

sleek pond
#

just paste the whole method where you are trying to set fireblock

onyx shale
#

let me guess hes gonna paste the import again

sleek pond
#

im guessing that fireblock is a package

#

within which

#

is all the fire stuff

#

the fact that it's not a class or anything

#

unless its a wierdly named static class

onyx shale
#

assuming i looked over nms imports it doesnt exist

#

and is neither a block method

sleek pond
#

really?

#

damn

#

lmao whered he get that from then

onyx shale
#

yeah no ideea where its from as hes not posting the actual code

#

only the method

#

fireBlock doesnt come out of nowhere,you initialized it somewhere

sleek pond
#

how long are you typing

#

jesus

quaint mantle
#
import net.minecraft.block;

public class FireBlock extends AbstractFireBlock {
   public static void bootStrap() {
      FireBlock fireblock = (FireBlock)Blocks.FIRE;
      fireblock.setFlammable(Blocks.BROWN_CARPET, 60, 20);
   }
}

I was hoping when I change 60 or 20 to like 999999 I will make fire infinite.

sleek pond
#

there we go

#

jesus

stuck stream
young knoll
#

Doesn’t 1.16 allow you to set up infinite burn blocks with datapacks

quaint mantle
#

1.16.5

dry beacon
#

Hey, I've got a pretty basic question, I'm trying to check if the player has 64 iron ingots in his main hand, how can I check for a certain value and not just one? My code: ```java
Player player = event.getPlayer();
Material mat = player.getInventory().getItemInMainHand().getType();

    if(mat == Material.IRON_INGOT) {          
          // Do shit here   
    }
}
young knoll
#

item.getAmount

sleek pond
dry beacon
#

thanks!

quaint mantle
#

I am not a coder. I downloaded example plugin with example class and I am trying to edit that so fire is infinite.

sleek pond
#

why are you doing nms then

onyx shale
#

yeah i see nothing about fireblock or abstractfireblock in nms

#

they dont exist

quaint mantle
#

Idk I found it on google, and it does exist in the obfuscated code somewhere

#

Idk where

#

I don't know what nms means tbh

young knoll
#

Well FireBlock is their class

sleek pond
#

yes

quaint mantle
#

Who's

hexed saddle
#

Not really spigot related but more api, however they don't have a discord, maybe someone here knows.
I'm building a phone plugin so people can call eachother, however, currently people who have been muted can call due to the commands.
We use litebans, so I was hoping to use their api to check if the user is muted or not, all good so far.
The only issue I am having is that when using the following code:

if (LiteBansFetcher.get().isPlayerMuted(p.getUniqueId(), "0.0.0.0")) {
            p.sendMessage(simCardClass.messages.getChatMessage("messages.muted_player_error"));
            return true;
        }

the error I receive in console is that I cannot run this in main threat, and need to run it async.
I myself an not that experienced with multiple threats in code, but wouldn't that cause the command to feel slow if I have to pull down every single time who is muted on every single command?
I aint asking for code rlly, more just, would running the check async cause it to become slow af?

Error:

- Caused by: java.lang.IllegalStateException: Database queries cannot be executed on the main server thread!
sleek pond
#

and where does AbstractFireBlock come from

quaint mantle
#

Also from net.minecraft.block

sleek pond
#

how do you know that

sleek pond
quaint mantle
#

I don't. Idea says it is existing class. I copied it from forum.

hexed saddle
sleek pond
#

not really

hexed saddle
sleek pond
#

it's basically the same

quaint mantle
#

It does compile tho

sleek pond
#

but on the main thread, until the query is returned, the main thread hangs

#

which you shouldn't do

onyx shale
hexed saddle
#

Gotcha, now, running async, is that using a runnable or?

onyx shale
#

yeah not sure what witchery ur on

quaint mantle
#

I don't understand

onyx shale
#

you downloaded a already made class by someone

sleek pond
#

go to the block package

onyx shale
#

seems like

quaint mantle
#

How do I disable moving a enderegg into a shulker box?

sleek pond
#

I think that woudl be the best way

young knoll
#

It does exist

#

Found the yarn mapping for it

hexed saddle
onyx shale
young knoll
quaint mantle
#

Yeah that's it

sleek pond
#

wait what

#

isn't that like client

quaint mantle
#

I don't know

onyx shale
#

well im using 1.16.5 spigot with nms

#

no such thing

#

here

quaint mantle
#

I found the obfuscated code

#

The whole class

#

But it is mojang code so I am not sure if I can like paste it on pastebin

#

@young knoll @hexed saddle

    @EventHandler
    public void shulker(InventoryClickEvent event) {
        if(event.getClickedInventory().getType() == InventoryType.SHULKER_BOX) {
            if(event.getCurrentItem().getType() == Material.DRAGON_EGG) {
                event.setCancelled(true);
            }
        }
    }
#

Like this?

onyx shale
#

is it working tho?? or you just have the code

sleek pond
#

@quaint mantle where did you get the project from

quaint mantle
#

github

#

I googled example plugin github

#

But this code isn't from the project

sleek pond
#

send the github link

quaint mantle
#

It builds in the .gradle folder or something

#

I can't change any of the code

sleek pond
#

send a link to the github repo

quaint mantle
sleek pond
#

you couldve just made that yourself

quaint mantle
#

I don't know how tho

young knoll
#

They have an event listener they don’t even register

grim sage
#

Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() where dragonBattle is the battle linked to my World but it doesn’t work

quaint mantle
#

I removed event listener

#

And command

#

I only kept Main class and deleted most of the code

onyx shale
#

in that case dont work with code and look at tutorials

quaint mantle
#

I just want to make fire infinite

#

My issue has been solved.

#

Like so I set one block in jungle on fire and the whole jungle burns down

onyx shale
#

BlockData -> Lightable -> setLit

quaint mantle
#

What does it?

#

do?

young knoll
#

Just use a datapack

#

And add blocks to the infiburn tags

wraith rapids
#

imagine if we had an API for such things

quaint mantle
#

I would have to set every single block to infiburn

onyx shale
#

we will

#

for bedrock at least

wraith rapids
#

nobody cares about bedrock

quaint mantle
#

Can't I just modify the acting of fire so it doesn't dissapear?

onyx shale
#

we will move to it eventually

wraith rapids
#

we won't

onyx shale
#

were alrdy forced to move soon to microsoft with our java acc

wraith rapids
#

not really

#

and if we are, bukkit will die

onyx shale
#

its alrdy decided

wraith rapids
#

yeah but that doesn't mean what you think it means

onyx shale
#

they will waste only so much before giving up on java

#

as its unprofitable

young knoll
hexed saddle
wraith rapids
#

wut

quaint mantle
#

Btw good luck with changing all source codes to Java 16 when 1.17 comes. Every single mod, every single plugin, every single source code of spigot, paper and everything else will have to be updated to Java 16. Sure it might work without it but since Minecraft will support Java 16, I don't see reason why to keep mods and plugins on Java 8

onyx shale
#

shulker eventually implements Inventory

quaint mantle
#

Because currently most mods and plugins are made with Java 8

young knoll
#

You do realize Java is fairly backwards compatible

wraith rapids
#

paper has already pushed for java 11

onyx shale
#

well 1.17 will roll out forcing java 16

#

so not sure why go for 8

quaint mantle
young knoll
#

Yes but why would updating to java 16 break things

onyx shale
#

unlikely to break

#

anything

wraith rapids
#

the only things that'll break are like _ variable names and reflection

quaint mantle
#

It won't but you can do some stuff slightly better

young knoll
#

Also 1.17 only forces java 16 on the client

quaint mantle
#

Performance wise

onyx shale
#

unkown after all the server is also compiled on java 16

wraith rapids
#

if you cared about performance you wouldn't be in this discord

quaint mantle
#

So modifying it with the new features of Java 16 in mind isn't bad idea

onyx shale
#

from the client

quaint mantle
#
public void disableEnderEgg(InventoryClickEvent event) {
        InventoryType inv = event.getWhoClicked().getOpenInventory().getType();
        Material item = event.getCurrentItem().getType();

        if(inv == InventoryType.SHULKER_BOX || inv == InventoryType.ENDER_CHEST) {
            if(item == Material.DRAGON_EGG) {
                event.setCancelled(true);
            }
        }
    }
#

Anyways I feel like Minecraft 1.17 will run so much better

wraith rapids
#

probably not

onyx shale
#

wont rly

#

its still java

wraith rapids
#

if anything it's going to run like shit because of the sound mechanics they added

young knoll
#

You seem to think java is some terrible language

quaint mantle
#

But Java 16 has better performance than Java 8

wraith rapids
#

that shit is going to weigh like crazy

#

yes but not significantly

onyx shale
#

still a single thread process

young knoll
#

Java isn’t that bad, minecraft is just a mess

wraith rapids
#

and you can already run the server or client on newer versions of java if you want

quaint mantle
wraith rapids
#

1.17 changes literally nothing in that regard

young knoll
#

I mean it’s not all single threaded

onyx shale
#

if it ever happens its gonna be on bedrock

wraith rapids
#

100% not a single thread process

#

there are hundreds of threads

quaint mantle
onyx shale
#

but not rly the important ones

wraith rapids
#

not necessarily

#

paper for example has offloaded chunk loading and generation off the main thread

#

and light is already on its own thread

onyx shale
#

like good yeah we have login chat and small things

errant drift
#

Mob tracking

wraith rapids
#

we have way more than chat and small things

#

only the main tick loop still happens on a single thread

quaint mantle
wraith rapids
#

obviously yes

onyx shale
#

maybe theyl scrap up some shitty multithread with that c++

wraith rapids
#

but it's better now than it was 3 years ago

#

significantly better

quaint mantle
#

Yeah it is

#

But the problem is that for example 1.12 spigot runs still better with all the stuff mostly on single thread than 1.16 paper because 1.16 it self is huge mess

wraith rapids
#

that's because mojang is prioritizing shitting out the maximum number of features in the minimum span of time

#

and so their implementation of everything is super sloppy

onyx shale
#

well with new stuff comes more performance cost

quaint mantle
#

So even when paper has offloaded chunk generation and other stuff on different thread, it didn't changed much and it still runs mostly same

onyx shale
#

ofc 1.8 will run much better than 1.16

wraith rapids
#

look at fucking villagers for example

young knoll
#

I still believe Mojang could spew out 10x the content if they really wanted to

wraith rapids
#

it took them 2 major versions to bandaid their impact by adding a cooldown on their fucking pathfinding

onyx shale
#

in a normal world they take ~20-25% of tick

errant drift
#

Didn’t mean to mention my bad

quaint mantle
#

1.8 is inanely fast

wraith rapids
#

it's very inane yes

quaint mantle
#

That's just shit

errant drift
#

Tuinity is good enough for 2b to switch

#

Modified tunity but close enough

quaint mantle
#

Tuinity is pretty good ngl

quaint mantle
wraith rapids
#

use google

quaint mantle
#

The modified one

errant drift
#

It’s closed sourced

wraith rapids
#

probably not publicly available

onyx shale
#

most likely another amazing ultra fast much better performance focused insane performance 500$ fork

#

scamming at its finest

quaint mantle
#

Btw I don't get it with Yatopia. The idea it self sounds great on paper but the devs are so stupid and they merge stuff they don't even know what it is doing.

#

wait what is yatopia again?

errant drift
#

It’s not as bad as it use to be

wraith rapids
#

$500 1.8 cannoning paper forks

quaint mantle
#

i've heard it's pretty good

wraith rapids
#

it's trash

quaint mantle
#

Looks like it

onyx shale
#

k boys,now that were all here,lets show our armorstand movement implementations,you go first

quaint mantle
#

The first commit is from 18 hours ago and it is a patch revert

quaint mantle
# quaint mantle wait what is yatopia again?

They basically combined multiple forks of paper into one to get the best features from each fork. It doesn't work that well in reality. But it's because the devs don't even know what they are doing.

#

They don't understand a lot of stuff.

wraith rapids
#

just throw some entity move packets at the player

quaint mantle
onyx shale
quaint mantle
#

It runs worse than paper it self

#

And it is extremely buggy

onyx shale
#

but first im looking if i can get easy way out and yoink a code

#

before i get to make one myself

quaint mantle
#

If you want Yatopia, you better go with Tuinity or Airplane

wraith rapids
#

i'm sure there is some snippet somewhere but it shouldn't be all that very complicated

onyx shale
#

sadly not rly

#

most pets plugin out there are under paywall

#

no free ones implementing complicated things

errant drift
young knoll
#

Can armor stands use AI goals

#

Since they are living entities

quaint mantle
#

Just decompile a public one

onyx shale
#

they do extend livingentity

wraith rapids
#

assign each of the components a vector that represents its location from the center point of the entity and then rotate them around as you see fit

#

then move them all in the cardinal directions and you're done

quaint mantle
#

I've stolen code from a lot of small public plugins

onyx shale
#

its nothing much of a teleport however

#

navigation is the problem

#

so the fker doesnt get stuck in a corner of something

#

or if it needs to jump,fall down

#

however 2nd problem is,theyr packets based

#

so not much AI can be done

wraith rapids
#

leverage existing navigation either by spawning a regular entity and using paper's pathfinder api or implement an entity type and use paper's ai goal api

#

you can hide the existing entity and replace it with your armorstand shit on the protocol layer

onyx shale
#

hmm could actually work

wraith rapids
#

will make shit like collisions and hitboxes and everything much more sane

onyx shale
#

not a bad ideea

#

time to look into pathfinder api i guess

wraith rapids
#

there are two different approaches

quaint mantle
#

I'm too scared to use paper API's

wraith rapids
#

one is to use the pathfinder api to command an entity to navigate to a specific spot or follow another entity

onyx shale
#

well armorstand is a livingentity i might be able to just slap

#

the pathfinder on it

#

if i also add movement attributes and such

wraith rapids
#

and the other is to use the ai goals api and give an entity ai goals like jumping, tracking, fleeing and whatever else is bundled in with the ai routines of the vanilla entities

#

as well as your own custom goals iirc

onyx shale
#

hmm guess ima have fun tonight

wraith rapids
#

the latter has a bit steeper of a learning curve and is more limited but it binds into the vanilla mechanics of the server better as you will be simply modifying goal list for the entity

#

the former is simpler to pull off but requires you to do all of the calculations required to be able to tell the entity to go to a spot you want

#

f.e finding that spot

onyx shale
#

think ima go with pathfinder api combined with a packet hack to hide the entity

#

from there i can simply use the entity location to dictate packets movement

#

for the armorstands

wraith rapids
#

entity location + rotation

onyx shale
#

hmm the pathfindergoal should have a waypoint list though

#

so i should get the angle it should be facing

wraith rapids
#

get the angle it is facing from the packet

blazing scarab
gaunt eagle
#

I am trying to send an actionbar for 1.16.5, but it does not work although it does not give any errors. Can anybody help me?

chrome beacon
#

You can use the spigot api

#

No need for NMS and packets

gaunt eagle
#

Still wondering the reason for this, do you have any idea?

tulip lodge
#

i created the nms system how to setting with porn.xml?

#

?paste

queen dragonBOT
tulip lodge
#

pls help

#

porn.xml

chrome beacon
tulip lodge
#

XD

#

you can help?

chrome beacon
tulip lodge
#

wait for give

#

pls change and give i need

chrome beacon
#

You might want to add some dependencies like spigot

tulip lodge
#

pls give dependencies spigot code

chrome beacon
#

Bro don't ask us to write it for you

tulip lodge
#

this?

#

this picture not for me

#

@chrome beacon

#

?

chrome beacon
upper vale
#

^

#

and click reload maven dependencies in intellij

#

and make sure you have the repo added

tulip lodge
#

ok

upper vale
#

also theres literally a wiki article on spigot on setting up your project with maven lol

tulip lodge
#

this?

upper vale
#

thats the bukkit repo

#

you're trying to get spigot dependency on a bukkit repo

tulip lodge
#

spigot repo how?

upper vale
tulip lodge
#

ok

spring walrus
#

Hello, I am new to Java and plugin development, but I know some basics, so I thought I could create some stats plugin. But I have a problem. How can I listen for harvested items, for example to save stats of how many potatoes player farmed? It seems like I cant listen for PlayerHarvestBlockEvent? So what is this event doing? Im getting this error from it: [14:57:37 ERROR]: [FoxStats] FoxStats v0.0.1 BETA attempted to register an invalid EventHandler method signature "public void eu.skyfox.foxstats.events.EventManager.onPlayerHarvest(org.bukkit.event.player.PlayerHarvestBlockEvent,eu.skyfox.foxstats.storage.MySQL)" in class eu.skyfox.foxstats.events.EventManager

Do I have to listen for something else?

tulip lodge
#

do you have you event class implements Listener?

#

public class name implements Listener

spring walrus
#
{
    MySQL databaze = new MySQL();
    public EventManager()
    {
        databaze.mysqlSetup();
    }
    @EventHandler
    public void onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
    {
        new onPlayerHarvest(e, this.databaze);
        System.out.println("Harvest!");
    }
}```
#

yep

tulip lodge
#

and register event?

spring walrus
#

yes, in main getServer().getPluginManager().registerEvents(new EventManager(), this);

#

other events are working fine... just Harvest event seems to by different?

tulip lodge
#

ok wait i was test your code

#

wait

stuck stream
#

Ok :3 I have to be doing something dumb that I just can't figure out

#

I have Material import and it can't find Material.RAW_FISH

tulip lodge
#

What do you do with the harvest event?

stuck stream
#

🧐

tulip lodge
#

@spring walrus

#

@stuck stream wait

spring walrus
# tulip lodge What do you do with the harvest event?
{
    public onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
    {
        String item = null;
        if(e.getItemsHarvested().get(1).getType() == Material.POTATO)
        {
            item = "potato";
        }
        System.out.println(e.getItemsHarvested().get(1).getType()); //DEBUG
        System.out.println(e.getItemsHarvested().size());//DEBUG


        //write data into database if the harvested item is logged
        if(item == null) return;

        String sqlCommand = "INSERT INTO player_stats (player_name, stats_item, date, value) " +
                "VALUES ('" + e.getPlayer().getName() + "', '" + item +"', NOW(), "+ e.getItemsHarvested().size() +")";
        try
        {
            Statement st = databaze.getConnection().createStatement();
            st.execute(sqlCommand);
        }
        catch(Exception exc)
        {
            System.out.println(exc.getMessage());
        }
    }
}```
tulip lodge
#

What is the meaning of harvest?

spring walrus
#

passing the data into Database.. but it doesnt even get there.. it does not do anything, it is not listennign for that event

stuck stream
#

farming a crop

tulip lodge
#

ok

#

ok wait

spring walrus
stuck stream
spring walrus
#

No, it doesnt

#

it doesnt do anything

stuck stream
#

Does the crop have to be fully grown?

spring walrus
#

on server startup, it just says that it failed to register the event

stuck stream
#

Try messaging the player instead of syste,.out

spring walrus
#

It doesnt listnen I think

stuck stream
#

Oh

tulip lodge
#

why does not work

#

i was test and change your code

#

no work

stuck stream
#

Oh.... you need to register the listener

spring walrus
stuck stream
#

onPlayerHarvest implements Listener

tulip lodge
#

i was register

spring walrus
tulip lodge
#

i was implements

stuck stream
#

That code doesnt show an Event handler oh...

#

yea ok

tulip lodge
#

i can't fix your problem

#

i was noob

#

i was started the new month

stuck stream
#

I'm new as well ;-;

spring walrus
stuck stream
#

Oh yea looks like theres more steps better off using BlockBroken and check if that block is a crop

spring walrus
#

but how do I get how many potatoes were dropped for example? Like.. I still dont understand the meaning of PlayerHarvestBlockEvent, when you cant use it... 😄

stuck stream
#

Honestly just don't get how many were dropped just disable the vanilla drop and generate 1-3

#

of a given crop

spring walrus
#

hmm, mby I could use the BlockDropItemEvent.. But... thats so annoying 😄 there literally exists event specificaly for harvesting crops, but you cant use it.. 😄

#

Mby someone who understands it better will explain it later.. when he reads it 😄

stuck stream
#

Ok my program works with Spigot 1.12 but when i upgrade to 1.15 I get that. What changes about Material between the versions?

grim sage
#

Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() where dragonBattle is the battle linked to my World but it doesn’t work

stuck stream
#

Can you just spawn the entity?

#

Like as a mob

stuck stream
lofty mulch
#

<type>_fish

grim sage
#

Yes but I want the normal battle of the ender dragon and If I spawn the dragon I will have to recreate the bossbar and replace all the Crystals and I’m not sure if the dragon will have the same behaviour that the classic ender dragon fight

lofty mulch
#

like salmon_fish

#

iirc

stuck stream
#

so raw doesnt work?

lofty mulch
#

since 1.12.2 is legacy version

#

you cant use 1.13+ with 1.12.2 api

stuck stream
grim sage
#

It doesn’t work

dry beacon
#

Is there a function to remove a block from inventory by id and amount?

grim sage
#

Already tried

stuck stream
#

damn

grim sage
#

This is the hell lmao

stuck stream
lofty mulch
stuck stream
#

LMAO

lofty mulch
#

and sorry

#

only SALMON

stuck stream
#

but that was only the first 2

#

oh my ss is bad

lofty mulch
#

the second has same error

stuck stream
#

does it have to be lowercase?

quartz anchor
#

check your maven compiler version

lofty mulch
#

should be upper

quaint mantle
#

u have errors in the item stack material

quartz anchor
#

wait which spigot version are you using

#

1.12 or 1.13+?

stuck stream
#

1.16.5 I had 1.12 on accident

#

;-;

#

Thank you @lofty mulch

lofty mulch
#

huh

stuck stream
#

for fixing me fish and glass

#

❤️

lofty mulch
#

is it working?

stuck stream
#

Oh well I have other errors but that's gone so pretty sure

lofty mulch
#

ok

gaunt eagle
#

How do I send an action bar to a player for 1.16.5?

paper viper
fast prairie
paper viper
#

you shouldnt define it or use the methods?

spring walrus
tardy delta
#

do I need to put this inside the onEnable method?

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        event.getPlayer().sendMessage("Welcome to the server!");
    }
tardy delta
#

bcs it doesnt even work

fading lake
#

No

#

Havr you used events before?

tardy delta
#

not yet

#

i'm really new to this

fast prairie
fading lake
#

are you implementing listener at the top of the class? i.e public class Plugin extends JavaPlugin implements Listener

fading lake
tardy delta
#

whoops

fading lake
#

and are you registering it properly?

spring walrus
#

Yes. I have class EventManager, that listens for all the events. And than separate class for every event. The separate classes are called by EventManager, its more clear for me 😅

#

And I have no problem with any other event, just this one.. 😄

foggy bough
#

has anyone learned from the channel "Glak Jack" I need to make sure that he is legit

fading lake
fast prairie
fading lake
#

they're odd tho

spring walrus
tardy delta
#

Is there a tutorial to add a eventmanager class?

#

then I'll try that out

fading lake
#

no dont add event managers

tardy delta
#

oh

cinder thistle
#

most of the time

fading lake
#

thats for people that undersrand the basics

split panther
#

btw, if you never learn Java before, be cautious about YT tutorial, many of them have no clue to do proper Java

cinder thistle
#

^^^

fading lake
cinder thistle
#

most don't follow conventions either

remote light
fast prairie
cinder thistle
#

so if you're learning I recommend you google java coding conventions and learn from TSC

fast prairie
#

Also phones about to die

foggy bough
#

or has anyone learned making plugins from VerveDev

cinder thistle
#

I haven't found a much better option

tardy delta
#

I know Java but learning programming plugins is much more difficult 🥲

cinder thistle
#

it really isn't

tardy delta
#

well in the beginning it is

fading lake
#

the problem with TSC is their developers all have completely different coding styles, so their tutorials are sometimes really different from eachother

#

Wait the send button is bluer

#

huh

cinder thistle
#

they should all have the same conventions

cinder thistle
fading lake
#

I use white theme so I don't see much of it

grim sage
#

Hey pls someone know how to restart the ender dragon fight as if a player placed the 4 ender crystal on the portal, I have tried to use dragonBattle.initiateRespawn() where dragonBattle is the battle linked to my World but it doesn’t work

paper viper
ivory sleet
paper viper
#

i bet you havent explored classloading or stuff like methodhandles

#

before

spring walrus
# fast prairie Can you send the method here? Just wanna see if there any obvious differences
{
    public onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
    {
        String item = null;
        if(e.getItemsHarvested().get(1).getType() == Material.POTATO)
        {
            item = "potato";
        }
        System.out.println(e.getItemsHarvested().get(1).getType()); //DEBUG
        System.out.println(e.getItemsHarvested().size());//DEBUG


        //write data into database if the harvested item is logged
        if(item == null) return;

        String sqlCommand = "INSERT INTO player_stats (player_name, stats_item, date, value) " +
                "VALUES ('" + e.getPlayer().getName() + "', '" + item +"', NOW(), "+ e.getItemsHarvested().size() +")";
        try
        {
            Statement st = databaze.getConnection().createStatement();
            st.execute(sqlCommand);
        }
        catch(Exception exc)
        {
            System.out.println(exc.getMessage());
        }
    }
}``` here is the method that works
paper viper
#

eww allman

spring walrus
#

its basically the same thing

ivory sleet
#

Bukkit is basically single threaded which can be sort of a relief if you’re new to programming

spring walrus
#

just another event

split panther
#

Java is very very complicated
but many of that you do not need to much, as other developer abstract it away from you

#

tbf, most language is very complicated when you tries to do advanced stuff

foggy bough
#

can someone look over this tutorial and check if it will work?: https://www.youtube.com/watch?v=9_kRspIX2eE&list=RDCMUCDMYO_8-0dY79Y09zxVAIhw&index=9

How to Be Spiderman in Minecraft:

Today we code "Minecraft, But We Can Swing Like Spiderman". A trick using leads, arrows, invisible bats, velocity, and more, makes it so that we can play survival Minecraft without mods and swing like Spider-man.

This isn't really a challenge, it's just a fun thing we added to vanilla Minecraft (this isn't lik...

▶ Play video
ivory sleet
#

Java isn’t very very complicated tbf

split panther
spring walrus
# fast prairie Can you send the method here? Just wanna see if there any obvious differences
{
    public onBlockDropItem(BlockDropItemEvent e, MySQL databaze)
    {
        String item = null;
        if (e.getItems().size() == 0) return;
        if(e.getItems().get(1).getItemStack().getType() == Material.POTATO)
        {
            item = "potato";
        }
        else return;

        System.out.println(e.getItems().get(1).getItemStack().getType());
        System.out.println(e.getItems().size());
        System.out.println(e.getPlayer().getName());


        //write data into database
        String sqlCommand = "INSERT INTO player_stats (player_name, stats_item, date, value) " +
                "VALUES ('" + e.getPlayer().getName() + "', '" + item +"', NOW(), "+ e.getItems().size() +")";
        try
        {
            Statement st = databaze.getConnection().createStatement();
            st.execute(sqlCommand);
        }
        catch(Exception exc)
        {
            System.out.println(exc.getMessage());
        }
    }
}```
#

here, sorry 😄

proper notch
#

If you've never done an OOP language before, it can be a lot to take in.

ivory sleet
#

That’s for sure

paper viper
#

all clickbait

spring walrus
fast prairie
paper viper
#

never watch these types of vidoes

proper notch
#

But like, say you've done some other languages like C, java will be so much easier.

tardy delta
#

I'm doing something wrong

foggy bough
paper viper
#

the reason why intellij does that is cause it warns you

#

if you dont call it

split panther
#

wait... did they use NMS?

paper viper
#

it thinks its unused

split panther
#

ah no

paper viper
#

but for eventhandlers, you dont call it. the event bus does it for you

#

so thats fine

spring walrus
tardy delta
#

but when i join the server there is no "welcome to the server"

proper notch
#

It's just that IJ can't actually tell that method is ever being called, but as long as you register the listener it's fine.

tardy delta
#

I dont need how to fix that

paper viper
spring walrus
# fast prairie I can't see any differences, but I assume it has something to do with passing in...
{
    MySQL databaze = new MySQL();
    public EventManager()
    {
        databaze.mysqlSetup();
    }
    @EventHandler
    public void onPlayerHarvest(PlayerHarvestBlockEvent e, MySQL databaze)
    {
        new onPlayerHarvest(e, this.databaze);
        System.out.println("Harvest!");
    }
    @EventHandler
    public void onBlockDropItem(BlockDropItemEvent e)
    {
        new onBlockDropItem(e, databaze);
    }
}```
This is the event manager. It doesnt even execute the "Harvest!" ... cuz its not listnening. it just throws error on server startup for the first event
paper viper
#

new onPlayerHarvest(e, this.databaze);

#

??

#

new onBlockDropItem(e, databaze);

#

??

#

why?

spring walrus
#

so every event has its own class

paper viper
#

What are you doing in that class?

#

No...

#

why?

#

Just paste the code you use from that class in the event

#

and also the naming, please don't use that name

#

use a better class name

proper notch
#

databaze -> database

paper viper
#

Mhm

proper notch
#

mysqlSetup -> setupMySql/setupMysql

spring walrus
paper viper
#

And also, why are you declaring a new instance everytime the event is called

#

create a manager

#

onPlayerHarvest -> PlayerHarvestManager

#

then create a method in there

#

which accepts the event ig

#

if you really want that

#

after all, you are just declaring new but never actually storing it as a variable and doing anything with it

#

just create a manager

spring walrus
#

Look, Im not a professional developer, im just a guy that is trying to create some plugin... 😄 I just asked if anyone knows why cant i listen for PlayerHarvestBlockEvent. thats all... 😅 I will look into proper class naming etc, thanks for the advice, but that does not solve my main issue...

paper viper
#

no it doesn't, but do you not want to improve?

tardy delta