#help-development

1 messages · Page 1773 of 1

maiden mountain
#

@steady rapids

steady rapids
#

that is what I did without gradle and maven, is it the same now that I have gradle? wouldnt it leave out the dependencies?

maiden mountain
#

I havent used gradle before so i cant tell

#

But try it out

#

Otherwise try Maven

static crane
#
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class FlyCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player){
            Player p = ((Player) sender).getPlayer();
            boolean flying = false;

            if(flying == false) { //
                p.setAllowFlight(true);
                p.setFlying(true);
                flying = true;

                System.out.println("Fly var is in !flying" + flying);
            } else {
                p.setAllowFlight(false);
                p.setFlying(false);

                System.out.println("Fly var is" + flying);
            }
        }


        return true;
    }
}```
maiden mountain
#

@hollow spindle So i assume you only want it to be executed once right?

static crane
#

Can someone help me it keeps returning true

hollow spindle
maiden mountain
#

Yeah, the easy way is just to create a private field that keeps track with a counter

hollow spindle
#

aye that seems to be the case haha

hybrid spoke
#

Called when an ItemStack is inserted in an enchantment table - can be called multiple times

west bone
maiden mountain
#

@static crane

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

public class FlyCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player){
            Player p = ((Player) sender).getPlayer();
            boolean flying = false;

            if(flying == false) { //
                p.setAllowFlight(true);
                p.setFlying(true);
                flying = true;

                System.out.println("Fly var is in !flying" + flying);
            } else {
                p.setAllowFlight(false);
                p.setFlying(false);

                System.out.println("Fly var is" + flying);
               
            }
            return false //True or false
        }


        return true;
    }
}
hollow spindle
static crane
#

tnx

hybrid spoke
hollow spindle
#

Yeah that sounds about right

maiden mountain
maiden mountain
#

hehe

valid solstice
#

anyone know how to get the EntityEquipment for ArmorStand instance? I'm trying to set the armor stand's main hand into something but armorstand#setiteminhand() is deprecated

urban mauve
#

guys

#

i did login with Telegram

#

and my plugin weight is 10-11MB

#

how i can less my plugin weight?

drowsy helm
#

are you shading spigot again

urban mauve
#

nope

drowsy helm
#

you can always use external source like i said before

urban mauve
#

like to make everything dependencies in order to reduce weight?

chrome beacon
#

How many dependencies are you shading?

urban mauve
#

3

#

but 2 of them I can make dependencies

chrome beacon
#

Shade as few dependencies as possible and minify the jar

maiden mountain
valid solstice
maiden mountain
#

Glad i could help you out

tardy delta
floral pewter
#

Hey, I'm programming a few plugins for a server of mine and I'd like to streamline the process as much as possible. I use maven, and I'd prefer to have all my external plugin dependencies available from a repository instead of having to include the jar files in my project directory.

Is there a service which packages spigot resources under a maven repository?

vale ember
young knoll
#

Only the API

#

Spigot isn’t a GitHub repo

floral pewter
stone sinew
#

Wouldn't work for premium plugins anyways.

floral pewter
#

There are no premium plugins in my dependencies

stone sinew
#

Either way public repos are up to the author.

floral pewter
#

Would the best way be to just create a lib folder with the plugins in my project directory, and mark them as provided in the pom?

hybrid spoke
#

i mean you could also make a jar which contains every jar you need

#

so it would be your central jar jar

#

which you can shade into your jar

#

so you have a jar jar jar

floral pewter
#

But if the servers in question already run the plugins and I shade the dependencies into the jar, wouldn't that cause potential conflicts?

#

At the very least it would increase the plugin size

young knoll
#

I assume they meant a big jar for dependency

#

But I don’t know why you’d bother doing that

hybrid spoke
floral pewter
#

I don't see why making a monolithic dependency jar would provide any benefits over including them individually

stone sinew
floral pewter
#

Right, thanks

stone sinew
#

Remember though shading adds the entire plugin to your resource, so if you give out the jar to others you need the authors perms.

paper viper
#

no fees if you are on the free plan, and also its forever

eternal oxide
#

for dependencies (non plugin) use the libraries entry in plugin.yml

floral pewter
last ledge
#

can someone give me a basic help or information that how can i make a plugin, when u right click a item with enchanting book, the item gets enchanted, there will be no use of anvils

quasi flint
#

events

#

applyEnchant

#

getHand

young knoll
#

InventoryClickEvent, getCursor, and addEnchantment

last ledge
#

hope its not complicated

quasi flint
#

i mean coding must be understood

#

java

last ledge
#

ye ik

quasi flint
#

so not super duper easy

#

but easy enough

hybrid spoke
quasi flint
#

heis already in my dms

#

already beeing worked at

steady rapids
#

to build my plugin for a different server version, do i have to change the dependency 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'? or just the api-version: 1.17 in plugin.yml

quasi flint
#

why build for different server version?

#

one plugin can work on multiple versions

#

just have to check if u use version specific things

steady rapids
#

I tested my plugin on a 1.17 server and it worked, then I moved it to a 1.8.9 server and it's not working, when i do /plugins it is marked as red

quasi flint
#

error in console?

#

why not use viaversion

#

backwards?

quasi flint
#

rewind?

steady rapids
#

I cant update the server to 1.17, i have to build the pl for 1.8 but idk what to change to do so

#

I already have viaversion, rewind and backwards btw

quasi flint
#

why use 1.8

#

please someone kill me and relieve me of this mortal plain

steady rapids
#

i hate it too, but players pay me for it

#

soo

quasi flint
#

then use oldcombatmechanics

#

ise a plugin for 1.9+ and it brings back old pvp

steady rapids
#

would 1.8 plugins still work? some of them are legacy af and not updated anymore

quasi flint
#

u could always just try

#

or code it urself

steady rapids
#

so my choice here is to either find out how to build 1 plugin or recode half of the plugins I use & get annoying players to cry about it .-.

maiden mountain
#

You dont need to recode your plugin for each version

#

Determine the lowest spigot version that your plugin will work on

#

Java is backwards compatible not upwards

quaint mantle
maiden briar
#

com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 35 path $.extra[0].bold
How? My JSON is valid, I have used serval online JSON parsers

ivory sleet
#

Something’s obviously not syntactically correct

ebon stratus
#

any help with this?

wide creek
#

is it normal that chunkSnapshot#getBiome(x, y, z) doesn't return the acutal biome that is gonna get generated?

#
ChunkSnapshot chunkSnapshot = world.getEmptyChunkSnapshot(x,z, true, false);
                    int chunkBlock = chunkSnapshot.getHighestBlockYAt(7, 7);
                    if (chunkSnapshot.getBiome(7, chunkBlock, 7).equals(Biome.FOREST)) {{
                    //saves the coordinates for teleport the player when needed
                    }
old cloud
#

Is that:

public static <T> void async(Supplier<T> task, Consumer<T> callback) {
    BukkitScheduler bs = Bukkit.getScheduler();
    bs.runTaskAsynchronously(plugin, () -> {
        T returnValue = task.get();
        bs.runTask(plugin, () -> callback.accept(returnValue));
    });
}
```the same as that:
```java
public static <T> void async(Supplier<T> task, Consumer<T> callback) {
    BukkitScheduler bs = Bukkit.getScheduler();
    bs.runTaskAsynchronously(plugin, () -> {
        bs.runTask(plugin, () -> callback.accept(task.get()));
    });
}
```I'm unsure if `runTask` is executed before `task.get()`
solar sable
#

