#help-archived

1 messages · Page 215 of 1

edgy cove
#

Im able to send messages and receive them

#

There it doesnt say how to answer

#

....

#

if its possible

wary ledge
#

@frigid ember how do you save an effect

lone fog
#

Try giving the effect with a 1 tick delay

wary ledge
#

how do i add a delay?

edgy cove
#
new BukkitRunnable() {
  public void run() {
    //MY CODE
  }
}.runTaskLater(plugin, delayInTicks);```
#

so... do anyone know how to send a response from a sent message and then receive that answer on spigot

#

because the only thing that ik how to do is sent from bungee to spigot and spigot to bungee

#

without sending an answeerr

wary ledge
#

i have to do delay my entire method?

#

i can't just delay that 1 line

rare prairie
#

learn java

lone fog
#

Just delay the addPotionEffect

edgy cove
#

^^

#

so... no one knows?

#

I have a number saved on a BUNGEE plugin and I want to get it. So for it Im trying to using plugin messaging. I have a method called getNumber in the spigot plugin and I want to make it return the number from the BUNGEE plugin. How can I do it?

rare prairie
#
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);

try {
  out.writeUTF("Message");
  out.writeUTF("messagehere");
  out.writeUTF(ChatColor.GOLD + "another");
} catch (IOException e) {
  return;
}

player.sendPluginMessage(plugin, "BungeeCord", b.toByteArray());

try {
  b.close();
  out.close();
} catch (IOException e) {
}
edgy cove
#

hum

#

but that will just send

#

Ik how to do that

#

I need to receive an answer and return it in the method

rare prairie
#

you'll find here the receive listener

edgy cove
#

ik how to do that too......

#

I need to know how to return the value in that method

tropic nacelle
#

return 4;

#

??

edgy cove
#

?

#

What are u saying lol

umbral dirge
#

How do i override an vanilla comand? For example /kill with custom messages

edgy cove
#

if u register the command

#

it should overrite

umbral dirge
#

nope

#

oh wait

#

it does

#

im very sorry

#

i only reloaded not restarted

wispy pewter
#

Nothing to be sorry about 👍

edgy cove
#

I have a number saved on a BUNGEE plugin and I want to get it. So for it Im trying to using plugin messaging. I have a method called getNumber in the spigot plugin and I want to make it return the number from the BUNGEE plugin. How can I do it?
@edgy cove ...

wary ledge
#

what do i put for plugin

#

is it the name?

edgy cove
#

? wdym?

wary ledge
#

well all the runtasklater timers

#

require a plugin

edgy cove
#

Oh...

wary ledge
#

what do i put for plugin

edgy cove
#

its the main class

wary ledge
#

ok

edgy cove
#

but the instance of it

#

so if u are making it inside the main class just put this

#

eh litteraly this

wary ledge
#

it's not the main class

edgy cove
#

it is

#

the instance of it

wary ledge
#

im putting the code in anther class

edgy cove
#

oh ok

wary ledge
#

in my listener

edgy cove
#

uh I cant explain very well but I will try

frigid ember
#

sorry to butt in... but is there an updated "Auto Command" Plugin?

edgy cove
#

u can create a public static variable for ex:

wary ledge
#

in the main class or this class

edgy cove
#

main class

wary ledge
#

ok

#

i already have a private static ForJump instance; if that's what you mean

#

wait that's private

edgy cove
#
  public static Plugin plugin;

  // AND THEN IN THE ON ENABLE...
  public void onEnable() {
    plugin = this;
  }

  // IN YOUR EVENT CLASS
  BukkitRunnable#runTaskLater(MainClass.plugin, 5L);
#

sorry to butt in... but is there an updated "Auto Command" Plugin?
@frigid ember wdym?

frigid ember
quick arch
#

You want to encapsulate that...

edgy cove
#

Why dont u use that one then?

frigid ember
#

oh soo it works even if its old version?

edgy cove
#

oh haha

#

I see...

#

U can try ye

frigid ember
#

lol oke

edgy cove
#

idk if it will work

frigid ember
#

i found something recent which is compatible with 1.13 sooo

#

probably...?

#

ima try oof

edgy cove
#

ye

#

try is the best way

#

of doing things

frigid ember
#

yus

wary ledge
#

so this

#

}.runTaskLater(ForJump, 1);

#

plugin = this;

#

ohhh

#

i needed to put plugin

edgy cove
#

....

quick arch
#

uh...

#

you'd want to make it private and make a getter for it

#

If it's not private, I could easily go and change that plugin variable to my own plugin

#

and that'll mess a lot of things up

edgy cove
#

@quick arch lol

#

if he makes it private

#

he cannot acess it

#

from another classes

wary ledge
#

yea

edgy cove
#

@past orbit try WHEAT?

quick arch
#

That's why a public getter exists 😐

unkempt ridge
quick arch
#
private static MESystem instance;

public MESystem() {
    instance = this;
}

public static MESystem getInstance() {
    return instance;
}
#

boom

#

done

edgy cove
#

@past orbit well u can use the legacy material support in last case but I will check here 1 sec

#

oh

umbral dirge
#

How do i get an offline player?

#

Player target = Bukkit.getOfflinePlayer(args[0]).getPlayer();

#

I ahve this

balmy sentinel
umbral dirge
#

But it throws error

balmy sentinel
#

because Player and OfflinePlayer are two separate things.

umbral dirge
#
Caused by: java.lang.NullPointerException
        at de.skylead.commands.ban.onCommand(ban.java:22) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
        ... 15 more
balmy sentinel
#

you need to do OfflinePlayer player = Bukkit.getOfflinePlayer

umbral dirge
#

But i need to get if the player has an perm

balmy sentinel
#

print args[0] out is it null?

umbral dirge
#

No

#

if(target.hasPermission("skylead.kick.bypass")) {

#

this is null

edgy cove
#

whats that target?

umbral dirge
#

an offline player

edgy cove
#

well thats the null thing but it should not be possible

rare prairie
#
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
if (target == null)
   return false;
edgy cove
#

line 22 of ban.java

#

@rare prairie I think OfflinePlayer is never null....

#

or it is?

balmy sentinel
#

why are you checking if an OfflinePlayer has permissions anyways?

umbral dirge
#

If he is an admin

#

People cant ban him

rare prairie
#

or it is?
ah it have @NotNull annotation

balmy sentinel
#

why don't you just not allow people to ban players with a higher rank

umbral dirge
#

...

#

if people bann me

#

no

#

just no

balmy sentinel
#

what?

edgy cove
#

well

#

Can u send the entire code plz?

#

and the full error

wispy pewter
#

@umbral dirge you can check if the player is null

edgy cove
#

it might help

umbral dirge
#
public class ban implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        Player p = (Player) sender;

        if(p.hasPermission("skylead.kick")) {
            if(args.length > 1) {
                OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);

                if(target.getPlayer().hasPermission("skylead.kick.bypass")) {

                    p.sendMessage("§8● §3§lSkyLead §8» §7Diese Person darf nicht gebannt werden.");

                    return false;
                }

                MySQL.createPlayer(target.getPlayer());

                MySQL.banPlayer(target.getPlayer(), 1, false);
                kickManager.kickBannedPlayer(target.getPlayer(), 1);

                if(args[1] == "1") {
                    p.sendMessage("§8● §3§lSkyLead §8» §7Du hast " + args[0] + " für Hacking 30 Tage gebannt.");
                }

                for(Player pl : Bukkit.getOnlinePlayers()) {
                    if(!pl.getName().equals(p.getName())) {
                        if(pl.hasPermission("skylead.notify")) {
                            pl.sendMessage("§8● §3§lSkyLead §8» §7" + p.getName() + " hat " + args[0] + " für Hacking 30 Tage gebannt.");
                        }
                    }
                }
            } else {
                p.sendMessage("§8● §3§lSkyLead §8» §7Bitte benutze§8: §7/ban <SPIELER> <GRUND>");
            }
        } else {
            p.sendMessage("§8● §3§lSkyLead §8» §7Bitte benutze§8: §7/ban <SPIELER> <GRUND>");
            return false;
        }

        return false;
    }
}
#

I need to get if the player has an permissin

edgy cove
#

@wispy pewter its a OfflinePlayer what is never null

wispy pewter
#

Ah oke

edgy cove
#

oh

#

its because u do

#

target.getPlayer()

#

just use target.hasPermission()

#

but idk if it will work btw

umbral dirge
#

Does not work

#

Method not found

wispy pewter
#

Check the docs

edgy cove
#

then

#

u cannot check a permission

#

of a offline player

#

if u use an API like Vault

umbral dirge
#

Maybe with permissionsex api

#

oh

edgy cove
#

u can indirectly, directly acess the permission plugin

#

and maybeeee

#

it will work

umbral dirge
#

PermissionsEx.getUser(target.getName()).has("skylead.ban.bypass")

wary ledge
#

i want to make a basic start/stop command

#

like /m4j start and /m4j stop

edgy cove
#

so...

#

what they would do?

wary ledge
#

toggle my listeners/event handlers

edgy cove
#

hummm

#

so u can unregister listeners if Im correct

#

and then register them

#

or

#

u could make a boolean

#

like boolean enabled

wary ledge
#

i assume i should put a Boolean for true and false

#

yeah

edgy cove
#

if(!enabled) return;

wary ledge
#

i had to make a toggle for my fabriuc mod

edgy cove
#

in every listener

wary ledge
#

i think the hard part is how do i add arguments to commands

edgy cove
#

hum

#

in spigot?

wary ledge
edgy cove
#

oh man

#

Its easy!

#

when u create your onCommand method

#

the String[] parameter are the args

wary ledge
#

so add another String[]

#

ok

edgy cove
#

    public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
      if(args.length < 1) {
        // NOT ENOUGH ARGS
        return;
      }
      if(args[0].equals("start") {
        //START CODE
         return;
       }
      if(args[0].equals("stop") {
        //START CODE
         return;
       }
}```
#

