#help-development

1 messages · Page 2191 of 1

quiet ice
#

Not after your code

thorny dawn
#

how will this affect the code?

harsh totem
#

The delayed code is supposed to be in the Runnable

thorny dawn
#

this block of code is inside a runnable

harsh totem
#

It is not

#

Its empty

thorny dawn
#

i am basically trying to delay a for loop by 1 second

#

its like

harsh totem
#

The delayed code should be in the {} after the runnable

thorny dawn
#
public class MyRunnable: Runnable {
override fun run() {
    // some runnable stuff
    Bukkit.getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugin("Mobwars")!!, Runnable {}, 20)
  }
}
thorny dawn
#

wait let me compile and ill be back

harsh totem
#

Is it spigot? Why is there "!!"

thorny dawn
#

cause .getplugin() can be null

harsh totem
#

What?

thorny dawn
#

this is kotlin

harsh totem
#

Ok

thorny dawn
#

"?" for nullable "!!" for not null

harsh totem
#

@thorny dawn did what I told you help?

thorny dawn
#

yeah im reloading the server

harsh totem
#

Ok

peak jetty
#

this code doesent work but there are no errors, i want it to be so that when a player joins the get teleported to the spawn etc

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        if(event.getPlayer().hasPermission("unnamed.joinmessage")) {
            Location location2 = new Location(Bukkit.getWorld("lobby"), 220.500, 53, -1.500, 0, 0);
            event.getPlayer().teleport(location2);
            getServer().broadcastMessage(ChatColor.GOLD + "[un.named] " + ChatColor.WHITE + ChatColor.BOLD + event.getPlayer().getName()  + ChatColor.WHITE + " joined the hub.");
            event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 10, 0);
        }

    }

}```
thorny dawn
# harsh totem Ok

i got some weird result but ill try rearranging some stuff and see if it will work

#

@harsh totem no it just does it all at once

harsh totem
thorny dawn
#

it doesnt wait execution

harsh totem
#

what's your code?

thorny dawn
#

it does it instantly

#
class CountdownInit() : Runnable {
    
    override fun run() {

  for(world: World in Bukkit.getWorlds()) {
      val worldconfig: YamlConfiguration = YamlConfiguration.loadConfiguration(File("${world.name}/gamedata.yml"))
      if(worldconfig.get("gamestate") == "STARTING") {
          val wrld: World = world;
          send("Begun countdown on ${world.name}")

          world.players.forEach { plr ->
              PlayerJoin().createScoreboard(plr)
          }
          for(i in 30 downTo 0) {
              worldconfig.set("gamestate", "STARTING IN ${i}s")
              worldconfig.save(File("${world.name}/gamedata.yml"))
              Bukkit.getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugin("Mobwars")!!, Runnable {

                  world.players.forEach { plr ->
                      PlayerJoin().createScoreboard(plr)
                      if(i == 20 || i == 15 || i == 10 || i == 5 || i == 4 || i == 3 || i == 2 || i == 1) {
                          plr.sendMessage(ChatColor.translateAlternateColorCodes('&', "&eStarting in &a$i &eseconds."))

                      }
                      PlayerJoin().createScoreboard(plr)

                  }
              }, 20)


          }
          break
      }

  }
    }


}
harsh totem
#

idk i'll search for a sec

thorny dawn
#

kk

iron glade
iron glade
harsh totem
#

ok wait

#

it's a library

#

nvm

#

idk

quiet ice
#

(I have almost no knowledge of kotlin, so forgive my incompetence)

sharp flare
#

maybe a 10 ticks delay or less if not try above

iron glade
#
public static HashMap<UUID, Inventory> cachedInv = new HashMap<>();

//after some time:

p.getInventory().clear();
p.getInventory().setContents(RestoreCommand.cachedInv.get(p.getUniqueID()).getContents());```

Any ideas why this is not restoring the inventory?
quiet ice
peak jetty
sharp flare
#

getScheduler#runTaskLater

quiet ice
sharp flare
#

got confused but no worries

hybrid spoke
#

?scheduling

undone axleBOT
hybrid spoke
#

delay it by 1 tick

hybrid spoke
thorny dawn
#

@harsh totem after a bit of debugging around i realised that it waits the first time in the for loop and then executes it all at once

peak jetty
sharp flare
#

it accepts the plugin instance and a bukkit task consumer

thorny dawn
#

and delay (Long) ^

sharp flare
#

oh yeah

#

forgot that

#

you can check the link above for examples

iron glade
peak jetty
thorny dawn
#

no

peak jetty
#

(im new to this)

thorny dawn
#

getServer().getScheduler().runTaskLater(Plugin plugin, new Runnable {}, Long delay)

chrome beacon
#

?scheduling

undone axleBOT
chrome beacon
#

^ read this

maiden granite
#

hey am i in the right place to get support in in the middle of editing the spoigot.yml

peak jetty
#

ok

lament swallow
#

How would I remove testplugin:tpa while keeping tpa?

thorny dawn
#

how are u registering the command?

lament swallow
#

getCommand("tpa").setExecutor(new TpaCommand());

tender shard
#

you can also set your server to stop sending namespaces as tab complete

lament swallow
#

how would i do that?

tender shard
#

in spigot.yml:

commands:
  send-namespaced: false
urban kernel
#

how do i add config in bungee

lament swallow
#
  send-namespaced: false
  tpa:
    description: Teleport to a player
    usage: /<command> <player>```
Is this correct?
tender shard
#

no

#

as I said, it belongs into the spigot.yml

#

not the plugin.yml

lament swallow
#

aaaaa

#

mb

tender shard
#

np lol

#

the option should already be there, it's true by default

lament swallow
#

yep

tender shard
#

alternatively you could get the SimplePluginManager's CommandMap and remove the namespaced entries for your command

lament swallow
#

it worked thanks

urban kernel
#

how do i use bungee's config api

tender shard
#

?paste

undone axleBOT
tender shard
#

here's my main class for a simple bungee plugin

iron glade
#

Is there a better way of doing something like this?

private HashMap<UUID, ItemStack[]> cachedInv = new HashMap<>();
private boolean restoreInventory;
cachedInv.put(restoreInventory ? target.getUniqueId() : null, target.getInventory().getContents());```
crude flint
#

Hello World !

I have a little problem, I need to use my DataBase (MySql) for do a license system but my plugin will by release at clients. I don't want to give the password (obvious I think) and i wan't to know if it's possible to connect to a DataBase without password and just get the informations return by the dataBase :)