guys how to detect right click on a specific block?

tardy delta
#

PlayerInteractevent

vale ember
#

PlayerInteteractEvent

waxen barn
tardy delta
#

event.getClick

#

Click.RIGHT_CLICK or somethicg

#

eheh

solar sable
#

ik how to detect the right click but how to make it detect on a specific block that it clicks on

tardy delta
#

check the type of the block

old cloud
#

woops

tardy delta
#

o:

solar sable
old cloud
#

block#getType

tardy delta
#

event.getBlock().getType()

old cloud
#

And make sure that the block is not null, because it can

tardy delta
#

check if it == Material.Stone or something

#

how can the block be null

#

i'm curious

waxen barn
#

How can I ask here some question, that requires to post a screenshot?

old cloud
waxen barn
# old cloud

Wait what, why I don't have perms to send images?

old cloud
solar sable
#
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (e.getClickedBlock() != null) {
                Player p = e.getPlayer();
                e.getClickedBlock().getLocation();
                p.sendMessage("§7test event");
            }
        }
``` so how?
solar sable
waxen barn
tardy delta
#

if you only accept right click block, the block cant be null no?

#

or does air block counts as null?

old cloud
tardy delta
#

it does uwu

solar sable
#

alright so how do i make it detect a specific block?

tardy delta
#

check if the type equals a material you choose

old cloud
#

e.getClickedBlock().getType() == Material.SOME_TYPE

tardy delta
#

Material.UWU

old cloud
#

^ for example

solar sable
#

wait i put it in an if statement right?

visual tide
#

yes

solar sable
#

if (e.getClickedBlock().getType() == Material.block)

solar sable
#

so i need to change my null check to the code?

eternal oxide
#

you need both

visual tide
#

if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.block)

eternal oxide
#

null check and type check

solar sable
#

oh thanks

solar sable
#

alright so

#
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.OAK_STAIRS) {
                Player p = e.getPlayer();
                e.getClickedBlock().getLocation();
                p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
                p.sendMessage("§7test thing");
            }
        }
``` is this correct?
old cloud
#

Looks good

solar sable
#

okay then

#

let me try it

eternal oxide
old cloud
eternal oxide
#

when you schedule anything it attempts to run in the next tick

#

doesn;t matter if sync or async

#

its processed next tick

old cloud
#

ok, so the both code snippets are equivalent

#

i mean it would be weird if they were not, but it somehow looks wrong idk

eternal oxide
#

they look the same to me

old cloud
#

Ok so I can summarize it to bs.runTaskAsynchronously(plugin, () -> bs.runTask(plugin, () -> callback.accept(task.get())));

#

Thankyou :)

solar sable
#

guys what does this mean

#
[00:02:25] [Server thread/ERROR]: Could not load 'plugins\My plugin testing.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `amxyargaming.testing.Testing'
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:73) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:410) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:276) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1212) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-266]
    at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.ClassNotFoundException: amxyargaming.testing.Testing
    at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:146) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[patched_1.17.1.jar:git-Paper-266]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:467) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:71) ~[patched_1.17.1.jar:git-Paper-266]
    ... 8 more
hasty prawn
#

It can't find your main class

vale ember
#

that no amxyargaming.testing.Testing class exist

#

did you put your class in proper package? is your class name in plugin.yml and in actual project same?

solar sable
#

oh

#

my plugin yml is

#

name: Testing
version: '${project.version}'
main: amxyargaming.testing.Testing
api-version: 1.17
authors: [ amxyargaming ]
description: yuh

vale ember
#

and where is your actual Testing.java file located?

solar sable
#

in the me.amxyargaming.testing

hasty prawn
#

Okay well...

#

there you go

young fossil
#

right so your package name is wrong

vale ember
#

in plugin.yml

young fossil
#

you need me.amxyargaming.testing.Testing

solar sable
#

ooh

#

so i didnt have the me.

young fossil
#

mm.

solar sable
#

its okay now?

young fossil
#

looks alright to me

vale ember
solar sable
#

alright thanks!

young fossil
#

man I hate that I have to have my forum name, wanted to ditch that long ago

solar sable
#

lol

fresh heath
#

Explain what does Object is an instance of an Class mean ?

hasty prawn
#

?learnjava

undone axleBOT
hasty prawn
#

Probably is explained in one of those

vale ember
solar sable
#

yup

fresh heath
#

/most recomended

solar sable
#

well since you wanna know only one thing

#

i suggest

vale ember
#

just google it

solar sable
#

docs oracle

solar sable
#

i mostly google it online

#

sorry if i sound dumb here but what does this mean

#
Error occurred while enabling Testing v1.0 (Is it up to date?)
java.lang.IllegalStateException: Duplicate recipe ignored with ID testing:super_work_pickaxe
    at net.minecraft.world.item.crafting.CraftingManager.addRecipe(CraftingManager.java:89) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.craftbukkit.v1_17_R1.inventory.CraftShapedRecipe.addToCraftingManager(CraftShapedRecipe.java:58) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.addRecipe(CraftServer.java:1371) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.Bukkit.addRecipe(Bukkit.java:831) ~[patched_1.17.1.jar:git-Paper-266]
    at me.amxyargaming.testing.Testing.onEnable(Testing.java:69) ~[My plugin testing.jar:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:500) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:535) ~[patched_1.17.1.jar:git-Paper-266]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:449) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.MinecraftServer.loadWorld(MinecraftServer.java:725) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:306) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1212) ~[patched_1.17.1.jar:git-Paper-266]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-266]
opal juniper
#

Duplicate recipe ignored with ID

solar sable
#

what does that mean

#

?

opal juniper
#

are you adding new recipes

#

cause you are probably using the same id or sommin

solar sable
#

i have 2

#

the first time i made the first recipe it was fine

vale ember
#

