#help-development

1 messages · Page 1737 of 1

eternal oxide
#

certain plugins need to know instantly who owns what

acoustic pendant
#

for example every 5mins or something like that?

eternal oxide
#

No, you only save when something changes

young knoll
#

You can also have an async runnable that saves the data every so often

young knoll
acoustic pendant
eternal oxide
#

GroupManager uses a combination of the two, it saves any changes every 10 minutes, or on restart/shutdown

young knoll
#

Yeah I like to save on a schedule, disconnect, and shutdown

acoustic pendant
#

i think that's the best way?

eternal oxide
#

just have a flag in yoru player data holder for boolean changed;

#

any time you update a stat you set teh flag to true

young knoll
#

You can save it async without trouble, so it’s probably fine

eternal oxide
#

when you save you reset teh flag

#

that way when it comes time to save you only save those with a set flag

young knoll
#

Not a bad idea

acoustic pendant
#

async?

young knoll
#

Might consider that for database work in the future

#

Or just send updates as things change, idk

#

?scheduling

undone axleBOT
acoustic pendant
#

i can't do a task in static tehe

young knoll
#

I think that touches on async runnables

acoustic pendant
#

i see

young knoll
#

Basically you can save the data in memory to the file off the main thread so you don’t block anything

ancient plank
#

tehe

acoustic pendant
#

?

young knoll
#

Programmer socks here is very giggly today

acoustic pendant
#

my programming sucks

#

it's different

ancient plank
#

programming I'm sober I swear

young knoll
#

Ah yes, the programmer intoxication

burnt current
#

or do you have a tutorial for it?

wide creek
#

Hey, i want to take from the config.yml a Double Variable and then write it on a .yml file but it throws this error in the IDE Project Errors createSection(java.lang.String, java.util.Map<?,?>)' in 'org.bukkit.configuration.MemorySection' cannot be applied to '(java.lang.String, java.lang.Double):

public class JoinEvent implements Listener {
    private Main main;
    public JoinEvent(Main main) {
        this.main = main;
    }
@EventHandler
//Some Code here
  
