#help-development

1 messages Β· Page 1377 of 1

drowsy helm
#

cast it then

main tangle
#

sure why not

#
package com.deathlimiter.main;

import java.io.File;
import java.io.IOException;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    private static Main main;
    public File ymlFile;
    public YamlConfiguration ymlConfig;
    
    @Override
    public void onEnable() {
        System.out.println("[DeathLimiter] Loaded.");
        
        Bukkit.getPluginManager().registerEvents(new onDie(), this);
        getCommand("resetdc").setExecutor(new resetDC());
        getCommand("setdl").setExecutor(new setDL());
        
        initYaml();
    }
    
    public File getYML() { return ymlFile; }
    public YamlConfiguration getYmlConfig() { return ymlConfig; }
    
    public void initYaml(){
        saveDefaultConfig();
        ymlConfig = (YamlConfiguration) getConfig();
    }
    
    public static Main getMain() {
        return main;
    }
    
}
dusty herald
#

🀷 should be fine, thought you should read up on Dependency Injection ;)

main tangle
dusty herald
eternal oxide
#

getConfig() returns a FileConfigurations so use a FileConfiguration not a YamlConfiguration

#

no casting

quiet ice
#

Yeah, I would also advise against casting

drowsy helm
#

casting it wont do anything to it

quiet ice
#

Other than a ClassCastException

drowsy helm
#

it extends FileConfiguration

quiet ice
#

The implementation might have it as a YamlConfiguration right now, however in the future it might lead to very hard to debug exceptions

#

If you cast a FileConfiguration to a YamlConfiguration it will throw a CCE

main tangle
#
package com.deathlimiter.main;