limber owl
#

how can I make emerald ore drop experience, this doesn't work and changing the event.getExpToDrop() to some int like 3 doesn't work too

        if(event.getBlock().getType() == Material.EMERALD_ORE) {
            event.setCancelled(true);
            event.getBlock().setType(Material.AIR);
            event.setExpToDrop(random.nextInt(event.getExpToDrop())+event.getExpToDrop());
        }
thorny dawn
#

how do i cancel a runnable?

iron glade
#

Bukkit.getScheduler().cancelTask(yourRunnable);

thorny dawn
#

ok ty

thorny dawn
thorny dawn
iron glade
thorny dawn
# iron glade Can you show the code?
                Bukkit.getScheduler().runTaskTimer(Bukkit.getPluginManager().getPlugin("Mobwars")!!, Runnable {
                      if(count > -1) {
                          gameconfig.set("gamestate", "STARTING IN ${count}s")
                          gameconfig.save(File("${player.world.name}/gamedata.yml"))
                          this.createScoreboard(player)
                          count--
                      }
                }, 0, 20)
``` (written in kotlin if youre gonna point out any syntax mistakes)
limber owl
#

then how would i cancel dropping the emerald?

iron glade
#

Bukkit.getPluginManager().getPlugin("Mobwars")!! why are you not just referring to your plugin instance?

thorny dawn
#

cause di is complicated as fuck in kotlin

iron glade
#

oh

thorny dawn
#

u dont exactly have static variables in kotlin unless u use a hacky way which isnt really good

iron glade
limber owl
#

it's on 1.8

thorny dawn
#

should i use "this"?

limber owl
iron glade
#

"this" refers to your class and not the runnable you're in

limber owl
#

and paste in the task

urban kernel
#

bungee config api

tardy delta
#

or

Bukkit.getScheduler().runTask...(plugin, task -> {
  // stuff
  task.cancel();
  return;
}, delay stuff)```
tender shard
#

does someone know how I can declare an annotation parameter

#

like I want to have a custom annotation

@MyAnnotatino("someValue")
public static void something() { ...
tardy delta
#
@interface MyAnnotation {
  String value();
}```
tender shard
#

lol

#

thanks

tardy delta
#

ye

#

you can also do stuff like String value() default "";

tender shard
urban kernel
tardy delta
#

i hope you specified the retentiontype

urban kernel
#

can u tell me how to use

tender shard
#

because you cancelled the event

limber owl
tender shard
thorny dawn
#

how would i cancel inside the runnable's body?

tender shard
#

then you can do configurationProvide.load(file)

#

and save t as Configuration

tender shard
limber owl
tender shard
timber patrol
#

Anyone willing to help me make a plugin by 1st of July? DM me if you are interested.

thorny dawn
# tender shard by using cancel()

this is what i got so far:

               val runnable: BukkitTask = Bukkit.getScheduler().runTaskTimer(Bukkit.getPluginManager().getPlugin("Mobwars")!!, Runnable {
                      if(count > -1) {
                          // do stuff
                      } else {
                          // do stuff aswell
                          // CANCEL RUNNABLE HERE
                      }
                }, 0, 20)
urban kernel
#

where does

ConfigurationProvider.getProvider(YamlConfiguration.class)
``` go
tender shard
urban kernel
#

huh

thorny dawn
tender shard
#

wait how is that even valid

#

you don't declare the run method

tardy delta
#

kotlin aaa

urban kernel
#

?

tender shard
#

?learnjava

undone axleBOT
tardy delta
#

and return

urban kernel
tardy delta
#

?static

#

meh

tender shard
#

learn basic java

tardy delta
#

static variables are variables that belong to a class not a specific instance x-)

thorny dawn
urban kernel
#

i can confirm that the first link does not teach you how to do that

thorny dawn
tardy delta
#

isnt BukkitTask#cancel a thing?

urban kernel
#

i mean it does not teach you how to do it

#

it teaches you how to make classes and print to console

tender shard
# thorny dawn
        new BukkitRunnable() {
            @Override
            public void run() {
                // Your code here
                cancel();
            }
        }.runTaskTimer(this, 0, 20L);
    }
ivory sleet
#

Ceryth

#

@thorny dawn

#

You do it like

thorny dawn
#

yes

#

hi

tender shard
thorny dawn
urban kernel
tender shard
ivory sleet
#

So you can use the Consumer<BukkitTask> with BukkitScheduler

tender shard
#

if you'd be using a proper language it would be so easy to just create an anonymous BukkitRunnable

ivory sleet
#

run(plugin, { task ->
task.cancel()
});

#

iirc

tender shard
#
        Bukkit.getScheduler().runTaskTimer(this, task -> {
            task.cancel();
        }, 0, 20L)
tardy delta
thorny dawn
#

alr ty ❤️

ivory sleet
#