something like this

wary ledge
#

ok

#

how do i make it like how those plugins auto complete it

edgy cove
#

eh in what version are u?

#
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
        String arg = args.length > 0 ? args[args.length -1] : "";
        return Arrays.asList("farm", "farmland", "furnace").stream()
                .filter(s -> (arg.isEmpty() || s.startsWith(arg.toLowerCase(Locale.ENGLISH))))
                .collect(Collectors.toList());
}``` I found this on internet....
wary ledge
#

1.16

light stone
#

How can I launch a boat with a player up in the air? I've tried setting the velocity with setVelocity, but it doesn't work with players in the boat (only with empty boats).

wheat mirage
#

For, say, a skyblock core. Is using different world files for each island better or using just one world?

lime crater
#

hi. If I'm not defining crafting recipes in the main class, how do I define it in the other class?

edgy cove
#

oh eh

#

I dont think its rlly a material

#

u can try cast the block, MaterialData, or block data into Crops

#

to see if it works

lime crater
#

Please @ me if you know btw 🙂

edgy cove
#

@lime crater dont put this and yes new ClassName()

lime crater
#

Sorry?

edgy cove
#

hi. If I'm not defining crafting recipes in the main class, how do I define it in the other class?
@lime crater

#

isnt that u wanted to know or Im just so confused? hahhaa

lime crater
edgy cove
#

ok can u show me exacly what u want to do and your code rn

lime crater
#

I have nothing in my main class regarding this, that's what I want to figure out.
In my other class where I want to have the recipe I have https://prnt.sc/ttcpep

wary ledge
#

it should toggle right?

lime crater
#

Could be any crafting recipe, doesn't matter.

nova mural
#

is there a non deprecated way in 1.13+ of getting the name of an inventory

#

i think i'm blind i can't find anything

sturdy oar
#

InventoryView

amber hemlock
#

@EventHandler
public void test(CreatureSpawnEvent e) {
if(e.getEntity() instanceof IronGolem) {
IronGolem golem = (IronGolem) e.getEntity();

            float falldis = 0;

                if(golem.getFallDistance() > 0 && !golem.isOnGround()) {
                    falldis = golem.getFallDistance();
                }
                
                    if(golem.isOnGround()) {
                        golem.damage(falldis * 2);
                    }
            }
#

Hello Guys I am new to coding

#

and trying to code a plugin to make ig take fall damage

#

what did I do wrong 😅

#

Sorry if I am big noob haha

grim halo
#

Does someon know what event is fired when an Anvil lands?

peak marten
#

@grim halo EntityChangeBlockEvent

grim halo
#

Ah right. Thanks.

peak marten
#

some code I used:

pastel condor
#

Wow that’s a very generic event

peak marten
#

        Block block = e.getBlock();

        if(block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
            return;
rugged dome
#

hello anyone can help me i cant post anything or reply in the spigot forums

grim halo
#
  @EventHandler
  public void onAnvilLand(EntityChangeBlockEvent event) {
    Block block = event.getBlock();
    if (block.getType() != Material.ANVIL || block.getRelative(BlockFace.DOWN).getType() != Material.AIR) {
      return;
    }
    // Do stuff with landed Block
  }

This should work right?

wary ledge
#

how can i make a command tab complete?

#

i want to add start and stop

#

so when they type /m4j, start and stop pop up

peak marten
#

@wary ledge Bukkit.getPluginCommand("").setTabCompleter(new YourClassImplementingTabComplter);

#

just a snippet of course.

wary ledge
#

i got that

#

but how do i add the things that pop up

#

like how does it know what to show

peak marten
#

You add the results to the list

#

just a sec

wary ledge
#

i already have a working command

#

do i add to it or change it

#
    public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {```
peak marten
#

That's a command

#

not a tabcompleter

wary ledge
#

so then do i make a new class

peak marten
#

Yes you do

#

A new class that implements TabCompleter

lime crater
#

If I have this in my main class and it works perfectly,

        ItemStack grass = new ItemStack(Material.GRASS);

        ItemMeta meta = grass.getItemMeta();
        meta.setDisplayName(ChatColor.GRAY + "boop");
        meta.setUnbreakable(true);
        meta.addEnchant(Enchantment.ARROW_DAMAGE, 5, true);
        grass.setItemMeta(meta);

        NamespacedKey grasskey = new NamespacedKey(this, "grass_key");
        ShapedRecipe grassrecipe = new ShapedRecipe(grasskey, grass);

        grassrecipe.shape("   ", " S ", " C ");
        grassrecipe.setIngredient('S', Material.STONE);
        grassrecipe.setIngredient('C', Material.COBBLESTONE);

        Bukkit.addRecipe(grassrecipe);```
After changing NamespacedKey(this, ...) to the plugin name outside in another class, why wouldn't that work?
fossil shoal
#

hey guys, when changing the max health attribute of an entity, its helath doesn't update nor does it regenate up to the new max health value. What has to be done to fix this?

peak marten
#

@fossil shoal

            Objects.requireNonNull(entity.getAttribute(Attribute.GENERIC_MAX_HEALTH)).setBaseValue(health);
tiny dagger
#

uh

edgy cove
#

How can I wait for a variable become true and then make a code?

tiny dagger
#

how does that work?

fossil shoal
#

I know that, the attribute is set successfully

peak marten
#

and are you then setting the health?

fossil shoal
#

I am not

#

just setting the max health

peak marten
#

entity.setHealth(double health);

#
        entity.setHealth(health);
edgy cove
#

How can I wait for a variable become true and then make a code?

peak marten
#

@edgy cove , what do you mean?

edgy cove
#

I have a method

#

that makes a thing

#

but that thing is not instantly

#

so I need to wait for a boolean to become true

#

and then return a double on the method

fossil shoal
#

Is there no way to make the health regenerate up to the newly set max health?

edgy cove
#

while stops the entire server

peak marten
#

@fossil shoal , yes it is possible

edgy cove
#

so I cannot use it

#

as like this I cannot transform the boolean in true after the thing finishes

fossil shoal
#

okay, how? 🙂

peak marten
#

you get the entity, set it's max health to the new max health

#

then again:

wary ledge
#

im going off a spigot forum post

peak marten
#

you do entity.setHealth(new health goes here)

wary ledge
#
public class TabComplete implements TabCompleter {
    private static final String[] COMMANDS = { "m4j" };
    //create a static array of values

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {

        final List<String> completions = new ArrayList<>();

        StringUtil.copyPartialMatches(args[0], COMMANDS, completions);

        Collections.sort(completions);
        return completions;
    }
}```
peak marten
#