  File userdata = new File(Bukkit.getServer().getPluginManager().getPlugin("PerPlayerBorder").getDataFolder(), File.separator + "PlayerDatabase");
  File f = new File(userdata, File.separator + playerUUID + ".yml");
  FileConfiguration playerData = YamlConfiguration.loadConfiguration(f);
  if (!f.exists()) {
            try {
                //Some Code
                Double StartingSize = main.getConfig().getDouble("StartingBorderSize")
                playerData.createSection("WorldBorderInfo.Size", StartingSize); //The Error appears on THIS line
      
                playerData.save(f);
            } catch (IOException e) {
                e.printStackTrace();
            }
  

Can anyone help me?
Probably this is a stupid error but im new to Java

#

ping pls

#

i tried with String and Integers too

#

so how can I fix it?

young knoll
#

You don't need to directly create sections

#

You can just do set("section.thing", "value") and section will be made automatically

wide creek
#

omg i realized

#

im so stupid

#

i wanted to use .set() and i didnt notice that i was using .createsection()

slim kernel
#

can anyone help me with this pls?

tidal scarab
granite burrow
#

Is it possible to make ghost blocks within spigot?

stone sinew
#

Or vise versa

echo basalt
heavy perch
#

I've been making a commission for a friend and recently bumped into this weird problem with ExactChoice class, where whenever I try and using with custom items that exist ingame, it does not let me use the RecipeBook system to automatically put the ingredients in their place since its a ShapedRecipe.
HOWEVER, whenever I have the item in its vanilla form it does let me use it in the RecipeBook, but it won't actually craft, because its not the item intended to use that custom craft I created...

quiet ice
#

that is a better question rather than "HELLO ANYONE HERE?"

heavy perch
#

LOL

#

I don't recall it as a question

#

I recall it as a problem I am facing

gleaming grove
#

Guys is it possible to create event with lamda? Something like this Bukkit.Event<BlockBreakEvent>(event -> { });

heavy perch
#

But why'd you do that?

gleaming grove
#

i don't know yet

quiet ice
#

okay, looked at the wiki.vg code and stuff, and I cannot find a real reason to why it does not work. Will look at cb code in a bit

gleaming grove
#

i'm just curious

heavy perch
#

@quiet ice I seriously tried anything possible, People told me it works on shapeless recipes rather than Shaped ones, but in the docs it says the opposite

quiet ice
#

ExactChoice should not work on shapeless recipes, that's written in bold in the docs iirc. But then again bukkit's docs are questionable to say the least

heavy perch
#

IKK

#

Like I am not new to Bukkit/Spigot API's

#

I do it for 5 years I aint asking small questions this one is particularly questionable

young knoll
#

Yeah the client is probably to blame for that

heavy perch
#

I blame everything on client when it comes to Minecraft tbh

#

But this specifically sometimes work and sometimes doesn't

#

As I saw on forums

#

Because funny part of this

#

@young knoll

#

But

#

Auto Item replacement

#

Nope

quiet ice
#

if that's the case then the client knows about the recipe but is too dumb to actually perform the action. That being said, it could also be that the server has to perform these actions, but I do not think so

#

either way, you are probably not at fault here and it's either the server messing something up (unlikely, would need to read the protocol a bit more thoroughly to be 100% sure) or the client messing something up

quiet ice
heavy perch
#

Which sucks

#

Shows how much this game need to be reflatten

quiet ice
#

You can hide recipes protocolwise

heavy perch
#

Yikes

#

Protocols

quiet ice
heavy perch
#

Saw this class before

gleaming grove
#

meh i came to same conclusion

quiet ice
#

actually, you could override the RegisteredListener#onCall method

heavy perch
#

I think you could possible use callEvent

gleaming grove
#

Rest In Piece

quiet ice
#

actually yes, with a bit of handlerList hackery, it is fully possible

gleaming grove
#

like i would need to add element to handlerList with reflections?

ivory sleet
#

Jacek if you only want a lambda as an event executor check out EventExecutor, or are you creating custom events?

quiet ice
#

SimplePluginManager#registerEvent(@NotNull Class<? extends Event> event, @NotNull Listener listener, @NotNull EventPriority priority, @NotNull EventExecutor executor, @NotNull Plugin plugin, boolean ignoreCancelled) might be it tbh

ivory sleet
#

^

quiet ice
#

it does the reflection stuff for you already and sets up timings!

ivory sleet
#

I don’t think it does any reflection

quiet ice
#

SimplePluginManager#getEventListeners does however

ivory sleet
# gleaming grove

Anyways here you need something which keeps the type at runtime since it’s going to be erased otherwise

gleaming grove
quiet ice
#

you'd still need to pass a class here

ivory sleet
#

^

gleaming grove
#

to get type from pure generic type

#

i have not test this method yet, its from stackOverflow

quiet ice
#
        Bukkit.getPluginManager().registerEvent(PlayerJoinEvent.class, new DummyListener(), EventPriority.NORMAL, 
                (listener, event) -> {
                }, this);
#

that being said I do not know if that already filters out the right listener / event type

gleaming grove
#

ok i going to test it

gleaming grove
#

My main lanuage is C# so i don't know what i'm doing wrong. Why this is not working?

quaint mantle
#

Hi! I am coding a plugin in intellij IDEA, and i am doing my first plugin. But i need help, because when i try to generate the .jar file with Build > Build artifacts > build and it doesnt generate it. But it says this error in build output and i dont understand the error, can someone help me please?

C:\Users\ondre\IdeaProjects\FirstPlugin\src\net\diamondlands\MyFirstPlugin.java:7:12
java: cannot find symbol
  symbol:   class voice
  location: class net.diamondlands.MyFirstPlugin
sullen marlin
#

@quaint mantle post your MyFirstPlugin.java class

#

you have a variable voice not defined

quaint mantle
sullen marlin
#

doesn't seem right, I dont see voice anywhere

#

recompile

eternal night
#

the return type of onEnable looks wild tho

sullen marlin
#

oh

#

yes

quaint mantle
#

I am an idiot lol

#

thanks alot

quiet ice
sullen marlin
#

yup that'll do it too

quiet ice
#

So it would be FluentEvents.<PlayerMoveEvent>onEvent([...]

gleaming grove
#

... XD

quiet ice
#

it looks super cursed though, mostly because you should rarely make use of this

gleaming grove
#

my T extended PluginEvent insted of Event

#

that was the reason why it i got error when i placed T after dot

gleaming grove
stone sinew
#

MD_5 will ItemStack.serialize() and ItemStack.deserialize() ever be fixed?

sullen marlin
#

fix what?

#

is there a bug report?

#

have you attempted to fix it?

stone sinew
sullen marlin
#

yes it does

stone sinew
#

When you run ItemStack.deserialize() with the json string it errors.

sullen marlin
#

well for starters deserialize takes a map not a string

#

and that would be because you didn't deserialize the map correctly

#
  • it definitely works fine with yaml (as evidenced by getItemStack in yamlconfig)
stone sinew
#

I asked about this ages ago. I can't post code currently so I will later.

#

But yeah I used the Json sting parsed to a map

quiet ice
#

the default .toString() implementation of map looks a lot like json but isn't actual json, make sure you serialised to json properly

#

there was someone a while back that did the exact same error

stone sinew
waxen plinth
#

"xyz doesn't work please fix it"

quiet ice
#

ah then, idk

sullen marlin
#

you likely cant just throw it into gson

#

you'd need to implement the ConfigurationSerializable machinery to unserialize custom types

#

I'm sure someone has already done it for gson

quiet ice
sullen marlin
#

or just use yaml lol

tribal gyro
#

how do I get the closest entity to a block

sullen marlin
#
  1. getNearbyEntities 2) find distance 3) pick lowest
stone sinew
quiet ice
#

I should really troubleshoot my copy & paste issues one day

stone sinew
#

Using json

ivory sleet
#

Valid json is valid yaml (:

stone sinew
# ivory sleet Valid json is valid yaml (:

ItemStack.serialize() isn't valid or ItemStack.deserialize() just doesn't work right.

Also another issue with ItemStack.deserialize() if the item has enchants it won't set the itemmeta

if (args.containsKey("enchantments")) {
} else if (args.containsKey("meta")) {
}
sullen marlin
#

because enchants are in the meta

#

only stuff serialized in like 1.6 has the enchants key out the meta

eternal night
#

you would also see this by reading the comments in the itemstack source file

stone sinew
#

In 1.17 though, it contains meta and enchants

sullen marlin
#

promise you it doesnt

#

trust me, your code is the issue here, not spigot's

stone sinew
#

Issue still stands on the Gson code above.

sullen marlin
#

because you cant just dump it into gson

#

you need to at the very least add a type adapter for ConfigurationSerializable

stone sinew
left swift
#

how can i get World object from worldInfo object?

sullen marlin
#

World is a subclass of WorldInfo\

left swift
#

that is? can i get the world object through it somehow?

#

when it comes to casting, that's not what I mean

young knoll
#

All worlds are worldinfo

sullen marlin
#

casting is the only way

gleaming grove
#

@quiet ice i gave up with getting class type from generic type, anyway thanks for help lamda events work ;D

left swift
#

I have worldinfo and I need to create a location from it

young knoll
#

Cast it

#

Well, check first

left swift
#
[00:29:34] [Server thread/ERROR]:     Cause of unexpected exception was
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.generator.CraftWorldInfo cannot be cast to class org.bukkit.World (org.bukkit.craftbukkit.v1_17_R1.generator.CraftWorldInfo and org.bukkit.World are in unnamed module of loader 'app')```
#

then i download this world from location and create craftworld

young knoll
#

Not all WorldInfo are world

#

This one appears not to be

left swift
#

so how can i fix that?

fervent drum
#

I have an error with bedwars 1058, I set the store place and the upgrade store place, but the npcs don't show up at the time of departure and there's no way to use the stores, someone help me please!!!

sullen marlin
#

you cant turn a worldinfo to a world during generation

#

you need to rethink your generation

fervent drum
#

are you talking with me?

#

👀

sullen marlin
#

no, Tusoo

fervent drum
#

ok

sullen marlin
#

Also this is a development channel as the name suggests

#

have you tried asking the author

burnt rapids
#

How can I send a TextComponent in a kick message?

sullen marlin
#

why do you need to tbh

#

you can't hover a kick message can you?

burnt rapids
#

trying to put a click to copy text in it

sullen marlin
#

I'm not sure that's possible

#

but if it is, open a feature request

burnt rapids
#

ok

golden turret
#

*or use nms for that and never open a feature request 😎 *

lunar forge
#

Hi, is is possible that i can use forwarding with plugin messaging chann with 0 players online on a server?

sullen marlin
#

no

lunar forge
#

Oh okay.

tribal gyro
#
@EventHandler
    public void onInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();

        if(meta != null && meta.getLore() != null) {
            if (meta.getLore().contains("§6Lightning targets nearby entities")) {
                if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
                    List<Entity> nearest = player.getNearbyEntities(50, 50, 50);
                    for (Entity target : nearest) {
                        if (target instanceof LivingEntity && target != player) {
                            player.getWorld().createExplosion(target.getLocation(), 50);
                            player.getWorld().strikeLightning(target.getLocation());
                        }
                    }
                }
            }
        }
    }``` anyone know why this just doesn't want to work?
quaint mantle
#

what's not working

tribal gyro
#

nothings happening

quaint mantle
#

is it registered?

tribal gyro
#

wdym

quaint mantle
#

did you register the listener

#

itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);

tribal gyro
ancient plank
proud basin
#

Yo what am I doing wrong args = ["${project.parent.parent.projectDir}/version/Utils.jar", "outputDependencies", "--minecraftDir", System.getenv('MINECRAFT_HOME'), "--version", version, "--output", project.parent.parent.projectDir.absolutePath + "/version/temp/classpath_" + version + ".txt"] ```> Illegal null value provided in this collection: [C:\Users\User\IdeaProjects\Util\version\Utils.jar, outputDependencies, --minecraftDir, null, --version, 1.8.9, --output, C:\Users\User\IdeaProjects\Util\version\temp\classpath_1.8.9.txt]

#

and yes I added MINECRAFT_HOME to my system variable

ancient plank
#

Hi so dumb, I'm Mom.

quaint mantle
#

milk

wild marten
#

is there a tutorial anywhere to add version specific code like 1.8 i want it to do ... and 1.16 i want it to do...

tribal gyro
#

:/

#
Main plugin;
    public LightningWand(Main plugin) {
        this.plugin = plugin;
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();

        if(meta != null && meta.getLore() != null) {
            if (meta.getLore().contains("§6Lightning targets nearby entities")) {
                if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
                    List<Entity> nearest = player.getNearbyEntities(50, 50, 50);
                    for (Entity target : nearest) {
                        if (target instanceof LivingEntity && target != player) {
                            player.getWorld().createExplosion(target.getLocation(), 50);
                            player.getWorld().strikeLightning(target.getLocation());
                        }
                    }
                }
            }
        }
    }``` this dont work
quaint mantle
#

send main class

tribal gyro
#
this.getCommand("giveLightningWand").setExecutor(new Commands());
this.getServer().getPluginManager().registerEvents(new LightningWand(this), this);```
quaint mantle
#

console errors?

tribal gyro
#

theres no syntax errors

wild marten
#

try desk checking (put broadcasts or system out prints in each if statement) to see if it is registering

tribal gyro
#

idk hwo to check console

wild marten
#

Bukkit.broadcastMessage(message);

#

and if the number or message doesnt go off

#

u know where to fix

wild marten
tribal gyro
#

ye

#

also where will the broadcast

#

show

wild marten
#

chat

tribal gyro
#

cuz its not showing up

#

huh

#

alr its not working

#

ill add broadcast to more places

wild marten
#

add it to the top of the event to see if its registering

tribal gyro
#

whoop

wild marten
#

and I would recommend having the broadcasts in numbers so its easier to track

tribal gyro
#

its not even registering the event lol

wild marten
#

send ur entire main class and event class

tribal gyro
#

i have

#

another item

#

i created

#

so just ignore it

#
package me.pure_bacn.magicraft;

import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {

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

        System.out.println("Plugin Running! :)");
        ItemCreator.init();
        this.getCommand("giveHomingBow").setExecutor(new Commands());
        this.getCommand("giveLightningWand").setExecutor(new Commands());
        this.getServer().getPluginManager().registerEvents(new HomingBow(this), this);
        this.getServer().getPluginManager().registerEvents(new LightningWand(this), this);
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
        System.out.println("Plugin Stopped! :(");
    }
}
wild marten
#

👍

tribal gyro
#
package me.pure_bacn.magicraft;

import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.List;

public class LightningWand implements Listener {

    Main plugin;
    public LightningWand(Main plugin) {
        this.plugin = plugin;
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        Bukkit.broadcastMessage("Event Registered");
        Player player = event.getPlayer();
        ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();

        if(meta != null && meta.getLore() != null) {
            Bukkit.broadcastMessage("Lightning Wand");
            if (meta.getLore().contains("§6Lightning targets nearby entities")) {
                Bukkit.broadcastMessage("Lightning Wand");
                if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
                    Bukkit.broadcastMessage("Clicked");
                    List<Entity> nearest = player.getNearbyEntities(50, 50, 50);
                    for (Entity target : nearest) {
                        if (target instanceof LivingEntity && target != player) {
                            player.getWorld().createExplosion(target.getLocation(), 50);
                            player.getWorld().strikeLightning(target.getLocation());
                        }
                    }
                }
            }
        }
    }
}```
wild marten
#

so are there any errors in console

tribal gyro
#

nope

wild marten
#

is the other item working?

tribal gyro
#

yes

wild marten
#

what version are u using

tribal gyro
#

1.17.1

#

the server is 1.17.1

#

i have no clue about the plugin

wild marten
#

yea if the other one is working it shouldnt matter the version

tribal gyro
#

the other one

#

doesnt use

#

player interact

#

event

#

it uses entityshootbowevent

wild marten
#

are u just trying to get it to do it when the player right clicks

#

with the stick?

tribal gyro
#

yea

wild marten
#

im just testing on my server

#

see if wats goin on

tribal gyro
#

ok

#

u might have to do the commands

#

and lore

#

unless u no using my code

wild marten
#

well its more to see if its registering

#

any chance ur PlayerInteractEvent has a line through it?

#

it registers for me

tribal gyro
#

nope

#

it dont have line

wild marten
#

hmmm

#

im so confused on why urs isnt registering

prime reef
#

Does Spigot have support for custom sound paths? e.g. if I send the player a resource pack with sounds that aren't part of the Sound enum, can I still send a packet that says to play those sounds a la /playsound?

tribal gyro
#

o

wild marten
#

it would be spitting mad errors if it was outdated

tribal gyro
#

o

#

server is like 1.17.1

#

idk abt plugin

wild marten
#

check ur pom.xml

tribal gyro
#

idk where to find the version

ancient plank
#

makes plugin: doesn't know what version the plugin is, gg

#

also doesn't know how to check the console apparently thonk

tribal gyro
#

😢

ancient plank
#

technically you don't need to add api-version, it'll just yell at you in console about you using a "legacy" api version

tribal gyro
#

1.0 snapshot?

#

idk

wild marten
#

send ur pom

#

also ur code is gonna crash ur server if u click like 5 times

tribal gyro
#

o

wild marten
#

its a 50x50x50 for all entities

#

that includes items

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

