#help-development

1 messages · Page 1381 of 1

eternal oxide
#

It probably only came up because he was trying to return teh items to the player from teh crafting grid

deft sedge
#

IT doesn't work

#

sdofijefio

eternal oxide
#

lol, it works here

deft sedge
#

ill send what i did

young knoll
#

Yeah I had a small feeling this wasn’t the issue

deft sedge
#

?paste

queen dragonBOT
eternal oxide
#

I tested with a single item and multiple in different slot

deft sedge
#

yea me 2

young knoll
#

I imagine spigot has a way to keep created inventories referenced

#

What spigot version are you on

#

And is it up to date

deft sedge
#

1.16.5

eternal oxide
#

That code I sent you exactly as is worked perfectly

#

all in the same class

lost matrix
#

Why does it have to be a Fireball?

deft sedge
proud sapphire
#

can someone help me with detecting and cancelling number key shortcuts

young knoll
#

downloaded

proud sapphire
#

inventoryclickevent doesnt seem to detect it

deft sedge
lost matrix
#

You can also use other projectiles and disable their gravitiy. Then listen for the ProjectileHitEvent and create an explosion.

brittle badger
lost matrix
eternal oxide
deft sedge
#

ok

lost matrix
brittle badger
#

yes

eternal oxide
#

I added a login event so the inventory opens as soon as you join the server

deft sedge
#

I convinently forgot how tomake a new project

#

edfdsfdfefs

#

also i might've selected paper plugin in creation but idk

#

I'm using intelij btw

#

i do have a paper plugin tho

eternal oxide
#

you can put that code in yrou current plugin

#

the class has events registered so just put it in exactly as I gave you

deft sedge
#

k

#

imma do tahat now

proud sapphire
eternal oxide
#

there is a seperate event for that...

proud sapphire
#

what's the event?

eternal oxide
#

looking

#

Um, I guess not. Old age moment. I could have swore there was a specific event when transferring between inventories

proud sapphire
#

hmm

brittle badger
#

@lost matrix so are there any alternatives?

young knoll
#

There is InventoryMoveItemEvent

#

But that’s for hoppers

young knoll
#

What entity does that

#

Hopper Minecart?

eternal oxide
#

I'd test if it fires for a player too

lost matrix
proud sapphire
#

it is actually firing inventoryclickevent but cancelling it does nothing

young knoll
#

Creative mode?

#

Because creative mode is jank

proud sapphire
#

nope can do it in creative and survival

eternal oxide
#

creative has its own events

brittle badger
young knoll
#

Yeah I think the server puts more trust in creative players

brittle badger
#

I use gradle

deft sedge
#

@eternal oxide it's ur trigger, it works perfectly but it's basically the same WTF is wrong with mine?

brittle badger
#

i do forge modding as well so used to gradle

#

but maven and gradle are similar right?

eternal oxide
deft sedge
#

ok, so should I put the command and the other thing in the same class?

lost matrix
eternal oxide
#

you could as its all related

deft sedge
#

ok

young knoll
#

Im still dubious on that one

#

But if it works who am I to question it

brittle badger
brittle badger
bright jasper
#

Can i get a chatcolor from a string that is like

#

&x&f&f&f&f&f&f

#

I need to get a chatcolor from a toStringed ChatColor basically

deft sedge
#

once I implemented it in the same class as the command, the first slot works, but only if it has to return one item stack 🤦‍♂️ @eternal oxide

eternal oxide
#

for me it works with any number of slots occupied

proud sapphire
#

it was because .getCurrentItem() returns null for some reason if you hotkey

deft sedge
#

@eternal oxide if it's not too much trouble, can u try urs with the command as the trigger, that seems to be the only difference

#

?paste

queen dragonBOT
deft sedge
eternal oxide
#

sec

deft sedge
#

does it all in one class

deft sedge
brittle badger
deft sedge
#

@eternal oxide Pls ping me if responding, im gonna be on my phone but i'll still read ur response

deft sedge
#

sdofjseoifjsif

#

well

#

idek

#

can u send me ur code

eternal oxide
deft sedge
#

k thx, imma go to bed

eternal oxide
#

kk

deft sedge
#

ill try tmr

#

Thanks for all ur help

#

have a good night

bright jasper
#

Having an issue, I have a bungee chatcolor(HAS to be bungee for what im doing)

#

And I am using the team api to do team.setColor

#

which wants a bukkit one

#

how i do

heavy sapphire
#

Would it be a bad idea to, in the onEnable() method, store getProxy() in a static variable so I can access it from a static context? I need someway to convert online player's usernames to UUIDs. I don't want to use the mojang api because its rate limited.

eternal oxide
#

You pass your plugin instance via dependency injection

quaint mantle
#

how to check if the block breaked in the BlockBreak event has been breaked by a player or a villager

eternal oxide
#

Do you mean a fake player/NPC as villagers don't fire the blockbreak event. I don't believe they can break blocks

quaint mantle
#

when they pickup carrots

#

villager farmer

eternal oxide
#

thats harvestblock not breakblock

#

and again, only players trigger that event

quaint mantle
#

and is this event triggered by villagers

#

onPlayerInteract

eternal oxide
#

the event name tells you all you need to know

quaint mantle
#

is villager considered by players

eternal oxide
#

no

summer scroll
#

Will CompletableFuture resolve CME?

#

I have a method to create a data each player and save them to the SQL and then cache the data into a Map with async task but It's giving me CME.

chrome beacon
#

Use a concurrent map or a syncronized one

eternal oxide
#

you can;t modify from two threads without synchronizing

summer scroll
#

Can I save the data into sql with async and then cache them sync?

ivory sleet
#

cache them sync?

#

I mean quite frankly you should probably use a concurrent data structure and just cache it on the same thread

eternal oxide
#

use a Future to save/load to the SQL. then run sync to put it in your cache

summer scroll
#
CompletableFuture.runAsync(save/load).thenAccept(put in cache);
eternal oxide
#

not quite, as the thenAccept is still Async

ivory sleet
#

Wrap the callback with the BukkitScheduler like
.thenAccept(o -> {
Bukkit.getScheduler().runTask(plugin, () -> {
this.cache.put(...);
});
});

eternal oxide
#

yep

ivory sleet
#