@edgy cove , do you have a basic java knowledge?

#

I would highly recommend you looking into that

#

@wary ledge , yes

fossil shoal
#

@peak marten What I mean is make the entity naturally "regain" this health

edgy cove
#

Eh MrGeneralQ on some things

wary ledge
#

Error:(20,19) java: method copyPartialMatches in class org.bukkit.util.StringUtil cannot be applied to given types; but it no work

edgy cove
#

in this case I dont know what to do

#

I know some things some I dont

wary ledge
#

i has been lied to

fossil shoal
#

so for example entity spawns with 20 -> I set new max health to 20 -> it slowly gains health up to 40

peak marten
#

@fossil shoal , why would you not be able to ? if you want regenerating health, you will need a bukkit runnable and retrieve the entity you want to regen it's health

#

You need a bukkit runnable for that

#

@wary ledge , what do you mean?

wary ledge
#

i get that error

peak marten
#

Don't use that.

#

you will need to build in the logic, and for example say, if the arg[0].equalsIgnoreCase("some sub command")

#

then:

#

return your new array of Strings (autocompletions)

#

Also, don't forget to sort them.

wary ledge
#

what line

peak marten
#

Example of my plugin:

#
   @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] args) {
        if (args.length == 0) {
            return this.bloodmoonService.getSubCommands().keySet().stream().filter(a -> sender.hasPermission("bloodmoon." + a)).sorted().collect(Collectors.toList());
        }
#

It returns a list of all the registered subcommands of the bloodmoon command

#

So based on your command, you return a different result

wary ledge
#

but how do i set sub commands

peak marten
#

How does your command look?

#

what does it loo like?

wary ledge
#

not good

#
public class PluginCommands implements CommandExecutor {

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

        if (args.length < 1) {
            sender.sendMessage(ChatColor.RED + "Please use /m4j <start/stop>");
        }
        else {
            if (args[0].equals("start")) {
                ForJump.active = true;
                sender.sendMessage(ChatColor.GREEN + "Mine for Jump started!");
            }
            else {
                if (args[0].equals("stop")) {
                    ForJump.active = false;
                    sender.sendMessage(ChatColor.RED + "Mine for Jump stopped!");

                }
                else {
                    sender.sendMessage(ChatColor.RED + "Please use /m4j <start/stop>");
                }
            }
        }
        return true;
    }
}```
fossil shoal
#

@peak marten this is not what I am talking about. The entity does not naturally regenerate health past 20, that means that even if I set its health to 40 (for example) using setHealth and then it gets hit, it won't regenerate its health back to 40 (which is the max health in this example). What I am asking is why is the health regeneration does not go past 20 even though I increased the max health and whether there is something I can do to change that.

rare prairie
#
switch (args[0].toLowerCase()) {
  case "start":
    // c
    break;
  case "stop":
    // c2
    break;
  default:
    break;
}
peak marten
#

Okay so, in your new class you write:

List<String> commands = new ArrayList<String>();
commands.add("start");
commands.add("stop");

if(args.length < 0){
return new ArrayList<String>(commands);
}
#

@fossil shoal , I could be wrong, but are you sure that automated health regeneration is even a thing?

wary ledge
#

is that it

peak marten
#

No matter if it actually exists or not, you can solve your issue by using the runnable.

edgy cove
#

@peak marten so u know how?

peak marten
#

If spigot doesn't do it for you, then you can make it work

quick arch
#

mobs don't regenerate health naturally

peak marten
#

@edgy cove , your use case is a bit vague

#

Thank you for the confirmation @quick arch

quick arch
#

bot dumb

peak marten
#

The bot warned me great

quick arch
#

yeah it's dumb

fossil shoal
#

I saw the message

quick arch
#
Horses, donkeys, mules, llamas and the wither are the only mobs that regenerate health naturally over time. 
edgy cove
#

@peak marten I want to wait for a boolean becomes true and then return something in my method.

That boolean becomes true from the Main Method and I want to it to wait on a method in another class.

quick arch
#

Probably could just use the regeneration effect to regenerate their health

#

instead of creating a runnable

#

but that's going to be relatively slow

peak marten
#

Interesting, didn't even think about that

#

Picono, you want to wait for a variable to become true, would that be in the same method? If yes, you need to use a do while, if not, you need to use a runnable
still unsure on what you actually mean

fossil shoal
peak marten
#

You're welcome

nova badge
#

is there a way for an item not to go inside hopper
when dropped on it?

peak marten
#

yes

#

Listen for the InventoryPickupItemEvent event, and cancel it

nova badge
#

thank you

peak marten
#

You're welcome

compact marsh
#

Hey I need help with WorldGuard maven api.
Repository:

        <repository>
            <id>sk89q-repo</id>
            <url>http://maven.sk89q.com/artifactory/repo/</url>
        </repository>

Dependency:

        <dependency>
            <groupId>com.sk89q.worldguard</groupId>
            <artifactId>worldguard-bukkit</artifactId>
            <version>6.1.3-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

Somehow IntellIJ keeps giving me errors and it takes years to load the project
Error:
Could not find artifact com.sk89q.worldguard:worldguard-bukkit:pom:6.1.3-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
It says that it is trying to get it from hub.spigotmc.org but it doesn't actually load it from the given http://maven.sk89q.com/artifactory/repo/.
Anyone know a fix?

rare prairie
#

do mvn clean install

#

or mvn compile install

frigid ember
#
DeathInfo:
  e9d30742-403e-4726-8b0f-de85903ede35:
    '0':
      location: world, 229, 72, 251
      reason: Lazinq fell out of the world
      time: 1596480049777
#

tryna get this info back out again

#

but it is not working :/

#

ikr loadData looks like shit

#

thats probably why its not working

lone fog
#

ConfigurationSection se = getConfig().getConfigurationSection("deathlocation." + uuid + "." + deaths.indexOf(data));

frigid ember
#

.

lone fog
#

But it's called DeathInfo not deathlocation

frigid ember
#

ohh shit

#

I had that earlier :/

#

shouldve noticed that ;|

compact marsh
frigid ember
#

and there has to be a ". " at the end I think

edgy cove
#

uuuuuuuuuuuuuuuuf

frigid ember
#

ConfigurationSection se = getConfig().getConfigurationSection("DeathInfo." + uuid + "." + deaths.indexOf(data) + ".");

#

returns null

rare prairie
frigid ember
#

deaths.indexOf(data)

#

so probably this

#

bcz it doesnt make sence

#

😦

compact marsh
#

522 Origin Connection Time-out so probably worldguard repo is overloaded
@rare prairie When I do it in my browser I get no errors with browsing to that repo.

rare prairie
#

try to remove placeholderapi repo, build your project, after that if the build success, add back the papi repo and build again

#

or remove the m2 folder from users, if have (dont know intellij generating this folder)

compact marsh
#

wait placeholderapi is getting 522 error...

rare prairie
#

great

wheat mirage
#

For, say, a skyblock core. Is using different world files for each island better or using just one world?

edgy cove
#

Hello I have a method called getNumber with the parameter playername in my API class in my spigot plugin and I want to it return a number that is saved on my bungeecord plugin. Here is a small scehematic of the messages that I sent of what is happenning: https://prnt.sc/tte5bl. So explaining writing... in my method I send a message to bungee and then bungee when it gets that messages send a message for spigot with the number (the listener of received messages is in the main class). Now when I receive that number I add it in a Map... so in my method I need to send the message and then when the main class receives the message I need to return the number that is saying on the message (that was putted on a map). How can I do this? (I already made everything sending messages I just need to make something to wait until the Map contains the number and then yes get the number from it and return it on the method)

Lightshot

Captured with Lightshot

#

I really appreciate help hahahahahah

frigid ember
#

Hey there, is there a way to get an entity if its in the line of sight of an player?

#

placeholderapi got ddosed

#

all of clip's shit is down

#

how do i make the default rank/group on luckperms a different to "default"

odd knoll
#

Did you google? 😐

wheat mirage
#

For, say, a skyblock core. Is using different world files for each island better or using just one world?

frigid ember
#

ye

odd knoll
#

So did you read the wiki thread that comes up?

frigid ember
#

nvm ill just set the default to the thing i want

ripe narwhal
#

how do I change plugin priority

frigid ember
#

idk

nova mural
#

can someone idiot check me pls

heavy pelican
#

How can I find the Spigot API docs for 1.8.8?

nova mural
#

was support for wildcard permissions removed in 1.13+

heavy pelican
#

Thx

dusky sigil
#

How can I make a Material that is a string variable? (Material.VAR)

#

because Material. + VAR doesnt work

nova mural
#

Material#matchMaterial

dusky sigil
#

Thanks!

frigid ember
#

is plot squared in 1.16?

fast ore
#

creeper.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40); is this how u set the health for entities?

bold anchor
#

sure

#

That's maxhealth

#

To set the halth just call the function

frigid ember
#
    private void saveData() {
        for (Map.Entry<UUID, List<Data>> myDataMap : dataMap.entrySet()) {
            List<Data> deaths = dataMap.get(myDataMap.getKey());
            myDataMap.getValue().forEach(data -> {
                String saveKey = "DeathInfo." + myDataMap.getKey() + ".";
                String intPlace = saveKey + deaths.indexOf(data) + ".";
                getConfig().set(intPlace + "location", locToString(data.getLocation()));
                getConfig().set(intPlace + "reason", data.getReason());
                getConfig().set(intPlace + "time", data.getTime());
            });
        }
        saveConfig();
    }```