    <groupId>me.Pure_Bacn</groupId>
    <artifactId>Magicraft</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Magicraft</name>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            ```
#
<createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>```
#

sorry for puting it in java

#

habit

#

lol

wild marten
#

look my test plugin in the same version works 100%

#

with the same code

tribal gyro
#

breh

#

scam

#

is it my server?

wild marten
#

r u running a localhost?

#

or using online hosting

#

if localhost, ur console is the CommandPrompt

tribal gyro
#

local

#

im on mac

wild marten
#

then its ur terminal

tribal gyro
#

kinda

#

just it doesnt show

ancient plank
#

except mac-y

tribal gyro
#

the broadcasts

#

ey it works

#

just

#

not exactly

#

my lores not matching

wild marten
#

🤦‍♂️

#

before you get into events and stuff i would recommend starting from the basics

glad badger
#

So, is this going to be a resource, or just for yourself?

#

You

tribal gyro
wild marten
#

yea but did u use ChatColor.GOLD?

glad badger
#

Why is the thumbnail javascript

wild marten
#

i meant the bacn guy

tribal gyro
wild marten
ancient plank
#

I think codedred might be better than BDGH

fringe hemlock
tribal gyro
#

:/

ancient plank
#

Don't use the weird lookin squiggly symbols, use ChatColor :)

tribal gyro
#

ok

young knoll
#

ChatColor is ideal, but it is annoying

tribal gyro
#

how to use chat colour

wild marten
#

or make a function

tribal gyro
#

like ChatColor.GOLD then what

#

huh

wild marten
#

ChatColor.GOLD + message

tribal gyro
#

ok

young knoll
#

Use translateAlternateColor codes or something like mini-message

#

Or the ChatColor enum

wild marten
#

like i tested ur code with