pey (:

summer scroll
#

oh okay, i thought thenAccept is sync because there is thenAcceptAsync too.

eternal oxide
#

its on the thread that completes the Future

summer scroll
#

ah okay

ivory sleet
#

Well it’s sync with respect to execution of the supplier/runnable that is declared ahead of the callback you declare.

hushed spindle
#

when you do YamlConfiguration#get() which returns an object I should be able to check the instance of that object right, when I use config.get("somename") on for example

somename: 30.0

will this object be an instance of a string or a double or something else

eternal oxide
#

it will return an generic Object. use the correct getter for your type.

hushed spindle
#

no i get that but im trying to generate abstract objects with configurable options for each and some of those options are string or doubles or lists

#

was wondering if i could just cast the generic object to the option type it needs instead of making a whole bunch of type specific abstractions

eternal oxide
#

Is there a reason you are not using ConfigurationSerializable?

hushed spindle
#

its not what im looking for

ivory sleet
#

It has stuff like getString getInt getList alr?

#

But yes you should although it may be the case a boxed primitive is returned

#

That’s probably guaranteed

knotty arch
#

hey can someone take a look at smth for a plugin I'm developing and tell me if it seems like the best way to implement it

ivory sleet
#

Sure

knotty arch
#

Alright 1 sec

hushed spindle
#

this was all i needed so it'll be fine

ivory sleet
#

Interesting

eternal oxide
ivory sleet
#

Ftr it’s pointless to reinvent the wheeel

hushed spindle
#

it wont be an issue anyway with how its implemented

sage dock
#

pls help

sage dock
#

I need to add to my jar file which I have on my computer
not to the global repository

eternal oxide
#

Instructions are on there about how to make your own patches

sage dock
#

okay

summer scroll
#

So I have a save method and it will get a new connection, and it the method will run another method that will get a new connection, should I pass the connection on the parameter instead?

ivory sleet
#

Do you use hikari ?

summer scroll
#

nope

#

it's kinda my first time using sql

ivory sleet
#

Ah well it may still be of your interest to have a look at hikari connection pool then

eternal oxide
#

just have a getConnection(). In that method you check if the connection is good, if not create a new one.

summer scroll
summer scroll
ivory sleet
#

Elgar means you should have one connection at the time

summer scroll
#

And maybe change to something like this

public void insert(Connection connection, String uuid, String value){}
public void update(Connection connection, String uuid, String value){}
ivory sleet
#

Then check if it’s a good one, if it is keep it else may wanna close and get a new one

#

Aglerr if all of those methods are in the same class then maybe it worth putting the connection into a field and use that field instead of passing it through method parameters

eternal oxide
#

With yoru code you are not dealign with the connection or anything if it errors

summer scroll
#

Now I'm confused xd

ivory sleet
#

Then maybe inject the databasemanager instead passing the single connection ?

summer scroll
#

I'm currently moving everything to a manager class and let's see how it turns out.

#

Thanks for the help.

hidden karma
#

Hello im wondering if there is somebody that could help me make an Aspect of the End i have read online and i didnt find anything helpfull

#

someone plaese

potent pagoda
#

Will anytime soon forge andspigot be as one ?

sour rampart
#

Hey, quick question about gui. How would you make it so the player can move items from their inventory, to only certain slots of the gui? (The slots where there are no items in it)

outer crane
#

look into Sponge if you want a Plugin API that works with mods

hidden karma
#

Hello im wondering if there is somebody that could help me make an Aspect of the End i have read online and i didnt find anything helpfull
someone plaese

summer scroll
errant drift
sour rampart
potent pagoda
#

Magma is hell of a lag maker

errant drift
#

not really

#

if you have shit hardware anything will be a "lag maker"

crude charm
#
                        Player player = event.getPlayer();

                        player.sendMessage("1");
                        if (event.getAction() != Action.RIGHT_CLICK_AIR || event.getAction() != Action.RIGHT_CLICK_BLOCK)  return;
                        player.sendMessage("2");
                        if (event.getItem() != null && !event.getItem().getItemMeta().getDisplayName().equals(CC.GREEN + "Server Selector")) return;
                        player.sendMessage("3");
                        openSelector(player);

why is this not working? It prints one but not two or three.

potent pagoda
#

i have normal server working with 100ppl

ivory sleet
#

The second check is most likely always true @crude charm

errant drift
#

modded cannot handle 100ppl easily?

#

Well depends on the mods

potent pagoda
#

no no not modded

ivory sleet
#

Or I mean yeah

#

Use &&

crude charm
errant drift
#

then why are you comparing magma to a vanilla server with 100 players?

ivory sleet
#

Instead of ||

crude charm
#

ok

ivory sleet
#

Actually the first check

potent pagoda
#

tnx for help

ivory sleet
#

Sry my bad not the second one

wide dune
#
public static void sendTitle (Player player, String title, String subtitle, int fadein, int stay, int fadeout) {
        IChatBaseComponent chatTitle = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}");
        IChatBaseComponent chatSubtitle = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}");

        PacketPlayOutTitle t = new PacketPlayOutTitle (PacketPlayOutTitle.EnumTitleAction.TITLE, chatTitle);
        PacketPlayOutTitle s = new PacketPlayOutTitle (PacketPlayOutTitle.EnumTitleAction.SUBTITLE, chatSubtitle);
        PacketPlayOutTitle length = new PacketPlayOutTitle (fadein * 20, stay * 20, fadeout * 20);

        ((CraftPlayer) player).getHandle().playerConnection.sendPacket (t);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket (s);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket (length);
        }```
#

is that wrong?? it doesnt seem to be working but I dont understand why

ivory sleet
#

?paste

queen dragonBOT
wide dune
#

1.8.8

#

Where sendtitle is deprecated

crude charm
#

just use it

#

it doesent matter

wide dune
#

I need to be able to control fade in and out

crude charm
#

why

wide dune
#

Its a necessity I have for this plugin

hidden karma
#

How do i give a player speed?

crude charm
#

spigot docs :/

hidden karma
#

okey

summer scroll
crude charm
#

yup, use a switch and default so u dont get an error

cunning cloak
#

How do I make a GUI with multiple options for a Punish/Admin GUI? E.g Press on green wool > How long > Silent Punishment etc.

#

I have tried it before and I am really confused so I scrapped the idea.

sour rampart
summer scroll
#

If the clicked inventory is the top inventory, then proceeds.

sour rampart
summer scroll
hidden karma
#

how do i wait 5 seconds in java?

summer scroll
#
if (title.equals((gui.inv_name))) {
  if(event.getClickedInventory() == event.getView().getTopInventory()){
``` Try this maybe.
sour rampart
#

k thx

summer scroll
#

Or