#

I need to get this info again

#

but I havent really had a huge succes yet

fast ore
#

so all the creepers that spawn in my world will have the health of 40?

frigid ember
#

could some1 maybe help

#
DeathInfo:
  e9d30742-403e-4726-8b0f-de85903ede35:
    '0':
      location: world, 228, 69, 257
      reason: Lazinq fell out of the world
      time: 1596481945677
    '1':
      location: world, 221, 64, 263
      reason: Lazinq fell out of the world
      time: 1596481950063
    '2':
      location: world, 213, 68, 251
      reason: Lazinq fell out of the world
      time: 1596481958142```
#

stored like this

#

can be 3 of each player

#

but can also be 1, 2

#

the location is stored by my own locToString

#

and I also have a stringToLoc

#
    private void loadData() {
        if(getConfig().getConfigurationSection("DeathInfo") != null) {
            ConfigurationSection sec = getConfig().getConfigurationSection("DeathInfo");
            for (String uuid : sec.getKeys(true)) {
                Integer sec1 = getConfig().getInt(sec + "." + uuid + ".");
      }
}
}```
#

is what I currently have

lone fog
#

Why do you have a . at the end

frigid ember
#

to complete the path

#

shouldve also done that behind sec :/

#

like this

#

Does anyone know a toggle command for toggling a event??

#

what?

#

a toggle line of code in java that allows you to toggle an event

#

call the event?

#

no to turn it off and on

#

via config.yml?

#

NO

#
/*
*/```
patent monolith
#

is there a way to hide messages like these in console?

[08/03/2020 04:00:55 pm] [Server thread/INFO]: Villager EntityVillager['Fletcher'/114315, l='ServerLevel[world]', x=-540.48, y=63.94, z=-90.72] died, message: 'Fletcher was slain by Drowned'

I am trying to host a strictly vanilla server, but today I accidentally saw this message when I glanced in the console and now I feel like I am cheating for knowing this information lol. If I had to compare this to something else, it is like accidentally seeing a mineshaft through the ground while the server chunks are trying to render, so I have to try and forget I even saw that

sacred osprey
#

hi i am using the plugin of factions3 and i have a question about the dynmap because i want to change the color for each one region on the map. How can can i do it?

#

and a friend told me to do the question here

lone fog
#

is there a way to hide messages like these in console?

[08/03/2020 04:00:55 pm] [Server thread/INFO]: Villager EntityVillager['Fletcher'/114315, l='ServerLevel[world]', x=-540.48, y=63.94, z=-90.72] died, message: 'Fletcher was slain by Drowned'

I am trying to host a strictly vanilla server, but today I accidentally saw this message when I glanced in the console and now I feel like I am cheating for knowing this information lol. If I had to compare this to something else, it is like accidentally seeing a mineshaft through the ground while the server chunks are trying to render, so I have to try and forget I even saw that
Spigot.yml has an option

#

I think it's show-villager-deaths or something

frigid ember
#

anyone know a plugin that i can make and open a menu with a command

#

for 1.16.1

fringe cliff
#

Anyone by chance have a fix for GoldenCrates item dupe with visual item rolls enabled?

frigid ember
#

@frigid ember What kind of menu?

cerulean musk
#

Guys how can i use MySQL ? Need an account ?

frigid ember
#

yo so im reading a book about java, and it keeps mentioning operand, but it doesn't define it, what does operand mean?

grim halo
#
      • / are operands for example
#

as well as ++ -- %

frigid ember
#

so arithmetic operations?

grim halo
#

Those are arithmetic operands.

frigid ember
#

hmm

grim halo
#

Ther are also logical operands
== != > < <= >= && ||

wanton sinew
#

Anyone have any thoughts on how to make different plugin permission error messages show a rank needed instead of just no permission?

frigid ember
#

yeh logical and relational

#

reading that rn

grim halo
#

And operands for bit manipulation ~ & | ^

#

@cerulean musk You need to install mysql on your server. There are a lot of tutorials on that.

cerulean musk
#

İ have a plugin and its support MySQL. But it wants username passowrd and ..

#

Need a MySQL account or idk ?

sturdy oar
#

You need a MySQL server

grim halo
#

@cerulean musk As stated above. You need to install a mysql database on your server. There you can manage your profiles.

cerulean musk
#

Oh i will try it thanks.

tiny dagger
#

well % is a modulo

#

not sure is an operation per say

#

🤔

grim halo
#

yes. literally the modulo operand

tiny dagger
#

what's the definition of an operand lol

#

🤔

west bison
#

Hey guys, can somebody help me with the ConversationFactories?
I try to use them as a little input service. I would like to send a message to the player if he did input a wrong number or message (e.g the wanted player is not online or the input is not a number).

And there is the problem. I cant send a message to the player immediatly after a prompt.
Can somebody help me with this issue?

frigid ember
#

anyone know a plugin for creating chest like menus that you can open with a commands

sinful spire
west bison
#
    @Override
    public @Nullable Prompt acceptInput(ConversationContext context, String answer) {
        
        Player p = (Player) context.getForWhom();
        
        if (answer.equals("yes") && answer.equals("no") {
            p.sendMessage("Wrong input! Only yes or no allowed.");
        }
        
        return null;
        
    }

Thats not the original code but it will produce the same issue

sinful spire
#

"eqauals"?

west bison
#

Does anybody know how to send messages in a prompt or immediatly afterwards

#

@sinful spire sorry i quickly wrote that with notepad

sinful spire
#

ok

limpid fulcrum
#

hey I was wondering if it was possible to disable the overworld on my server and only have the nether

#

I know you can disable the nether and end but what about the overworld

grim halo
#

set the server spawn to a nether world and disable portal travel

limpid fulcrum
#

how do I disable portals?

restive granite
#

wait i cant send screenshot here :-:

limpid fulcrum
#

gotta be verified

restive granite
#

oh ok ill verify really quickly

#

t

limpid fulcrum
#

?

restive granite
#

i was just checking if i got the role xd

grim halo
#

Just add a "}" to the end of your class to complete the class body...

restive granite
#

hey so im very new to programming java like really new im trying to make a plugin that lets players use /help to notify any avaible staff that have the perm playerhelp.staff so that they can come help them and i dont understand how to fix this error

#

hm

#

wdym exactly

tiny dagger
#

crii

#

why the double online player?

grim halo
#

The character }
Put one more at the end of your class...
You have more opening brackets { than closing ones }

#

Also would you mind to copy the command method in here.
Just add 3x ` at the start and end to format code.