import java.io.File;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    private static Main main;
    public File ymlFile;
    public FileConfiguration ymlConfig;
    
    @Override
    public void onEnable() {
        System.out.println("[DeathLimiter] Loaded.");
        
        Bukkit.getPluginManager().registerEvents(new onDie(), this);
        getCommand("resetdc").setExecutor(new resetDC());
        getCommand("setdl").setExecutor(new setDL());
        
        initYaml();
    }
    
    public File getYML() { return ymlFile; }
    public FileConfiguration getYmlConfig() { return ymlConfig; }
    
    public void initYaml(){
        saveDefaultConfig();
        ymlConfig = getConfig();
    }
    
    public static Main getMain() {
        return main;
    }
    
}
```like this?
drowsy helm
#

you wont need ymlFile anymore

#

but yes

quiet ice
#

Similaraly, if you cast an Integer to an ArrayList it will throw a CCE despite it being both an Object

#

You can cast them to Object though

drowsy helm
#

YamlConfiguration extends FileConfiguration

#

integer and arraylist analogy isnt the same scenario

#

thats like saying you cant cast a list to an arraylist

quiet ice
#

Integer extends Object

sturdy patrol
#

You can cast a list to an arraylist. sometimes.

#

But not always

drowsy helm
quiet ice
#

Vector is the best example for that

eternal oxide
#

You can cast a YamlConfiguration to a FileConfiguration, not the other way around.

quiet ice
#

You cannot cast a Vector to ArrayList

#

(though for that no cast is needed as the java language automatically does that)

main tangle
#

how can i get statistics?

olive badger
#

Hello,
Im still stuck on my gradle issue but i progress.
Now the project compile but i just need find the good configurations for shadowJar

Currently i have jetbrains annotations in my jar but i think i don't it.

And how i can publish an shadowed version for the api ?

My project : https://github.com/orblazer/gradle-bug

Thanks by advance

obtuse anchor
#

So how do I fix the plugin AuctionHouse because whenever I join my server (Deop) or anyone else joins my server the /ah, auction house gives, "you do not have permission to use this command!" But when Oped it works perfect no problem any help someone could give?

eternal oxide
#

Give the correct permissions and ask for help in #help-server

west lance
#

Any idea what's the offset between armorstand foot and it's display name

olive badger
#

an jar with dependencies like configurate or acf (not included right now in the github project)

#

but after thinking its probably useless because the dependencies is always declared

quiet ice
#

You can declare a dependency twice under two scopes iirc

ivory sleet
#

you wanna shade in configurate and acf?

hushed spindle
#
                frame.getPersistentDataContainer().set(holoDisplaykey, PersistentDataType.STRING, Utils.holoLocationToString(frame.getLocation(), signLocation));
                System.out.println("frame was given key");
                frame.getPersistentDataContainer().set(holoTypeKey, PersistentDataType.STRING, "item");
                frame.setVisible(false);
                frame.setInvulnerable(true);
                frame.setFixed(true);

                UUID frameUUID = frame.getUniqueId();
                new BukkitRunnable(){
                    @Override
                    public void run() {
                        Entity checkFrame = Main.getPlugin().getServer().getEntity(frameUUID);
                        if (checkFrame != null){
                            if (checkFrame.getPersistentDataContainer().has(holoDisplaykey, PersistentDataType.STRING)){
                                System.out.println("frame has key!");
                            } else {
                                System.out.println("frame has no key.");
                            }
                        } else {
                            System.out.println("the frame no longer exists");
                        }
                    }
                }.runTaskLater(Main.getPlugin(), 100L);

I'm trying to save some data in an item frame entity but it seems like it keeps disappearing shortly after, anyone have a clue why?

#

using this same code on armor stands works but on item frames its just inconsistent for some reason

olive badger
ivory sleet
#

I mean its just unclear what you want

olive badger
#

for the api (i keed only that module for clear explain), i want only include that part in my other plugins like an lobby plugin.

And if i shade the common dependencies i can have an util methods like i have said for configurate and reduce the plugins sizes
After its propably not the best but i don't know how i can make other way ^^

ivory sleet
#

Idk still what you need but use the shadowJar plugin to shade in and then declare your module as implementation in the project that is responsible for producing the final jar

olive badger
#

ok so in shadowJar i need use configurations = [project.configurations.implementation] ?

ivory sleet
#

not really

#

I dont do it in that way at least

drowsy helm
#

anyone aware of a method of scaring animals without using LivingEntity#damage as that knocks them up

#

vanilla entities, so cant set ai

olive badger
#

im still confused ^^ and the doc of shadow plugin is not updated for gradle 7

ivory sleet
#

can you just try to explain what exactly you want? I am sorry but your explanations so far have been quite dim and confusing

raw swallow
#

Anyone know any good json config api?

ivory sleet
#

configurate

olive badger
#

ok, sorry i don't know every word in english πŸ˜… but i can try in other way.

  • I want to include in my core-api the common methods for the other plugins like configurate and so have an util methods like an ConfigurationManager for easier make the plugins
  • The core is for implement the methods like an database manager
  • So in my lobby plugin (for example) i want include core-api and so have an easy way to have configuration like i simple use ConfigurationManager.create and no remake everything in all plugins
olive badger
# olive badger ok, sorry i don't know every word in english πŸ˜… but i can try in other way. - ...

and if you prefer with dependencies specifically :

  • core-api :
    • configurate: can used in other project (plugins)
    • acf-paper : can used in other project (plugins)
    • acf-bungee : can used in other project (plugins)
  • core-common : implement all common methods for bukkit and bungeecord
  • core-bukkit :
    • paper-api : provided (so not included in final jar)
  • core-bungeecord :
    • waterfall-api : provided (so not included in final jar)

So the plugin (the final jar builder) : include core-api, configurate (relocated), acf-* (relocated), core-common, core-bukkit, core-bungeecord
But maybe my logic is wrong and maybe could not work due to relocation. Im really confused with the relocation (i prefer use an custom plugin system in JavaScript and im really more comfortable ^^)

olive badger
hushed spindle
#

thats kind of the weird thing though because that seems to be the case for setvisible, setinvulnerable, setfixed, but not for persistent data container

#

the persistent data container is never saved

carmine ivy
#

How would I teleport a player between worlds without multiverse. I've tried player.teleport(Bukkit.getWorld("worldname").getSpawnLoaction() but it doesn't work

hushed spindle
#

well maybe it is, but it seems to reset shortly after

olive badger
#

i have never try the persistent data so i can't help with that

olive badger
carmine ivy
#

Wait there i'm going to see if I can create some tests without a ui at the moment

#

Then I'll tell you if there is an error

#

@olive badger Here is the code and error so far

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked();
        if (event.getView().getTitle().equals(ChatColor.DARK_GREEN + "Select a game!")) {
            event.setCancelled(true);
            if (event.getCurrentItem() == null) return;
            if (event.getCurrentItem().getItemMeta() == null) return;
            if (!event.getCurrentItem().getItemMeta().hasDisplayName()) return;

            if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.GOLD + "" + ChatColor.BOLD + "Knockback Arena!")) {
                //new WorldCreator("knockbackArena").environment(World.Environment.NORMAL).createWorld();
                player.sendMessage("Test");
                player.teleport((Bukkit.getWorld("knockbackArena")).getSpawnLocation());
                player.closeInventory();
            }
        }
    }

error:

Could not pass event InventoryClickEvent to WolfPVPMain v1.0
org.bukkit.event.EventException: null
#

I'm sure its because of this line

player.teleport((Bukkit.getWorld("knockbackArena")).getSpawnLocation());
olive badger
#

what is line generate that exception ?

carmine ivy
#

line 25:

player.teleport((Bukkit.getWorld("knockbackArena")).getSpawnLocation());
#

says this

at GUI.gameSelectorListener.onInventoryClick(gameSelectorListener.java:25) ~[?:?]
olive badger
#

ok so its because the world is doesn't load

carmine ivy
#

I don't know how to load the world other than using world creator

//new WorldCreator("knockbackArena").environment(World.Environment.NORMAL).createWorld();
#

The line i took out since it creates another error

#

I could send it if you want

#
The process cannot access the file because another process has locked a portion of the file
#

Now nothing happens when I click the item inside of my gui

eternal oxide
#

Check if the world exists before trying to load it

olive badger
#

you need load it before with Bukkit.createWorld(WorldCreator.name("worldName"))

carmine ivy
#

Orblazer i'll try it

#

Hm sill the same error

carmine ivy
#

It is because of the file permissions, and maybe my code

eternal oxide
#

If it says the file is busy it has been loaded

#

CHeck if its loaded before you attempt to create/load it

carmine ivy
#

It doesn't have permission
Because:

The process cannot access the file
#

I can't load the world because of the perms

olive badger
#

if you have make an copy of the world you have probably copied an loaded world and you have an .lock file

eternal oxide
#

no

carmine ivy
#

nor would I be able to create a world

carmine ivy
#

I'll check

#

I see session.lock

eternal oxide
#

if (Bukkit.getWorld("namehere") != null)

carmine ivy
#

what do I do with it

carmine ivy
olive badger
#

you can delete it

carmine ivy
carmine ivy
#

YES I found out why

World knockbackArena is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from knockbackArena's world directory if you want to be able to load the duplicate world.

Finally gave me english

#

Perfect

#

Loads the world

#

Thanks guys

carmine ivy
olive badger
summer scroll
#

https://paste.md-5.net/axoyabafel.cs. This current code is setting all blocks in a chunk to AIR using packets and I want it to set the blocks to AIR If the y level is above 63 for example, how can I do that? (I don't really know about packets and I'm currently modifying a plugin)

hardy valley
#

check if the Y is above 63

#

if yes

#

set the blocks to air

eternal oxide
#

Line 26, 27 and 28 change zero to 64

#

probably

#

nah maybe not

quiet ice
#

https://wiki.vg/Chunk_Format might be of note when working with these packets, though I do not know how much of this is hidden by the packet implementation for you

summer scroll
#

Or I want it to place a grass block in y 63, so it'll look like a default plot.

quiet ice
#

Does anyone know any Library (ideally one that is packaged in Bukkit) that uses longs for Hashmap hashcodes (or removes the need of it entirely without reducing performance to ashes)? Right now I'm trying to make a claim plugin however I have a 1:1625 (while for a 64-bit hashcode it would be 1:2642245) chance that a claim hashcode collides, which I deem to be too low for it being safe to use

earnest junco
summer scroll
earnest junco
ivory sleet
quiet ice
summer scroll
earnest junco
#

At least that's my first guess

quiet ice
#

I'd use the state ids

summer scroll
#

but what's that means?

#

2 from 8 to 9 for grass_block

quiet ice
#

It means it has 2 states (with snow and without) that range from 8 to 9 (bot inclusive it appears so)

#

Though the server should store the global palette somewhere however

summer scroll
#

So If I use 8 or 9 the block will be grass_block?

earnest junco
#

so 8 for normal grass, 9 for snowy

quiet ice
#

No, 9 is default

#
  "minecraft:grass_block": {
    "id": 8,
    "item": 8,
    "default_state": 9,
    "class": "GrassBlock",
    "tint": "minecraft:grass_tint",
    "states": {
      "8": {
        "properties": {
          "snowy": true
        },
        "render": {
          "model": "minecraft:block/grass_block_snow"
        }
      },
      "9": {
        "properties": {
          "snowy": false
        },
        "render": [
          {
            "model": "minecraft:block/grass_block"
          },
          {
            "model": "minecraft:block/grass_block",
            "y": 90
          },
          {
            "model": "minecraft:block/grass_block",
            "y": 180
          },
          {
            "model": "minecraft:block/grass_block",
            "y": 270
          }
        ]
      }
    }
earnest junco
#

πŸ€·β€β™‚οΈ try both, you'll find out

quaint mantle
#

How do I prevent a particular mob from attacking the player with pathfindergoal?

#

this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, false)); isn't working

carmine ivy
#

I have a problem and its only a small one,
code:

                player.teleport(Bukkit.getWorld("LobbyMain").getSpawnLocation());

Error:

Could not pass event PlayerInteractEvent to WolfPVPMain v1.0
org.bukkit.event.EventException: null

The world that i'm trying to load is the main world

ivory sleet
#

?paste send entire stacktrace

queen dragonBOT
summer scroll
ivory sleet
carmine ivy
#

oh shit yeah sorry

#

I hate to ask but,
What is a stack trace

olive badger
ivory sleet
#

Could not pass event PlayerInteractEvent to WolfPVPMain v1.0
org.bukkit.event.EventException: null

the shit that comes after this

carmine ivy
#

No, the knockback world works

ivory sleet
#

like
at blah.blah

#

casued by Blah

carmine ivy
#

So the entire error

ivory sleet
#

yeas

carmine ivy
#

ok I'll send

#

The knockback world teleports me, but the lobby one doesn't

olive badger
#

yes but with your code the only possible Null is the Bukkit.getWorld

carmine ivy
#

Yea

#

Wait,

olive badger
#

so that is because the world is not loaded

carmine ivy
#

I think I may have found the prob,em

#

problem*

#

brbn

#

I have fixed it. It's because the else if wasn't in the right place

#

I'm not that great at this πŸ˜†

earnest junco
grand coral
#

Anyone know how to get from a block the Drops with a luck pickaxe?

quaint mantle
young knoll
#

Im sure there is

#

But it’s NMS so you have to do some digging

ivory sleet
#

but tbf just use a new GoalSelector

ancient whale
#

Hey, I would like to check if someone is in some square area, the only way I can think about so far is checking the location of every player, but it feels kinda dirty, could there be an other way of doing it ?

earnest junco
quaint mantle
quaint mantle
ivory sleet
#

idk but it might involve reflection

#

not sure tbf

rapid vigil
#

I'm using the 1.12.2 API

#

And CraftBukkit.1.12.2 in my build path

quiet ice
#

I would say that you need 1.12.1 Craftbukkit on build path

rapid vigil
#

But am coding in 1.12.2

quiet ice
#

then change it to v1_12_R2

rapid vigil
#

It doesn't find the R2

#

There's only v1_12_R1

grand coral
#

I do not have NBTTag in my Sourcecode why how to add it?

earnest junco
rapid vigil
#

maven

earnest junco
#

Can you post your pom?

rapid vigil
#

Alright

quiet ice
#

My guess is that either you do not declare the cb jar in the pom or you have not the cb jar in the maven local repo

rapid vigil
#

It's more than 2k characters..

quiet ice
#

?paste it then

queen dragonBOT
rapid vigil
earnest junco
#

Yeah geol was right, you didn't declare the craftbukkit jar

rapid vigil
#

How do I declare it?

quiet ice
#

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

For spigot (dont't ask how it is performed for cb)

quaint mantle
#

how to know if a player is in a xxx chunk?

quiet ice
#
Location loc = player.getLocation();
int chunkX = loc.getBlockX() >> 4;
int chunkY = loc.getBlockZ() >> 4;

After that you can do the rest of the magic

quaint mantle
#

rt

#

ty*

rapid vigil
quiet ice
#

This is the Spigot discord lol

rapid vigil
#

I mean that code didn't work

quiet ice
#

Also, paper is a fork of spigot, so there shouldn't be all to many differences

rapid vigil
#

It didn't find the 1.12-R0.1-SNAPSHOT

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

This is the code right?

quiet ice
#

This belongs in the dependency block of your pom

#

If that does not work then you are fully lost because neither paper nor spigot are going to help you with
a) An ancient version
b) A fork of spigot
Though chances are that you did not run BuildTools

quaint mantle
#

Hey sigot! How do you remove pathfindergoal from a particular mob? I've seen several threads of spigot, but I don't understand. I'm sorry.

#

"sigot"

marble lion
#

What latest version of the Java Runtime and JDK that Spigot is compatible with?

quiet ice
#

Java 16

carmine ivy
#

How can I give players permissions

marble lion
#

org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: nos/myfirstspigotplugin/MyFirstSpigotPlugin has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0

#

any ideas?

carmine ivy
#

wut

#

Wait there

marble lion
#

Im using Netbeans v. 10

carmine ivy
#

Go to your project settings

#

@marble lion I know how to fix your error

quiet ice
carmine ivy
quaint mantle
#

πŸ‘‰πŸΏπŸ˜„πŸ‘ˆπŸΏ

quiet ice
marble lion
#

ok

carmine ivy
#

Download OpenJDK 8

#

thats the version you need

quiet ice
#

This installer should automatically update Java

carmine ivy
#

^

quiet ice
carmine ivy
#

When I tried to use Java 11 or 16, it always gave me that error until I switched to java 8

quiet ice
#

Because your JRE was still at Java 8

carmine ivy
#

Oh shoot

quiet ice
#

You only updated the JDK (javac)

carmine ivy
#

That makes way more sense

#

Ok

#

Imma fix that real quick lmao

#

Is there a way I can give players permissions

quiet ice
#

Depends

#

Either use Vault or Superperms for that

carmine ivy
#

Is there a way I can do in my code

#

Without an api

#

Or with

quiet ice
#

Player#addAttachment is likely what you are search for, but Vault is suggested as it is the bigger permissions compat API

carmine ivy
#

Ok

#

Thanks for the help

tender bronze
#

Hi, how do I make an item open the tebex buy gui?

carmine ivy
#

So when you right click an item, you want it to open a gui, am I correct @tender bronze

tender bronze
#

yup*

carmine ivy
#

Do you have any code written at the moment

tender bronze
#

when u first join the game u get the item thats meant to open the gui

carmine ivy
#

Ohhhh

#

Ok

tender bronze
#

so there is already a command to open it

#

which is /store

#

but when i try to run that inside the console

#

that doesnt work

#

so i dont know what to do

carmine ivy
#

Wait, your trying to run your command in the console

#

Or in the command bar

tender bronze
#

how do i do it in the command bar?

#

that would be way easier

carmine ivy
#

You just press t or /

tender bronze
#

.

#

i want a script to do it

carmine ivy
#

Oh

tender bronze
#

so like

#

i have the code down already

carmine ivy
#

Ok

tender bronze
#

ill sen

#

send

carmine ivy
#

Thank you

tender bronze
#

store:
material: ENCHANTED_BOOK
amount: 1
slot: 1
display_name: "&cGame shop"
lore:
- "&7Right-click to open the game shop!"
actions:
- "[CONSOLE] store"

#

where can i run the command

#

instead of the console

#

is there a way i can run it in the command bar inside the script?

carmine ivy
#

Are you using script

#

skript*

tender bronze
#

heard of it but im not using it

tribal sparrow
#

does the PlayerMoveEvent not get fired when a player is a passager? even if they're moving their cursor?

carmine ivy
#

Wait there

#

Don't you have code like this for instance:

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

        Player player = (Player) sender;

        return false;
    }
#

Java

#

No?

tender bronze
#

i added the code inside the config file

carmine ivy
#

Oh

#

Ok

tender bronze
#

im using deluxehub

#

to add the item

carmine ivy
#

I have no idea how to add that

#

wait

#

Lemme rephrase

tender bronze
#

ok

carmine ivy
#

I don't know how to help you because I have never used deluxehub and whats ironic is that I'm learning config files because I skipped out on them

#

Why can't you just write you code in eclipse or intelij

tender bronze
#

eh

carmine ivy
#

bro

tender bronze
#

its easier in the config

carmine ivy
#

Send me your code

paper viper
#

what config file?

#

how can you write code in config files

#

wtf lol

summer scroll
carmine ivy
#

ikr

tender bronze
#

not

#

code

carmine ivy
#

oh

#

right

summer scroll
#

And also that's not coding xd.

tender bronze
#

its literally just inside the deluxehub config

paper viper
#

^

carmine ivy
#

^

#

lol

paper viper
#

then wrong channel to ask?

#

lol

carmine ivy
#

Idk why you couldn't have just learnt normal code

#

like java

#

Its easier

tender bronze
#

i know

#

but i dont know java

carmine ivy
#

Learn it

tender bronze
#

and it takes time to learn java

carmine ivy
#

And:?

#

I'm learning right now

tender bronze
#

good for u

carmine ivy
#

And i'm fast learner

#

Bro

tender bronze
#

no ones the same

carmine ivy
paper viper
#

Even DaBaby can learn java

summer scroll
carmine ivy
#

Because this isn't code

tender bronze
#

wouldve been easier if u told me in the first place

carmine ivy
#

I thought you were normal and used java

#

not write "code" in config files

#

Your choice

tender bronze
#

i didnt mean to word it like that

carmine ivy
#

But stil

#

Its fine

#

Just sounded toxic lmao

tender bronze
#

sorry

carmine ivy
summer scroll
#

chill, he's just in a wrong channel.

carmine ivy
#

No he was just a little toxic earlier and my mistake if I took it the wrong way

quiet ice
#

Could you stop arguing about who's toxic?

carmine ivy
#

Were not.

#

Anyway isn't even a big deal

night copper
#

Guys is there a simple way to check if a player is holding a piclaxe, axe or shovel. And I want to check every material type like iron, wood etc.

quaint mantle
#

love how you go from # to . so late

#

xD

summer scroll
#

oh

gleaming grove
#

for example you can check like this Material.STONE_PICKAXE.IsItem();

summer scroll
#

please use == to compare enums

night copper
#

but I want to check if he is holding an iron or wood or netherite pickaxe

grand coral
#

How to get the drops from a block?

night copper
#

is there an easier way

#

or I have to use the OR operator

gleaming grove
#

@quaint mantle https://www.youtube.com/watch?v=Fnonn5chXk4&ab_channel=CodedRed i think this is only the way

Custom pathfinder goals is here! I went very in-depth the best way I could to explain how custom pathfinders work. I hope you all enjoy and understand the video :D Thanks for watching!

P.S
Sorry about the damn zombie noise in the background forgot I had my mc sound on :(

Want more videos?
Become a Patreon support to gain access to more videos!...

β–Ά Play video
quaint mantle
gleaming grove
#

i guess you need to overwrite some methods

quaint mantle
kind coral
#

hi guys i have a custom itemstack with fancy lore and everything, tho this item has a durability, and using .equals() will stop it from working since it just gets the item with a full one, how would i fix this?

kind coral
earnest junco
quaint mantle
quaint mantle
kind coral
earnest junco
gleaming grove
#

@Override
public void initPathfinder() {

}
earnest junco
gleaming grove
#

that should remove default pathing goals

marble lion
#

What is the difference between the Shaded and non-shaded Spigot API? I see the file size of the shaded is much larger.

sand vector
#

is there any way to get rid of the items name when it is hovered over, atm i have it so it is "=" but i don't want it to have any type of name or hover info

#

also hate that the equals is not aligned

earnest junco
earnest junco
gleaming grove
sand vector
#

ok, guessing thats the closest you can get to removing it

earnest junco
gleaming grove
#

if you will do sth like that, there will be not pathfinding at all ``` @Override
public void initPathfinder() {

}  @Override
public void a()  {

}           ```
quaint mantle
#
    public void initPathfinder() {
        //super.initPathfinder();
    }
    
    public void a() {

    }```