You should learn (3

tardy delta
#

val runnable: BukkitTask = ... like bruh

urban kernel
#

@tender shard what is it?
like string etc

tender shard
ivory sleet
#

you probably don’t need to define the type explicitly

tardy delta
#

i hope so

urban kernel
#

ConfigurationProvider.getProvider(YamlConfiguration.class);

tender shard
#

as I already told you twice, it's not a String but a ConfigurationProvider

#
private static ConfigurationProvider yamlConfigurationProvider = ConfigurationProvider.getProvider(YamlConfiguration.class);

public static void main(String... args) {
  Configuration myConfig = yamlConfigurationProvider.load(new File("config.yml"));
}
urban kernel
#

where does it go

#

startup or

tender shard
#

?learnjava

undone axleBOT
urban kernel
#

does it go in onenable?

tender shard
#

it goes whereever you need it

tardy delta
#

lmao a file of all my emails

urban kernel
#

how do i ead from it

#

and how do i put config.yml into wherever it needs to be

#

it's in esources

tender shard
urban kernel
#

how do i put it in the "data folder"

tender shard
#

it even has a saveDefaultConfig method

#

did you even look at it?

urban kernel
#

yes

tender shard
#

well then just use the methods I sent

urban kernel
#

it's fking confising

tender shard
#

not really

urban kernel
#
    getProxy().getScheduler().schedule(this, this::showDebugOnDiscord,2, TimeUnit.SECONDS);
#

eh discord??

tender shard
#

obviously you do not need that

#

try to look at the names of the methods

#

if a method is called "saveDefaultCOnfig" then this is probably the method to save the default config

urban kernel
#

@tender shard

tender shard
#

?learnjava

undone axleBOT
tender shard
#

you have no idea about the basic prinicples of this language

#

for example stuff like variable scope

#

and visibility

#

so you should learn that

urban kernel
#

hm

tender shard
#

alright then welcome on my block list, too

urban kernel
#

why

tender shard
#

don't wanna waste my time talking to people who don't even want to try to learn java

compact cape
#

Is EnumHand.a in 1.18 same as EnumHand.MAIN_HAND

urban kernel
#

just because i blocked a bot?

compact cape
ivory sleet
#

Why 😦

urban kernel
#

it pisses me off

ivory sleet
#

Our innocent 🤖

tender shard
# ivory sleet Why 😦

I sent them ?learnjava a few times because they have no idea about variable visibility and scope and other basics

urban kernel
#

anyway i fixed the error with yamlconfigblah

tender shard
#

and they refuse to try to learn it

ivory sleet
#

:/

eternal oxide
#

the only message cafe gives which people don;t like is the learnjava one. Getting annoyed at that is silly. Just learn Java

urban kernel
urban kernel
acoustic pendant
#

why is this not generating?

eternal oxide
#

cafe has a lot of other messages we use to help people

acoustic pendant
#

the schematic

eternal oxide
#

?pdc

eternal oxide
#

just ONE example

urban kernel
#

<version>1.5-BETA-DO-NOT-POST-TO-SPIGOT</version>

#

beta be like

tender shard
#

why would anyone besides you post it on spigot anyway?

acoustic pendant
urban kernel
#

i meant i shd not post it

acoustic pendant
#

is it the same?

lament swallow
#

how would I use scoreboard names in chat?

acoustic pendant
urban kernel
#

@tender shard it created the directory but didnt put the file in it

#

how do i make it move config.yml to the data folde

compact cape
#

save it 🤷

urban kernel
#

how

tardy delta
#

saveDefaultConfig() in your onEnable

crude flint
tardy delta
#

it will not override it

#

smh

crude flint
#

Hello World !

I have a little problem, I need to use my DataBase (MySql) for do a license system but my plugin will by release at clients. I don't want to give the password (obvious I think) and i wan't to know if it's possible to connect to a DataBase without password and just get the informations return by the dataBase :)

urban kernel
#

what do i do

honest echo
#

whats slot number for helmet ?

tender shard
tardy delta
acoustic pendant
tender shard
tender shard
#

they are using bungeecord

tardy delta
#

bruh

tender shard
#

and the saveDefaultConfig is copy pasted from one of my bungee plugins

#

it takes a File and a String (the resource file name)

urban kernel
#

wait what string does it want

tardy delta
#

"filename.extension"

urban kernel
#

saveDefaultConfig("config.yml");

tender shard
urban kernel
#

so both will be conffig.yml?

#

config*

tender shard
urban kernel
#

but the file object is config.yml?

granite owl
#

where can i post code

tender shard
#

I really don't understand why you just don't look into my code and see how I'm doing it

granite owl
#

on this md5 board

tender shard
undone axleBOT
urban kernel
#

?paste

undone axleBOT
granite owl
#

ty

#

why does this happen with this event

tender shard
granite owl
#
@EventHandler
    public void onInventoryClose(InventoryCloseEvent event)
    {
        if (list != null)
        {
            for (int i = 0; i < Admin.vanishList.size(); i++)
            {
                list.next();
                list.remove();
            }
        }
    }
tender shard
#

Configuration config = loadConfig("config.yml");

granite owl
#

why does this cause the error whenever someone can't resolve the server ping properly

#

it happens when a ping to the server in the server list isnt resolved properly

urban kernel
tender shard
#

some lists don't allow removing stuff. for example the list generated by Arrays.asList

granite owl
#

i actually just want to decrease the amount of displayed players

tender shard
#

show the code where you create the list

granite owl
#

hm?

tender shard
#

show the code where you declare "list"

urban kernel
granite owl
#

ah right

#

event.iterator()

tender shard
#

I see

#

you cannot remove from that

granite owl
#

kk how do i decrease the amount of listed players otherwise

#

the callback doesnt provide much

tender shard
#

I think you need to use packets and check the outgoing packet

#

so e.g. ProtocolLib

urban kernel
#

@tender shard

#

where do i put Configuration config = loadConfig("config.yml");

tender shard
granite owl
#

kk ty just good to know that it doesnt work ill just remove that for now then

tender shard
crude flint
tender shard
granite owl
#

its not like an integral part of my plugin

tender shard
urban kernel
tender shard
crude flint
tender shard
urban kernel
#

so Configuration config = loadConfig("config.yml"); would go in a cmd class

crude flint
tender shard
tender shard
urban kernel
#

whats a getter

tender shard
#

a method that returns a field

urban kernel
#

oh ok

tender shard
#
    private static final Object myObject;
    
    public static Object getMyObject() {
        return myObject;
    }
#

this is a getter

urban kernel
#

right

thorny dawn
#

does getlivingentities count players aswell?

tardy delta
#

a player is an entity too so i guess ye

ivory sleet
#

ye

#

it derives the living entity class

thorny dawn
urban kernel
humble tulip
#

Are you using spigot config api?

tardy delta
#

bungeecord

urban kernel
#

bunge

tender shard
#

cursed maven

tender shard
honest echo
#

am trying to cancel event if player tries to put off helmet

  @EventHandler
   public void onPlayerInteract(InventoryClickEvent e){

       Player player = (Player) e.getWhoClicked();
       int slott = e.getSlot();

       player.sendMessage(String.valueOf(slott));

       if (e.getInventory().getType() == InventoryType.PLAYER){

           if (e.getSlot() == 39){
               e.setCancelled(true);
           }

       }
}```
#

but its not cancelling event

tender shard
honest echo
#

it just letting player put of helmet

tender shard
honest echo
#

ohk thanks

tardy delta
#

@tender shard why both ignorecancelled true and checking if its not cancelled?

tender shard
#

and I didn't double check every line

#

but yeah it's not needed and I'll remove it, thx

tardy delta
#

x)

tender shard
#

it even still uses ItemStack#setDurability

tardy delta
#

i dont even know what to use instead

#

casting it to Damageable?

tender shard
#

yes

#

but

#

IIRC the logic would change

#

because you can set a Damageable's damage to the max damage value so that the item has 0 durability but it won't break automatically

#

setDurability will automatically break the item

tardy delta
#

ah

tender shard
#

so I'll use the deprecated method until it finally gets removed

#

you can even make items with negative damage lol

#

Damageable is a bit weird

#

implementing player is a bad idea. every other week there's like 3 new methods lol

humble tulip
#

Why do u need to implement player 8)

tender shard
#

it's used for stuff like "silent" permission checks

#

e.g. "can a player build at XY" without the actual player getting messages from worldguard like "You cannot build here" etc

subtle folio
#

I know nothing about particles, is there a resource online for which I could use to make a circual particle spin around this respawn anchor?

tender shard
#

didnt you pay attention in math classes? ;P

subtle folio
#

oh good god,

tender shard
#

jk I also can't remember exactly how it works

#

but it's actually totally easy

subtle folio
#

ninth grade fam is killing me

#

okay off to the google

tender shard
#

yeah I wish could help but my math classes were 10 years ago lol. but you definitely simply need some sin/cos to get the correct location from your center point

#

and then just do that in a runnable

subtle folio
#

i have to use pi -_-

#

i HATE geometry

humble tulip
#

x = sin(t)

#

y=cos(t)

subtle folio
#

what is t?

humble tulip
#

Parametric equation of a circle

#

Uses one parameter

subtle folio
#

so pi?

humble tulip
#

No

#

If u put in a value for t

#

U get one point of the circle

subtle folio
#

it will go out in lenght?

#

ahhh

#

so then I just generate numbers until it completes

#

by lioke +1

humble tulip
#

Maybe like plus 10

subtle folio
#

ok ok

humble tulip
#

From 0-360

#

But it's in radians

#

So use math.toradians

eternal night
#

Or just increment in pi/x

humble tulip
#

Alternatively, you can figure what is 2pi/36

subtle folio
#

im noting this all down lmfao

humble tulip
#

Which is pi/18

humble tulip
subtle folio
#

okay okay

humble tulip
#

for (double angle = 0;angle < 2pi;angle+=pi/18)

#

Basically your loop looks lile that

#

And angle is t

#

In the eqn from above

subtle folio
#

alright

humble tulip
#

Btw did you get scoreboards working?

subtle folio
#

Thank you so much 😄

subtle folio
humble tulip
#

Did u work on it?

subtle folio
#

I tried adding the player to all the player's previous scoreboards to no avail

humble tulip
#

No u gotta add all the players to the new players scoreboard

#

As well

#

U have to do both

subtle folio
#

oh wait lemme test

tender shard
acoustic pendant
#

what is the ladder of event priority?

humble tulip
#

Lowest to highest

tender shard
#

LOWEST, LOW, ... HIGHEST, MONITOR

humble tulip
#

Then monitor

#

That's execution order

tender shard
#

so yeah LOWEST is first, HIGHEST is second last and MONITOR is last

subtle folio
#

still cant see others

#
for (Player onlinePlayers : Bukkit.getOnlinePlayers()) {
            setNametag(onlinePlayers, p);
            setNametag(p, onlinePlayers);
        }``` join event ^
```java
public void setNametag(Player player1, Player player2) {
        Scoreboard scoreboard = player2.getScoreboard();
        if (scoreboard.getTeam(player1.getUniqueId().toString()) != null) {
            scoreboard.getTeam(player1.getUniqueId().toString()).unregister();
        }
        Team team = scoreboard.registerNewTeam(player1.getUniqueId().toString());
        team.setPrefix(ChatColor.translateAlternateColorCodes('&', "eee"));
        scoreboard.getTeam(player1.getUniqueId().toString()).addPlayer(player2);
    }``` setNameTag function ^
humble tulip
#

I'm gonna try

subtle folio
#

knock yourself out 😄

obsidian thistle
#

Does the flying speed attribute in spigot apply to all entities? MC wiki says only bees and parrots

humble tulip
#

Ik u can set player flying speed

#

So I'd say yes

obsidian thistle
#

Is that elytra speed ?

#

I know creative flying is different right?

maiden briar
#

Sending messages from Bungee to Spigot works, but Spigot never seems to receive the messages

#

SpigotSide:

getServer().getMessenger().registerOutgoingPluginChannel(this, "ArenaPlugin");
getServer().getMessenger().registerIncomingPluginChannel(this, "ArenaPlugin", new BungeeMessenger());
@Override
    public final void onPluginMessageReceived(String channel, Player player, byte[] data)
    {
        try
        {
            DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(data)));
            JsonObject message = new JsonParser().parse(inputStream.readUTF()).getAsJsonObject();
            System.out.println(message); //not working
            String task = message.get("task").getAsString();

Bungee Side:

public static void sendToBukkit(String task, JsonObject message, ProxiedPlayer player)
    {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        DataOutputStream dataOutputStream = new DataOutputStream(outputStream);

        try
        {
            message.addProperty("task", task);
            message.addProperty("player", player.getName());
            dataOutputStream.writeUTF(message.toString());
        }
        catch(IOException e)
        {
            e.printStackTrace();
        }

        player.sendData("ArenaPlugin", Base64.getEncoder().encode(outputStream.toByteArray()));
    }

Tried with prints before, works

#

Yes, me

minor garnet
#

is possible to make 2 entities mount on a player, explaining my reason is that I want each of the players to view a specific entity mounted on a player, I thought about using packetplayoutentitydestroy but that just makes the entity disappear from the world , but keep it there invisible

example, in one player seat there would be a creeper, for the other player view, the player seat there would be a zombie, sorry bad translator

maiden briar
fierce salmon
#

does colored wool exist in 1.12?

#

bc I don't see any spigot materials for colored wool in my 1.12.2 plugin

maiden briar
#

Oh ok

vocal tundra
#

How does one solve LinkageError for duplicate class definition even tho I inspected the jars and only one class definition exists

#

there's like a 10% chance on startup for the linkage error to occur and the other 90% of the time works good

tender shard
#

efficiency is always Enchantment.DIG_SPEED right? also for axes, right?

tender shard
#

if yes, you should ALWAYS relocate them into your own package

vocal tundra
#

I am shading a utility class but I have 3 plugins that I'm communicating with

vocal tundra
#

it's weird that the error only occurs like 10% of the times I start the server up

tender shard
tender shard
vocal tundra
#

I'm hard depending on the plugin I'm taking the class from tho

tender shard
#

most useful class ever

tender shard
undone axleBOT
eternal oxide
#

Linkage error on startup or restart?

vocal tundra
#

on startup

#

I'm trying to get the error rn lol

#

could it be the utility class clashing tho,

eternal oxide
#

Show the error else its all guesses

dreamy arrow
tender shard
#

you should report that error

subtle folio
#

homecome my code isnt translating the color codes of op'd players? everything else works fine : java String format = p.isOp() ? lvltxt + ChatColor.translateAlternateColorCodes('&', Tazpvp.chat.getPlayerPrefix(p)) + "%s " + ChatColor.WHITE + "%s" : lvltxt + ChatColor.translateAlternateColorCodes('&', Tazpvp.chat.getPlayerPrefix(p)) + "%s " + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', "%s"); e.setFormat(format);