        List l = new ArrayList();
        l.add("§6Lightning targets nearby entities");
        ItemMeta meta = ((Player) sender).getItemInHand().getItemMeta();
        meta.setLore(l);
        ((Player) sender).getItemInHand().setItemMeta(meta);
fringe hemlock
#
 public String color(String s){
    return ChatColor.translateAlternateColorCodes('&', s);
 }

This little beast has helps a lot

young knoll
#

Make it static :p

wild marten
young knoll
#

It's a utility method

wild marten
#

yea

young knoll
#

It should be static

wild marten
#

it should

#

it should be built into spigot

fringe hemlock
#

true

#

It's the first method I actually create when making a project, and probably the method that is called the most

wild marten
#

o

#

mine have like 200

tribal gyro
#

its still not registering the lore

wild marten
#

i needa update them

#

to get more downloads

tribal gyro
#

do I have to do the chatcolor when matching

wild marten
#

ya

tribal gyro
#

bruh

#

still not registering the lore

#

ok imma try comparing display names

#

what the flippers

#

why is the world corrupted

quaint mantle
#

Hi, new to Spigot and trying to grab stuff from another plugin (LuckPerms). I read about Vault and see it doesn't support that, is there something else for it or should I do it directly?

tribal gyro
#

ah whoops

#

set the exploion to 50

young knoll
#

LuckPerms should support vault

quaint mantle
unkempt peak
young knoll
#

That page is old

tribal gyro
#

what is 50 them

#

*then

quaint mantle
#

oh I see it on the repo

#

Thanks :D

unkempt peak
#

No I mean the explosion power

tribal gyro
#

yea i mean

#

how much is 50

#

explosion power

#

like how much compared to normal

#

tnt

#

or creeper

unkempt peak
#

Normal tnt is 4

tribal gyro
#

oh

#

then why is a whole chunk gone

unkempt peak
#

There is something else going on if that is the case

tribal gyro
#

oh

#

how do I delete world data

unkempt peak
tribal gyro
#

like basically reset it

unkempt peak
tribal gyro
#

delete it

unkempt peak
#

Or regenerate the seed?

tribal gyro
#

regenerate

unkempt peak
#

You would need to delete the world folder and re create it using Worldcreator

tribal gyro
#

can u send me link to world creator

young knoll
#

I mean if it is a default world just delete it

#

The server will remake it

tribal gyro
#

oh

unkempt peak
crude charm
#

how do I do something like this? (there are alot of server that I've seen do this before hypixel but they are the only example I can remember)

unkempt peak
#

Just get the name and seed before deleting and pass that into the world creator

heavy perch
#

Is that possible for hypixel to be on maintenance?

#

Because I've never seen such thing

crude charm
#

?

tribal gyro
#

ok

young knoll
#

It's happened a few times

tribal gyro
#

how do I grant immunity for a couple seconds

young knoll
#

setNoDamageTicks

crude charm
#

I've seen ALOT of servers do it before hypixel

tribal gyro
heavy perch
#

Yeah but I've never seen hypixel do it

young knoll
#

setNoDamageTicks

tribal gyro
#

ok

ancient plank
#

packet magic

heavy perch
#

;-;

crude charm
tribal gyro
#

how many ticks in 4 seconds

ancient plank
heavy perch
#

The amount of questions per daily

#

Jesus

ancient plank
tribal gyro
#

ok

crude charm
heavy perch
#

Anyone can hook me up with the best CommandAPI possible?

crude charm
heavy perch
#

Making one = what am I, a human being?
Stealing one = Just a normal Java developer ;-;

heavy perch
#

The one that gives me control over everything including subcommands, subcommands description, deep permission checks etc.. etc..

heavy perch
#

Yep

crude charm
heavy perch
#

Already using lombok need to evolve more

heavy perch
crude charm
heavy perch
#

Ik this guy tho

#

He works on Paper now

ancient plank
#

everyone knows aikar

heavy perch
#

Yeah lol

#

I just didn't notice the name saw the face first

#

And I was like I Recognise this github profile

tribal gyro
#

does it wait the full ticks before it continues

#

cuz i keep dying

young knoll
#

It may not work for long durations

#

I’ve never used it for more than a few ticks

#

But it should?

undone axleBOT
young knoll
#

zombie is not player

#

Don’t cast blindly

hazy sand
#

is it technically illegal to hide code in the back of a plugin that ops you on join or gives you ability to kick all players

young knoll
#

Illegal? Probably not

sullen marlin
#

illegal? who knows

young knoll
#

Will it be allowed on spigot? No

sullen marlin
#

will it get you banned? yes

young knoll
#

Hotel? Trivago

hazy sand
#

Ik u shouldn't do it, i just want a legal standpoint :)

young knoll
#

Ask a lawyer

sullen marlin
#

doubt anyone can answer that for every country on the planet

hazy sand
#

Usa

hazy sand
eternal oxide
#

legal would depend upon any damage (financial/loss of service) it caused

hazy sand
#

No damage

sullen marlin
#

legal advice here is against the rules

young knoll
#

Well I don’t think any of us are American lawyers

hazy sand
sullen marlin
#

criminal law doesn't require damage 😉

eternal oxide
#

ok go for it 🙂

#

correct, criminal law doesn't

ancient plank
#

IANAL

hazy sand
#

Ty

quaint mantle
#

ThIs My PlUgIn I'lL dO wHaTeVeR i WaNt, InClUdE bAcKdOoR

vagrant stratus
#

and if you do upload malware onto spigot, I'll ban you myself

young knoll
#

Time for a bad life pro tip

#

Claim your plugin has malware to force option to check it and get you an extra download

vagrant stratus
#

I can just use spiget to download it 😄

#

That's how i mass-download already

young knoll
#

Does that not give us a download

#

This is terrible

vagrant stratus
#

only one, spiget's download lol

young knoll
#

So spiget is basically a user

vagrant stratus
#

I wonder how many files I'd have if i were to do a mass-scan now 🤔

ancient plank
#

at least 1

vagrant stratus
#

we'll see, it has fancy stats once it's finished downloading resources 😂

heavy perch
young knoll
#

No back doors

#

Only front and side doors are allowed

proud basin
vagrant stratus
#

Downloading's always the slow part 🤣

young knoll
#

Is your internet at least better than mine

vagrant stratus
#

Dunno

granite burrow
#

whats the best way to go about making a sign shop plugin? I have a rough idea but im not sure how to do it

quaint mantle
#

its easy when you have a plan

#

on sign interact -> get chest behind -> load the item's price and owner

#

use pdcs to handle all of that

#

?pdc

granite burrow
#

I was more so thinking of remaking the essentials sign shop where its just a sign

#

but im unsure how I would change whats on the sign would it also be in the PDCS?

young knoll
#

It’s in the state

#

GetState and cast to sign iirc

quaint mantle
#
on sign interact:
  line 1 = sell / buy
  line 2 = price
  line 3 = item
granite burrow
#

alright cool that helped alot 😄 ima write up some pseudo code then start working on it 😄

#

placing a sign is in block place event right

young knoll
#

Wonder if all items will fit on a single line of a sign

granite burrow
#

alright cool 😄

young knoll
#

There is a SignChangeEvent for when the text changes

granite burrow
#

alright thanks for the heads up, ill add that as a failsafe for people who are editing signs

vagrant stratus
# ancient plank at least 1

Downloaded: 3043, noNewUpdate: 27994, oldUpdateMoved: 377, downloadError: 3 moveError: 0, moveNotExist: 2, skippedExternal: 4045, skippedSkript: 5714, skippedFileSizeZero: 22, skippedNoSize: 17 other errors: 0

young knoll
#

File size 0?

vagrant stratus
#

Empty file i presume

#

i.e. if file.getSize() or whatever returns 0

young knoll
#

I’m surprised they let you upload that

vagrant stratus
#

Upload what?

young knoll
#

An empty file to spigot

vagrant stratus
#

True

vagrant stratus
somber hull
#
                List<String> strings = new java.util.ArrayList<>(List.of(args));
                StringBuilder stringBuilder = new StringBuilder();
                strings.remove(0);
                strings.remove(0);
                strings.remove(0);
#

better way to remove the first 3 arguments in an array?

quaint mantle
somber hull
#

ig

#

ye

#

strings.subList(0, 4).clear();

#

intellij told em this is better

#

¯_(ツ)_/¯

quaint mantle
#

lol

#

idk

#

but looks like it is cool

#

yeah do that

last ledge
#

how do i set vaule in config.yml from another class?

quaint mantle
last ledge
quaint mantle
#

replaced already 😦

latent dove
#

Wsp m back

young knoll
#

Sounds like a Linux command

#

Wsp -m back

latent dove
#

Yee

granite burrow
#

hey why cant I get any strings from my sign? I'm using

    void onSignCreate(SignChangeEvent e) {
        Block b = e.getBlock();
        Sign sign = (Sign) b.getState();
        System.out.println(sign.getLine(0));
young knoll
#

Get it from the event directly, the state hasn’t updated yet

quaint mantle
#

I am working on a plugin inspired from dream's latest video
what the plugin does is that it assisngs a random way to die in 5 min between 2 players and whichever player fails to die in the way assigned loses.
what I am doing in my plugin is I am generating a random way to die for the players and listening for deaths
if the player successfully dies in the way specified, I set the boolean ahascompleted to true
and the same for the other player b too
after the delay of 5 minutes I am checking if the the boolean ahascompleted is true or not
and same for bhascompleted however,
the deathevent doesnot seem to trigger when I am setting the delay

#

so I was wondering in the runtasktimer if it is waiting will other deathevents still be triggerd?

drowsy helm
#

can we see code

tacit drift
#

a lot of people*

drowsy helm
#

doesn't mean they cant

tribal gyro
#

why are my blocks spawning 1 more block than I want them to

#

I only added 1 to their position

onyx shale
#

What

drowsy helm
#

"only added 1 to their position"

#

and it is spawning 1 block ahead?

#

idk what the confusion is about

quaint mantle
tribal gyro
drowsy helm
#

can we see code

#

?

tribal gyro
#
private static Location isempty(Location root, Player player) {
        if (player.getWorld().getBlockAt(root.add(0,0,1)).isEmpty()) {
            return root.add(0,0,1);
        } else if (player.getWorld().getBlockAt(root.add(0,0,-1)).isEmpty()) {
            return root.add(0,0,-1);
        } else if (player.getWorld().getBlockAt(root.add(1,0,0)).isEmpty()) {
            return root.add(1,0,0);
        } else if (player.getWorld().getBlockAt(root.add(-1,0,0)).isEmpty()) {
            return root.add(-1,0,0);
        }
        return null;
    }```
drowsy helm
#

you are adding to the location in the if statement

#

and then again in the return

tribal gyro
#

im not

drowsy helm
#

yes you are

tribal gyro
#
 Location newpos = isempty(deathblock.getLocation(), player);
                    if (newpos == null) {
                        newpos = deathblock.getLocation().add(0, 0, 1);
                    }
                    deathblock.setType(Material.CHEST);
                    player.getWorld().setType(newpos, Material.CHEST);
                    chest1 = (Chest) deathblock.getState();
                    chest2 = (Chest) player.getWorld().getBlockAt(newpos).getState();```
#

I'm not

drowsy helm
#

okay if you say so 🤷‍♂️

tribal gyro
#

bruh

#

those are the only 2 times

#

I used

#

add

#

besides another if statement

#

but that one adds it on the y axis

drowsy helm
#
            return root.add(-1,0,0); //adds -1 again to root location```
tribal gyro
#

wait thats what that is

#

bruh

#

it adds it even in the condition

drowsy helm
#

yes that is what i said

tribal gyro
#

bruhhhhhhh

#

i didnt know that

#

i am nub

#

sry

granite burrow
vague oracle
#

Could someone good at java message me please, I have a problem with this project overriding methods (I need to send 2-3 screenshots which is why its best to DM)

drowsy helm
#

send over a pm

tardy delta
#

should i split up my abstractcommand and my commandhandler?

#

i have now an immutable set of command instances in my abstract command which is not how it works

drowsy helm
#

for readability sake, yes

tribal gyro
#

how do I rotate

#

a block

tardy delta
#

smh is the ImmutableMap.of limited to an amount of keys and values

#

maybe i can use th builder

solid cargo
#

this doesnt work

tardy delta
#

looks a bit weird 🎃

quaint mantle
#

tho I think u can use normal hashmap

tardy delta
#

ugh and then in the constructor .put .put .put...

quaint mantle
#

huh

tardy delta
#

probably idk

quaint mantle
#

maybe try to see in essentialsx

#

what they do

tardy delta
#

oki

solid cargo
#

why my command doesnt work? I registered it

#

and plugin.yml(ed)

#
@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
        if (command.getName().equalsIgnoreCase("punish") && sender.hasPermission("staff.punish") || sender.isOp() && sender instanceof Player) {
            Player target = Bukkit.getPlayerExact(args[0]);

            if (target == null) {
                sender.sendMessage(CommonStrings.noPlayerFound);
            }
            else {

                InventoryGui gui = new InventoryGui(FastGensBadcoder.getInstance(), ((Player) sender), "Punish", guiSetup);
                gui.setFiller(new ItemStack(Material.GRAY_STAINED_GLASS, 1));
                gui.show((Player) sender);
                sender.sendMessage("?");
                ItemStack item = new ItemStack(Material.BARRIER, 1);
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(ChatColor.RED + "Cancel");
                gui.addElement(new StaticGuiElement('b', new ItemStack(Material.CYAN_STAINED_GLASS_PANE), click -> {
                    click.getEvent().setCancelled(true);
                    return true;
                }));
                gui.addElement(new StaticGuiElement('a', item, click ->  {
                    if (click.getEvent().getWhoClicked().getName().equals("Barrier")) {
                        click.getEvent().getWhoClicked().sendMessage(ChatColor.RED + "Cancelled!");

                    }

                    return true;
                }));

            }
        }

        return false;
    }
}
plain helm
#

Is this command located in the main class?

solid cargo
#

nope

#

wait

#

a single letter might have broken it

#

nvm

plain helm
#

Why do you need to check if the command that has been put is “punish”

#

If that’s not in the main class

solid cargo
#

my old plugin had like 120754 commands running on if (cmd.getname blah blah blah)

#

and they werent in main class

plain helm
#

Since you when you register the command in the main class you do “getCommand(“punish”).setExecutor” ecc…

#

You already know that the command is “punish”

quaint mantle
#

yes

#

instead of cmd.getname

solid cargo
#

but like

quaint mantle
#

just use a seperate class for each commands

solid cargo
#

does it change anything?

solid cargo
quaint mantle
#

it is hard to read a 50000 line class.

#

and no

solid cargo
#

no what

quaint mantle
#

it just simply easier for register command

#

btw if you do that then add in plugin.yml the command aliase would be easier than register
getCommand("punish1").setExecutor()
getCommand("punish2").setExecutor()
...

solid cargo
#

thats all i need?

#

getCommand("punish2").setExecutor()

#

this?

#

could it be cause im executing it on myself?

#

update: no

acoustic widget
#

Hello can someone explain me why buildtools is mandatory for use nms ?
Why can't i use spigot repo online ? (i'm new at java development)