gleaming grove
#

i think ``` @Override
public void initPathfinder() {

}```
#

should enought

quaint mantle
#

and no public void a?

gleaming grove
#

yes

#

try and tell me result

quaint mantle
#

sure

quaint mantle
#
public VindicatorAI(Location location) {
        super(EntityTypes.VINDICATOR, ((CraftWorld) location.getWorld()).getHandle());
        this.setPosition(location.getX(), location.getY(), location.getZ());
    }

    @Override
    public void initPathfinder() {
        //super.initPathfinder();
    }
    ```
#

this is full code

gleaming grove
#

no, you need to get rig of

#

/super.initPathfinder();

quaint mantle
#

okay

#
    public VindicatorAI(Location location) {
        super(EntityTypes.VINDICATOR, ((CraftWorld) location.getWorld()).getHandle());
        this.setPosition(location.getX(), location.getY(), location.getZ());
    }

    @Override
    public void initPathfinder() {
        super.initPathfinder();
    }
``` still attacking me
#

😦

gleaming grove
#

i will check it on my own

quaint mantle
#

thanks :))

#

your very kind

marble lion
#

Would anyone mind looking at my code real quick to see why the broadcastMessage(msg) isn't working when I /reload the plugin in game?


import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class MyFirstSpigotPlugin extends JavaPlugin
{
    @Override
    public void onEnable()
    {
        if(Bukkit.getOnlinePlayers().size() == 1)
        {
            Bukkit.getOnlinePlayers().forEach((player) -> broadcastToServer("Hello " + player.getName()));
        }
        else
        {
            broadcastToServer("Hello World!");
        }
        broadcastToServer("Hello World!");
    }

    private void broadcastToServer(String msg)
    {
        Bukkit.broadcastMessage(msg);
    }```
drowsy crest
#

Set a listener to check for player join. You're running the method on enable so Bukkit.getOnlinePlayers().size() wouldn't be valid

gleaming grove
#

@quaint mantle in my case everything works ``` public class CustomZombie extends EntityZombie
{

public CustomZombie(Location location)
{
    super(((CraftWorld)location.getWorld()).getHandle());

    this.setPosition(location.getX(), location.getY(), location.getZ());
    ((CraftWorld)location.getWorld()).getHandle().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
}


@Override
protected void initPathfinder() {

}

}```

#

@quaint mantle

quaint mantle
#

hmm

#

thanks but super(((CraftWorld)location.getWorld()).getHandle()); is error

#

and spawnreason is already custom :0

#

but thanks

gleaming grove
#

what verion of spigot you use?

quaint mantle
#

1_15_R1

gleaming grove
#

ok i am v1_16_R3

drowsy crest
gleaming grove
maiden briar
#
<?xml version="1.0"?>
<project name="${pom.properties.artifactId}" default="Build">

    <--- How to replace this line above <project name =.....> --->
    <xmlproperty file="pom.xml" prefix="pom" keeproot="false"/>

    <condition property="serverPath" value="${pom.properties.server.path}">
        <os family="windows" />
    </condition>

    <property name="foundation.version" value="${pom.properties.foundation.version}"/>

    <target name="Build">
        <jar jarfile="${serverPath}\plugins\${ant.project.name}.jar" basedir="./target/classes/" includes="**/*">
            <zipgroupfileset dir="${user.home}/.m2/repository/com/github/kangarko/Foundation/${foundation.version}/" includes="**/*${foundation.version}.jar" />
        </jar>
    </target>
</project>
quiet ice
#

what is that?

kind coral
#

i got my persistant data set, everything works great but the helmet doesn't seem to get removed after the durability goes to 0

quiet ice
#

You need to remove it manually, as far as I know the server does not do that until the tool is used again

kind coral
#

how would i remove it manually?

quaint mantle
#

?jd

night copper
#

does p.updateInventory() do p.closeInventory() and p.openInventory() at the same time

#

??

quiet ice
#

Intventory#remove

kind coral
quiet ice
#

Also in your damageItem implementation?

night copper
#

πŸ˜₯

#

ignored

zinc saffron
#

How can i get the item stack of an item from the armor contents of entities?

kind coral
night copper
#

entity.getHelmet
.getChesplate
.getLeggings
.getBoots

#

i think

zinc saffron
#

But something's not working

night copper
zinc saffron
#
                event.setCancelled(true);
            }```

in the isCrashItems boolean

```            try {
                item.getItemMeta();
            } catch (Exception exception) {
                return true;
            }```

is not working
#

it doesnt check of a item an entity has throws an exception

kind coral
night copper
#

are you sure?

kind coral
#

yes

night copper
#

ok

#

whats your helmet itemstack?

earnest junco
night copper
#

How can I check if a player sent a double in AsyncPlayerChatEvent

kind coral
#

just parse the message

#

use Double.parseAsDouble() i think

#

and if it throws number format exception it means its not a double

night copper
#

ty

#

its parseDouble i just checked

thorn beacon
#

Am I right in thinking this is the place to put in the "front page" of your plugin which normally has fancy graphics etc...?

night copper
#

Yes

thorn beacon
#

mkay, thanks

night copper
#

you can put images

#

and gifs I think

thorn beacon
#

Yeah, I've sussed that out - I just expected it to be a bigger box I guess

night copper
#

It goes down

#

its scrollable

#

when you write a lot

thorn beacon
#

oooh that would make sense

kind coral
#

how would i ignore durability when checking between two itemstacks, i made my own method but doesn't seem to work

sand vector
#

So i know for commands you have to put them in the plugin.yml file, but is there a way to put all these commands in another yml file so the plugin user can change the names?

kind coral
#

just register them via bukkit and link everything trough config

#

there are guides

#

howd the fuck is it giving an error

earnest junco
earnest junco
worldly ingot
#

I see && a.getItemMeta().getDisplayName() above

#

Which is not a boolean. It's a String

earnest junco
kind coral
#

tyvm

quaint mantle
#

Any reason why I do not get the playername on my array ? Player name is stored on the 3th column of my database

night copper
#

how do I check if a player is in a hashmap(uuid, string) and how do I remove him

earnest junco
quiet ice
#

I assume it would be something like if (hashmap.remove(player.getUniqueId())) {/* had entry */}

random epoch
#

Try setting the item amount of the left hand to 0

quaint mantle
#

and it the issue is still the same

dusk wedge
#

why set it to null? and not air

quaint mantle
#

Because air didnt work

young knoll
#

Setting it to null should work

#

Don't set the type to null

#

Set the actual item to null

hardy valley
#

wdym?

outer crane
#

for loop on the object?

trail oriole
#

Guys, it's now been a while I'm searching on internet and I didn't want to ask for help but I can't get myself through that...
Anyone knows how to make a player shoot a guardian laser beam when right clicking an item?

#

I really don't like asking for help but never found about that specific projectile

quaint mantle
#

Is there an easy way to find which direction a player is facing without having to do an entire function for converting the yaw and pitch to something usable?

#

wait nevermind found that player.getFacing().getDirection().getX() works pretty good

opaque grove
#

is is possible that: assert x = 1 && y= 1 only checks first value

young knoll
#

If x != 1 it will only check the first value

lost matrix
#

And checks are from left to right

young knoll
#

In this case it's an and operation, so if the first one is false there is no reason to check the second one

opaque grove
#

i mean i have this assert

assert Megarena.getPlugin().Game.get(p.getUniqueId()).equals("megarena") && e.getItem() != null;

switch (e.getItem().getItemMeta().getDisplayName()) {

but the item is null

quiet ice
#

it performs as many checks as it needs to

#

asserts are killed at production runtime btw

opal juniper
#
@EventHandler
    public void onMove(PlayerMoveEvent event){

        Player player = event.getPlayer();

        List<Entity> entities = player.getNearbyEntities(20,20,20);
        for(Entity entity : entities){
            if(!(entity instanceof ArmorStand)) return;
            ArmorStand armorStand = (ArmorStand) entity;
            if(armorStand.getCustomName().equalsIgnoreCase("hello")){
                Location location = event.getTo();
                location.setY(location.getY() + 10);
                armorStand.teleport(location);
            }
        }
    }

Im a bit confused, this code^^ seems to tp the player to the armour stand, not the other way around. What have i done wrong? πŸ˜„. It is supposed to keep the armour stand 10 blocks above the player at all times

lost matrix
#

You can simply make a simple KNF DNF forming from
v < x || v < y to !(v >= x && v >= y)

lost matrix
opal juniper
#

ooooooohhh yeah

#

im stupid, thanks

lost matrix
wet breach
glass sparrow
wet breach
#

The item is null the check is apparently not picking that up

#

should read the comments πŸ˜‰

lost matrix
young knoll
#

Aren't they generally used for unit testing

quiet ice
#

They are good to clear up misconceptions for the IDE

opaque grove
#

yeah i replaced the assert with if x==nullreturn

lost matrix
#

You would need to run the jvm with the -enableassertions flag to even make use of them

#

And they dont throw exceptions but extend Error. Better use a fail fast approach or in your case simple null checks.

young knoll
#

Anything is possible with enough jank

runic cloud
#

How can I prevent players from taking items from inventory? Even if I cancel the InventoryClickEvent, players still can take items using shift + fast inventory close

lost matrix
trail oriole
#

You can cancel event from InventoryDragEvent I think

trail oriole
lost matrix
trail oriole
#

Thanks guys, sorry for taking ur time should have Googled better

lost matrix
#

Lol... the newest snapshot introduced a Marker entity. It can hold all the nbt data you want without being ticked. So we now can easily write data to a position without having to spawn an invisible ArmorStand. Imma find out if it can be named because then its a nice alternative to ArmorStand based holograms...

young knoll
#

That does sound nice

#

As well as the resource pack message

lost matrix
#

Wait thats server side only. Still nice.

young knoll
#

Huh

#

So it's just for storage

wet breach
#

which is actually handy

young knoll
#

Sounds like a decent way to store data on arbitrary locations

wet breach
#

instead of putting the data on all the blocks or data about the blocks, you could use marker entities for that instead

#

this way when the blocks are ticked, it doesn't need to tick all that data until the plugin/server actually needs it

#

see it being useful for those who like making protection plugins πŸ˜‰

young knoll
#

I still want to be able to hook into the random tick system

#

spigot plz

wet breach
#

in general it would be nice to be able to hook into quite a few things

young knoll
#

True

runic cloud
#

If I click the slot 3 times, it still passes the event.setCancelled(true) in an inventoryclickevent

#

and I can place an item in a specified slot

young knoll
#

HAve you tried survival

#

Creative is wack

chrome beacon
#

Make sure you cancel the InventoryDragEvent too

young knoll
#

I've still never had to do that

#

But people seem to say it often

lost matrix
#

If the click is cancelled then the drag doesnt even have a chance to be triggered

young knoll
#

That's what I figured

chrome beacon
#

Yea true ;/

young knoll
#

The only issue I have had is opening inventories while in a bed

runic cloud
#

I click a slot twice and it gets cancelled, but for the third time it just bypasses that.

runic cloud
#

the latest paper I assume

#

but will double-check that

chrome beacon
#

Paper πŸ‘€

quaint mantle
runic cloud
lost matrix
earnest junco
runic cloud
quaint mantle
#

Oh it's the result slick I tought the statement

chrome beacon
#

Or test the plugin on spigot and see if the issue still happens

lost matrix
earnest junco
paper viper
#

I remember using this plugin https://www.spigotmc.org/resources/lib-hates-mods.78202/ which helps detect forge clients and clients with the fabric api joining the server. It supports a way to check if the user has a certain blacklisted mod and if so, kick them. You can try decompiling the plugin and see what it does.

#

its made by libraryaddict, the same dude who made Lib Disguises

#

np

humble heath
#

hey can anyone help me

lost matrix
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

humble heath
#

i want to make a Gamemode Gui i Have the /Gm working for my self but i cant seem to get the /gm <playername> working propely i can open the gui but i cant make it change the other persons gamemode how could i referance the other players name in the listener, i have the gui working but the bit i cant get working is the geting the name from the command class to the listener class i.e: /gm ArcaneLegend then in the listener class arcanelegend.setgamemode(Creative);

young knoll
#

You can save the two uuids to a map

#

Executor and target

humble heath
#

how would i do that

paper viper
#

i dont remember it being obfuscated when i last had it

#

hm weird

#

one second

lost matrix
#

Looks more like decompiled than obf

humble heath
#

i dont get that to be honest the map system

summer lily
#

Hey, Since JRE 8 support is going done, should I code in JRE 11 as well?

lost matrix
summer lily
#

All right

lost matrix
#

For personal use def a higher version

summer lily
#

Ok thank you

jade perch
#

Java 7 is best

summer lily
#

7?

#

never used

#

why do you think?

jade perch
#

ever heard of 7/11

#

that's why

lost matrix
#

I would use 6
More compatible with Windows 95 systems

quiet ice
#

You should use Java 16 to bork your gradle install

wet breach
#

most of the time you won't be, so its perfectly fine to target Java 8

#

as far as installing Java on servers, they shouldn't be using Java 8 since like 2-3 years ago

#

maybe longer

ivory sleet
#

Yeah it lost LTS

dusty herald
#

lmao I got an email from Kangarko on my throwaway about Java 16

#

sorry, jave 15 (

ivory sleet
#

16 does introduce some cool features ngl

dusty herald
trail oriole
#

Am I the only one to code my minecraft server in Javascript?

cunning cloak
#

What does this mean? org.bukkit.plugin.InvalidPluginException: Abnormal plugin type

#

?paste

queen dragonBOT
trail oriole
cunning cloak
cunning cloak
ivory sleet
#

Does your main have a nullary constructor?

cunning cloak
#

Let me check

ivory sleet
#

If not then make sure to add one

cunning cloak
#

This is the only one that is in my main public SlipStuff(SlipStuff plugin) { this.plugin = plugin; }

ivory sleet
#

Remove it

#

It’s utterly useless and redundant

dusty herald
#

You don't do that, that is what onEnable is for

ivory sleet
#

And it makes your plugin abnormal

cunning cloak
#

Okay

opal juniper
#

Is there a way to set the player camera somewhere else? like just offset it?

cunning cloak
#

Thanks @ivory sleet & @dusty herald for your help!

trail oriole
#

But what do you mean by offset the camera

#

Like seeing your player from somewhere else?

opal juniper
#

like the camera is say 5 blocks up

#

i tried with the cam packet however that fixes the movement

lost matrix
trail oriole
#

With the citizen plugin you could work pretty easily around that

#

Depends on what you want to do with the camera

opal juniper
#

Just like you were playing normally but the cam was somewhere else

trail oriole
#

Like controlling your player from somewhere else or just having it?

lost matrix
#

Yeah but working out a proper camera position is pretty complex and requires some math.

opal juniper
#

controlling

wet breach
trail oriole
#

Try searching on Google, maybe some people have done that before

#

I think it's actually possible but pretty complex

lost matrix
wet breach
#

ah yes that too

trail oriole
#

Maybe controlling a npc clone of your player would be easier

lost matrix
wet breach
#

That is actually nice and like they added that

#

I mean, its not something I really cared for too much, but it is still nice nonetheless πŸ™‚

opal juniper
#

Yeah, just to test i tried this:

        CraftEntity e = (CraftEntity) entity;

        final PacketPlayOutCamera packet = new PacketPlayOutCamera(e.getHandle());
        CraftPlayer p = (CraftPlayer) player;
        p.getHandle().playerConnection.sendPacket(packet);

However this freezes the cam, is there like a way to take the player's movements and apply it to the entity?

wet breach
#

unfortunately because linux sockets are in Java 16, can't really PR to spigot to update connection code to make use of it when servers are on the same host 😦

lost matrix
opal juniper
#

hmmm, true

#

imma hit the hay and think bout this at a later time

#

thanks for the ideas tho

sand vector
#

what does this do? "player.getCustomName()" is this just a way of getting someones nickname?

dusty herald
#

Gets the custom name on a mob or block.

sand vector
#

ah thanks

cunning cloak
#

How do I make it so then all of the content is sent back to the player using args.length, if so is there a simple way to do this?

dusty herald
#

you mean like this?

#

command: /msg username hello buddy
returns to the user username:

#

hello buddy

#

idk

cunning cloak
#

No like /testcommand hi returns hi back to the player after they have executed it.

#

So basically returning the message back to the player

glass sparrow
#

just use String.join() if there's multiple args

cunning cloak
#

How do I use that @glass sparrow?

glass sparrow
#

String.join("sep", args)

#

i think

dusty herald
#

I like to

#

String.join(" ", args).trim();

#

just incase

cunning cloak
#

What does .trim() do?

dusty herald
#

method removes whitespace from both ends of a string

cunning cloak
#

Ah

#

Thanks @dusty herald & @glass sparrow for your help!

woeful crescent
#

Hey everyone

trail oriole
#

Hey

woeful crescent
#

I would like to replaceAll(), but not if there is a backslash before what I am trying to replace

#

I'm not very familiar with regexes, is there any way to do this without iterating through all occurances?

#

So, for example, if someone types "RED" I want to replace it with ChatColor.RED + "", but if someone types "\RED" I don't want to replace it

glass sparrow
#

@woeful crescent can you assume RED will have whitespace around it?

woeful crescent
#

You mean spaces?

glass sparrow
#

yea

woeful crescent
#

no I can't assume that

#

someone would probably just type GREENhey guys I can type in green

woeful crescent
#

Thank you

#

oh, and exclamation marks aren't metacharacters, right?

rocky glacier
#

I think theres something wrong with spigot... I am setting an entities yaw (armorstand this case) with entity.setRotation(newYaw, 0). Then, the entity rotates, but only a bit. When requesting the entities yaw, it seems to be correctly set. When I look at the actual result in game though, it has an actual yaw thats only a fraction of the rotation. https://imgur.com/a/P9jC4TR

I am also riding the armorstand, it has a model, its invisible and it is invulnerable (fyi)

#

Spigot seems to correct itself after a few seconds though (usually around 30 seconds later). It then corrects the yaw to the expected yaw in game

#

Also i use paper spigot

bright jasper
#

wrong channel one min

#

Tfw just realized Hypixel scales 100k players by having many bungee proxies and having a DNS load balancer that connects users to different proxies. Most of their modifications to spigot/bungee allow them to run seamlessly in kubernetes or swarm which allow communication between servers on different systems. Everything past that point is decently vanilla when it comes to the jar and everything that comes after is a plugin that uses class injection to replace spigot functionality when they need it

#

πŸ‘

#

Hypixel does not need to run thousands of people on one core/jar/container, they need to run about 50 maximum at one time per core/jar/container

#

which is decently easy

#

the difficult part comes in balancing and communicating aka the kube part

#

and all their packet stuff they do with NMS and world loading with skyblock

rocky glacier
#

Yea.. did you really think they did all on one dedi

bright jasper
#

No but people do, and i was like "hmm they cant all be connected to one proxy that connects to spigot servers. Even having one proxy with 10k people on it is gonna choke it to death"

#

People kept saying that they had some sort of proxy they wrote that was more scalable than bungee but thats bull

#

no matter what you do you cant hold 100k connections on one process

#

so they have many bungeecord instances with DNS balancing which explains ALOT

#

search up bungeecord

lost matrix
#

plugin messaging channel

bright jasper
#

as in the /server command provided by bungee

lost matrix
bright jasper
#

this is not a development question and the answers here wont be correct for your situation

#

no worries

dusk wedge
#

if anyone uses protocollib's version of multiblockchange can you show me how you did it, it seems I either don't understand or it isn't working. 1.16.5

lost matrix
dusk wedge
#

1s I'll get a pastebin

dusty herald
#

?paste

queen dragonBOT
sturdy patrol
#

@bright jasper Just to complete what you said, they probably use multiple proxies. If you contact their dns at different times, they will give you a different ip every few minutes, probably depending on the load

bright jasper
#

Yeah they for sure do

#

Join the game and do

#

/proxy

#

it gives you your current proxy ID

sturdy patrol
#

πŸ‘ your method is even easier than asking the dns for an ip every few minutes ahah x)

torn oyster
#

if you did Block#breakNaturally() on a spawner, would it drop the spawner?

#

if not

#

how would i make it drop it

lost matrix
earnest junco
torn oyster
#

how do i change the spawner type

#

mob

torn oyster
#

i meant get it

#

sorry

young knoll
#

CreatureSpawner can be obtained via block.getState and casting

torn oyster
#

oh lol

olive valve
#
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 2));
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 3));
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 4));
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 5));
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 6));
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 7));
            wait(1200);
            p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 8));
            wait(1200);```
would i do this if i wanted haste to increase every minute?
ivory sleet
#

Uh

#

No

#

You probably should use the bukkit scheduler

olive valve
#

ok

olive valve
earnest dome
#

What is that

ivory sleet
#

uh yeah or as I do
this.getServer().getScheduler().runTaskLater(this,() -> {
//code here that should be delayed
},1_200L);

But yours works though I don’t know if it’s safe to use async in your case

earnest dome
#

Like what is the potion for?

olive valve
#

my command

earnest dome
#

Ah nice

olive valve
#

so mine will work?

earnest dome
#

Idk

ivory sleet
#

Might get an exception.

olive valve
#

k

ivory sleet
#

Telling you it needs to be done on server thread

olive valve
#

ok

#

ill use yours, Conclure, bc mine has an exception

torn oyster
#

is Bukkit#getPlayer(name) case-sensitive?

ivory sleet
#

No

olive valve
#
                //code here that should be delayed
            },1_200L);``` how come this code doesnt work?