if(event.getClickedInventory().getType() != InventoryType.PLAYER){
cunning cloak
glass sparrow
#

@cunning cloak you can just open new menus/redraw your current menu with different items and stuff

summer scroll
glass sparrow
# cunning cloak How would I do that?

Set an item to green wool and use your method of checking for a click, then the click method will be to open a different gui or just change the items of one gui if you dont want your mouse resetting, and then treat the second opened gui as a standalone thing where you can click anything you want

#

treat them like folders on a desktop, you can open a folder then it shows you a whole list of new folders to open

trail oriole
#

Why is this line not working?
player.setWalkSpeed(player.getWalkSpeed() + 0.2)

cunning cloak
glass sparrow
cunning cloak
glass sparrow
hybrid spoke
glass sparrow
hybrid spoke
#

close current -> open new -> cursor reset
don't close current -> open new -> cursor don't reset

glass sparrow
humble heath
#

how do i save the data from a hash map to a config file called playerdata.yml

neat charm
#
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.xrokz.orgins.Main'
```why ?
 ```yml
 name: Inferno
 version: 1.4.1
 description: This plugin is so 31337. You can set yourself on fire.
 author: CaptainInflamo
 authors: [Cogito, verrier, EvilSeph] 
 website: http://forums.bukkit.org/threads/MyPlugin.31337/
 
 main: com.xrokz.orgins.Main```
hybrid spoke
# humble heath how do i save the data from a hash map to a config file called playerdata.yml

for example: PSEUDOCODE

var File file
var Config config//your config
var HashMap<UUID, Integer> hashmap //your hashmap

// your method
public void saveToConfig() {
    //do your stuff
    file = new File("dir", "playerdata.yml");
    config = YamlConfiguration.loadConfiguration(file);
    for(UUID uuid : hashmap.keySet()) {
        config.set(uuid.toString(), hashmap.get(uuid));
    }
    config.save(file);
}
opal juniper
#

does it extend java plugin

humble heath
#

plugin yml is in wrong place

opal juniper
#

oh, yeah

#

im stupid

#

it needs to be in src

neat charm
#

it is in src

opal juniper
#

no

#

it is not

#

it is in com.xrokz.orgins

neat charm
#

no

humble heath
#

needs to be in resorces

opal juniper
neat charm
#

i tried to move it it says name conflict

hybrid spoke
#

show us your structure

neat charm
#

its just java project not maven or gradle

opal juniper
#

it is in src.com.xrokz.orgins

neat charm
opal juniper
#

just drag it onto the src package

#

wait, click on the arrow to the left of com.xrokz.orgins

hybrid spoke
#

did your main class extend javaplugin?

opal juniper
neat charm
hybrid spoke
opal juniper
#

ok, thats good

neat charm
#
public class Main extends JavaPlugin {
    
    private static HashMap <UUID, OrginsManager> players = new HashMap();   
    
    @Override
    public void onDisable() {
        // Don't log disabling, Spigot does that for you automatically!
    }

    @Override
    public void onEnable() {
        // Don't log enabling, Spigot does that for you automatically!
        
        // Commands enabled with following method must have entries in plugin.yml
        getCommand("mymana").setExecutor(new GetManaCommand(this));
    }
}```
neat charm
opal juniper
#

sorry 😄

unreal quartz
#

just unzip it and take a look 😛

opal juniper
#

how are you compiling?

neat charm
unreal quartz
#

and there’s your problem 🙂

neat charm
#

in eclipse > export > JAR file

unreal quartz
#

I don’t use eclipse, but on that page there should be an option to select what to add to the jar

#

your actual java files are in selected

opal juniper
#

^^

unreal quartz
#

un*

opal juniper
#

intellij gang 😎

#

lmao

neat charm
#

i always select everything

hybrid spoke
opal juniper
#

yuhuh

opal juniper
hybrid spoke
#

never used it since years

opal juniper
#

never used it full stop

river spear
#

https://prnt.sc/11kqyod If I now right-click on a stone, how can I loop blocks in the radius from there and only get the first layer of stones without not touching the stones behind.

Lightshot

Captured with Lightshot

unreal quartz
humble heath
#

is ther anyone that can help

opal juniper
neat charm
hybrid spoke
#

?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.

unreal quartz
#

could be of importance

humble heath
unreal quartz
#

just check them all and see what works

opal juniper
river spear
hybrid spoke
river spear
humble heath
#

i dont understand that i hjave sent my 3 classes

neat charm
hybrid spoke
opal juniper
unreal quartz
neat charm
#

nope

#

wait new error

unreal quartz
#

welp. dunno what to tell you I don't use eclipse, so you're gonna have to google it

#

what is it

rain flint
#

Hello, is it safe to leave the connection to an SQLite database opened the whole time when the plugin is running ? Because i'm currently connecting / disconnecting everytime I need to access it, but it takes a bit of time to connect

opal juniper
neat charm
#
[15:13:23 ERROR]: Could not load 'plugins\orgins.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/xrokz/orgins/Main has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:397) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:305) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:389) ~[patched_1.16.5.jar:git-Paper-595]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:251) ~[patched_1.16.5.jar:git-Paper-595]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-595]        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-595]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_281]
Caused by: java.lang.UnsupportedClassVersionError: com/xrokz/orgins/Main has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 52.0        at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_281]
opal juniper
#

update your java or get an older jdk

unreal quartz
#

your JRE is 8 but you compiled it with 15

neat charm
#

im using java 1.8 64-bit

unreal quartz
#

not for compiling

opal juniper
unreal quartz
#

you can probably change it somewhere in eclipse

opal juniper
opal juniper
humble heath
hybrid spoke
#

PSEUDOCODE

neat charm
#

JavaSE - 1.8 ?

rain flint
humble heath
#

?

rain flint
#

Oh no ok sorry I didn't understood

opal juniper
unreal quartz
#

you would typically use something like hikaricp to manage this for you

#

I would look into it if I were you

opal juniper
#

im not familar with databases, however that is how i would do it 😄

rain flint
opal juniper
#

keeps the data saved in case of a crash, as well as not calling the db too much

rain flint
#

Thanks for your help 😉

neat charm
#

i guess it fixed

humble heath
#

can someone help me plz

neat charm
#

nope

[15:19:13 INFO]: [Inferno] Enabling Inferno v1.4.1*
[15:19:13 ERROR]: Error occurred while enabling Inferno v1.4.1 (Is it up to date?)
java.lang.NullPointerException: null
        at com.xrokz.orgins.Main.onEnable(Main.java:31) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-595]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-595]
        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-595]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Paper-595]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-595]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-595]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_281]
[15:19:13 INFO]: [Inferno] Disabling Inferno v1.4.1```
humble heath
hybrid spoke
#

In computer science, pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine reading. It typically omits details that are essential for machine understanding of the algorithm, suc...

unreal quartz
neat charm
#
getCommand("mymana").setExecutor(new GetManaCommand(this));```
#
package com.xrokz.orgins;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class GetManaCommand implements CommandExecutor {
    
//    private static OrginsManager playerData;
    public GetManaCommand(Main main) {
        // , OrginsManager cplayerData
        // this.playerData = cplayerData;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String arg2, String[] arg3) {
        if(!(sender instanceof Player)) return false;
        String cmdName = cmd.getName().toLowerCase();

        if (!cmdName.equals("mymana")) {
            return false;
        }
        return true;
    }

}
unreal quartz
#

getCommand("mymana") has returned null, which only occurs when you don't specify you command in plugin.yml

neat charm
#

ok

#

thx

sour rampart
#

is there some function that does something like gui.getitemslot(Item_slot_number).getBlockType?

eternal oxide
#

inventory items are ItemStacks not blocks, but both have a Material

humble heath
#

what am i doing wrong

sharp hemlock
maiden briar
#
private void register(Command command)
    {
        Bukkit.getServer().getPluginCommand(command.getName()).setExecutor((sender, cmd, label, args) ->
        {
            command.onBukkitCommand(sender, command.getName(), args);
            return true;
        });

        Bukkit.getServer().getPluginCommand(command.getName()).setTabCompleter((sender, cmd, label, args) -> command.onTabComplete(sender, command.getName()));
    }

The registering works, but if I type the command I will get /command in the chat. Command: https://paste.md-5.net/upivamuvub.java

maiden briar
#

And indeed you save a string not an UUID. Use UUID.fromString()

left swift
#

How can I make a prefix over the player's head taken from the group like the TAB plugin does (I mean more like making it in the player's nametag)

sharp bough
#

is there a way to see all the possible deaths theres is?

#

like "death by" and a list

sharp bough
#

hm i think that works thanks

neat charm
#
java.lang.NullPointerException: null
        at com.xrokz.orgins.Main.onItemUse(Main.java:69) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor66.execute(Unknown Source) ~[?:?]```
#

im getting this

#

line nice int playerMana = players.get(p.getUniqueId()).getPlayerMana();

#
@EventHandler
    public void onItemUse(EntityShootBowEvent e) {
        Entity p = e.getEntity();
        ItemStack bow = e.getBow();
        String bowName = bow.getItemMeta().getDisplayName();
        
        if(bowName.equals("Thunder Bow")) {
            if(!(p instanceof Player)) e.setCancelled(true);
            p.sendMessage("Item: Thunder Bow!");
            
            int playerMana = players.get(p.getUniqueId()).getPlayerMana();
            
            p.sendMessage(bowName);
            Entity thunderArrow = e.getProjectile();
            thunderArrow.setCustomName("Thunder Arrow");
            p.sendMessage(thunderArrow.getName());
            p.sendMessage(thunderArrow.getCustomName());
            
            
            if(playerMana < ThunderBowMana) {
                p.sendMessage("Not Enough Mana");
                e.setCancelled(true);
            }
            
            
        } else {
            p.sendMessage(bowName);
        }
    }```
quiet ice
#

Likely hasn't been done before, but does anyone know any gradle plugins that allow for removal of methods (ideally based on an annotation)?

lost matrix
quiet ice
#