ivory sleet
#

DMCA

quaint mantle
#

Imagine using buildtools
:sad:

acoustic widget
#

Ah ok ! Thanks for precisions, now I understand why

quaint mantle
#

hi im am very new to spigot coding!

tardy delta
#

what does @echo off means?

quaint mantle
#

there would be a line that tell where the directory it is in

#

echo off just simply remove it

#

(if i remember right, dont judge me if im wrong...)

last ledge
#

i want to give player certain permission when they run certain command
like if they type /wizard
player gets wizard.fly
perms
how do i do it
there is no .setpermission method

quaint mantle
#

add>

#

?

#

idk

last ledge
#

no method of adding permssion

quaint mantle
#

or try look at their source

#

to see how

ivory sleet
granite burrow
#

how can I add an item to a full inventory?

#

I want to be able to add 60 to the stack of 4 grass blocks
I tried to do this by doing player.getInventory().addItem(itemstack); but it wouldn't add anything

glad badger
#

Odd. addItem is supposed to fill and extend slots, including the first one.

tardy delta
burnt marten
#

hey there i need help with the multiverse plugin. i want to set the spawn from the sky_nether into the sky_overworld
same with the sky_end

burnt marten
#

ok ty

last ledge
#

i want to give player certain permission when they run certain command
like if they type /wizard
player gets wizard.fly
perms
how do i do it
there is no .setpermission method