restive granite
#

ok

grim halo
restive granite
#

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

public class Main extends JavaPlugin {
    
    @Override
    public void onEnable() {
    
    }
    @Override
    public void onDisable() {
        
    }
    
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (label.equalsIgnoreCase("help")) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                if (player.hasPermission("playerhelp.use")) {
                    player.sendMessage(ChatColor.RED + "A Staff member will be with you shortly!");
                    for (Player all : Bukkit.getServer().getOnlinePlayers()) {
                        for (Player p : Bukkit.getOnlinePlayers()) {                     
                            if (player.hasPermission("playerhelp.staff")) {
                                player.sendMessage(ChatColor.DARK_RED + player.getName() + ChatColor.DARK_RED + " Needs Help!!");
                            }

                    }
                    return true;
                }
                
            }

        }
            else {
                sender.sendMessage(ChatColor.DARK_RED + "You do not have Permission to access this command!");
                return true;
            }
            
        return false;
    }
}
fast ore
#

how do i give mobs potion effects like a zombie for example

restive granite
#

so i know what u mean 7smile7 but like if i put one like this look what happens

solid sundial
#

is it possible for me to do:
float x = .5;
float y = .0;

#

float z = .5;

#

or what should i do to get the players x y and z

sinful spire
#

double x = player.getLocation().getX();

grim halo
#
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (!label.equalsIgnoreCase("help")) {
      return false;
    }

    if (!(sender instanceof Player)) {
      sender.sendMessage(ChatColor.DARK_RED + "You do not have Permission to access this command!");
      return true;
    }

    Player player = (Player) sender;

    if (!player.hasPermission("playerhelp.use")) {
      return true;
    }

    player.sendMessage(ChatColor.RED + "A Staff member will be with you shortly!");

    for (Player online : Bukkit.getOnlinePlayers()) {
      if (online.hasPermission("playerhelp.staff")) {
        online.sendMessage(ChatColor.DARK_RED + player.getName() + ChatColor.DARK_RED + " Needs Help!!");
      }
    }

    return true;
  }

@restive granite I formatted your method to make it more readable. Try to escape more early if certain conditions are not met.

solid sundial
#

tanks

restive granite
#

omg

#

thank you so much

#

ur the best tyyyy

solid sundial
#

alright, I have GUI, and I want it when a player presses on a certain field (already know how to do that) i want it to look for someone to write a string in chat. However i want this string to NOT be a command, but still be able to do something special. Is this possible?

fast ore
#

zombie.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 3)); am i doing this right?

frigid ember
#