Yeah, though it should still be available for linking. Basically I want to link to superclass members that are not there at compile time, but may be there at runtime (without having to resort to reflections since I'm using hot code)

lost matrix
neat charm
#

i did it thx

#

i used playerMana instead of this.playerMana in OrginsManager.java

lost matrix
quiet ice
#

I guess so

lost matrix
tulip lodge
#

How can I make my plugin support all versions?

quiet ice
#

Import Bukkit multiple times or just hope that bukkit will do that for you

#

Bukkit usually does an adequate job in that

tulip lodge
#

What about Spigot?

lost matrix
tulip lodge
#

Can a spigot?

quiet ice
#

Spigot = Bukkit for anything that is newer than 6 years

tulip lodge
#

ok

sand vector
#

is there a way of commenting out a chunk of code other than using // each line?

lost matrix
#
/*
   Multi
   Line
   Comment
*/
sand vector
#

cheers

sharp bough
#

is there a way to delete the drops when an entity dies? my current code

for(World w : Bukkit.getWorlds()){
            for(Entity e : w.getEntities()){
                if(e instanceof Pig){
                    ((Pig) e ).damage(1000);

                }
            }
        }```
#

im trying to delete the drops from an ender dragon

sharp bough
#

thx

rotund pond
#

Hello everyone !
Would it be possible to have some help please?

I would like to make a tool (like in WildTools) with a durability system visible in the lore of the item.
Something like that :

This item allows you to do something!
Durability: XX

I just have one big issue for me: How do I get the remaining durability of the item?
And how could I modify it?

This question seems easy, but I would like it to be done by being fully configurable in the config ...
But I have no idea which method to have ...

Thank you !

lost matrix
olive valve
#

how come my code isnt working? ```if (cmd.getName().equalsIgnoreCase("hastytimer")) {
for (Player player : Bukkit.getOnlinePlayers())
if (player.hasPermission("hastytimer.work"))

                    player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 1200, 1));
            Plugin plugin = null;
            Bukkit.getScheduler().runTaskLater(plugin, () -> {
                // code
            }, 20L);

        }
    }
}
lost matrix
#
  1. This is useless unless you have that CommandExecutor registered for multiple commands: if (cmd.getName().equalsIgnoreCase("hastytimer"))
  2. Define "isnt working" (Any errors? What happens?)
rotund pond
olive valve
#

i dont get it, to me java is so much different than spigot programming, what am i doing wrong?

lost matrix
olive valve
#

it has one error

#
java: reached end of file while parsing```
#

i know alot of java programming but spigot doesnt make sense to me. how can i learn spigot programming?🤔

ivory sleet
#

By doing it also trial and error like most stuff

lost matrix
# olive valve i know alot of java programming but spigot doesnt make sense to me. how can i le...

Spigot is just java. There are some higher concepts but if you know "alot of java programming" then you will get there by just trying a bit.
There are 3 fundamentals that are a bit different from spigot programming then usual java programming.

  1. Your entry point is not defined by a main method. Your entry is either the onLoad() or the onEnable() method inside of your JavaPlugin class.
    The JavaPlugin class has one instance that is bootstrapped by the spigot classloader. Meaning you never create an instance yourself but use the one accessible in the onLoad() or onEnable()

  2. Event based programming. Its a bit hard to grasp how the event handling works if you dont know reflections and the actual purpose of the EventHandler annotations.
    All you can do is read up on how to use the event api and learn as you go.

  3. You only program against an API and dont really have any classes but only abstraction to program against.
    There is also a lot happening in the background regarding the plugin.yml

Commands are actually one of the things which are quite easy to understand if you know java quite well.

lost matrix
olive valve
#

ok'w

#

well im gonna go do some java courses

minor garnet
#

i can get the location of my click in the event of clicking on a block, not being the player's location but where the aim is

lost matrix
#

Define "where the aim is"
You can get the clicked BlockFace quite easily.

#

The direction (vector) if the click is basically the direction of the players eye location.
If you want an exact intersection then you might need to ray trace.

neat charm
#

can i make custom enchants ?

lost matrix
neat charm
#

how ?

quaint mantle
#

Currently bans and mutes are stored like this. what would be the best option to check if the current date is > EndDate. i was thinking to get all values from EndDate loop them put em on an array or are there better ways to do this ?

lost matrix
# neat charm how ?

You extend the Enchantment class and register it using the same class. You would need to set a boolean in the class via reflections before. There are def tutorials out there.

lost matrix
quaint mantle
#

That's a great idea thanks

#

is using url shortners allowed?

#

mainly stuff like adfocus

lost matrix
quaint mantle
#

for posting resources

#

https://developer.spotify.com||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​|| https://kurwa.club/u/h9d8F.png

Tacosheel

Music, meet code. Powerful APIs, SDKs and widgets for simple and advanced applications.

lost matrix
quaint mantle
#

alr, ty

#

This is my current listener, there was a highest priority no ?

rotund ravine
#

Supposedly,

young knoll
#

yes

sharp bough
#
for(World w : Bukkit.getWorlds()){
            for(Entity e : w.getEntities()){
                if(e instanceof EnderDragon){
                    Bukkit.getLogger().info("test");
                    ((EnderDragon) e ).damage(100000000);

                }
                Bukkit.getLogger().info(String.valueOf(w));
                Bukkit.getLogger().info(String.valueOf(e));
            }
        }```
why does this work for pigs but no ender dragons?
quaint mantle
#

?jd

sharp bough
#

am i missing something?

ivory sleet
sinful python
#

How do I check if a consumed item is a carrot? This is what I have so far
if (playerItemConsumeEvent.getItem() == )

#

I'm not sure what to compare it to, as I can't compare it to Material.CARROT because they're different types, but ItemStack doesn't seem to allow something like ItemStack.CARROT

#

So I'm pretty sure it needs to be compared to an ItemStack but not sure how to write it

ivory sleet
#

getItem returns Material right

#

Then you need to compare Material

lost matrix
lost depot
#

guys, World.getFullTime() returns a long, is that in ticks or something? jdoc is unclear

#

i need to compare current world time with an older time

lost matrix
#

The relative time is in ticks. So a full day is 24 * 1000 ticks
The absolute time is the time since creation. Also in ticks.

lost depot
#

thanks! very appreciated

neat charm
#

how can i change item damage ?

#

i want diamond sword to deal 17 damage instead of 7 without enchants or strength

lost matrix
neat charm
#

how

lost matrix
#

The ItemMeta contains the attribute modifiers that can be changed and/or replaced.

neat charm
#

item.addAttributeModifier() ?

#
item.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, AttributeModifier.???);```
torn jewel
#

what is the best way to support multiple storage methods such as yml, Mysql, SqlLite ,MongoDB ect

lost matrix
torn jewel
#

ok

olive valve
#

how come my project didnt build on my desktop, there arent any errors

#

with intelliJ

fading lake
#

what did you click

olive valve
#

Project Structure > Artifacts > Output location > Desktop

rain flint
#

Did you built artifacts ?

olive valve
#

yea

fading lake
#

no thats where you tried to save it

olive valve
#

?

fading lake
#

sorry slow responses, my dogs mashing her face against my keyboard -_-

#

are you using maven or no maven/gradle

olive valve
#

ok i might sound dumb for this. i dont know what maven is

fading lake
#

:sobs_in_project_management:

rain flint
#

Did you put the "compile output" into the jar (on the left)

chrome ferry
#

Cough cough use Gradle

maiden briar
#
String[] newArgs = new String[args.length];
if(args.length > 1)
     System.arraycopy(args, 1, newArgs, 0, args.length - 1);

The problem: I try to copy my arguments to a new list, and want to drop the first argument (args[1] old will be args[0] new), this works, but my list will get an extra null value at the end ([arg, null])

fading lake
#

id recommend converting your project to maven cause it saves your sanity, but you should be able to do it by clicking Ctrl + F9

chrome ferry
#

Gradle ^^

fading lake
#

maven ^^^

rain flint
#

Import everything by yourself ^^^^

chrome ferry
maiden briar
#

No

chrome ferry
#

ArrayUtils.copyToRange

#

I believe

maiden briar
#

Ok I can try

chrome ferry
#

Then it returns a new array

olive valve
#

what is maven?

chrome ferry
#

You’ll need Apache commons, (spigot provides it its shaded)

fading lake
#

are you sure the extra null is because your array is 1 bigger than the args its supposed to fit?

chrome ferry
fading lake
olive valve
#

how do i use/get it?

chrome ferry
#

Create a pom.xml

rain flint
chrome ferry
#

In your project root

fading lake
#

if youre using intellij you can rebase the project onto it in its file structure

maiden briar
winter sand
#

What packet/packets the server send to a player when the player is being damaged by another player?

fading lake
#

why dont you use the EntityDamageByEntityEvent?

chrome ferry
#

I was going to say that haha

sour rampart
#

quick question: Am I allowed to do this:

recipe.setIngredient('%', Material.SUGAR);
recipe.setIngredient('B', Material.GLASS_BOTTLE);

        recipe.shape("B%B","%B%","B%B");
winter sand
fading lake
#

ah, let me try and find it

winter sand
#

i don't want to know which packet the client send, but the server

#

i think Entity Animation and Update Health

fading lake
#

yeah but how to see what player was hit though is what I cant find

#

there's client events for it, but o_o

novel lodge
#

I'm trying to get into making Spigot plugins but for some reason it doesn't register the plugin, I've followed the example on how to set one up

plugin.yml put into resources

name: TestPlugin
version: 1.0
main: frogge.the.dude.testplugin
author: Frogge```
#