probably you copy-pasted them and forgot to change ids?

solar sable
#

hm wait

#

lemme show

#

NamespacedKey key = new NamespacedKey(this, "super_work_pickaxe");

#

this the id right?

eternal oxide
#

this is your plugin instance

solar sable
#

let me just show the thing

vale ember
#

show the other

solar sable
#
 ItemStack i = new ItemStack(Material.DIAMOND_PICKAXE, 1);

        ItemMeta meta = i.getItemMeta();

        meta.setDisplayName(ChatColor.translateAlternateColorCodes('&',"&cSuper Work &bPickaxe"));

        i.setItemMeta(meta);

        i.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3);
        i.addEnchantment(Enchantment.DIG_SPEED, 3);

        NamespacedKey key = new NamespacedKey(this, "super_work_pickaxe");

        ShapedRecipe recipe = new ShapedRecipe(key, i);

        recipe.shape(
                "DPD",
                " O ",
                " O "
        );

        recipe.setIngredient('D', Material.DIAMOND_BLOCK);
        recipe.setIngredient('P', Material.DIAMOND_PICKAXE);
        recipe.setIngredient('O', Material.OBSIDIAN);

        Bukkit.addRecipe(recipe);
``` this is the first recipe
#
ItemStack item = new ItemStack(Material.TOTEM_OF_UNDYING, 1);

        ItemMeta m = item.getItemMeta();

        m.setDisplayName(ChatColor.translateAlternateColorCodes('&',"Totem Of Undying"));

        item.setItemMeta(meta);

        NamespacedKey k = new NamespacedKey(this, "totem_of_undying");

        ShapedRecipe r = new ShapedRecipe(key, item);

        r.shape(
                "GGG",
                "GEG",
                " G "
        );

        r.setIngredient('G', Material.GOLD_BLOCK);
        r.setIngredient('E', Material.EMERALD);

        Bukkit.addRecipe(r);
``` this is the second
hasty prawn
solar sable
#

uh

#

at the

#

onEnable?

hasty prawn
#

Are you reloading

solar sable
hasty prawn
#

That might be why

solar sable
#

oh

hasty prawn
#

Idk if it unregisters recipes when you do /reload

solar sable
#

oohh

#

wait let me

#

stop and start

#

i stopped it and then start it again but still says the same thing

#

hm

eternal oxide
#

unless you are unregistering them they are there permanently

vale ember
#

unregister them in onDisable, maybe?

solar sable
#

how?

#

wait actually

#

let me try something

#

brb

eternal oxide
#

or just check for their existance before you attempt to recreate/register them

hasty prawn
#

Recipes are saved persistently? :o

vale ember
solar sable
#

hm

#

well heres something i did to fix it

#

i removed the second recipe

#

but now its telling me the commandexecutor is null which i think is because i didnt put them in the plugin.yml so im trying it rn

hasty prawn
#

Ohh I see the problem

#

You're creating the 2nd Shaped Recipe with key instead of k

solar sable
#
commands:
  hello:
    usage: /hello
    description: hi

  minus:
    usage: /minus
    description: yes
``` is this how to write the commands in plugin.yml
hasty prawn
#

yeah, so they're both going to be named superpickaxe whatever

solar sable
#

ooohh

#

so how to make it not be the same?

hasty prawn
#

You already made the other NamespacedKey for totem_of_undying, it's called k.

#

So just use that in your recipe constructor

solar sable
#

huh?

hasty prawn
#

ShapedRecipe r = new ShapedRecipe(key, item);

You should be making that with k, not key. key is the other NamespacedKey for super_work_pickaxe

solar sable
#

ooohhh

#

i see it now

#

thanks you

#

also is there a way for me to put these recipes in one class

#

it hurts me to see them out in the open in the main class

hasty prawn
#

Yes, you can

solar sable
#

how?

#

also the thing is fixed, it loads in without any error now

#

yey

#

but where do i need to make a class for it to be alone

#
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.OAK_STAIRS) {
                Player p = e.getPlayer();
                e.getClickedBlock().getLocation();
                p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
                p.sendMessage("§5test");
            }
        }
``` how to make the armor stand spawn in the block
eternal oxide
#

e.getClickedBlock().getLocation().add(0.5,0.5,0.5)

vale ember
solar sable
vale ember
solar sable
#

oop

#

well this is just a test first

#

so later ill use chatcolor

#

im just seeing if i can do the code first then play with it yk

vale ember
#

like this ChatColor.translateAlternateColorCodes('&', string)

solar sable
#

ik-

tardy delta
solar sable
#

i know how to use chatcolor 💀

tardy delta
#

not that i use it

visual tide
solar sable
#

right?

visual tide
#

its not like chatcolor does anything else

solar sable
#

i mean botch is fine tbh

#

both*

tardy delta
solar sable
#

💀

solar sable
eternal oxide
#

you use it in the spawn call

solar sable
#

where?

#
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.OAK_STAIRS) {
                Player p = e.getPlayer();
                e.getClickedBlock().getLocation().add(0.5,0.5,0.5);
                p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
                p.sendMessage("§5test");
            }
        }
spare prism
#

NMS; 1.17.1 | Pathfindergoal doesn`t work properly

vale ember
#

actually yes, it may cause problems on some systems, why just don't avoid using it? why to put yourself into a potential trouble?

solar sable
#

oh wait a second

#

nope nvm

#

anyways so how?

#

it spawns on me and not the block

visual tide
#

you didnt listen to what elgar said
the new location is e.getClickedBlock().getLocation().add(0.5,0.5,0.5)

solar sable
#

thats what i did no?

visual tide
#

no

#

youre just doing e.getClickedBlock().getLocation().add(0.5,0.5,0.5); and ignoring its output

stoic osprey
#

Can anyone help me - when teleporting a player I get this error: java.lang.IllegalArgumentException: location.world?

vale ember
#

you still using p.getLocation() in spawnEntity method

solar sable
#

oh

#

then where do i put it then?

visual tide
empty gyro
#

my server is saying there isnt a plugin.yml file in my plugin but there is and it is formatted correctly

solar sable
#

where do i put it?

empty gyro
#

src

stoic osprey
visual tide
solar sable
#

ooohhh

#
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.OAK_STAIRS) {
                Player p = e.getPlayer();
                e.getClickedBlock().getLocation();
                p.getWorld().spawnEntity(e.getClickedBlock().getLocation().add(0.5,0.5,0.5), EntityType.ARMOR_STAND);
                p.sendMessage("§5test");
            }
        }
``` is this correct?
vale ember
visual tide
#

also why the e.getClickedBlock().getLocation()

vale ember
solar sable
#

oh ok