wait chick for ```java
float x = .5;
float y = .0;
float z = .5;

couldn't you just do ```java
float x = .5, y = .0, z = .5;
```?
solid sundial
#

yeah

#

i already resoved that issue thogh

#

thanks tho

frigid ember
#

oh alright

grim halo
#

@solid sundial You cant recommend chat input to the player.

near lodge
#

alright, I have GUI, and I want it when a player presses on a certain field (already know how to do that) i want it to look for someone to write a string in chat. However i want this string to NOT be a command, but still be able to do something special. Is this possible?
@solid sundial
On player click, close inventory and send them a mesage telling them to type one
Listen to the async chat event and on chat, check if you are waiting for a user input, if so there you have it

solid sundial
#

ok

void hawk
#

hey guys, i have a plugin on called regionclaim for 1.16 I dont see a direct uninstall method as i seem to have found a better option with more features. To do this am i just turning off the plugin, deleting the folder and restarting the server or is there other steps i have to do?

near lodge
#

Remove the jar and you are good to go

solid sundial
#

i have it so that it closes the GUI. That answers my question but im just asking now, im ok if this does not work, if it only listens for that string during the time period where my GUI is out

void hawk
#

My first time playing around with plugins. Thankyou for your time

near lodge
#

i have it so that it closes the GUI. That answers my question but im just asking now, im ok if this does not work, if it only listens for that string during the time period where my GUI is out
@solid sundial If your GUI is out, the player won't be able to chat

solid sundial
#

ok

#

thanks so much

#

ur the best

grim halo
#

@solid sundial You can put the player id in a set and listen for the async chat event.

near lodge
solid sundial
#

to any staff that can see this is it possible to make more than one help room because there are so many conversations colliding

#

that gif helps lots

near lodge
#

You could look at the source of the anvil gui

solid sundial
#

ok

#

thanks!

near lodge
#

The chat thing your are trying to do works but may be confusing to people

solid sundial
#

yeah lol

restive granite
#

yeah i agree with @solid sundial there should be more than 1 help room

frigid ember
#

anyone know any menu (chest like) creating plugins 1.16.1

#

?

#

i just want a plugin

grim halo
frigid ember
#

i did but no 1.16

#

?

grim halo
#

Did you try it? Just because they didnt test it for 1.16 doesnt mean it wont run there. If it runs on 1.15 you have a very good chance that it runs on 1.16

frigid ember
#

ill test

#

bicxter

#

there's a 1.16 deluxemenus dev build

#

that's working perfectly fine without any reported issues

restive granite
#

hmm for some reason the permissions that i put seem to not be showing up in luck perms

frigid ember
#

ok

#

probs

grim halo
frigid ember
#

it wont work :(

#

i mean

#

i cant find the 1.16 dev build thing

#

just google around, pretty sure you can ask around in their discord

solid sundial
#

if there are no plugins out there that fit your needs, go watch the 100 spigot coding tutorials out there and make one

#

Im pretty sure your looking for a GUI, and there are about 4-5 tutorials for that out there

restive granite
#

@grim halo tysm !

limpid fulcrum
#

set the server spawn to a nether world and disable portal travel
@grim halo how do I disable portals?

ripe narwhal
#

why do I have high ping on my server when I use localhost?

limpid fulcrum
#

explain what you mean by high ping?

#

like 100+?

ripe narwhal
#

yes

limpid fulcrum
#

0.0

ripe narwhal
#

and tps is 20

grim halo
#

@ripe narwhal not possible

graceful vigil
#

You aint on localhost if you have a high ping

ripe narwhal
#

wdym

#

im using localhost

#

and I have high ping

#

somehow

limpid fulcrum
#

send a screenshot

ripe narwhal
#

is it the server lagging?

#

I GOT TIMED OUT

limpid fulcrum
#

and timings pls

ripe narwhal
#

WTF

limpid fulcrum
#

send timings please

ripe narwhal
#

timings?

#

Im getting timed out

#

how

#

Im not kidding Im using localhost

#

is there a way to fix this?

limpid fulcrum
#

try 127.0.0.1

ripe narwhal
#

ok

sturdy oar
#

That ping is not original

#

Could be wrong since it's provided by a external plugin

ripe narwhal
#

true but I mean

grim halo
ripe narwhal
#

if Im getting timed out

#

is it lag?

#

or my internet?

grim halo
#

@ripe narwhal What are your specs?

ripe narwhal
#

of my computer?

grim halo
#

No of your washing machine

ripe narwhal
#

...

#

cpu i7-8750h
ram 32 gb

#

uh

#

I have the server on a ssd with 3gb per sec speed

grim halo
#

This should be plenty... do you have mutliple servers running?

ripe narwhal
#

no

#

I only run one server at a time

grim halo
#

type ping localhost in your console pls

ripe narwhal
#

Reply from ::1: time<1ms

#

so its the server

grim halo
#

How? Its a server on the same machine right?

ripe narwhal
#

yes

#

I dont understand how my ping goes up and the tps stays at 20

#

shouldn't the tps go down

grim halo
#

TPS and latency have nothing in common.

ripe narwhal
#

oh ok

torn robin
#

^

#

Ping is client-server

#

TPS is how fast the servers running

ripe narwhal
#

btw sometimes when I join it takes some time to load chunks

#

and I stay at 0 ping on those times

grim halo
#

@torn robin He has >2000ms on his localhost server... this is not possible

torn robin
#

Impressive

tiny dagger
#

it means it's not calculated

bold anchor
#

That’s quite the latency

ripe narwhal
#

I mean now its 256 ping

#

but sometimes it goes really high

tiny dagger
#

lol

torn robin
#

Local host ping more or less is 0

tiny dagger
#

are you sure you're not joining thru the router ip?

torn robin
#

Cause it’s a local host

tiny dagger
#

or the public ip?

ripe narwhal
#

Im sure

tiny dagger
#

localhost is 0

ripe narwhal
#

Im really sure Im using localhost

#

cuz I already joined 3 times

#

with it

torn robin
#

You can also just use local host as the IP in MC

#

no space

ripe narwhal
#

but I think its the loading chunks thing thats doing this

torn robin
#

Das not how ping works last I checked

ripe narwhal
#

ik but that is doing something

solid sundial
#

is it possible to use my variable through different methods. I know it is, but for some reason it not working

ripe narwhal
#

it takes some time to load chunks so I guess its slow internet?

grim halo
#

so you made sure that:

  1. There is only one server running (no other javas in your task manager)
  2. You dont have hamachi or something like this running
  3. You are connected via "localhost"
ripe narwhal
#

Let me check

grim halo
#

And chunkloading has nothing to do with your ping

ripe narwhal
#

1- yes
2- just checked
3- Im sure

grim halo
#

@solid sundial Yes you can pass variables if you have them in the right scope.

solid sundial
#

i get that

primal topaz
#

i need help

solid sundial
#

but how and why does it not work

ripe narwhal
#

ok so my ping goes super high when I get on the server

#

and when I play for a little while

#

it gets lower

#

idk why

#

now I got timed out

#

cuz I rejoined

primal topaz
#

my plugin wont load

grim halo
solid sundial
#

check your plugin.yml

primal topaz
#

how

#

ive been looking where

#

i dont even have one

solid sundial
#

umm

grim halo
primal topaz
#

ik thats why

#

but idk how to set that up

solid sundial
#

are you coding or is this a plugin you got from spigot

primal topaz
#

a plugin i got from spigot

solid sundial
#

ahh

#

what happens when you type /plugins

primal topaz
#

in where

solid sundial
#

game

primal topaz
#

o

#

Plugins (0)

solid sundial
#

yeah

grim halo
#

So you downloaded a plugin from spigot and it doesnt load?

primal topaz
#

mhm

#

yea

grim halo
#

Did you put it in your "plugins" folder

primal topaz
#

why was i warned

grim halo
#

Read what the bot said...

solid sundial
#

7smile7 how do i do it when my variable is a Location

primal topaz
#

im not spamming doe

#

why cant i load the plugin?

#

do i dm you the error?

grim halo
#

@primal topaz You can just post the error here

solid sundial
#

ye, but my method that i want it in only takes ClickNPCevent @grim halo

sturdy oar
#

Local host ping more or less is 0
@torn robin localhost ping is the time that electron travel inside your computer circuit and the server sends them back

primal topaz
#

doesnt let me

grim halo
#

@sturdy oar Thats not quite how this works...

sturdy oar
#

Bro

#

Minecraft protocol is just sending ordered electrons

#

😂

primal topaz
#

yeah it doesnt let me send error

bold anchor
#

Fiber is light not electrons

grim halo
#

@sturdy oar that is a gross oversimplification of networking

sturdy oar
#

Yes

primal topaz
#

@grim halo can i dm you the pic

sturdy oar
#

👀 👀 👀

grim halo
#

@primal topaz Sure

sturdy oar
#

I know perfectly how the mc protocol works , although networking is still magic to me

pastel condor
#

is there anyway I can fix this?

balmy sentinel
#

they’ll become empty anytime you restart your plugin and or declare a new instance of that class

pastel condor
#

so I should make those methods static?

balmy sentinel
#

making them static won’t fix the issue. The problem is how your code is setup right now it won’t save when the server restarts. My recommendation is if you want to save the data for a longer period of time (meaning through a restart) use a database or yml file.

pastel condor
#

I don't need to data to save for a restart

winged sparrow
#

or depending on what you're saving, a json file.

pastel condor
#

I actually want to wipe it on restart

#

but thats not my problem

#

my problem is it's wiping no on restart

#

and what I don't understand, is I have another class thats very similar and it doesn't have problems of hashmaps resetting

balmy sentinel
#

do you declare an instance of that class anywhere?

pastel condor
#

the one I'm having issue with or the other one?

balmy sentinel
#

the one you’re having issues with.

pastel condor
#

yes I do

balmy sentinel
#

in multiple classes?

#

or just one

pastel condor
#

for the one without issues, I just have one instance, but for the one with issues I have multiple

#

which kind of makes sence

#

I guess

balmy sentinel
#

that’s the issue

#

every time you declare a new instance of that class the maps will be wiped

pastel condor
#

ah maybe I'll have my worker class store an instance, and just have all the classes use that

#

though a method

balmy sentinel
#

if you want to save them create one instance of it in your main class and then when you need to use them get the instance from your main class

#

if that’s makes sense

pastel condor
#

yes, I did something like that in my other plugin

#

I just don't want to clutter my main class

#

though

#

but I might have to

balmy sentinel
#

just have a private method that’s creates all the instance you need one instance of in your main class and call that method onEnable. Then just create getters for those instances in your main class

limpid fulcrum
#

@grim halo thank you

#

+rep

pastel condor
#

just have a private method that’s creates all the instance you need one instance of in your main class and call that method onEnable. Then just create getters for those instances in your main class
oh yeah I have that 🙂

#

thanks

limpid fulcrum
#

rip thats disabled

pastel condor
#

hmm thats odd it looks like the hashmaps are still clearing

#

thats the code in the main

balmy sentinel
#

just do private Jail jailer; and then onEnable do jailer = new Jail();

#

see if that fixes it

pastel condor
#

hmm okay

frigid ember
#

I haven't gotten a response from spigot in over a week about being locked out of my account

pastel condor
#

same issue

#

it didn't work for some reason

hollow root
#

I am writing a permissions plugin which works fine, but tabcomplete does not work for any commands. anyone got an idea? I just create a new PermissionAttachment and set the permissions there, shouldn't that be enough for Bukkit/Spigot to allow tab complete?

balmy sentinel
#

@pastel condor if you’re absolutely positive no other instances of that class are being created then I don’t know why it would be clearing unless you manually clear it somewhere or redeclare the map again somewhere.

tawny whale
#

Has there been a fix for the end city? My server still crashes every time someone tries to go to the endcity unfortunately

wary ledge
#

how do i make tab complete commands?

#

my command is /m4j start/stop

#

so i just want to make start and stop pop up

torn robin
#

implement TabCompleter

wary ledge
#

but how

#

i make a new class right?

#

or do i modify my command class?

torn robin
#
public class ACommand implements CommandExecutor, TabCompleter {
}
wary ledge
#

ok...

#

what's it?

#

but how do i add sub commands

torn robin
#

the compiler should automatically warn you to add the inherited functions

#

if you click the auto-add button then it'll add the method

#

the method is something like
List<String> tabComplete(...)

wary ledge
#

yeah no Error:(11,8) java: net.neednot.mine.PluginCommands is not abstract and does not override abstract method onTabComplete(org.bukkit.command.CommandSender,org.bukkit.command.Command,java.lang.String,java.lang.String[]) in org.bukkit.command.TabCompleter

torn robin
#

yeah so specify onTabComplete

tidal path
#

anyone familiar with worldguards new api?

torn robin
#

it should have a button to auto add the methods

wary ledge
#

do i make a new method separate from the command?

torn robin
#

yes

#

public List<String> onTabComplete

wary ledge
#

ok

#

it made it

#

now how do i add the things that pop up

torn robin
#

the method returns a list of strings to recommend at the specified argument position

wary ledge
#

do i remove @org.jetbrains.annotations.NotNull

torn robin
#

if you return "a", "b", "c", then it will recommend a b and c

wary ledge
#

what is @org.jetbrains.annotations.NotNull for

torn robin
#

are you using intellij?

wary ledge
#

yes

torn robin
#

It's for the IDE to know that the specified field will never be null

#

or at least should never be null

#

you can delete it if you want to, but if it's not causing issues you should leave it

wary ledge
#

and where do i put the list of recommendations?

torn robin
#

the method returns it

#

List<String> onTabComplete

wary ledge
#

rn it returns null

torn robin
#

so return an array that you want?

dry horizon
#

how to change the name tag?

#

<#Player>.setCustomName() ?

wary ledge
#

String[] args so do i put the list inside []

spring coyote
#

how can i make a player open their own inventory?

torn robin
#

Think of it as the same as onCommand Need

#

but instead of returning true/false you return the suggestions

hollow root
#

how can i make a player open their own inventory?
@spring coyote ```java
p.openInventory(p.getInventory());