ivory sleet
#

You didn’t put anything in the lambda

summer scroll
#

You have _

ivory sleet
#

That works fine

olive valve
#

what is "lamda"

summer scroll
#

between delay and thing

olive valve
#

oh

ivory sleet
#

Alger that’s syntax correct

#

The lambda is the () -> {...}

olive valve
#

oh

ivory sleet
#

No Woods don’t listen to aglerr because 1_200L and 1200L is equivalent in terms of their functionality

summer scroll
#

oh my bad, i thought runTaskLater needs delay and period

ivory sleet
#

But basically put your potion effect code inside the lambda

olive valve
#

its says in runTaskLater that there isnt a method. i forgot how to make a method

ivory sleet
#

What u got?

#

Feels like you need to learn basic java first

olive valve
#

i watched a 2hour video ive been all over the internet and i guess I STILL DONT KNOW??

#
               ```
ivory sleet
#

My tip is to not watch videos but using learning sites

olive valve
#

i have

#

and alot

#

several

#

but can someone help me fix this?

#

please

summer scroll
olive valve
vague oracle
#

What is the problem?

olive valve
#

alot

#

every time i try to build the project

#

it gives me a new exception

#

i have no idea how to learn java i thought i knew how to but nothing works? i guess

eternal night
#

We have all been there. Try Jetbrains Academy (has a free trial or register for their student licence for free) (to woods george jr)

olive valve
#

ok thanks Lynx

eternal night
#

so you just want to code bungeecord plugins using gradle ?

#

I mean, just include the bungeecord repository and dependency in your gradle.build ?

#

neat xD

#

just make sure to compileOnly

#

don't want a copy of the bungee api included in your plugin

#

the gradle dependency scope ?

paper viper
#

its the same as <scope>provided</scope>

#

in maven

#

basically you want to make it so you don't include

#

the api

dusty herald
#

Default maven scope is compile

eternal night
#

but what is default gradle behaviour xD

#

compileOnly seems weird to be default

dusty herald
#

Iirc you set it, there is no default

eternal night
#

yeah ^

dusty herald
#

Maven without the scope tag will default to compile though

eternal night
#

looks good πŸ‘Œ

#

I mean, newer minecraft versions may introduce new api in bungeecord

#

1.16 has new api for 1.16 minecraft

#

I mean, if you can you should always attempt to code against and run latest

young knoll
#

Wait, bungeecord can detect that?

#

Looks like you can only get the name and version

#

Mod names have to be unique anyway iirc

#

I assume it's forge

paper viper
#

Yeah you can lol

#

You saw the code right

#

was it useful

#

xD

young knoll
#

Interesting method to block certain mods

#

Of course it's not super hard to bypass

#

It's a map <String, String>

#

So you can turn it into an array fairly easy

sand vector
#
Bukkit.getPluginManager().registerEvents(new EventsClass(), this);
#

Doing this makes the class continuously run right?

young knoll
#

Define continuously run

sand vector
#

like it will check go through each public void? idk how to explain it

#

so like i have EventsClass() with all the public void onInteract(PlayerInteractEvent event)

glass sparrow
#

do they have an @brave glenHandler

sand vector
#

ye

glass sparrow
#

then yeah

#

didnt mean to tag

sand vector
#

ok, sorry for my poor explaination XD

cinder thistle
#

it's so hard for me to actually help people here

#

instead of correcting their conventions

sinful python
#

I'm trying to create a primed tnt entity, is there a child class to the abstract TNTPrimed class without abstract methods?

#

I don't want to manually set all the variables when I create an instance of the class

#

Also sorry in advance if I ask a few dumb questions, I'm just getting started :)

lost matrix
#

TNTPrimed is the interface provided by Spigot. You very very rarely implement an interface from Spigot.
You would spawn a primed tnt by simply calling the spawn method from a world.
So:

  public TNTPrimed spawnTNT(final Location location) {
    final World world = location.getWorld();
    return world.spawn(location, TNTPrimed.class);
  }

Or:

  public TNTPrimed spawnTNT(final Location location) {
    final World world = location.getWorld();
    return (TNTPrimed) world.spawnEntity(location, EntityType.PRIMED_TNT);
  }

@sinful python

sinful python
#

Oh, thank you!

lost matrix
#

What are your takes on multi language support?
I would like to support multiple languages and thought about many different ways.
It should be

  1. Accessible (So something static or an enum)
  2. Scalable (Prevent boilerplate by annotation scanning for example)
  3. Robust (If public static then also final or generated static getters on private mutable static fields)
young knoll
#

Are we talking spoken language or programming language

upper vale
#

I personally speak Java

lost matrix
# young knoll Are we talking spoken language or programming language

I honestly just wanted something that would provide me with messages from a file in a way that doesnt drain my will to live...
This was one consideration:

public class Language {
  
  @Translatable(path = "some.path.for.explanation", base = "Some base value")
  public static String COOL_VALUE;
  
}

Which i dont like because the fields are mutable this way.

young knoll
#

I just use a map

#

I guess an enum would work too

lost matrix
#

Ill just use an enum for now.

sand vector
#
if (messageMap.get(uuid) == message) {

}            

So when both variables are equal to the same value lets say "R", the IF statement wont execute. Is there a difference to a String hashmap and normal String?

summer scroll
#

You want to use .equals to compare String.

#

or .equalsIgnoreCase.

sand vector
#

ah yes, totally forgot about that. Thanks

summer scroll
#

np

quaint mantle
#

Hello, spigot I have problem with evoker

I cleared evoker's all pathfinders like this:

@Override
    public void initPathfinder() {
        super.initPathfinder();
        Bukkit.broadcastMessage("A");
    }

But evoker still summoning mobs (Vex, etc)

#

Also, thanks to @gleaming grove it works now!

young knoll
#

initPathfinder adds the goals

#

How would that remove them?

quaint mantle
#

thanks

#

it works

#

xD

#

hello spigot, I have problem with my mob.

I removed all ai and added attacknearplayer pathfindergoals like this,

@Override
    public void initPathfinder() {
        this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityPlayer>
                (this, EntityPlayer.class, true));
    }```