vale ember
empty gyro
#

oh yeah lmao

#

thanks

solar sable
#

alright it works the armor stand spawns on it

#

but how do i make the armor stand spawn in it

#

like one block under it

stoic osprey
#

when I'm doing

player.teleport(teamOneSpawn);

where teamOneSpawn is a location, I am getting the error:

null
 Caused by: java.lang.IllegalArgumentException: location.world

can someone tell me whats happening here?

eternal oxide
#

add(0.5,-1,0.5)

vale ember
solar sable
#

oh ok

vale ember
#

or -1

solar sable
#

eh wait which one-

#

oh ok

eternal oxide
#

0.5 is center of teh block

#

so if you want it 1 full block down you -1 from y

solar sable
#

well i want the head of the armor stand at the middle

eternal oxide
stoic osprey
# spare prism what is ur import

import com.mini.minimcc.lobby.SendToLobby;
import com.mini.minimcc.minigames.GameType;
import com.mini.minimcc.teams.TeamManager;
import com.mini.minimcc.util.SendTitle;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerMoveEvent;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
solar sable
#

okie

#

alright now how do i ride an entity

stoic osprey
#

I should note that afterwards it says
com.google.common.base.Preconditions.checkArgument(Preconditions.java:141)

spare prism
#

and the entire stacktrace

stoic osprey
#

ok

stoic osprey
#

hmm

#

it definitely exists

eternal oxide
#

not loaded

stoic osprey
#

as all the other classes have no trouble accessing it

solar sable
#

elgarl do you know how to ride an entity

stoic osprey
#

also I am in the world at the time

eternal oxide
#

that error is saying teh world is invalid, its not loaded

vale ember
solar sable
#

oop thanks

stoic osprey
vale ember
#

full err log ?

eternal oxide
#

where are you setting the location?

stoic osprey
#

If I restart the server the error comes up until I do /reload and then the error doesnt come up

stoic osprey
eternal oxide
#

thats why

stoic osprey
#

what?

solar sable
eternal oxide
#

a static variable is initialized before the worlds are loaded

stoic osprey
#

hmm ok

solar sable
#

can someone tell me how? 😅

stoic osprey
#

Ah

#

and when I do /reload the worlds are already loaded

eternal oxide
#

you need to set yoru location at teh earliest in onEnable

vale ember
stoic osprey
#

I think I understand

solar sable
vale ember
stoic osprey
#

why does everyone put # instead of . when showing the methods thing - surely it shoyuold be entity.addPassenger

solar sable
tardy delta
hasty prawn
#

No

young fossil
#

it's how you reference an instance method in javadoc.

hasty prawn
tardy delta
#

~~an instance method?

young fossil
#

one that isn't static

hasty prawn
#

I mean you can reference static methods the same way

tardy delta
#

a static method isnt an instance method?

young fossil
#

No

hasty prawn
#

No

young fossil
#

because you don't need an instance of an object to call it

tardy delta
#

does that mean it isnt or it is? just no

hasty prawn
#

It's not

stoic osprey
tardy delta
#

well i say it is not static 🌝

hasty prawn
eternal oxide
#

use . or use # I use both so don;t care 😉

hasty prawn
#

^ It doesn't really matter

solar sable
#

yup

hasty prawn
#

I mean Elgar uses semicolons instead of apostrophes, but we know what he means anyways

solar sable
#

why are we even arguing about this 😆

eternal oxide
#

and teh

hasty prawn
#

Yeah that too lol

vale ember
#

how people understend which one is static and which one is not?

hasty prawn
#

It's probably the one that has static in the name 5Head

solar sable
#
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
            if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.OAK_STAIRS) {
                Player p = e.getPlayer();
                Entity entity = Bukkit.getWorld("world").spawnEntity(e.getClickedBlock().getLocation().add(0.5,-1,0.5), EntityType.ARMOR_STAND);
                
                p.sendMessage("§5test");
            }
        }
``` how to make the armor stand invisible
hasty prawn
#

We can't just write this plugin for you

solar sable
#

i know how to make it invulnerable

hasty prawn
#

You need to Google some stuff and figure things out for yourself

spare prism
solar sable
#

oop

#

okay let me search

#

sorry

hollow bluff
vale ember
#

armorStand.setVisible(false) - both: invisible, invulnarable

solar sable
#

i wrote

#

entity.setVisible(false) and uh nothing happened

vale ember
#

full code?

tardy delta
#

you still havent figured it out?

wraith kettle
#

Does anyone know which event i must listen to avoid the "no damage" sound?
Currently tried EntityDamageByEntityEvent, but it seems not be triggered. And PlayerInteractEntityEvent seems only for right click.

solar sable
#

oh hey morice

wraith kettle
#

Well, more then register the event and print debug things to check it isnt possible?

#

No

#

As i said: "Currently tried EntityDamageByEntityEvent, but it seems not be triggered. And PlayerInteractEntityEvent seems only for right click."

#

The event works fine, but this not works in case of "no damage"

tardy delta
#

is there a EntityDamageEvent?

#

isn't it that one?

#

@wraith kettle

#

smh why am i tagging people

wraith kettle
#

You mean for my problem?

tardy delta
#

yes

wraith kettle
#

No, the player is still alive.
But if you just spam attack, then "ENTITY_PLAYER_ATTACK_NODAMAGE" sound will be played.
And try to "listen" on this event

tardy delta
#

Damage

wraith kettle
#

This event will only be triggered for me if there are any damage

vale ember
#

Probably packets then? But I'm no sure

tardy delta
#

it has to work with an event

wraith kettle
#

I do that already to disable this sound. But i want it only disabled on attack

tardy delta
#

i'm sure

chrome beacon
#

Why not prevent players from hitting eachother with teams. That would solve your issue

wraith kettle
#

I only want to disable the sound. Not disabling pvp

chrome beacon
#

Oh

tardy delta
#

oh

wraith kettle
#

hmm i just check the javadoc and still cant find any event that seems to work in this case

tardy delta
#

cancel the sound event would be big brain

#

🤓

wraith kettle
#

Yeah, the problem is, that i not want to disable it all over the time.
Only if a player tries to attack an player

tardy delta
#

there is probably no sound event

#

or somewhere internal

hollow hill
#

hey can some help me? and yeah yeah I know don't ask to ask, but my thing will fill up the whole screen lol

tardy delta
#

?paste

undone axleBOT
hollow hill
#

so just clarifying before I send it ;D

#

oh thanks

tardy delta
#

paste it there

#

np

hollow hill
#

so when you say anything in the server it gives an error in the server console

#

it's like "event (or e) AsyncPlayerChatEvent can not pass to EternalPlugin v1.0"

tardy delta
#

wait what am i looking at?

hollow hill
#

basically I'm trying to highlight someone's name when it's mentioned in a message

tardy delta
#

if message contains a player name?

#

ah

hollow hill
#

and make like a ping sound

hollow hill
wraith kettle
#

Ok i found an event 😄
EntityDamageEvent

eternal oxide
#

you are trying to cast a Player object to a CharSequence

hollow hill
eternal oxide
#

yes

hollow hill
#

oh lol

eternal oxide
#

its an impossible cast

hollow hill
#

it said it needed to be a char sequence

eternal oxide
#

you read it wrong

hollow hill
#

are there alternatives?

tardy delta
#
@EventHandler
public void onChat(PlayerAsyncChatEvent event) {
  Player player = event.getPlayer();
  Bukkit.getOnlinePlayers().forEach(p -> {
    if (event.getMessage().contains(p.getName()))
      player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1.0f, 1.0f);
});
}``` i guess
hollow hill
tardy delta
#