wary ledge
#

yeah so where the heck do i put the list

torn robin
#

you return it

#

return Arrays.aslist("Test");

#

for example

wary ledge
#

oh

hollow root
#

String[] args so do i put the list inside []
@wary ledge You must return a list. E.g.

String[] asd = new String[] { "one","two"};
return Arrays.asList(asd);
wary ledge
#

can i make it so it won't do /m4j start start start...

pseudo sky
#

hello, where can I report an bug? 😐

hollow root
#

what's the bug?

pseudo sky
#

since 1.13 release, we can make team's (vanilla). since that date, it is not possible to show up the prefix in the chat

hollow root
#

since 1.13 release, we can make team's (vanilla). since that date, it is not possible to show up the prefix in the chat
@pseudo sky I don't think it's a spigot problem, however I don't have any idea about teams and stuff, maybe you should ask in the spigot forums

wary ledge
#

thanks

hollow root
#

np

#

since 1.13 release, we can make team's (vanilla). since that date, it is not possible to show up the prefix in the chat
@pseudo sky btw bug reports go here: https://hub.spigotmc.org/jira/secure/Dashboard.jspa but please only do that if you are 100% sure it's really a spigot bug. for example did you try with vanilla?

frigid ember
#

Can i get help here for the spigot website?

quick arch
#

Don't think team prefixes ever showed in the chat unless it's done by a plugin 🤔

hollow root
#

Can i get help here for the spigot website?
@frigid ember what's your problem?

#

Don't think team prefixes ever showed in the chat unless it's done by a plugin 🤔
@quick arch I think so too

frigid ember
#

Well i got locked out of my acc and i don’t know my email or password and i can’t do anything, can I make a new account?

patent monolith
hollow root
#

I believe you should contact the staff at tmp-support (at) spigotmc.org. the rules forbid second accounts, so better try to contact them first

Well i got locked out of my acc and i don’t know my email or password and i can’t do anything, can I make a new account?
@frigid ember

frigid ember
#

email?

quick arch
#

I think there's a pretty high chance of you getting your account back

#

A friend of mine lost her account, email them and got it back

hollow root
quick arch
#

Forgot what the response was though

frigid ember
#

oh ok, thanks

hollow root
#

np, good luck

#

might take a week for them to answer though^^

frigid ember
#

alright with me

cyan kelp
#

How can I get a block ID from a block object?

hollow root
#

you mean the material?

#

what version?

cyan kelp
#

1.16

hollow root
#

you can do Block#getType()

#

it will return a Material e.g. Material.GRASS

#

or do you really need the numeric ID?

cyan kelp
#

I would prefer the numeric ID

quick arch
#

🤔

hollow root
#

not possible without some dirty hacks using 3rd party libraries

quick arch
#

You have to use a library to do that

hollow root
#

numeric IDs are gone since 1.13+

cyan kelp
#

Ah ok

hollow root
#

(for a good reason)

quick arch
#

^ +1

cyan kelp
#

Good to know, thanks for the help

hollow root
#

may I ask why you need the numeric id?

quick arch
#

There's a library to get their ids

#

but it's a mess

#

🤢

hollow root
#

yeah there's something like XMaterial or something but I would never use that xD

quick arch
#

yeah, that

cyan kelp
#

I'm just messing around with BlockBreakEvent

#

I was gonna use the id in a switch case so certain things would happen if you broke certain blocks

quick arch
#

Couldn't you just use the type 🤔

torn robin
#

just use the enum

hollow root
#

you can also do that with Material

cyan kelp
#

Yeah I know that now lol