But my mob not attacking players
#

and my mob's ai is all removed (I want to add this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityPlayer> (this, EntityPlayer.class, true)); )

vague drift
#

hello, does anyone know a method of licenses to prevent piracy of Premium plugins that does not violate the terms of use of spigot?

young knoll
#

Open Source

#

Can't pirate something that's open source

vague drift
#

piracy in this case is to put free download on leaked plugin sites

young knoll
#

I'm aware

#

My point still stands

vague drift
#

some people buy the Premium resource and put it on leaked sites

young knoll
#

I'm aware
My point still stands

quaint mantle
#

This means that after I remove all the pathfinder in the mob with the following code, the new pathfinder does not work even though I added a new pathfinder. (Not all pathfinders in the mob apply)

@Override
    public void initPathfinder() {
        this.goalSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityHuman>
                (this, EntityHuman.class, true));
    }
young knoll
#

In all seriousness, spigot adds a bit off protection to your plugin when it's downloaded, and you can do some basic obfuscation to slow down leakers

#

But you will never be able to stop them, even with the best licensing system

dusk wedge
#

even the biggest companie's games with millions of $ poured to anti-piracy get cracked

young knoll
#

You could pursue legal action, but it's up to you if that's worth it

#

In the end I advocate for open source, pay for support