main in frogge.the.dude:

#
package frogge.the.dude;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class testplugin extends JavaPlugin {

    @Override
    public void onEnable() {
        getLogger().info("onEnable is called!");
    }

    @Override
    public void onDisable() {
        getLogger().info("onDisable is called!");
    }

    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
        if (label.equalsIgnoreCase("bruh")){
            Player player = (Player) sender;
            player.sendMessage("Ligma balls");
        }

        return false;
    }
}```
winter sand
#

lol

sour rampart
#

how would I convert an ItemStack into a Material?

gleaming grove
#

ItemStack .getMaterial() ?

neat charm
#

im trying to change item attack damage

#
item.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, AttributeModifier.???);

but idk how to use the AttributeModifier

abstract relic
#

but your plugin class doesn't implement command executor

#

and you're also not getting the command and then setting it to your plugin instance, additionally your command is not registered in your plugin.yml

quaint mantle
#

How can I show a fake player in the tablist? I have never done anything with modifying packets before so I don't have a clue what I'm doing. I don't mind using something like ProtocolLib. I've had a look around online but the stuff I found doesn't work (probably because I am not importing the NMS stuff which I don't understand) and I couldn't find anything about how to do it with ProtocolLib. Can someone give me an idea on how to do it (and explain what I need to import etc)?

ashen agate
#
player.getWorld().playEffect(loc, Effect.POTION_BREAK, new Potion(PotionType.POISON));
``` how do I play the actual green poison potion break effect as if you were to throw a splash potion? The code above results in black particles instead of green.
neat charm
quaint mantle
#

I have no clue how to send that packet but I'll work it out

fading lake
#

my only knowledge of how to do it involves minecrafts packets, cant find the way you do it with protocollib

#

id be able to find out if spigot developers helped people out on the forums, instead of incessantly arguing over bumping

lost matrix
fading lake
#

oh wait fuck im getting things mixed up, ignore me @quaint mantle lmfao

quaint mantle
#

Okay, but how would I send that? Would I use ProtocolLib?

sand vector
#

How do i get the max data stored in Items? in the screenshot it would be two.

fading lake
#

you mean the amount of items in Items?

lilac dagger
#

for that'd be config.getConfSection("Items").getKeys(false).size()

lost matrix
lilac dagger
#

something like that

fading lake
#

YamlConfiguration/FileConfiguration#getConfigurationSection("section").getKeys(false).size(); yeah

lost matrix
# quaint mantle Thanks

You just go through all fields from top to bottom of the packet and then try to fill each field with the right data.

Note: In some cases the actual packet doesnt quite match with the one represented in the protocol.
In this case (normally discovered through "not such field" exceptions) you would need to look at the actuall structure of the packet in the nms source code.

woven coral
#

its sayig that required is particle and provided is void

quaint mantle
lost matrix
# quaint mantle And once I have built the packet, how would I send it?
  public static void sendPacket(final Player player, final PacketContainer container) {
    final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    try {
      manager.sendServerPacket(player, container);
    } catch (final InvocationTargetException e) {
      e.printStackTrace();
    }
  }

But thats all covered on the ProtocolLib site.

quaint mantle
#

Thanks

lost matrix
#

So the method just returns void

woven coral
#

oh then how do I fix it? since I want to remove it after a few seconds

lost matrix
woven coral
#

I can't remove them?

lost matrix
#

I dont think so. Particles dont have any identity. They are just an effect that the client can display on a certain location.

woven coral
#

oh ok

#

another question

#

I have period set asan int in the pharentesies, and I want to remove 1 from it, how would I do that? I tried int p = period, and then removing it like that, did not work

woven coral
#

as in, if the period is set to 10, I want to remove 1 from 10

#

every second

quaint mantle
lost matrix
#

But that looks like some work

quaint mantle
#

Also, what is the action field? I see it is an integer, but what does the integer represent?

lost matrix
#

0: add player
1: update gamemode
and so on...

quaint mantle
lost matrix
# woven coral .

Then you need a scope where you can hold a mutable integer.
I still need more context.

woven coral
#

ok so

#

you can set period to any amount, every second it will deduct 1 from the initial value, if the value is 0, code will run

flint elk
#

Can anyone tell me how I make a tablist that looks like the one from hypixel skyblock?

woven coral
#

theres no more context I can give