paper viper
#

my eyes 😵‍💫

dreamy arrow
subtle folio
dreamy arrow
#

yep now i can access nms

vocal tundra
#

1.8 best version

quiet ice
#

.ban @vocal tundra heresy

subtle folio
#

bc I can?

#

that works fine

#

fear not

#

ok fine

paper viper
#

could u store a variable for it please

#

cause thats kinda hard to read

#

lol

subtle folio
#

thats the benefit of ternary operator 😄

tardy delta
#

uhm my last braincel just died

paper viper
tardy delta
#

i guess im officially braindead now

paper viper
#

that is not a benefit

#

just make a variable

tardy delta
#

i dont see any benefits for using that unreadable code

paper viper
#

lol

subtle folio
#

there

#

better?

vocal tundra
#

but why

paper viper
#

thats not better, thats bad code

#

lol

subtle folio
#

no??

paper viper
#

changing spacing doesnt do anything

#

you literally do the same thing except for the last part

subtle folio
#

idk how thats bad code

paper viper
#

just store the base part as a variable

thorny dawn
#
    fun createWorld(): String {
        Bukkit.unloadWorld("mbw_prototype", true)
        val worldname = GetUniqueWorldName().getWorldName()
        File(worldname).mkdir()
        File("mbw_prototype").copyRecursively(File(worldname), false)
        val gamedataFile: File = File("$worldname/gamedata.yml")
        gamedataFile.createNewFile()
        val world: World = Bukkit.createWorld(WorldCreator(worldname))!!
        world.setGameRule(GameRule.DO_WEATHER_CYCLE, false)
        world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false)
        val fileconfig: YamlConfiguration = YamlConfiguration.loadConfiguration(File("$worldname/gamedata.yml"))
        fileconfig.set("gamestate", "WAITING")
        fileconfig.set("waves", "0")
        fileconfig.save(File("$worldname/gamedata.yml"))
        return worldname
    }