vague drift
#

this is not feasible. I will think about leaving open source

#

this is a mistake because the developers lose out

young knoll
#

Go talk to MD about it

vague drift
#

but thanks for the tip

young knoll
#

I'm sure he will enjoy having that conversation again

vague drift
#

many developers abandon spigot because of the lack of protection against piracy and leaks

young knoll
#

Spigot doesn't make any money of premium plugins, so I doubt MD cares that much

vague drift
#

I understand

young knoll
#

<#general message> Here is the start of the last conversation about it

summer scroll
#

I'd rather having an open-source and paid for supports.

young knoll
#

Agreed

summer scroll
#

Instead having anti-piracy i guess.

young knoll
#

Or you can pay to not have to compile it

summer scroll
#

It'll take more time, setupping etc, paying web hosting maybe.

young knoll
#

It takes a location

#

So you pass a Location

quaint mantle
#

Any reason why my code isn't working ? Still saying that array is empty.

sinful python
#

Yeah I've tried creating locations but it just keeps giving me errors

#

Hmm nevermind I seem to have gotten it

haughty haven
#

hey fellas, I'm trying to make it so that if a player uses a certain bow, then an explosion will happen where that arrow lands. so far I got everything working, except there is an error whenever a skeleton fires an arrow from a bow. I figured I should check whether the arrow is null and if the shooter is a player, but that didn't fix the issue. here's the error