lost matrix
woven coral
#
    public void sendBloodEffect(String world, Location location, int amount, int period, long delay) {
        new BukkitRunnable() {
            @Override
            public void run() {
                System.out.println(p);
                if (p > 0) {
                    new BukkitRunnable() {
                        @Override
                        public void run() {
                            Particle.DustOptions dustOptions = new Particle.DustOptions(Color.RED, 1);
                            Bukkit.getWorld(world).spawnParticle(Particle.REDSTONE, location.getBlockX(), location.getBlockY(), location.getBlockZ(), amount, dustOptions);
                        }
                    }.runTaskLater(plugin, delay);
                } else {
                    cancel();
                }
            }
        }.runTaskTimer(plugin, 0L, 20L);
    }``` - here ya go
lost matrix
flint elk
#

Why public static void?

#

public void

#

Not static

grand cove
#

Is there a way to retrieve the event when a player smith an item? like CraftedItemEvent?

flint elk
#

I dont know

lost matrix
# woven coral ```java public void sendBloodEffect(String world, Location location, int amo...
  public void sendBloodEffect(final Location location, final int amount, final int duration) {
    new BukkitRunnable() {
      private int currentCount = duration;

      @Override
      public void run() {
        System.out.println(this.currentCount);
        if (this.currentCount-- > 0) {
          final Particle.DustOptions dustOptions = new Particle.DustOptions(Color.RED, 1);
          location.getWorld().spawnParticle(Particle.REDSTONE, location, amount, dustOptions);
        } else {
          this.cancel();
        }
      }
    }.runTaskTimer(plugin, 0L, 20L);
  }
lost matrix
unreal kayak
#

Guys i wanna authenticate mc server join session myself any idea where to get access token when loginevent?

lost matrix
unreal kayak
#

Tbh no

#

I just want the access token given by client

lost matrix
unreal kayak
#

Yes its offline mode

#

Its not my server im their dev

#

We are making our own auth system

#

I just want the key used to verify login

lost matrix
#

Oh so you dont need any information from mojang then?

unreal kayak
#

No, another dev made a launcher and the launcher should give token like mojang but instead of mojang one our own and we want to verify it ourselfes

#

From server side

onyx shale
#

for some reason that sounds like breaking tos to me idk why

lost matrix
#

Then you should either use the plugin messaging channel to communicate on a custom channel or...
You can have fun with this:
https://wiki.vg/Protocol#Login

unreal kayak
#

Ye how to get the verify key on loginevent? Thats all i want

grand cove
#

It depends on how your server works I guess?

#

I mean authentication server

lost matrix
unreal kayak
#

Then which event?

#

I want the event that provide it

lost matrix
lost matrix
unreal kayak
#

Just...

#

Dude its server secret

#

I cant tell much

onyx shale
#

and you are here asking for help

#

also im rather unsure about creating ur own mojang like authethication server

#

might get you blacklisted by mojang

mortal hare
#

Does anyone know where Bukkit OBC or NMS stores Inventory container UID at which gets sent to the client via packet?(edited)
can't find it anywhere

unreal kayak
onyx shale
#

once no minecraft client can see ur server

#

you will care

lost matrix
unreal kayak
lost matrix
onyx shale
#

well do anything malicious or sketchy and you will get more than mojang on ur head

#

just so you know,you cant do w/e you want with something

mortal hare
unreal kayak
#

Also we are making android launcher not pc launcher

lost matrix
# woven coral ```java public void sendBloodEffect(String world, Location location, int amo...
  private static final BlockData RED_STONE_DATA = Bukkit.createBlockData(Material.REDSTONE_BLOCK);
  public void sendBloodEffect(final UUID entityID, final int seconds) {
    new BukkitRunnable() {
      private int currentCount = seconds * 10;

      @Override
      public void run() {
        if (this.currentCount-- > 0) {
          final Entity entity = Bukkit.getEntity(entityID);
          if (entity == null) {
            this.cancel();
            return;
          }
          final World world = entity.getWorld();
          final Location particleLocation = entity.getLocation().add(0, 0.5, 0);
          final int amount = 2;
          final double offset = 0.25;
          world.spawnParticle(Particle.BLOCK_DUST, particleLocation, amount, offset, offset, offset, SpigotCore.RED_STONE_DATA);
        } else {
          this.cancel();
        }
      }
    }.runTaskTimer(this, 0L, 2L);
  }

I personally would do it different but this works.

onyx shale
lost matrix
mortal hare
#

Bungeecord

onyx shale
#

doesnt mcmmo have something similar?

mortal hare
#

ftw

mortal hare
#

even if its not network

fallow geode
mortal hare
#

i will still use bungeecord based proxy for security

#

both for packet attacks and ddos attacks against the main server supplying it with other outside protections

mortal hare
#

i would store the bukkitrunnable inside the static field

#

that way i wouldn't need to create runnable everytime

#

or implement it

lilac dagger
#

or just create one task

#

and then provide it runnables and such

#

or custom ones with a long ticks

#

to control the tick count

lost matrix
mortal hare
#

thanks!

#

but too late i think because i found even better solution for my problem 😄

viscid dune
#

can someone help me i wanne add a api to a plugin

#

but how ?

onyx shale
#

either slap the jar as dependency or add it to maven

viscid dune
#

idk how to do that

#

if i send you the plugin would you add a api for me ?

mortal hare
#

Maven, Gradle, Import jar by using IDE build system, Classpath's

viscid dune
#

please

mortal hare
#

choice is yours

onyx shale
#

well for start say waht you code in

viscid dune
#

its for a mc plugin

#

i got it from google

#

so

mortal hare
#

what IDE are you using

onyx shale
#

so you are not a dev

viscid dune
#

true

onyx shale
#

by that i mean ur not coding

#

right?

viscid dune
#

but i need a api in it so i can get in on my scoreboard in minecraft

#

true

#

is that a problem ?

onyx shale
#

well to connect a api someome has to code it

#

if the plugin doesnt alrdy have that feature you need someone to code it in

viscid dune
#

idk if it has

#

where can i find it what file ?

onyx shale
#

either plugin store page or if its mentioned somewhere

#

if not you cant rly look into a file to figure out

viscid dune
#

it says it is in

#

but where do i find it ?

#

what the api is

onyx shale
#

if it has it then simply having the api in the plugin folder should do the trick

#

example scoreboard to use placeholderapi..

#

nothing more than having both in the plugins oflder

viscid dune
#

not it in so the owner lies

#

idk if you wanne do it

#

but would you code it in it for me ?

#

please

timber dagger
#

wc

viscid dune
#

wc ?

timber dagger
#

wrong chat

sand vector
#
java.lang.IllegalArgumentException: Name cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at org.bukkit.Material.matchMaterial(Material.java:656) ~[patched.jar:git-PaperSpigot-"4c7641d"]
        at me.kian.Factions.Items.CustomItems.spawnCustomItems(CustomItems.java:36) ~[?:?]

I keep getting this error and i have no clue what to do. I know it says Name cannot be null and it shouldn't be. any help would be great!

Declaration: 
String dName = (String) plugin.getConfig().get("Items." + i + ".customName");
ChatColor cColorN = (ChatColor) plugin.getConfig().get("Items." + i + ".chatColorN");

line 36: meta.setDisplayName(cColorN + dName);
viscid dune
#

mariomax can you help me ?

timber dagger
#

no

viscid dune
#

please

timber dagger
#

i dont even know how to code

#

and stop begging people

#

and if you are gonna beg atleast pay the dude

onyx shale
#

?services

queen dragonBOT
onyx shale
#

gave up on taking requestes for a long time

novel lodge
#

Apparently Spigot only recognises java class files up to 52.0 but mine are compiled in 58.0, how can I downgrade to 52.0

lost matrix
novel lodge
#

How can I start with 16

glass sparrow
#

@viscid dune google how to add a maven/grade dependency to your project

viscid dune
#

Sorry I can’t code so

#

That doesn’t make much sense fir me

#

Does it takes long time to do ?

glass sparrow
#

no

#

it’s pasting in a block of text

viscid dune
#

Si what do I paste and where ?

glass sparrow
#

@viscid dune google how to add a dependency it’ll explain everything

viscid dune
#

Okay

#

I still dint understand it and I can’t code bro

chrome beacon
# sand vector ?

You'll have to add some debug messages to check what's null. If you want more help send the whole class in a paste

glass sparrow
viscid dune
#

Idk where do I find

glass sparrow
#

what actually is your goal

chrome beacon
#

He wants to add an API to a plugin that isn't his

#

And he doesn't know how to code

glass sparrow
#

yeah i know but i don’t understand his goal he said he can’t code so why would he need to do that

chrome beacon
#

Also he's currently begging me in DMs to do it for him

#

For free

brittle badger
#

@lost matrix i found a protected method that changes whether its on fire or not

#

in entityfireball

#

how can i change that?

chrome beacon
#

Reflection would be one option

brittle badger
#

who are you responding to?

glass sparrow
#

@viscid dune why do you need to add a dependency

viscid dune
#

So I can type %tokens% on my scoreboard

brittle badger
glass sparrow
viscid dune
#

Yes

glass sparrow
#

just put the plugin in your plugin folder

#

you don’t need anything special

chrome beacon
viscid dune
cunning cloak
#

How do I make my plugin "encrypted" which means if someone opens up my code it doesn't expose the raw code there? This is needed due to a license checker, API Keys etc coming in the future.

glass sparrow
#

that’s it

viscid dune
#

Inhale it

glass sparrow
#

@cunning cloak can use an obfuscation method

viscid dune
#

What next ?

glass sparrow
#

that’s it

cunning cloak
viscid dune
#

And where do I see the api

glass sparrow
glass sparrow
viscid dune
#

Nope

brittle badger
viscid dune
#

Inwint het in on my scoreboard or I type %tokens%

glass sparrow
glass sparrow
chrome beacon
viscid dune
#

It won’t load

glass sparrow
chrome beacon
#

Hm did discord remove my reply?

viscid dune
#

So how to fix

glass sparrow
viscid dune
#

K

main dew
#

How I can save structure to file?

viscid dune
#

What was the command for load it again ?

#

With world edit

#

Schematic

chrome beacon
#

ProGuard I guess...

glass sparrow
#

+1

#

there’s not really much point obfuscating a plugin if someone wants to find out how it works, they’ll find out how it works no matter your obfuscation method

chrome beacon
#

^^

#

It will just slow them down a bit

glass sparrow
#

just make it open source

cunning cloak
#

Yeah but I just want the person to be slowed down a bit.

cunning cloak
brittle badger
chrome beacon
novel lodge
#

How can I start a minecraft server with java 16

viscid dune
#

It’s just a command in minecraft right ?

#

No

#

But if you want you can help me

#

My problem is that i idont know hiwntonload placeholder api

#

Np

chrome beacon
viscid dune
#

I can’t help you to srry

chrome beacon
#

Did you make a plugin or are you just using one

sharp bough
#
    public void onEnderDragonDeath(EntityDeathEvent event){
        if(event.getEntity() instanceof EnderDragon){
            Bukkit.getLogger().info(String.valueOf(event.getDroppedExp()));
            event.setDroppedExp(0);
            //Bukkit.getLogger().info("canceled");
        }
        //Bukkit.getLogger().info("not canceled");


    }```
does anyone know why this keeps droping exp?
#

the if condition doesnt work

#

i checked the docs

#

theres a setdropedExp int

chrome beacon
#

The dragon might have a special case for xp drop

#

Not sure

#

You need to make sure you load the worlds on server start

sharp bough
brittle badger
#

how can i force the return value for a method?

ivory sleet
#

I mean

#

its forced anyways or what?

brittle badger
ivory sleet
#

then return false?

lost matrix
brittle badger
#

so theres a method that basically determines if the fireball is on fire or not

#

i got the method using reflection

#

but i dont know how to force it so that the method always returns a certain value

lost matrix
#

EntityFireball.class? Whats the method called

brittle badger
#

W_

#
protected boolean W_() {
        return true;
    }```
#
public void tick() {
        Entity entity = this.getShooter();
        if (!this.world.isClientSide && (entity != null && entity.dead || !this.world.isLoaded(this.getChunkCoordinates()))) {
            this.die();
        } else {
            super.tick();
            if (this.W_()) {
                this.setOnFire(1);
            }

            MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a);
            if (movingobjectposition.getType() != EnumMovingObjectType.MISS) {
                this.a(movingobjectposition);
                if (this.dead) {
                    CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
                }
            }

            this.checkBlockCollisions();
            Vec3D vec3d = this.getMot();
            double d0 = this.locX() + vec3d.x;
            double d1 = this.locY() + vec3d.y;
            double d2 = this.locZ() + vec3d.z;
            ProjectileHelper.a(this, 0.2F);
            float f = this.i();
            if (this.isInWater()) {
                for(int i = 0; i < 4; ++i) {
                    float f1 = 0.25F;
                    this.world.addParticle(Particles.BUBBLE, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
                }

                f = 0.8F;
            }

            this.setMot(vec3d.add(this.dirX, this.dirY, this.dirZ).a((double)f));
            this.world.addParticle(this.h(), d0, d1 + 0.5D, d2, 0.0D, 0.0D, 0.0D);
            this.setPosition(d0, d1, d2);
        }

    }```
#

tick code

lost matrix
#

Oh thats bad. It doesnt return a field. So you have 2 things you could do.

  1. Extend EntityFireball and overwrite the W_ method
  2. Inject bytecode that changes the return value of that method.
brittle badger
#

which one is less breaking

#

im guessing the 1st option

sand vector
brittle badger
#

@lost matrix when i override i get an clashing error

#
public abstract class Dodgeball extends EntityFireball implements SizedFireball {
    protected Dodgeball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
        super(entitytypes, world);
    }

    @Override
    protected boolean W_() {
        return false;
    }
}
warm mica
#

Why is it abstract

#

You should read your error and try to solve it first btw

brittle badger
#

huh

#

thats really weird

#

also why do the fireballs have no collision]

lost matrix
#

No idea. There is probably a class that should be extended rather than EntityFireball.
I just realised that EntityFireball is abstact

brittle badger
#

entity dragon fireball overrides W_ and that makes it so that there is no fire

#

oh wait

#

maybe i can add listener for entity combust event

#

and then cancel it if its my specifi fireball

lost matrix
#

Already tried that. Doesnt help

stoic orbit
#

Is there a chunk move event less expensive than normal move event?

lost matrix
stoic orbit
#

how?

#

?

lost matrix
#

One moment pls im writing

lost matrix
# stoic orbit how?
  @EventHandler
  public void onMove(final PlayerMoveEvent event) {
    final Location from = event.getFrom();
    final Location to = event.getTo();

    if (to == null) {
      return;
    }

    final int fromX = from.getBlockX() >> 4;
    final int toX = to.getBlockX() >> 4;

    final int fromZ = from.getBlockZ() >> 4;
    final int toZ = to.getBlockZ() >> 4;

    if (fromX == toX && fromZ == toZ) {
      return;
    }

    event.getPlayer().sendMessage("You crossed chunk from [" + fromX + " | " + fromZ + "] to [" + toX + " | " + toZ + "]");
  }
brittle badger
lost matrix
#

Interestingly enough i can make a dragon fireball burn by overwriting the W_ method but not the other way around.

stoic orbit
#

is it less expensive that the normal move event

lost matrix
brittle badger
#

yeah, but where is it is the question

lost matrix
stoic orbit
#

so it's less expensive right?

lost matrix
#

Its def not less expensive than not using the event at all...

stoic orbit
#

is there a better way

#

actually im trying to use vehicle move event

#

im trying to make a minecart limit

#

so players cant spam minecart into chunks

lost matrix
stoic orbit
#

why wont you tell me!??!!?

brittle badger
#

sarcasm 🤦‍♂️

lost matrix
stoic orbit
#

what

#

???

brittle badger
#

its sarcasm

#

the method given is the best method

stoic orbit
#

oh

#

is it better to use if (!to == null) or just use
if (to == null) {
return

brittle badger
#

2nd one

stoic orbit
#

whats the difference?

brittle badger
#

it just looks better

stoic orbit
#

no difference?

brittle badger
#

yes

lost matrix
#

early return pattern makes the code more clear. No performance difference

gaunt eagle
#

i need a little help ^^

#

about ShapedRecipe

#

I don't know what I should do. Can anybody help?

lost matrix
sour rampart
#

hey, I created a custom recipe with a custom command (/createrecipe) and I stopped and started the server again. When I started it again, the recipe did not work. Any suggestions?

gaunt eagle
lost matrix
gaunt eagle
#

thats one?

lost matrix
# gaunt eagle oh

No. You should generally avoid deprecated methods because they are subject to change like removal in the next version.

lost matrix
gaunt eagle
lost matrix
#

Its of type NamespacedKey and not of type String
So you need to create an instance of NamespacedKey with NamespacedKey::new(Plugin, String)

brittle badger
#

think i found a solution, i can make an entity that overrides the tick method for dragonfireball to remove all the potion stuff

#

but i dont know how to make custom entities

gaunt eagle
wide galleon
#
public class Death implements Listener {
    Timer timer = Main.getMain().getTimer();

    @EventHandler
    public void playerDeath(PlayerDeathEvent event){
        final Player player = event.getEntity();
        for (final World world : Bukkit.getWorlds()) {
            world.setGameRuleValue("showDeathMessages", "false");
        }
        Bukkit.broadcastMessage(" ");
        Bukkit.broadcastMessage(" ");
        Bukkit.broadcastMessage("§c✞ §6" + player.getDisplayName() + " §7has §6died§7. §cFeelsBadMan §7in Chat! §c✞");
        Bukkit.broadcastMessage("§8» §e§oReset the World with§r §6/reset §e§o.");
        Bukkit.broadcastMessage("§8» §6the seed was §e" + Bukkit.getWorlds().get(0).getSeed());
        Bukkit.broadcastMessage("§8» §6Time: §e" + Main.shortInteger(timer.getTime()));
        Bukkit.broadcastMessage(" ");
        Bukkit.broadcastMessage(" ");
        for (final Player all : Bukkit.getOnlinePlayers()) {
            all.setGameMode(GameMode.SPECTATOR);
        }
    }
}``` for some reason, this disables my plugin?
lost matrix
gaunt eagle
lost matrix
wide galleon
#
        at net.dxkyy.duckyschallangesv2.Listeners.Death.<init>(Death.java:14) ~[?:?]
        at net.dxkyy.duckyschallangesv2.Main.onEnable(Main.java:46) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:494) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:408) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:435) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:218) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:809) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[server.jar:2991-Spigot-018b9a0-f3f3094]
        at java.lang.Thread.run(Thread.java:834) [?:?]```
lost matrix
#

Main.getMain() returns null

wide galleon
#

ohhh

gaunt eagle
#

xD

paper viper
#

you can't use those symbols

#

for recipes

#

read the stacktrace

#

to see what symbols are allowed

lost matrix
#

Oh yeah. Didnt read your key. It should be something descriptive like "custom_glass_recipe"
so a-z 0-9 and /._-

gaunt eagle
#

The training video was fine

paper viper
#

read 👏 the 👏 stacktrace

lost matrix
# gaunt eagle are u sure?

Yes. The namespace has to contain only lower case characters, numeric digits and some special chars including _

gaunt eagle
#

I get it, thanks ^^

cinder thistle
lost matrix
# cinder thistle that world is hella fucked lol

Im not saying that i got bored and wrote a listener that creates an explosion on each block that was destroyed by an explosion but
somehow this recursive explosion chain ate through my world...

cinder thistle
#

👀

#

wish I could afford a testing server or just run one on my computer :/

cinder thistle
#

hm?

#

anyways I haven't been able to test a plugin in months

#

the best I can do is test my mongo code

lost matrix
#

Arent there free mc server options?

brittle badger
#

there are

cinder thistle
#

they're shitty

#

at least in my experience

brittle badger
#

i got custom entity working YAY!

lost matrix
#

Regarding the ignition

#

Because for me it didnt

brittle badger
#

lemme do some more testing

#

how do i mak a custom entity type?

lost matrix
#

You dont need to unless you want your entity to be persistent.

gaunt eagle
#

Except for the book's title and the author, other codes are working. Why didn't he give me the other information?

sand vector
#
config.set("Ranks.1.itemNames", "['Paladins Headgear', 'Paladins BreastPlate', 'Paladins Chausses', 'Paladins Sabatons']"); 
#

Is this the correct way of setting an array in a yml?

lost matrix
#

Yes. Just throw it as a list in there.

sand vector
#

How would i do that?

brittle badger
#

actually i think if i register an entity type itll work

lost matrix
# sand vector How would i do that?
  public void saveAsList(final FileConfiguration configuration, final String path, final String[] content) {
    configuration.set(path, Arrays.asList(content));
  }

But you can also try and just throw the array in there and see if it works.

brittle badger
#

so @lost matrix how can i register an entitytype?

quaint mantle
sharp bough
#

could someone tell me why this event cancel isint working please?

#

it works with any other entity, but the ender dragon

quaint mantle
#

what do u mean by isnt working

unreal quartz
#

probably cuz the ender dragon has a special case where it just spawns the xp orbs instead of the standard way

sharp bough
#

yea it spawns the exp orbes a few times, not like normal entities

sharp bough
quaint mantle
#

it handles exp differently

#

you will need to make make your own enderdragon entity

sharp bough
#

yea do you know how?

quaint mantle
#

and override the method where xp is handled

sharp bough
#

is that fr?

quaint mantle
#

yup

#

more work than usual. if you want, you can make a feature request for the api

#

maybe they will add an event for it or something

unreal quartz
#

5 years ago

#

lol

sharp bough
#

i mean theres an event, event.setDroppedExp(0) but it only works with normal entities

sharp bough
quaint mantle
#

make a new issue and link it to that one

#

you will help not only yourself but others 😄

elfin pilot
#

question about objects

#

if i may interrupt

#

so I talked a bit about this yesterday, but I'm working on an RPG-engine plugin-thingy and I need a way to serialize and load data to and from a file

#

There are objects like Quest which might contain information like the level required, objective list, etc

sharp bough
#

In addition to this, the ender dragon actually dies over the span of 200 ticks (10 seconds), and drops experience each of these ticks.
could i use that and make a loop that runs for 10 seconds to delete all exp orbs?

elfin pilot
#

it does

#

well

#

json

quaint mantle
#

gson is a wrapper for json that lets you serialize and deserialize pojos

elfin pilot
#

there are also objects like Creature which specify information about a certain mob, like its health, defense, what have you

#

ah, alright, but i have a little more to explain, sorry

#

what's to stop me from creating one object that pairs a String with JSONObject

#

the String acts as a key for the JSONObject, and each JSONObject is grouped into a bigger one when the server shuts down

#

instead of creating a Creature and Quest and Enemy and Item with their own respective getters and setters

#

let me paste some code here as an example

#

something like this


public class JSONKeyComponent {

    private String key = "";
    private JSONObject obj;
    
    public JSONKeyComponent(String keyName, JSONObject json) {
        key = keyName;
        obj = json;
    }
    
    public String getKey() {
        return key;
    }
    
    public JSONObject getObject() {
        return obj;
    }
    
    public int getInt(String keyName, int defaultValue) {
        int value = defaultValue;
        
        if(obj.containsKey(keyName)) {
            value = Integer.parseInt(obj.get(keyName).toString());
        }
        
        return value;
    }

    public String getString(String keyName, String defaultValue) {
        String value = defaultValue;
        
        if(obj.containsKey(keyName)) {
            value = obj.get(keyName).toString();
        }
        
        return value;
    }
    
}
quaint mantle
#

is there a reason for that?

#

using gson you could have something like:
PlayerData (class)
--> Quests
--> Stats
--> Inventory

you would then serialize PlayerData into a file, and it'll contain Quests, Stats, Inventory all serialized as well

#

then you can deserialize the file back into PlayerData

elfin pilot
#

hmmmmmmmmmmm

#

alrighty

#

i'll see what i can come up with

ebon shoal
#

hey uhhh,
does anyone know what this error means?

console:

Cannot load configuration from stream
org.bukkit.configuration.InvalidConfigurationException: while parsing a block mapping
in 'string', line 24, column 1:
Gamemode:
^
expected <block end>, but found '<anchor>'

#

its an error in my config but idk what it means

ebon abyss
#

send the config

ebon shoal
#

!paste

#

uh

#

bot doesnt work

#

but ill just go to the web

#

here

brittle badger
#

is it possible to turn a playerhead itemstack into a block?

eternal oxide
ebon shoal
#

yea i want it to have no value

#

do i have to set it to something

eternal oxide
#

then comment it out

#

same as you did for settings:

ebon abyss
ebon shoal
#

but i want to set it on player's command

ebon abyss
#

Key: is perfectly fine yaml

eternal oxide
#

oph I see

woeful crescent
#

I will show you the regex in a sec