me liking .forEach uwu

hollow hill
eternal oxide
#
for (Player player: Bukkit.getOnlinePlayers()) {
    if (message.contains(player.getName())) {```
hollow hill
#

the code you sent would highlight the sender's name if they said it

#

I think

#

oooooh

#

alright thanks man

quaint mantle
#

why do you like forEach

hollow hill
#

@eternal oxide would that loop through every player and find a match though?

#

that's what I previous code kinda did

solar sable
#

im struggling with this armor stand thing rn

hollow hill
#

like a for loop or whatever it's called can't think atm lol

solar sable
#

it spawns on the block but when i ride it i float

hollow hill
solar sable
#

why do i float

hollow hill
#

can't you adjust the posistioning?

solar sable
#

i tried but some of it just makes me sit inside the block

eternal oxide
#

adjust teh y position when spawning

hollow hill
#

can I see a screenshot of that

#

when you're inside the chair*

solar sable
#

hold on

hollow hill
#

but yeah @eternal oxide should I just use my old looping method?

eternal oxide
#

no

#

your old looping is terrible

hollow hill
#

does the code that you sent me loop it?

eternal oxide
#

That is a simple for loop

solar sable
hollow hill
#

so when you check if the message has anyone from the player list does that loop through every name?

eternal oxide
#

yes, thats what the for loop is for

hollow hill
#

ooooh

#

alright

#

thanks

solar sable
#

if its -1 it stil float but if i make it -1.1 and so on, it breaks it

#

i tried -0.5 and so on stil didnt work

eternal oxide
#

breaks?

solar sable
#

i mean like it still makes me inside the stair

eternal oxide
#

and -1 makes you float?

solar sable
#

yup

eternal oxide
#

disable teh AI on the stand. It probably has none, but it will prevent anything affecting it

solar sable
#

okay let me try

eternal oxide
#

it will not be affected by gravity

solar sable
#

i made it "stand.setAI(false);

old cloud
#

I have a question about the Mojang API. Do I have to integrate a system to not go over the request limit or should I just get the info from the API itself?

hollow hill
#

for whatever I forgot player.getName() existed so I was sitting there wondering how to get a string xD

#

oh should I check the message for the player name instead?

#

(instead of the Player)

#

nvm it already is I'm blind

#

lol thanks though man

opal juniper
solar sable
#

guys whats .setCustomName

#

and .setCustomNameVisible

quaint mantle
#

a custom name of entity

solar sable
#

is it like one of those floating texts

quaint mantle
#

if visible set to false, player will see the name only if he targets entity

quaint mantle
solar sable
#

oohh

#

okay then

flint carbon
#

Does anyone know how to silently run a console command?

#

I can run it but I don't want to see feedback in the console

solar sable
#

uh i dont think thats a thing?

#

do you mean you want to run a command without console detecting it?

old cloud
#

If you mean that

solid cargo
#

what is a good workaround for a custom itemstack to continue working after its enchants or durability changes? could it be ItemStack#isSimilar ?

eternal oxide
#

isSimilar compares all bar stack size

quaint mantle
eternal oxide
#

if you want to detect your custom items add to its PDC

quaint mantle
#

?pdc

solid cargo
#

i remember long ago

old cloud
#

Since when does PDC exist?

solid cargo
#

someone recommended me to create a boolean for it

#

since 1.13 i think

#

or .14, idk

blazing scarab
#

1.14

old cloud
#

Im using 1.16 and ItemStack has only Metadata and no PDC

blazing scarab
#

On 1.13 there's an deprecated alternative

old cloud
#

Or is it the Meta?

blazing scarab
#

Yes meta

old cloud
#

Aight

solid cargo
#

i forgot how can i check what pdc it has

#

something like

#

.getItemInMainHand()

#

further i forgot

old cloud
#

Its in the item meta

solid cargo
#

.getItemMeta

solar sable
#

is there any way to set higher enchants number

#

like fortune 10 or something?

old cloud
#

Yes, you have to set ignoreLevelRestriction to true

solar sable
#

oh

old cloud
#

For example: item.addEnchant​(Enchantment.WHATEVER, 10, true)

solar sable
#

ooh ok

#

hm doesnt seem to work

solid cargo
#

im too lazy to start up my localhost, this should work... right?

solar sable
#

or i cant

solid cargo
#

lemme give you an example for one of my old plugins

#

its very simple

solar sable
#
i.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 8, true);
``` because this clearly doesnt work
remote spade
#

Hello, I need help with BuildTools

solid cargo
# solar sable ```java i.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 8, true); ``` because th...
public ShapedRecipe getRecipeProt(){
        ItemStack item = new ItemStack(Material.ENCHANTED_BOOK);
        NamespacedKey key = new NamespacedKey(this, "prot_six_book");
        EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta();
        meta.addStoredEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 5, true);
        meta.setDisplayName(ChatColor.GOLD + "Enchanted Book");
        List<String> lore = Arrays.asList(ChatColor.AQUA + "Apply this book to your armor", ChatColor.AQUA + "To get this custom enchant", "", "§6§lLEGENDARY");
        meta.setLore(lore);
        item.setItemMeta(meta);
        ShapedRecipe recipe = new ShapedRecipe(key, item);
        recipe.shape("KHK",
                "CAL",
                "KBK");
        recipe.setIngredient('H', Material.DIAMOND_HELMET);
        recipe.setIngredient('B', Material.DIAMOND_BOOTS);
        recipe.setIngredient('C', Material.DIAMOND_CHESTPLATE);
        recipe.setIngredient('L', Material.DIAMOND_LEGGINGS);
        recipe.setIngredient('K', Material.BOOKSHELF);
        recipe.setIngredient('A', Material.BOOK);
        return recipe;
    }
``` this is code for a protection 6 book
solid cargo
#

yes,
meta.addStoredEnchant(Enchantment.YOUR_ENCHANT, LEVEL, true)

#

for an enchanted book ^^

old cloud
#

or just meta.addEnchant

solid cargo
#

if you want an enchant for a weapon or something, then do
meta.addEnchant()

solar sable
#

okay

#

okay so i need to

#
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) item.getItemMeta();
``` add this?
#

and then do meta.addEnchant() ?

solid cargo
#

if thats for a book

#

then yes

#

but instead of .addEnchant

#

do .addStoredEnchant

#

BUT

#

if you want it for a custom itemstack

#

then do

#

ItemMeta meta = item.getItemMeta();

#

and do meta.addEnchant

solar sable
#

thats what i did before-

solid cargo
#

wait then

#

what do you need

#

for a book

#

or an itemstack (weapon, tools etc)

solar sable
#

itemstack

solid cargo
#

ah

solar sable
#

lol

solid cargo
#

ok brb

solar sable
#

okie

solid cargo
#

lets move this to dms so less polution

old cloud
#

Or just open a thread lol

quaint mantle
#

how would i go about making a crafting table inventory similar to that of hypixel skyblock's where i can give multiple amounts of item for a single recipe

#

Thats hard

stoic osprey
#

So I'm trying to detect if a block exists or not after an explosion in the EntityExplodeEvent. However, whenever I blow up the block i'm checking, and the event triggers, it says the block is still there (event though it isn't)

here is my function:

@EventHandler
    public static boolean onExplosion(EntityExplodeEvent event) {
        if (gamePlaying) {
            for (Block b: event.blockList()) {
                if (b.getType() == Material.GOLD_BLOCK) {
                    Block block = new Location(Bukkit.getWorld("mcc"), -260, 10, 324).getBlock();
                    System.out.println(block.getType());
                    if (block.getType() != Material.GOLD_BLOCK) {
                        allowedAcrossVoid = true;
                        teamOneRespawn = false;
                        for (UUID uuid : teamOne) {
                            Player player = Bukkit.getPlayer(uuid);
                            assert player != null;
                            player.sendMessage(ChatColor.RED + "Your gold is destroyed! You can no longer respawn!");
                        }
                        for (UUID uuid : teamTwo) {
                            Player player = Bukkit.getPlayer(uuid);
                            assert player != null;
                            player.sendMessage(ChatColor.GOLD + "You destroyed the enemy gold!");
                        }
                        return true;
                    }

Even though I blew up the gold block, the console still outputs that it is there?

ivory sleet
quaint mantle
stoic osprey
tardy delta
#

normally eventhandlers have to be a non static void method no?

stoic osprey
#

that could be a problem

#

but it's still running fine

#

just not doing what it's meant to

opal juniper
quaint mantle
#

Wtf

opal juniper
#

what

quaint mantle
ivory sleet
quaint mantle
ivory sleet
#

Since Bukkit just loops through your listeners declared methods and then just filter them based if they’re annotated or not.

ivory sleet
tardy delta
quaint mantle
#

eh wanted to say that static event handlers may not work on paper because of asm method executors

quaint mantle
#

for the changing of the barrier block into the crafted item i can either do a bukkit runnable to check every 10 ticks or so, what the player puts in the crafting inventory or just inventory click event to find out when the player put something

#

typing intensifying intensly

ivory sleet
#

What you probably want is to have one square matrix with size 3, which mirrors what the player puts in the gui. Then for every recipe I’d suggest having a separate matrix. And yes, the matrix class will have to be implemented by you.

Once you’ve got that, with the proper methods of course, you might want to map the recipes with a Map<Matrix,Recipe>.

Now, when a player puts down an item, you just fetch the item/material, and then put it in square matrix that is supposed to mirror the player’s input in the gui. Then you try accessing the recipe through the matrix with Map::get simply. Now for this to work, it requires you to properly hash every material/ingredient and also properly hash the matrix itself.

And for your question, using InventoryClickEvent would do fine here.

tardy delta
#

inv click event prob

ivory sleet
#

What I wrote now might not support shapeless recipes

tardy delta
#

Consumer<InventoryClickEvent> uwu

ivory sleet
#

But usually you could just, if the Map::get fails, take the ingredients and match them non ordered to another map which keeps track of the shapeless recipes.

quaint mantle
#

i have a code

#

i do not understand it

#

but it effectively recreated the crafting table

#

if someone could explain it I would be very glad

ivory sleet
quaint mantle
#

the code

tardy delta
#

ew List<Integer> craftingSlots = new ArrayList<>();
craftingSlots.add(10);
craftingSlots.add(11);
craftingSlots.add(12);

        craftingSlots.add(19);
        craftingSlots.add(20);
        craftingSlots.add(21);

        craftingSlots.add(28);
        craftingSlots.add(29);
        craftingSlots.add(30);
#

Arrays.asList(10, 11, 12,...)

quaint mantle
#

xD it isnt my code

ivory sleet
#

Yuh the code seems to be running with a time complexity of O(n) where n is the amount of recipes if I haven’t read that wrongly

#

Which is probably not a huge deal in your case

tardy delta
#

code can be simplfied many times

quaint mantle
ivory sleet
#

One instance is what FourteenBrush just mentioned

#

ArrayList() without passing anything to its constructor will use an array of length 10, which is somewhat unnecessary. With the assumption they’re not in need of expanding the list.

quaint mantle
#

hmm

#

i dont get any of this

misty current
#

so i've found a way to set final damage

#

ez

quaint mantle
#

im almost a beginner just tryna have a custom crafting table ;-;

misty current
#

and it made me wonder why tf is it not a thing on spigot

paper viper
#

i did remember i proposed an algorithm, but not really anyone implemented it tbh

#

but it is to use a hashed base database and combine all 9 slots into a key

#

but i have to think some more for shapeless recipes

quaint mantle
#

i have no clue about what u just said :D

neon storm
#

How do I teleport a vehicle with passengers on it? The Entity#teleport() method does not seem to work for it.

round finch
#

trouble importing Towny Stuff

quaint mantle
#

anyone here using intellij minecraft development plugin to make plugins?

#

I need help, when I build my plugin to .jar file it doesn't obtain source code classes

neon storm
ivory sleet
#

You could make just hash the ingredients unordered, if it happens to be the case there is no such shaped recipe with the given ingredients.

#

And then have another hash table for the shapeless recipes

ivory sleet
#

Of course it doesn’t give you source code classes

round finch
ivory sleet
#

Java compiles down to jvm bytecode

round finch
#

i thought of download the lastest to fix it

neon storm
quaint mantle
#

You d have to

brittle veldt
#

How would I go about saving a hashmap with string keys and arraylist of ints as value

quaint mantle
neon storm
tardy delta
#

ah a boat

tardy delta
neon storm
# tardy delta what for thing is that?

Hmm, its a bit more complicated than that, its a minecart riding a boat riding a minecart (and more, but I don't remember fully)

Correction... XD :
"cow riding a Minecart with a chest, which is riding a boat, which is riding a minecart.

riding the same minecart is a cod, riding an axolotl.
Loads of tags and nbt as well."

tardy delta
#

what the hell

#

why

neon storm
#

It's for testing

#

If I can teleport that thing, then I can teleport everything

tardy delta
#

its the same like teleporting a player on a horse i guess

#

the horse wont get teleported

#

i really have to check it out

round finch
#

i swear it is just to there annoy me
i didn't have that in my old plugin

tardy delta
#

satan looks under his bed every night making sure that thing isnt there

neon storm
brittle veldt
#

ik their text files lol but like

#

kk

quaint mantle
#

I need help, when I build my plugin to .jar file it doesn't obtain source code classes, when I decomiple it, it has older code in it

round finch
#

How do i import Towny API

#

D:<

hoary pawn
#

im trying to log some stuff in the console but is doesnt look like getLogger().info(); accepts things not in ""s

neon storm
round finch
#

normally i dont have this issue

opal juniper
#

pls use maven / gradle

late sonnet
# hoary pawn

the logger use string maybe you can use itemJsonReader.toString if this class handle correctly this..

round finch
#

normally it wasn't problem

#

but now i have this issue

crisp arch
#

Im getting StreamCorruptedErrors while trying to read from sqlite3 bytes, does anyone know the issue?

I personally think the problem is caused by the fact that im not writing the correct bytes, but I don't really know.

Heres my toByteArray function

    public static byte[] toByteArray(Object object) {
        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ObjectOutputStream output = new ObjectOutputStream(bos);
            output.writeObject(object);
            byte[] result = bos.toByteArray();
            output.close();
            bos.flush();
            bos.close();
            return result;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
round finch
quaint mantle
lavish hemlock
lavish hemlock
#

That won't fix it, probably

#

But do it, it's good coding practice

lavish hemlock
misty current
#

I'll send a better example when im at my pc later

true perch
#

How can you register the instance of essentialsx?

quaint mantle
#

What

true perch
# quaint mantle What

I'd like to store the instance of Essentials within my plugin so I can access things such as: essentials.getUser(player).isMuted()

quaint mantle
#

PluginManager.getPlugin("Essentials")

west oxide
#

hey

#

i am getting this error when i try to compile a plugin

#

what does this mean ?

lavish hemlock
#

have you checked that line

west oxide
#

what

lavish hemlock
#

bitch

#

10:69

#

line 10

#

column 69

opal juniper
#

the line that caused the error lol

#

collumn 69 tho

#

thats a long line

visual tide
west oxide
#

oh

#

sorry for being stupid lol

opal juniper
true perch
# quaint mantle PluginManager.getPlugin("Essentials")

Works perfectly!! Thank you java private boolean setupEssentials() { if (getServer().getPluginManager().getPlugin("Essentials") == null) { return false; } this.essentials = (Essentials) getServer().getPluginManager().getPlugin("Essentials"); if (this.essentials == null) { return false; } return true; }

lavish hemlock
#

hell I'm pretty sure IDEA lets you click the file link to jump to that line

opal juniper
#

i didnt make a joke

visual tide
#

well your end quote is missing somewhere

west oxide
#

error here

lavish hemlock
#

use ""

#

'' is for single characters like 'A'

young knoll
#

You can’t use ‘ ‘ for strings in java

lavish hemlock
#

"" is for strings

young knoll
#

This ain’t python or js

visual tide
#

"a" = string; 'a' = char

west oxide
lavish hemlock
opal juniper
#

i wish it was python cowontract

true perch
quaint mantle
#

You dont need to get Essentials 2 times :)

lavish hemlock
#

And you don't need to call the same method twice.

true perch
#

I was thinking that, yeah 😅 I just wrote it quick to see if I could actually do it

#

Thanks :>

true perch
west oxide
#

Ayyy lets gooo my first plugin

#

officially smart now

lavish hemlock
#

you could actually cast essentials to Essentials on declaration but it makes no difference

west oxide
lavish hemlock
#

also this would throw a NoClassDefError on Essentials not being found I believe but that's a harder problem to solve

young knoll
#

Does just having the import throw ncdf

lavish hemlock
#

I believe if it's part of the constant pool, yes.

young knoll
#

Or do you need to actually hit code that uses the import

true perch
lavish hemlock
#

Since the classloader resolves all dependency classes from the ctpool.

lavish hemlock
young knoll
#

What if you only use the import in local scope

true perch
lavish hemlock
#

import java.lang.String; just tells the compiler to turn String into java.lang.String

young knoll
#

So it should be fine if the code never references it

lavish hemlock
#

Sure, but the constant pool is the first thing loaded in a class, and that will always contain Class entries.

#

I don't actually know how the classloader resolves classes but I'm pretty sure it looks at the ctpool first.

west oxide
#

hey am interested in pvp plugins with minigames any tutorials someone can suggest me PLEASE

#

cuz i cant see to find any

young knoll
#

This is why referencing other plugins is annoying

lavish hemlock
#

indeed

young knoll
#

Gotta have all the stuff in its own class that isn’t touched unless the plugin is present

lavish hemlock
#

actually gimme a sec I'll make a small test

west oxide
sullen marlin
west oxide
#

or anything you can suggest me

#

pls

#

am lost

sullen marlin
#

obviously good advice though

young knoll
#

Oh gosh I don’t know if the person I watched even still exists

#

Do you know java already

lavish hemlock
#

Java was not designed for soft dependencies.

west oxide
#

no

lavish hemlock
#

learn Java

young knoll
#

?learnjava first

undone axleBOT
lavish hemlock
#

you cannot go from 0 to creating minigames plugins

young knoll
#

Trust me, it will save you some forehead wrinkles

lavish hemlock
#

the concept is too complicated for someone who does not know the language

west oxide
#

oh

#

okay

#

video tutorials vs docs which is better in your opinion ?

lavish hemlock
#

I wouldn't recommend Codecademy or Oracle's.

round finch
#

The mackup in the document following the root element must be well-formed

lavish hemlock
#

Codecademy is only good if you have their subscription, otherwise you can only go through a crash course

#

And Oracle's is not designed for beginners, plus is just ugly to look at.

lavish hemlock
round finch
#

wut i'm doing wrong?

quaint mantle
#

hey i need some help, i accidentally removed a method and its not in my local file history on eclipse;

i forgot how to get the difference between two timestamps

you just remove timestamp 1 from timestamp 2, right?

#

so like...

long - long

young knoll
#

Mhm

#

May need to abs it if the order isn’t consistent

quaint mantle
#

okay

#

its just to format the dates

#

because SimpleDateFormat wasnt getting the job done

#

so that should in theory work?

sullen marlin
#

why isnt SDF getting the job done

#

dont reinvent the wheel

#

java is smarter than you

quaint mantle
#

the text inbetween was reading as a format for some reason

#

idk why

round finch
#

Java has Date and Time

sullen marlin
#

put text in single quotes

#

'days, '

#

(when using SDF)

lavish hemlock
#

@young knoll I found out you can avoid class def errors.

quaint mantle
#

SimpleDateFormat("dd", ' days, ', "MM:ss"); then?

zealous glen
#

how do you change a horse variant now?

lavish hemlock
#

Framework is literally just a generic class that has a method that only returns false for this purposes.

#

Dependency is empty, and although I compile it alongside the other classes, I delete its class file before running.

#

So ye, conditional resolution.

zealous glen
#

Variant doesn't work for me

young knoll
#

Read the docs

#

It says it’s deprecated

west oxide
lavish hemlock
#

2 years.

west oxide
#

if you dont mind me asking of course or idk

sullen marlin
#

do you hate yourself

lavish hemlock
#

Nope I'm just a fan of style.

young knoll
#

I’ve been messing with spigot for 9 years now I believe

#

You can see stuff in the GitHub linked to my discord

lavish hemlock
#

The plugins I have made were shit and I made them when I was a beginner so I just ended up deleting them.

young knoll
#

I think my old plugins are still somewhere on my hard drive

young knoll
#

But if I don’t look at them, are they really even there

west oxide
lavish hemlock
#

I think 3 in just a few months.

west oxide
#

What plugins u made ?

lavish hemlock
#

Again, they were shit so I deleted them. I haven't made a plugin since as I haven't had any ideas.

#

Although I have yet to use it

#

Or test it

#

And I'm unsure if it's even good.

young knoll
#

Lol

west oxide
#

Oh i understand that

lavish hemlock
#

Honestly eventually I might just split this thing up into its actually unique functionalities.

quaint mantle
#

how should i format the remaining hours, and minutes in the formatDatesAs

lavish hemlock
#

You can only have one root tag.

#

Which means you can't do

<tag>
</tag>
<tag2>
</tag2>

at root level

sullen marlin
#

I dont think simple data format is ideal for timespans

#

isn't there an Interval time api in java 8

west oxide
quaint mantle
round finch
#

wut root tag?

lavish hemlock
#

jesus christ do you know what the fuck XML is

round finch
#

no i just click made new file .XML

sullen marlin
#

android has DateIntervalFormat

quaint mantle
lavish hemlock
#

Because if you can't understand what "root tag" means, it means you don't know how XML works.

#

It's not a difficult format, soooo

quaint mantle
#

there's cool time api in java 8 yes

lavish hemlock
#

Ye

#

Java 8's time API is nice

round finch
#

never heard of it normally i just use blank template from maven

quaint mantle
lavish hemlock
#

Yes

#

You are correct

#

Its just that I prefer my own code over other people's

#

Because I am usually more competent than other people

#

:)

quaint mantle
#

||selfish||

lavish hemlock
#

||you mean egotistical - selfish would assume I'm keeping the code to myself||

quaint mantle
#

ajwiwhama
yeah kinda

#

so i tried TimeUnit, but im still getting negative values, i must be doing Long math wrong?

sullen marlin
#

you want older - younger

lavish hemlock
#

I'm pretty sure you have to d2 - d1

#

yeah

sullen marlin
#

which is probably d2 - d1

quaint mantle
#

ahh

lavish hemlock
#

md_5 we are so smart uwu

west oxide
#

idk man

#

but

#

my plugin way better

lavish hemlock
#

show me

west oxide
#

its too good i cant leak it

#

:>

lavish hemlock
#

fair enough

west oxide
#

but only because you begged me

#

i will show you

lavish hemlock
#

You made two fatal mistakes:

west oxide
#

enough seeing time for you

#

lol

lavish hemlock
#
  • sendMessage can be separated into its own method for reduced noisiness.
  • Adventure > Bukkit chat API
west oxide
#

lol

west oxide
#

too smart for me

#

amma go back to learning about variables on java

#

;-;

lavish hemlock
#

good plan

west oxide
#

lol

west oxide
quaint mantle
#

Thsts funny the most smartest developers has only 1-2 projects

lavish hemlock
#

"most smartest"

west oxide
#

lol

lavish hemlock
#

tsk tsk

lavish hemlock
#

you made 10 grammatical errors (hyperbole)

#

you lose at life

quaint mantle
#

oh fuck

#

still a fact

west oxide
#

i just realized how hard it is to make plugins

#

;-; me who thought i can make a practice plugin in a week

blazing scarab
buoyant viper
#

@zealous glen u kinda smell

#

like a ba ka

lavish hemlock
#

personally I think it's easier to improve if you don't stay attached to the same project for too long

#

why? because you're no longer working with decades old code that, if you're trying to stay consistent, will keep you consistently bad

#

besides, new projects = new experience

ruby turtle
#

i agree

lavish hemlock
#

nice username

#

where's Parser tho

sullen marlin
#

imagine anyone working with decades old code

#

they just dont make code like they used to

lavish hemlock
#

excuse me

I will use Vector, Stack, and Hashtable if I want

#

thank you very much :p

blazing scarab
#

Who tf is hashtable

round finch
#

Fuk maven

#

just deleted my whole plugin

lavish hemlock
sullen marlin
#

I doubt maven did that

lavish hemlock
#

Was introduced in Java 1.0 but replaced in Java 1.4

round finch
#

all the bunch problems with my eclipse

blazing scarab
#

Aha

lavish hemlock
#

oh and Vector is List, and Stack is Deque

#

oh plus we have Enumeration which older parts of Java's stdlib still use

#

which is basically just Iterable/Iterator except you can't foreach like for (elem : thing)

sullen marlin
#

yeah enumeration is weird af

lavish hemlock
#

I hate it

#

fun fact:

#

Collections has a method to convert enumeration to list

quaint mantle
#

isnt enumeration just iteration while keeping track of the index

lavish hemlock
#

pretty much

quaint mantle
#

then why is it so bad

lavish hemlock
#

you can't foreach