#

and here's my code:

#
    @EventHandler
    public void onArrowBomb(ProjectileHitEvent event) {
        Arrow arrow = (Arrow) event.getEntity();
        Player player = (Player) arrow.getShooter();
        ItemMeta item = player.getInventory().getItemInMainHand().getItemMeta();
        Location arrowloc = arrow.getLocation();
        if (arrow != null && event.getEntity().getShooter() instanceof Player) {
            if(isCooldownOverApollo(player)) {

                if (ItemManager.apollo.getItemMeta().equals(item)) {
                    World world = player.getWorld();
                    world.createExplosion(arrowloc, 2, false, true);
                    startCooldownApollo(player);
                }
            }
        }
    }```
summer scroll
#

You need to check if the shooter is player.

haughty haven
#

yes

#

that's what I thought, but I don't think i did it right

summer scroll
#

You need to do that on the start of the method.

#

You're already getting the player while you haven't checked the shooter first.

haughty haven
#

ah i see

#

will test it now

sinful python
#

Does the block break function record the position of the broken block?

haughty haven
#

do I still need to check if the arrow is null?

young knoll
haughty haven
#

mhm, i see

young knoll
summer scroll
#

Check if the entity is instance of Arrow instead.

young knoll
#

I would like to argue that they should expect this using that name :p

candid galleon
#

@sinful python yes

sinful python
#

Hmm, do you know how I would access that information?

candid galleon
#

BlockBreakEvent#getBlock

sinful python
#

Thanks! :)

candid galleon
#

πŸ‘

olive lance
#

Does anybody have any good tips/examples of organizing an oncommand method for a command with lots of different arguments and different prerequisites to use the many arguments

#

I saw some people talking about using a map but I’m not sure where to start with that

young knoll
#

You would have a Map of String -> Consumer or Custom class that handles a single argument

#

?paste

queen dragonBOT
young knoll
young knoll
#

Looks like what I showed with more code :p

#

And a list which requires a loop and is therefor slower

summer scroll
#

Is it gonna make a lot of different in performance?

young knoll
#

No

#

But it’s good to avoid unnecessary loops

summer scroll
#

Ah alright, I will consider using Map instead.

#

Anyone know why it's giving me a warning Boolean method 'willDropCoins' is always inverted, what is that mean?

    public boolean willDropCoins(){
        return ThreadLocalRandom.current().nextDouble(101) <= (getChance());
    }
snow bane
#

im trying to share my project on github but intellij is saying my authentication is invalid

#

can i post a screenshot of it here or smth

drowsy helm
#

you're trying to post a repo on github?

snow bane
#

yeah

drowsy helm
#

use the github desktop app

#

or git bash cli

quaint mantle
#

hey spigot !how to bypass spigot the recived string length is longer than mixium allowed?

#

when I create npc

drowsy helm
#

you can add the npc to a team and put a prefix and suffix

#

which means you can have like 48 chars

deep solstice
#

im trying to add vault as a dependency to a maven project, here's what i added to my pom.xml:

            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>```