why does this shoot a null pointer exception at val world: World = Bukkit.createWorld(WorldCreator(worldname))!!? *the second time i execute it

subtle folio
#

fineeee

paper viper
#

i dont think people really understand how important variables are now for reading code

subtle folio
#

but i love having long method calliong chains

#

it makes my code so much more unusable!

paper viper
#

then that's not good code craftsmanship...

#

lol

#

what if your friend wanted to read that

subtle folio
#

what friends

paper viper
#

damn you rlly just did that to yourself

#

xD

thorny dawn
#

well

#

sometimes u have to accept the truth

#

😔

subtle folio
#
String fmsg = lvltxt + ChatColor.translateAlternateColorCodes('&', Tazpvp.chat.getPlayerPrefix(p)) + "%s " + ChatColor.WHITE;

        String format = p.isOp()
                ? fmsg + ChatColor.WHITE + "%s"
                : fmsg + ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', "%s");
        e.setFormat(format);```
#

tjere

#

theer

#

happy?

thorny dawn
#

😳

subtle folio
#

wait i think i did it in the wrong order

paper viper
#

arent you supposed to swap the statements of the ternary?

subtle folio
#

yep

paper viper
#

thats the reason why it didnt work

tardy delta
#

why tf combing char codes and colorcode enum

paper viper
#

idek

subtle folio
#

cuz

#

chat yk

tardy delta
#

not even using string.format

subtle folio
#

correct

mortal cedar
#

When I apply damage to a player with Player#damage it gets reduced by armor and the protection on it. Is there a way to add damage without this reduction but with damaging properly and not setting the health?

mortal cedar
#

setting the health won't make totems etc work

mortal cedar
#

You want code of a line that I already explained?

player.damage(whatever);

I just had issues that when the player has full netherite armor with prot this damage is reduced significant

thorny dawn
#

so u want them to receive true damage and ignore armor?

mortal cedar
#

My code just killed the player by damaging the current health and it didn't work with full prot armor. I just set it to max integer value and it works fine now but I'd like to know how to do it properly ^^
(Full netherite prot 4 causes 3,5 hearts instead of 10)

thorny dawn
#

i thought player#damage ignores armor

mortal cedar
#

I also thought that

thorny dawn
#

it doesnt?

mortal cedar
#

Idk if they changed that but it seems something doesn't work properly there

#

this should have killed me there

tender shard
#

people say "I use kotlin because it's not as verbose as java"
meanwhile me:

subtle folio
tender shard
#

otherwise I wouldn't know what it does in a week

mortal cedar
thorny dawn
round elbow
#

how can i use essentialsx in my plugin? i am coding in 1.8.8 spigot atm and i want my plugin to depend on essentials and use its commands

#

aka

mortal cedar
round elbow
#

make players execute essentialsx commands

tender shard
round elbow
mortal cedar
#

that it worked fine for like forever but now it just doesn't want anymore

thorny dawn
#

oh

round elbow
#

okay how can i check whether essentials plugin exists on the server

thorny dawn
#

i dont really know

mortal cedar
#

Maybe something changed in 1.17-1.18 but i have really no idea

tender shard
round elbow
#

okay ty

thorny dawn
#

val world: World = Bukkit.createWorld(WorldCreator(worldname))!! why is this null sometimes?

tender shard
#

sometimes java is weird

#

only time I ever needed to use upper-casting an object

subtle folio
#

angel chest?

#

wtf is that

tender shard
#

my death chest plugin

subtle folio
#

is it like a 45* rotated chest?

#

oh

#

neat

tardy delta
#

why the full path

round elbow
tender shard
#

sometimes intelliJ is so weird. it doesn't recognize McMMOUtils until I type it out. Then suddenly it knows about it

subtle folio
tardy delta
#

daddy

tender shard
#

it used to be called daddy

subtle folio
#

does your totem get stuck or smt

tender shard
#

so I can do

if(Daddy.allows(...))
#

but sometime it was stuck in an endless loop

#

so I renamed Daddy to Stepsister

#

because we all know that stepsisters tend to get stuck in awkward places

tardy delta
#

myes

subtle folio
#

i love this community

harsh totem
#

Is there a way to damage a player while ignoring his armor?

harsh totem
#

It doesnt ignore the armor

tender shard
#

yes

#

that's what you asked for

harsh totem
#

Tupo

#

Typo

tender shard
#

huh

#

Player#damage(float) deals exactly the given amount

#

no matter what armor they wear

harsh totem
#

Ok

#

Ill check

fierce salmon
#

?paste

undone axleBOT
fierce salmon
#

How can I use the custompermscommand string from the commandexecutor in my event listener?

tardy delta
#

early returns are a thing

fierce salmon
#

whats that

tardy delta
#
if (!(sender instanceof Player)) {
  sender.sendMessage("only players");
  return;
}

if (args.length < 1) {
  sender.sendMessage("incorrect usage");
  return;
}
// etc
// do all your stuff```
fierce salmon
quaint mantle
#