quick arch
#
switch (block.getType()){
  case Material.STONE:
    // stuff
  // cases
  default:
    // stuff
hollow root
#

but without the Material. part 🙂

quick arch
#

I don't use em' for materials at all ._.

hollow root
#

I don't know why but in switch it's only STONE e.g.

quick arch
#

it's wonky

hollow root
#

(I have to admit I always compare block.getType().name() for backwards compatibility)

quick arch
#

backward compatibility is too much work

torn robin
#

don't

#

tf

#

no

#

nonononono

hollow root
#

well I don't want to break 1.15 compatibility just because I check if something is blackstone for example

torn robin
#

pretty sure spigot natively supports backwards compatability

hollow root
#

no

#

you get something like a NoSuchFieldException or similar when using material enums that are not present in the used mc version

quick arch
#

try/catch scope to hide it all :kappa:

torn robin
#

try catch Throwable

hollow root
#

yeah that's possible too but I don't think it will be much faster^^

#

my current method is to create an arraylist<Material> in the onEnable that uses Material.getMaterial(...) and then comparing the enums at runtime

#

I think that's the most efficient approach

torn robin
#

i just support 1 version

hollow root
#

lucky you^^

quick arch
#

rip

#

Couldn't it just be an interface class

#

Aren't Sets also good for this 🤔

hollow root
#

i don't care, building the map takes no more than 2ms in onEnable(), after that everything is stored inside a HashMap<Material,Tool>

quick arch
#

!Set#contains(%insert material%)

cyan kelp
#

If I were to make a custom stuff for my server, is it better to keep it all in one plugin or spread it out across multiple plugins?

hollow root
#

depends

quick arch
#

I'd say spread it out

hollow root
#

if those stuff works indepedently of each other I would make more than one plugin, if they share many stuff either make one plugin or several plugins that share a common library or sth

quick arch
#

Don't be too bloated like Essentials

cyan kelp
#

Alright thanks

#

I'm new to this whole plugin thing so I'm just figuring out how I should sort my stuff

hollow root
#

I'd try to make separate plugins that each have their own use case, and it should only be responsible for that. however it depends. there is no general answer and everyone has a different approach

#

for example I wouldn't mix a plugin that changes ender dragon fights with a plugin that adds a gamemode command^^ but nothing wrong with a plugin that includes a gamemode, /give, /god etc command. you know what I mean

cyan kelp
#

Alright cool

#

Thanks for the recommendations

#

How could I get the entity that killed the player in an OnPlayerDeathEvent?

hollow root
#

you get the dead entity and call entity#getKiller

#
 public void onEntityDeath(EntityDeathEvent e) {
Player murderer = e.getEntity().getKiller(); // might be null if not killed by a player
}```
cyan kelp
#

I thought get killer only returns a player?

hollow root
#

I don't know if its possible to get a non-player-killer as getKiller() only returns player

#

yes thats true

#

don't know if it's possible to get non-player killers

#

well maybe with the on EntityDamageByEntityEvent

winged sparrow
#

It is

#

It takes a bit of nms, want to see how I did it?

hollow root
#

and then check if the new health is less than 0

#

I don't think NMS is required

#

but I don't know

winged sparrow
#

That didn't work for me when I tried it

#
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        EntityPlayer nmsPlayer = ((CraftPlayer) event.getEntity()).getHandle();
        if (nmsPlayer.getKillingEntity() == null) {
            return;
        }
        Entity entity = CraftEntity.getEntity((CraftServer) event.getEntity().getServer(), nmsPlayer.getKillingEntity());
        if (!(entity instanceof LivingEntity)) {
            return;
        }
        LivingEntity livingEntity = (LivingEntity) entity;
        if (!(entity.getScoreboardTags().contains("alpha"))) {
            return;
        }
        event.getEntity().spawnParticle(Particle.SMOKE_LARGE, livingEntity.getLocation(), 120, 0.6, 1, 0.6, 0.1);
        livingEntity.remove();
        event.setDeathMessage(event.getEntity().getDisplayName() + " was defeated by an Alpha " + StringUtils.capitailizeWord(livingEntity.getType().toString().toLowerCase()));
    }```
#

This was my solution to it, though.

#

Really basic nms nothing complex

quick arch
#

is this for players only or something 🤔

hollow root
#

the code by @winged sparrow is for every entity

winged sparrow
#

Checking for when a specific entity kills a player and performing an action afterward

cyan kelp
#

Alright cool

#

Thank you

hollow root
#

but it requires to import the specific MC version's classes, right?

winged sparrow
#

Yeah.

#

Not good for a public project, probably not

hollow root
#

would be a nice addition to spigot if they could add something like that to the API

winged sparrow
#

Yeah it was super accessible with just the nms player

hollow root
#

(or bukkit ofc)

winged sparrow
#

strange that there isn't an in-api equivilant

#

yep

hollow root
#

yeah sometimes it's strange that some basic features are missing

winged sparrow
#

I mean

#

getKiller should just return an entity

#

any entity

hollow root
#

for example NBT is also completely missing from the API

#

yeah that's true!

winged sparrow
#

NBT manipulation would be nice nice nice to have

#

From the comfort of abstraction

#

refresh

hollow root
#

what's the error if you hover with the mouse?

winged sparrow
#

Wait..

quick arch
#

Probably do that

winged sparrow
#

yeah it can be fucky. One time IntelliJ forgot the whole spigot api for me for no reason mid-coding

hollow root
#

yeah I always change my pom and refresh it then lol

winged sparrow
#

Do what he said

frigid ember
#

Or you can use sender instead

winged sparrow
#

Invalidate Caches / Restart

hollow root
#

but it works at the top so straaaaaaange

winged sparrow
#

Sender doesn't work since it's not a player object

#

wait..

#

does it?

#

I thought sender could be either player or console

quick arch
#

it can

frigid ember
#

yeah it can be both

winged sparrow
#

I mean I know that but I didn't realize sendMessage was a method that could be used with sender

hollow root
#

of course it can^^

#

sendMessage is for any CommandSender

#

you can even use .spigot().sendMessage() on a CommandSender

frigid ember
#

yeah

winged sparrow
#

I haven't did my research on this obviously lol

#

huh

quick arch
hollow root
#

yeah nested if's are nasty

winged sparrow
#

Indeed

hollow root
#

thats where the word "nested" comes from obviously 😛

quick arch
#

dw, nested ternaries are worse

winged sparrow
#

I remember my first code.. executing commands on a command send event and checking strings and it's this huge line of nested if statements

worldly heathBOT
golden geyser
#

Alright, so I am working on a plugin that uses scoreboards in addition to my Spigot plugin (private server and plugin) and I need to set an objective (called "SetLives") to a specific value. I can get the value easily, however I have no idea how to set scoreboard objective values. Can somebody please help me with that issue? Thanks.

quick arch
frigid ember
#

oh god

quick arch
#

yup...

hollow root
quick arch
#

probably both

hollow root
#

although it has nothing to do with that

frigid ember
#

@past orbit try using sender instead rn :/ ig it’s not working for you

earnest jackal
#

@past orbit You have declared the player variable inside the if statement / brackets, and below you cannot use it because it is outside that code block

quick arch
#

🤔

spring coyote
#

Is it more performance heavy on the server if I do calculations with a lot of decimal places?

hollow root
#

oh yeah the intendation is wrong

#

I thought the second player usage was inside the "upper" if statement

#

always format your code and it would have been obvious ^^

winged sparrow
#

Not really. It's roots and shit that will eat your performance alive

hollow root
#

Is it more performance heavy on the server if I do calculations with a lot of decimal places?
@spring coyote I think if you use a double it doesn't matter how many decimals it has

#

but I might be wrong

spring coyote
#

oh wow

#

ok

winged sparrow
#

maybe a bit more than dealing with integers, but it's a very small impact I believe.

hollow root
#

yes integers are of course a bit faster but I think it doesnt matter if you calculate 200d - 0.999947216vs. 200d - 0.9

spring coyote
#

yeah if I dont use a lot of decimal places for this then the difference will be obvious

#

thx

hollow root
#

lol it even seems to be faster with more decimals somehow

#
few decimals: 
1454100 nanoseconds

many decimals: 
784600 nanoseconds

integer: 
1185500 nanoseconds
#

tried it five times and "many decimals" was always faster

quick arch
#

that's wonky

hollow root
#
8517900 nanoseconds
many decimals: 
7202500 nanoseconds
integer: 
7337600 nanoseconds

this time it was quite the same

#

seems to be quite random^^

quick arch
#

wonky

hollow root
#

might also depend on the CPU and its instruction set or something, IDK

#

intel user here^^

#

@quick arch do you use AMD by any chance?

quick arch
#

yeah

hollow root
#

let my try on my AMD server, 5 mins

halcyon snow
#

amd

few decimals: 
30336400 nanoseconds
many decimals: 
554100 nanoseconds
integer: 
573800 nanoseconds
quick arch
#

that's wonky

#

🤔

#

my PC is shit though

halcyon snow
#

I was testing with an amd ryzen 7 3700x

quick arch
#

I'm on a 2014 AMD CPU