and ```        <dependency>
            <groupId>com.github.MilkBowl</groupId>
            <artifactId>VaultAPI</artifactId>
            <version>1.7</version>
            <scope>provided</scope>
        </dependency>```

when i try importing something from vault, such as `import net.milkbowl.vault.chat.Chat;`, nothing works. what am i doing wrong?
drowsy helm
#

try mvn clean

#

and mvn install

#

is your IDE saying you have an error importing the xml?

deep solstice
#

intellij is saying that i can't do the actual import statements in the java file

drowsy helm
#

but the xml, does it give errors?

#

the pom

deep solstice
#

nope

drowsy helm
#

tried restarting IJ?

deep solstice
#

ill do that now

#

still getting yelled at

#

wait

#

it lied, it's all working now

#

god i feel dumb, thanks for the help

drowsy helm
#

yeah lmao sometimes its just the ide

solemn shoal
#

wait vault does vault do chat?

#

i thought vault was economy specific

young knoll
#

It has a chat and economy API

solemn shoal
#

ah

#

not sure what the use of the chat api is

deep solstice
#

okay still going on about vault, i added this method as instructed by the github page. when i do it, the plugin disables, due to the second return statement. any ideas why?

    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false; // returns false here
        }
        econ = rsp.getProvider();
        return econ != null;
    }```
young knoll
#

It also has a permission API actually

#

Do you have vault and an economy plugin installed

solemn shoal
#

thats not supposed to happenen

deep solstice
#

oh wait shoot economy plugin

solemn shoal
young knoll
#

And does your plugin load after vault

deep solstice
#

god im dumb

solemn shoal
#

even if my pluugin is the only plugin it works fine

deep solstice
young knoll
#

It should

solemn shoal
#

i have the same code

deep solstice
#

okay yeah it worked now, forgot about the economy plugin lol

young knoll
#

Yes but what do you do with the return of that code