yes, that's why it should be a field lol

fierce salmon
#

how do you make it a field?

quaint mantle
#

private String custompermscommand;

#

Then in your command you would set the field to be what you want it to be

#

if the field isn't set yet you return on the event

manic helm
#

Is there any plans to make Bungeecord and spigot FML2 compatible?

fierce salmon
quaint mantle
#

sigh

#

?learnjava

undone axleBOT
quaint mantle
manic helm
#

yes

quaint mantle
#

no

manic helm
#

Their FML v2

#

hm

tender shard
#

bungee has forge support

manic helm
#

Not FML2 support

#

it has the old fml

tender shard
#

I have no idea what that even is lol

manic helm
#

meaning getModList etc of forge doesn't return anything as the channel Bungee communicates to the client in is outdated

rustic owl
#

Hello ! I come to you because I have an NBT String from an ItemMeta. How can I load it into my item? Do you have an idea? Thank you in advance.

eternal oxide
#

ItemMeta has no NBT strings. PDC on the meta does

#

?pdc

rustic owl
#

Ah thanks you

dreamy arrow
#

@tender shard bro this so fascinating. I can how see how everything plays out. Although most of the nms code is obfuscated for 1.8.8

#

:v that's not nms code tho

quiet ice
eternal night
#

couldn't you just clone bukkit and craft bukkit

#

to look at the actual source

dreamy arrow
#

:v u need to get buildtools for nms code

#

Well at least to use it

#

Let me find some nms code

quiet ice
#

Jesus what decompiler is that? IntelliJ-decompiler?

eternal oxide
#

Bukkit and CraftBukkit are on stash. NMS can;t be hosted as it belongs to Mojang

quaint mantle
#
    @EventHandler
    public void onDeath(PlayerDeathEvent event) {
        Player player = event.getEntity();
        Player killer = player.getKiller();

        double mh = player.getMaxHealth();

        if (killer instanceof Player) {
            double kmh = killer.getMaxHealth();

            player.setMaxHealth(mh - 2.0);
            killer.setMaxHealth(kmh + 2.0);

        }
        if (!(killer instanceof Player)) {
            player.setMaxHealth(mh - 2.0);
        }

        if (mh <= 2.0) {
            Bukkit.getBanList(BanList.Type.NAME).addBan(player.getName(), "Straciłeś wszystkie serca!", null, null);
        }
    }
#

help

#

this ban is not working

eternal oxide
#