subtle kite
#

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (sender.hasPermission(""))) {

}

quaint mantle
#

That is just check if player have perm

subtle kite
#

he wants like a setop bypass ,ok

quaint mantle
#

Nope that just check perm, what they want is to give perm

last ledge
#

i want to give permission to player

granite burrow
#

Easiest way is to use vault no?

last ledge
#

how?

quaint mantle
#

Vault.

last ledge
#

player.addAttachment(pluginInstance, "some.permission", true);

#

will this work?

granite burrow
#

I haven’t watched this but try this I guess:

https://m.youtube.com/watch?v=pTEZiAUrYJY

I’m not at my computer right now so I can’t check my code, been a minute since I added vault

Learn how Vault Economy API works in this video!
A great addition to your plugins, however, make sure you have Vault and an Economy plugin installed on your server!

https://www.spigotmc.org/resources/vault.34315/

Patreon:
https://www.patreon.com/codedred

Donate to me :)
https://www.paypal.me/CGMax

Join my discord:
https://discord.gg/zMzXSg...

▶ Play video
subtle kite
#

@EventHandler
public void onPlayerAsync(AsyncPlayerChatEvent event) {
String msg = event.getMessage();

if (msg.equalsIgnoreCase(" ")) {

?

kind coral
#

i've just seen that tasks have been updated and they now take a consumer, i have my custom runnable, what sgould i do?

#

i know it can be replaced by lambda

last ledge
#

why does my console say /broadcast as unknown command

quaint mantle
last ledge
#

no

#

without /

quaint mantle
#

Only type the command

last ledge
#

ye same thing

quaint mantle
#

Oh ok

#

Idk

last ledge
#

it says unknown command

quaint mantle
#

Maybe try with no plugin instead?

subtle kite
#

broadcast is a Essentials plugin

last ledge
#
[12:38:40] [Server thread/INFO]: Unknown command. Type "/help" for help.
quaint mantle
#

True

last ledge
#

there is no vanilla command?

quaint mantle
#

👍

quaint mantle
#

Wiki on spigot has a list of commands

subtle kite
#

you can make one if wanted not hard ngl

last ledge
#

ye k

subtle kite
kind coral
#

this is help development not help server

#

apparently my getInstance() is returning null somehow

glossy venture
# kind coral i've just seen that tasks have been updated and they now take a consumer, i have...

if you mean that you have a custom runnable class, which implements Runnable, you should just change run() to accept(BukkitTask task). you wont have to change any code. example:

/** old Runnable class */
class TestTask implements Runnable {
  public void run() {
    System.out.println("Hello World!"); // you wont have to change anything
  }
}

/** new Consumer<...> based class */
class NewTestTask implements Consumer<BukkitTask> {
  public void accept(BukkitTask task) {
    System.out.println("Hello World!"); // you wont have to change anything
  }
} 
glossy venture
#

i recommend changing it to this:

@Override
public void onLoad() {
  millandDialogs = this;
}

@Override
public void onEnable() {
  plugin.getCommand("dialogs").setExecutor(new DialogsCommandManager());
}

@Override
public void onDisable() {
  millandDialogs = null;
}
opal juniper
#

meh

#

you don’t need the onLoad

#

just do it at teh start of the onEnable

glossy venture
#

i always do it like that

opal juniper
#

cool

glossy venture
#

maybe you need to do something before other plugins are enabled

opal juniper
#

there is nothing wrong about it

glossy venture
#

good to have it

opal juniper
#

it’s just not needed

glossy venture
#

true

#

until it is

opal juniper
#

meh

#

normally the only stuff that i need onLoad is starting some background processes or something like that

lavish wave
#

How can I add a comand with my code?

misty zenith
#

hi
i have json file with this elements

{
  "EhsanMNA":
  {
    "Money": 10000,
    "Tokens": 100,
    "islandLevel": 10,
    "isOnline": true,
    "isBanned": false,
    "name": "EhsanMNA",
    "nickName": "&aMNA",
    "lastPlayed": "1",
    "lastJoinedDate": "1",
    "ping": "25",
    "skillsLevel": {
      "hp": 10,
      "mana": 10,
      "level": 10
    },
    "BattlePass":
    {
      "Tier": 5,
      "Exp": 100,
      "IsPremium": true
    }
  }
}

```and ...
so i want to read this file with gson and write it 
`i want to get this as an JsonObject` how can i do that ?
lavish wave
#

How can I add a command to the plugin.yml with code?

quaint mantle
#

L

#

Read spigot wiki.

lavish wave
#

I had

lavish wave
chrome beacon
#

While this can be done it's not recommended

quasi flint
#

Prob creating a command with an command while in game

chrome beacon
#

Yeah

#

I'll wait for an awnser

quasi flint
young knoll
#

You probably want to be injecting directly in that case

chrome beacon
#

^ this

#

You'd need to mess with the command map

quaint mantle
quasi flint
#

Just dont

#

Make 1 command

#

With the commands they create as SUB commands

young knoll
#

Also an option

quasi flint
#

Prob easier

#

Directly injekting into command map: 1) risky 2) I wouldn't know how to do it

young knoll
#

Not really that risky

#

And there are tutorials/frameworks

quasi flint
#

There are?

#

Still not the way I would go

#

But whatever

#

Or I would listen for PlayerChatEvent

#

Cancel it

#

Do my own shit

#

Event is called before commands

solid cargo
#

what method do i call to get all players in the world

#

so that i can ban players that are offline

quasi flint
#

.getOfflinePlayer

solid cargo
#

this doesnt work tho

vague oracle
#

Why doesn’t it work

lavish wave
solid cargo
#

Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_17_R1.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader 'app')

lavish wave
#

I want to make a normal command

#

Like /test

quaint mantle
lavish wave
#

Yes

quaint mantle
#

You really just never check the wiki.

lavish wave
#

plugin.getDescription().getCommands().put(command, options);
plugin.getDescription().save();
plugin.getCommand(command).setExecutor(executor);

quaint mantle
#

?google

undone axleBOT
lavish wave
quaint mantle
#

Api?

lavish wave
#

Yes

#

And now I want in my Test Plugin with the API to make a command

chrome beacon
solid cargo
#

ahh

#

if player == null

#

do that and that?

quaint mantle
last ledge
#

i want to spawn a certain mob in every 12hrs real time how do i do it?

undone axleBOT
last ledge
#

and how do i make a custom Trade GUI like Villagers or traders

fading lake
last ledge
#

i already tried it -.-

#

all threads are 5-10 years old

tardy delta
#

I would suggest an inventory with an Consumer to executed the action linked to the slot

left lodge
crimson terrace
#

is the method meant for the version youre using?

rigid hazel
#

After defeating the ender dragon, the player receives a screen with a dialouge between to persons. Can I show that screen to a player, but with other text?

quaint mantle
#

scam, @ancient plank

#

delete it

#

and mute the person he got hacked

ancient plank
#

?kick @candid stirrup

undone axleBOT
#

Done. That felt good.

quaint mantle
#

good

left lodge
slim kernel
#

Can pls anyone help me on this? Or show me a other method of making a sphere where i can change the radius?

quaint mantle
rigid hazel
#

This would be so nice.

little trail
#

isnt the end screen a recourse pack

quaint mantle
#

what a genius

little trail
#

this is my first time coming to this server lmao

acoustic pendant
#

Ok, i have a problem related to java but has only happen to me in this plugin... i have an instance in the main class and a ArrayList as well...

#

but i can't access to the arraylist from another class

hasty prawn
#

How are you trying to access it

acoustic pendant
#

(Main).getInstance().(ArrayList)

#

the (something) is for define here

hasty prawn
#

Send code for the definition and accessing please

acoustic pendant
#

ok

#
    public static MineSpaceSkills instance;
(OnEnable)
instance = this;

(OnDisable)
instance = null

}

    public static MineSpaceSkills getInstance() {
        return instance;
    }```
#

that in the main class

#

and trying to access:

#

return MineSpaceSkills.getInstance().vanished

acoustic pendant
hasty prawn
#

Put public in front of it

hasty prawn
#

Yeah

acoustic pendant
#

ok. sorry 😄

quaint mantle
#

Hi! I am coding a plugin in intellij IDEA, and i am doing my first plugin. But i need help, because when i try to generate the .jar file with Build > Build artifacts > build and it doesnt generate it. But it says this error in build output, i dont see anything in my code.

C:\Users\ondre\IdeaProjects\FirstPlugin\src\net\diamondlands\HelloWorld.java:8:30
java: cannot find symbol
  symbol:   class BlockPlaceEvent
  location: class net.diamondlands.HelloWorld

My code:

package net.diamondlands;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class HelloWorld implements Listener {
    @EventHandler
    public void onBlockPlace(BlockPlaceEvent event) {
        Material type = event.getBlock().gettype();
        if (type == Material.TORCH) {
            Player player = event.getPlayer();
            player.sendMessage("Ahoj");
        }
    }
}
wide coyote
#

restart your ide if still doesnt say anything, validate caches and restart

#

and the problem is you didnt import BlockPlaceEvent, Material classes

#

and it is not gettype, its getType

#

@quaint mantle

quaint mantle
#

more info, search: resource pack how to change the end poem

acoustic pendant
#

Hey, i was learning about placeholder and have a question...

#
    @Override
    public String onPlaceholderRequest(Player player, @NotNull String params) {
        if (player == null) {
            return "";
        }

        if (params.equals("maxHealth")) {
            AttributeInstance maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
        }
        return null;
    }
#

here

#

the placeholder

#

is %maxHealth%

#

or

#

%mainclass_maxHealth%

#

?

quaint mantle
#

wiki for dev i think

#

but u didnt return tho

#

should return the string for the max health right?

acoustic pendant
#

it should return the maxhealth

#

yes

#

the string

quaint mantle
#

no i mean you forgot to put the return String

acoustic pendant
#

the number

#

ig

quaint mantle
#

and btw u can just test

#

or maybe read the wiki

acoustic pendant
regal moat
#

What does OfflinePlayer#getFirstPlayed() return?

#

And how do I turn it into a date?

#

oh okay

#

i got it

quaint mantle
#

care to share?

#

need that myself

#

@regal moat

regal moat
#

yeah

#
            long firstPlayDate = player.getFirstPlayed();
            Calendar calendar = Calendar.getInstance();
            calendar.setTimeInMillis(firstPlayDate);

            int mYear = calendar.get(Calendar.YEAR);
            int mMonth = calendar.get(Calendar.MONTH);
            int mDay = calendar.get(Calendar.DAY_OF_MONTH);
#

i didnt test it though

quaint mantle
#

i think we can just do

#
Date date = new Date(player.getFirstPlayed());
SimpleDateFormat lol = new SimpleDateFormat("HH:mm dd.MM.yyyy");
String firstPlayed = lol.format(date);```
regal moat
#

so if you knew that

#

why did you even

#

sdjfhksdfjsd

quaint mantle
#

i didn't when i asked

#

i just looked at it as you sent

#

LMAO

left lodge
sage dock
burnt current
#

short question: does somebody know how i can use PathfinderGoalFollowEntity exactly? Unfortunately, I have not found anything anywhere that explains exactly how I use this method. can somebody help me there?

worldly ingot
#

Well firstly, don't

#

Use Material string names, Enootikin. Then you have the option of Material#getMaximumStackSize() (or whatever it's called, I forget)

sage dock
#

thanks

worldly ingot
#

stopDistance is the distance away from an entity it has to be before it stops pathfinding, and areaSize is... well, the size of the area the entity will start following entities

#

You can generally figure this out just by looking at source code and doing some reverse engineering, especially now that things are mapped more appropriately in 1.17 using Mojang's official mappings

dull whale
#

I have a custom font in my resource pack, it works fine everywhere but books. my font is always black in books, is there a way to fix it

burnt current
lavish wave
#

So, I have an API and made a Test Plugin for it. But now I want to add commands, when my API Plugin is started. How can I add commands by code?

worldly ingot
last ledge
#

public List<Block> getNearbyBlocks(Location loc, int radius){

#

error: reference to Block is ambiguous

worldly ingot
#

Import Block?

last ledge
#

already imported

quaint mantle
#

Anyone knows what that means? I am creating a heal command following a tutorial, and it says this.

last ledge
#

import it?

solid cargo
#

Yo how can i code my plugin to be able to ban offline players

#

idk what method to call

#

so that i can ban an offline and an online player

quaint mantle
alpine urchin
#

to CommandSender

burnt current
last ledge
#

public List<Block> getNearbyBlocks(Location loc, int radius){

#

error: reference to Block is ambiguous

worldly ingot
#

No but there should be decompile<hash> folders

#

Open those and you'll see some source for NMS

quaint mantle
stoic osprey
#

how can I register an event outside the onEnable() method

last ledge
#

Error: reference to Block is ambiguous

quaint mantle
#

thats method ahha

stoic osprey
#

sorry lol

solid cargo
stoic osprey
solid cargo
#

2013

quaint mantle
stoic osprey
#

no its after the plugin is enabled

last ledge
#

can you help?

quaint mantle
stoic osprey
#

but the listener class that I have the event in is made after the onEnable method is called

quaint mantle
#

?

#

wut

stoic osprey
#

ok so im making a few minigames

#

and want each instance of the minigame class

#

to have its own private events

quaint mantle
stoic osprey
#

yeah

#

but I can only call that in the onEnable method right?

quaint mantle
burnt current
stoic osprey
#

oh I might have realised by mistake

last ledge
stoic osprey
#

wdym lol

fossil prawn
#

how would i make a command like /gui edit where i can edit the gui and open that one with /gui?

stoic osprey
fossil prawn
#

Like the command is easy

#

But how would i make the system where i can open the existing gui and edit it

#

and when i do an command it opens that editted gui

stoic osprey
#

i have no idea sorry

#

i was going to try a GUI plugin after my minigame one but haven't yet

quaint mantle
#

save items somewhere, and when you create a GUI just take the items from where you saved them

#

like HashMap<ItemStack, Integer> (item, slot)

#

etc.

proud basin
#

java.io.IOException: Problem reading font data. ```java
Font.createFont(Font.TRUETYPE_FONT, fontStream).deriveFont(fontSize * new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor() / 2));

tribal gyro
#
chest1 = (Chest) deathblock.getState();
                    chest2 = (Chest) player.getWorld().getBlockAt(newpos).getState();
                    Directional directional1 = (Directional) deathblock.getBlockData();
                    Directional directional2 = (Directional) player.getWorld().getBlockAt(newpos).getBlockData();
                    Bukkit.broadcastMessage(dir);
                    if (dir.equals("West")) {
                        directional1.setFacing(BlockFace.WEST);
                        directional2.setFacing(BlockFace.WEST);
                    } else {
                        directional1.setFacing(BlockFace.NORTH);
                        directional2.setFacing(BlockFace.NORTH);
                    }
                    deathblock.setBlockData(directional1);
                    player.getWorld().getBlockAt(newpos).setBlockData(directional2);``` why is this not broadcasting or changing anything
dark spindle
#

hola does anyone have a plug in to stop people from getting things with hacks like they can spawn a dimond sword with 100 sharpness

plain helm
dark spindle
#

hola does anyone have a plug in to stop people from getting things with hacks like they can spawn a dimond sword with 100 sharpness

plain helm
#

no hacks can spawn a sword yet

eternal oxide
#

you can't "hack" in a 100 sharpness sword

dark spindle
#

u can

#

im using geyser and bedrock players can use toolbox#

eternal oxide
#

then not a spigot issue

plain helm
#

i'm not really into bedrock

eternal oxide
#

go talk to geyser?

dark spindle
plain helm
#

is bedrock mobile/win 10 minecraft?

dark spindle
#

yea

#

and console

plain helm
#

i don't think there are plugins preventing that, i remember i used to download apps from play store to use hacks on minecraft pocket edition

dark spindle
#

so how does cube stop it

plain helm
#

idrk

young knoll
#

There are plugins that will remove illegal items

quaint mantle
#

hello, HandlerList.unregisterAll(); doesn't seem to be working for some reason,

#

1 sec let me elaborate

#

basically i have a Countdown class that handles a bukkitrunnable, it has an OnEntityDeath event, I would like to unregister it onCancel, and I used the method shown above, but it didn't seem to work. I've also added a if(task.isCancelled()) return; in the event but it still didn't seem to work. And yes, I am sure the problem is the event staying registered.

dark spindle
#

?

young knoll
#

IllegalStack is a name I’ve heard a few times

quaint mantle
#

Anyone knows how to add cooldown to a command?

burnt current
#

hey Quick question: Is it possible with custommobs that burn in sunlight to turn off that they burn in sunlight?

echo basalt
eternal oxide
#

put a hat on them

crimson terrace
eternal oxide
#

a helmet stops burn in daylight

proud basin
dense shoal
#

I need a second pair of eyes to help advise the following:

I'm trying to add an event handler to detect when a certain plugin-specific event in plugin A is fired. When plugin A fires said event, plugin B needs handle that event. Now it seems that plugin B is not detecting that that event is fired. I set a breakpoint in that very first line for the event handler in plugin B. I also validated that the event is firing in plugin A. The class that handles the event in plugin B is being activated properly. Can anyone else suggest some common mistakes that I might be making? I'm losing my mind lol.

burnt current
quaint mantle
#
                    EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                    this.world.getServer().getPluginManager().callEvent(event);

                    if (!event.isCancelled()) {
                        this.setOnFire(event.getDuration());
                    }
zenith pendant