This code will never trigger if (!(killer instanceof Player)) {

quaint mantle
#

it does

eternal oxide
#

impossible

quaint mantle
#

try then

maiden briar
#

I have a TextComponent. It contains placeholders. I want to replace the placeholders to a custom TextComponent (multiple placeholders and multiple custom components). This creates an TextComponent[] which I can send to the player

How to do this as efficient as possible?

eternal oxide
#

You assume the killer IS a player right at the start. If it is not it will throw a ClassCastException and exit the method

eternal night
#

why would you create a text component before replacing the placeholders

maiden briar
eternal oxide
quaint mantle
#

aaaaaaaaaaa

#

ok

eternal oxide
quaint mantle
#

o ok

#

so its good?

#

i gtg

eternal oxide
#

ok looking over your code you try to ban the player if his max health is 2.0 or below. However you read the max health (mh) before you adjust it. so this should only ban the player when he actually hits 0 max health

#

However, bans by name are no longer supported

tardy delta
#

i guess banlists by name internally ban by uuid?

#

or am i wrong

eternal oxide
#

getBanList by name now returns null

tardy delta
#

is there a banlist by uuid then?

eternal oxide
#

yes

tardy delta
#

wwhere

eternal oxide
#

Um, good question. I assumed there was as the javadoc says there is

tardy delta
#

hehe

eternal oxide
#
getBanList
@NotNull
public static BanList getBanList(@NotNull
BanList.Type type)
Gets a ban list for the supplied type.

Bans by name are no longer supported and this method will return null when trying to request them. The replacement is bans by UUID.

Parameters:
    type - the type of list to fetch, cannot be null
Returns:
    a ban list of the specified type

tardy delta
#

wait what class is that

eternal oxide
#

I just checked 1.18.2 and no UUID type

#

That javadoc is from teh link I posted above

river spear
tardy delta
#

lol

eternal oxide
#

I'm going to hope the javadoc is just ahead of itself and it doesn;t yet return null

quaint mantle
#

How to create a NPC via protocollib?

eternal night
#

tho that is another resource

#

you could look at how they do it tho

tender shard
#

best lib ever haha

#

allows people to piggyback notch

iron glade
#

poor dude has to smell so much ass

tardy delta
#

¯_(ツ)_/¯

tender shard
#

ah yes

#

using switch/case when there are only 2 enum values

tardy delta
#

¯_(ツ)_/¯

quaint mantle
#

I need via protocollib

tender shard
#

I bet that 99% of people here have no idea about protocollib

#

protocollib sucks anyway

iron glade
#

count me in

tender shard
#

it makes everything like 300% more complicated than just using NMS

eternal oxide
#

?jira

undone axleBOT
tardy delta
#

whas that

quaint mantle
compact cape
#

What packet should I use to close a book gui?

tardy delta
#

oh

final monolith
#

how i can get a entity from an unloaded chunk? i have the UUID but Bukkit.getEntity() returns a null instance

eternal night
#

you cannot

#

the entity does not exist on the server if it isn't loaded

final monolith
#

something i can do?

eternal night
#

load the chunk the entity is in I guess ?

final monolith
#

thanks ;D

crisp steeple
tender shard
#

protocollib is so overly complicated that the whole purpose of it is useless

#

I mean it's okay to listen to incoming packets

#

but if you just wanna send an outgoing packet, protocollib just makes everything so complicated

humble tulip
#

lol

#

is it possible to intercept packets going out to open a new inventory and instead just send the items in the inventory?

#

so it doesnt reset the cursor

#

if not, it's fine because i really dont want to change the contents of the inventory

crisp steeple
#

you woul dhave to keep inventory size and name in mind as well

iron glade
#

?paste

undone axleBOT
humble tulip
#

i dont have anything to paste cuz idk if it's even possible

iron glade
#

Can someone help me on this?

crisp steeple
#

considering the client would be in a different inventory client side than server side, which would make the transaction id invalid

#

you would have to listen to incoming packets as well, and manually call inventoryclickevents

humble tulip
#

ahh damn

#

that's also alot of work

crisp steeple
#

yeah

#

it could also be exploited by the client to make them pretend to be in a certain inventory when they arent actually

humble tulip
iron glade
#

Yes of course xd

humble tulip
#

u should use a concurrenthashset btw

#

since asyncplayerchatevent is on another thread

iron glade
#

Never used that tbh

#

what's the benefit of it?

humble tulip
#

2 threads may try to access the set at once

#

unlikely but possible

eternal oxide
#

always Threadsafe if you can. Future proof code is good

iron glade
#

agree

humble tulip
#

so it sends not in the list somehow?

iron glade
#

I'll debug the list after adding them

humble tulip
#

print the list on player chat

quiet ice
humble tulip
quiet ice
#

(or KeySetView)

iron glade
#

the uuid is added when running the command

#

but when chatting it says it's empty

crude cobalt
#

Why it doesn't work?

int CustomModelData = 6370006;
item.getItemMeta().setCustomModelData(CustomModelData);
ivory sleet
#

need to set the item meta back

#

So youll have to store the ItemMeta in a variable temporarily

crude cobalt
#

I don't quite get it, is there some sample code?

ivory sleet
#

Yes just google how to set custom model data for items

paper bone
#
int customModel = 100;
ItemMeta mt = item.getItemMeta();
mt.setCustomModelData(customModel);
item.setItemMeta(mt);
#

You need to store a reference to the ItemMeta

#

Modify that,

paper bone
paper bone
crude cobalt
#

Thanks

iron glade
humble tulip
#

list is empty by the time u chat

#

?

#

wait nvm

iron glade
#

I'm kinda confused

quiet ice
#

You have two instances of that class

humble tulip
#

ooh yeahhh

quiet ice
#

(also, that arraylist should be final)

humble tulip
#

it should be a set

quiet ice
#

whatever

#

I have learned to ignore such performance issues

humble tulip
#

@iron glade that's the issue

quiet ice
#

More pay for me

humble tulip
#

haha u get to "optimize" later

quiet ice
#

If you want something optimized you have to start from the very start with that in mind

#

Optimizing something later usually does not work

eternal oxide
#

If you want to get it "finished" don't be concerned with optimizing much.

quiet ice
#

Yeah that is true, all of my overly optimised stuff never went into production

#

Especially because it takes ages to come up with anything and after a while the motivation is drained

eternal oxide
#

Is stash trying to use a different account to jira?

#

I just get a no permission to access BitBucket when trying to view PRs

humble tulip
#

yeah separate accounts

round elbow
#

how can i check if a player is vanished by Essentials's /vanish using my plugin?

eternal oxide
#

use teh Essentials API

round elbow
eternal oxide
#

No clue

golden turret
#

does the bungeecord Configuration have something like ConfigurationSerializable from bukkit?

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

granite owl
#
public class BackpackInventory implements InventoryHolder
{
    protected UUID holder = null;
    protected Inventory inv = null;
    protected int rows = 0;

    public BackpackInventory(UUID holder, int rows)
    {
        this.holder = holder;
        this.rows = rows;
        this.inv = Bukkit.createInventory(this, 9 * rows, "Backpack");
    }
    
    public UUID getHolder()
    {
        return this.holder;
    }
    
    public void setHolder(UUID holder)
    {
        this.holder = holder;
    }
    
    public int getRows()
    {
        return this.rows;
    }
    
    public void setRows(int rows)
    {
        this.rows = rows;
    }
   
    public Inventory getInventory()
    {
       return this.inv;
    }
}
```is this causing a memory leak per call?
mellow edge
#

^^^^^^^^^^^^^^

granite owl
#

because it keeps inventories in memory

#

kk

tender shard
#

it causes a memory leak however if you store references to your BackpackInventory class that you don't need anymore

golden turret
#

if you dont new BackpackInventory everytime

#

no

mellow edge
jagged quail
#

ok i have this now @tender shard

tender shard
granite owl
jagged quail
#

do i need to change the class that gets imported ?

eternal oxide
tender shard
#

maven-shade-plugin changes it automatically for you

jagged quail
#

because it imports these

#

ah

quiet ice
#

You can only view PRs if you have signed the CLA

urban kernel
#

can someone hel p me test plugin

eternal oxide
#

I guess I better read the contributing I often link to then 🙂

#

?contribute

granite owl
#
public void onInventoryClose(InventoryCloseEvent event)
    {
        if (event.getInventory().getHolder() instanceof BackpackInventory)
        {
            BackpackInventory inventory = (BackpackInventory) event.getInventory().getHolder();
            
            ...
        }
    }
```@martin
tardy delta
#

i dont see the damn codespaces tab lol

granite owl
#

i dont re-instance it

#

only upcast

tardy delta
tender shard
grim ice
tender shard
#

upcasting = Player > CommandSender
downcasting = CommandSender > Player

#

in 99.9% of cases you only need downcasting

granite owl
#

i suppose i get it right that if the inventory gets closed by the last viewer

#

the inventory gets removed from memory

#

and the BackpackInventory instance gc'd?

tender shard
#

yep

#

stuff gets garbace collected once there is no reference left to it

granite owl
#

which in this case happens

#

as the last viewer is closing the inventoryview

tender shard
#

yeah then it'll get GCed

granite owl
#

kk ty

humble tulip
#

@granite owl can i see how you implement backpackinventory?

granite owl
#

this

crude cobalt
#

One more question. Why it doesn't work?

ItemMeta meta = e.getItem().getItemMeta();
            int customModelData = meta.getCustomModelData();
            e.getPlayer().sendMessage(String.valueOf(customModelData));
            if(customModelData == 10);{
undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

granite owl
#
public static void onRightClickAbility(Player player, ItemStack is)
    {
        if (!CustomItems.itemCooldown(player, is)) return;
        
        ItemWrapper item = new ItemWrapper(is, null);
        
        if (item.getItemStack() != null)
        {
            if (item.isCustomItem())
            {
                if (item.getItemType().equals(Backpack.getItemWrapper().getItemType()))
                {
                    BackpackInventory inv = new BackpackInventory(player.getUniqueId(), item.getItemInteger("item_rows_current"));
                    
                    if (item.getItemBytes("item_inventory").length > 0)
                    {
                        //fill inventory
                    }
                    
                    player.openInventory(inv.getInventory());
                }
            }
        }
crude cobalt
tender shard
#

remove the ; after your if statement

granite owl
#

its a bunch of wrapper classes to access PDC flags

#

then creating the backpack inv

#

and making the user view it

crude cobalt
#

I'm blind

#

Thanks

tender shard
#

np lol

#

that'S what this discord is for

jagged quail
#

@tender shard there we go

humble tulip
humble tulip
#

Ahh that's smart

#

I use a map rn

#

Might switch to that

granite owl
#

if ur using my method

#

be aware thoi

#

its not reload safe

#

so u need to force players to close this inventory on reload

humble tulip
#

Yep i do that

#

Cuz a map isn't reload safe either

granite owl
#

thats why i typecast it

tender shard
#

why don'T you just use PDC

jagged quail
#

hmm

granite owl
#

and put in my own wrapper

jagged quail
#

alex i changed the version in the .txt file on github and it still says its the latest

tender shard
#

nvm then

jagged quail
#

v 1.4.6-ALPHA is on my server

granite owl
tender shard
granite owl
#

and thus ive written a simple wrapper for those flags

jagged quail
granite owl
#

and i put the itemstack in a wrapper instance for easier access

tender shard
granite owl
#

the itemwrapper instance goes out of scope anyway and the item itself persists

jagged quail
#

oh

#

my brain

tardy delta
#

mecha

tender shard
# jagged quail a

what's your plugin version? and what version did you save on github?

jagged quail
#

1.4.6 local

#

1.4.7 github

#

does it not support letters in the version?

tender shard
#

what link did you pass to the update checker?

tender shard
granite owl
#

@humble tulip

#
public static void onRightClickAbility(Player player, ItemStack is)
    {
        if (!CustomItems.itemCooldown(player, is)) return;
        
        ItemWrapper item = new ItemWrapper(is, null);
        
        if (item.getItemStack() != null)
        {
            if (item.isCustomItem())
            {
                if (item.getItemType().equals(Backpack.getItemWrapper().getItemType()))
                {
                    BackpackInventory inv = new BackpackInventory(player.getUniqueId(), item.getItemInteger("item_rows_current"));
                    
                    if (item.getItemBytes("item_inventory").length > 0)
                    {
                        ItemStack[] items = (ItemStack[]) NonReflectables.deserializeBukkitObjectFromByteArray(item.getItemBytes("item_inventory"));
                        inv.getInventory().setContents(items);
                    }
                    
                    player.openInventory(inv.getInventory());
                }
            }
        }
    }
tardy delta
#

lmao

jagged quail
#

unless github isnt letting it get the version.txt file

granite owl
#

to implement backpacks

tardy delta
#

why are you only using early returns in the first line

granite owl
#

as it pmuch says

jagged quail
#

@tender shard i can send the code in my onEnable if you want

granite owl
#

so u cant spam item right click effects

sullen fox
#

yo guys

tardy delta
#

do early returns for the other checks then too lol

sullen fox
#

if i want to connect my server to my bot

jagged quail
#
public void onEnable() {
    getLogger().info("Enabling");
    (new UpdateChecker(this, UpdateCheckSource.CUSTOM_URL, "https://raw.githubusercontent.com/oliver194/Mecha-Plugin/master/src/main/resources/version.txt"))
      .setDownloadLink("https://github.com/oliver194/mecha-plugin/releases")
      .setNotifyOpsOnJoin(true)
      .setUserAgent((new UserAgentBuilder()).addPluginNameAndVersion())
      .checkEveryXHours(2.0D)
      .checkNow();
    int pluginId = 15385;
    Metrics metrics = new Metrics(this, pluginId);
    getCommand("heal").setExecutor((CommandExecutor)new HealCommand());
    getCommand("feed").setExecutor((CommandExecutor)new FeedCommand());
    getCommand("fly").setExecutor((CommandExecutor)new FlyCommand());
    getCommand("mecha").setExecutor((CommandExecutor)new MechaCommand());
  }```
sullen fox
#

is this a good idea

#

wait i cant send images

#

lemme get the prnt sc

tardy delta
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

jagged quail
#

oof i dont think that D is meant to be there

humble tulip
#

Can i see what your custominventory class looks like

#

Well backpack

tardy delta
#

wdym with server stats

sullen fox
#

and maybe a hastebin of the all the players in the server

humble tulip
#

Do u just create an inventory and use the methods that u override from inventory to call them back on in inv you create?

rich inlet
#

How can I prevent a snowball from getting destroyed on ProjectileHitEvent?

eternal oxide
#

I'm not sure thats possible. But you could try canceling the hit event and zeroing out the snowballs velocity

jagged quail
#

this should have worked..

#

i dont understand why not

rich inlet
fierce salmon
#

how can i use a string from my override method inside of my eventhandler method in the same class?

jagged quail
#

@tender shard ahhh

urban kernel
#

is this right

paper viper
jagged quail
urban kernel
#
 package me.deveroonie.essentialsk.commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.Bukkit.*;
public class Broadcast implements CommandExecutor {
    public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
        Bukkit.broadcastMessage(args[1]);
        return true;
    }
}
jagged quail
#

essentialsk

urban kernel
#

essentialsk

#

essentials k it has trogans

#

jkjk

#

dont sue

urban kernel
opal juniper
jagged quail
#

yeah i did

opal juniper
#

well done

paper viper
jagged quail
paper viper
#

instead of [0]

#

for arguments

#

and also

#

what if arguments is empty

humble tulip
#

/command args[0] args[1] args[2] ...

urban kernel
#

i thought it was ]1]

humble tulip
#

thats how commands are

urban kernel
#

[1]

paper viper
#

Are you doing that on purpose?

urban kernel
#

i didn't realist [0] existed

paper viper
#

ignoring the first argument

urban kernel
#

no

humble tulip
#

args[0] doesnt even have to exists

paper viper
#

Exactly

humble tulip
#

so check args.length