#help-development

1 messages · Page 1904 of 1

proud forum
#

my bad!

lavish hemlock
#

Tbh I like langs that center around procedural more than OOP

quasi patrol
#

Feels slightly ignored?

sterile token
lavish hemlock
#

OOP is a bit too complicated and has not much benefit

sterile token
#

Just use: ?paste, then paste your code, press CTRL + S and then copy the url

#

Idk why it doesnt work

lost matrix
#

The only thing C# does better is generic handling. Because you can actually get those at runtime.
I absolutely hate properties. And C# has so much syntax sugar that its borderline obfuscating in some cases.

ivory sleet
undone axleBOT
lavish hemlock
proud forum
errant snow
# quasi patrol Feels slightly ignored?

Welcome to the spigotmc discord, if your conversation is asking for code I'd recommend the forums. People don't really care to look over that stuff in here :P

sterile token
ivory sleet
#

Maow is proficient in Java, he might be able to supply you a lesson or two MrHoneyBun

brave sparrow
lavish hemlock
#

Yeah I know the ins and outs of this terrible fuckin' language lmao

proud forum
#

thats up to him, i dont wanna waste his time tho

brave sparrow
#

There’s very few fundamental differences

lavish hemlock
brave sparrow
#

I doubt it worked

lavish hemlock
#

Since there's a few big syntactical differences

sterile token
ivory sleet
lavish hemlock
#

e.g. Spring does not exist in C#

brave sparrow
#

Lol

lavish hemlock
#

C# has different syntax for annotations (AKA attributes in their language)

#

Inheritance is different, : vs extends/implements

ivory sleet
#

Wait C# doesn’t have type erasure right

lavish hemlock
#

Yeah

brave sparrow
#

Nope

#

God I love English

lavish hemlock
#

It also allows you to specify generic types as primitives

ivory sleet
#

That’s just nice

brave sparrow
#

We both said opposite words and meant the same thing

ivory sleet
#

🥲

lavish hemlock
#

English is about as good as Java imo.

#

And I'm proficient in both, according to a lot of people...

brave sparrow
#

I can’t tell whether you’re being snarky

#

Because I love both

hasty prawn
#

Same

brave sparrow
#

English is my primary speaking language and Java is my primary programming language

lavish hemlock
#

Nah I just legitimately dislike English and Java.

proud forum
# lavish hemlock Yeah I know the ins and outs of this terrible fuckin' language lmao

alrighty maow, here is my problem regarding OOP n stuff like that

previously in my code i was using a public static boolean variable and was told this is innefficient
so someone gave me a plugins options class and said to implement it into my main class, which is where i've been stuck at
i know it might be a stupid questions but i've been trying to understand oop for days now and it isn't clicking lol
plugin options ```java
package me.mrhonbon.opmobs;

public class PluginOptions {

private boolean toggled = false;

public boolean isToggled() {
    return toggled;
}

public void toggle() {
    this.toggled = !this.toggled;
}

}```

quasi patrol
ivory sleet
#

No no

#

Remove the folder /build and /.gradle

hasty prawn
#

And pencils

lavish hemlock
#

Just cuz I use it doesn't mean I have to like it.

#

It's like

#

Stockholm Syndrome

#

But for your hobbies

ivory sleet
#

@quasi patrol as well if you use IntelliJ you can go to File -> Restart/Invalidate sth

#

And invalidate caches

#

(;

#

Hopefully that solves that

lavish hemlock
sterile token
lavish hemlock
#

For one, a config file is better.

lavish hemlock
#

You asked me this before and I told you I don't know how Mongo works.

sterile token
#

:)

proud forum
lost matrix
hasty prawn
sterile token
lavish hemlock
proud forum
#

here is my main class:

package me.mrhonbon.opmobs;

import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {
    private PluginOptions pluginOptions = new pluginOptions();

    @Override
    public void onEnable() {
        System.out.println("Hello world!");

        getServer().getPluginManager().registerEvents(new BreakBlock(), this);
        getServer().getPluginManager().registerEvents(new MobSpawns(), this);


    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }
}
lavish hemlock
#

How do you want that to be toggled?

#

By the user or by the developer?

proud forum
#

user

lavish hemlock
#

Then you'd want to read from a config file.

#

Or alternatively have it set up as a parameter in your command.

lost matrix
proud forum
#

ohhhh so i did this part right?

#

okok i think i got it

lost matrix
lavish hemlock
#

Well it's technically not a singleton instance

#

Unless you mean "singleton instance" as in the instance is a singleton

#

But a singleton wouldn't allow you to create more than one instance so yeah

little elm
#

Hi! Question about yml custom config files. If I do

someFileConfiguration.set("workers.timothy.age", 13);
someFileConfiguration.set("workers.timothy.salary", 100000);

Will it be shown as

- workers
  - timothy
    - age: 13
    - salary: 100000

Thanks in advance (:

EDIT my bad, i didnt mean if itll literally look like that second file. I was just wondering if the structure will be that way

lost matrix
#

No @little elm

ivory sleet
#

Go for it

lavish hemlock
#

Honestly dunno if I can help @proud forum considering I don't know how his plugin is supposed to work lmao

lost matrix
proud forum
little elm
proud forum
#

command class: ```java
package me.mrhonbon.opmobs;

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

public class MobSpawnCommand implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args[0].equalsIgnoreCase("on")) {
        if (sender instanceof Player)
            sender.sendMessage("Overpowered Mobs has been enabled.");
            this.isToggled = true;
    } else if (args[0].equalsIgnoreCase("off")) {
        if (sender instanceof Player)
            sender.sendMessage("Overpowered Mobs has been disabled.");
            this.isToggled = false;

    }
}

}

lost matrix
little elm
#

ohhhh ok thanks!

#

my bad with the dashes

lost matrix
lost matrix
proud forum
#

i might just have to go back to watching more java tutorials lol

lost matrix
proud forum
#

OH

lost matrix
#

Both need a reference to the same exact Object.

proud forum
#

okay! i think i got it, now its just the matter of implementing it into my mobspawns class using if else statements

#

thank you very much!!

lost matrix
proud forum
#

oh!

#

instances everywhere LMAO

lavish hemlock
proud forum
#

TRUE

#

java confuses me. deeply.

#

makes me angry.

quasi patrol
lavish hemlock
#

go crazy

#

go stupid

proud forum
#

AAAAAA

lost matrix
proud forum
#

WAIT WTF

#

I WAS LOOKIN THAT SHIT UP EARLIER

#

i didn't realize i just did it.

lavish hemlock
#

Yeah a lot of shit surrounding DI/IoC tends to be

#

worded very confusingly

#

tbh I did DI patterns for a long time without even knowing

#

you see

#

the idea is that when you have a dependency between two classes

#

a dependency meaning class A needs (an instance of) class B

proud forum
#

i am screenshotting this

lavish hemlock
#

instead of hardcoding that in your implementation

lavish hemlock
#

you "inject" it from somewhere else via your constructor

proud forum
#

soooo if i wanted to fully understand this, or just better, should i just use the java docs for reference?

lavish hemlock
#

well javadocs just explain how an API work, not what certain terms mean

lost matrix
proud forum
#

im glad im not the only one

little elm
#

How can I know if Bukkit#getOfflinePlayer(UUID uuid) successfully returned a player? What if that UUID doesnt exist?

lavish hemlock
#

Eventually over time you start to pick up on shit and form connections between different concepts

little elm
#
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull
UUID id)
Gets the player by the given UUID, regardless if they are offline or online.

This will return an object even if the player does not exist. To this method, all players will exist.

Parameters:
    id - the UUID of the player to retrieve
Returns:
    an offline player 
#

^ javadoc for reference

proud forum
#

im trying to learn java through spigot becuase minecraft and plugin development is something ive been interested in forever and just never got into it

proud forum
#

i started with skript and coded this exact same plugin i am trying to code in spigot

lavish hemlock
#

Oh boy, Skript

proud forum
#

yeah... waste of time honestly LOL

lavish hemlock
#

I mean it probably did teach you procedural programming

lost matrix
lavish hemlock
#

e.g. conditions and other types of statements

proud forum
#

yeah

#

you are 100% right

quasi patrol
lavish hemlock
#

I learned that from Batch

#

?paste

undone axleBOT
proud forum
#

shoot

lavish hemlock
#

But then Java taught me about classes and shit

lost matrix
#

Away with that script nonsense

proud forum
#

LOL

#

but yeah thats how i starterd programming all together

lost matrix
#

we do java here sir

quasi patrol
#

I will scream at my project if Gradle won't undie after I cleared cache, and invalided the caches... again...

lost matrix
lavish hemlock
#

Eh you don't need to restart your PC I think you could probably just kill the daemon.

#

Honestly I don't know 🤷‍♂️

quasi patrol
snow crow
#

again im back lol

quasi patrol
lost matrix
lost matrix
quasi patrol
#

I'll try the onedrive version again.

#

Ay a different error.

quaint mantle
snow crow
# lost matrix Main.java:53 Something in this line is null. Is it a command? Then check your pl...
        this.getLogger().info("Loading Lang...");
        Lang.setLangage(this.getConfig().getString("Lang"));
        assert Lang.getLangage() != null;
        if (Objects.equals(Lang.getLangage(), "EN")) {
            this.getLogger().info("Langage selected: English");
        } else if (Lang.getLangage().equals("FR")) {
            this.getLogger().info("Langage selected: Francais");
        } else this.getLogger().info("Langage selected: error ! (" + Lang.getLangage() + ")");

        loadLang();
        load();```
lost matrix
#

Whats line 53?

snow crow
#

} else this.getLogger().info("Langage selected: error ! (" + Lang.getLangage() + ")");

#

inside main

#

but in utils i have Lang.java

lost matrix
#

I doubt that this is the line that throws the exception. Compile it again, and then send the line which is
represented in the stack trace

quaint mantle
#

LOL

snow crow
#

lol

lost matrix
#

The error you posted is called a stack trace

snow crow
#

then i run it again and again in my mc server

hardy swan
#

@snow crow learn to read stacktrace

#

It says exactly which method throwing the NPE

quaint mantle
#

it isnt even hard and you should know it since you start a minecraft server lol

granite burrow
#

hey is there a DamageCause that is related to melee? I cant find it in the docs

young knoll
#

ENTITY_ATTACK

granite burrow
#

wouldnt that be for any sort of attack?

young knoll
#

What other attacks are there

granite burrow
#

Like by an item or by fist

young knoll
#

Yeah those are both melee

granite burrow
#

true, is there a way to check if its just a fist?

young knoll
#

Check if the attacker is holding nothing in their main hand

granite burrow
#

alright ill try that

quasi patrol
#

Would you actually have to create a discord bot to get a user by ID in a Spigot Plugin? (Discord4J).

sterile token
#

An insteresting question, when server goes down does PlayerQuitEvent or PlayerKickEvent get executed?

vocal cloud
granite burrow
quaint mantle
#

so i want to get started coding plugins how do i start?

round finch
#

Spigot Build tools

#

Or maven

quaint mantle
#

ill use build tools and im doing it on 1.16.5

#

it was the only server i could get to work on my pc without an error so

#

so what build tools do i get?

round finch
#

Use an ide interface developer environment FX like eclipse or intellij

quaint mantle
#

setting that up is gonna be a pain

#

correct

round finch
golden turret
#

both

#

actually

#

quit

#

considering /stop

#

i think

sterile token
#

Cuz i think if server goes down the events should be executed cuz if not plugins wont save player data

quaint mantle
#

Error: Unable to access jarfile BuildTools.jar

round finch
#

@quaint mantle note the server jar is a bootrep

quaint mantle
#

figures

#

look i have no idea what im doing

round finch
#

But in folders you can find the right jar

round finch
sterile token
#

If you are from terminal its caused because you are not on the same dir as your jar

quaint mantle
#

im usin my command prompt

round finch
#

Make sure it jar file name is correct

sterile token
sterile token
round finch
#

I don't know mac

quaint mantle
#

so i need a walkthrough with this because i dont know how to do any of this

round finch
#

Make text

#

In a folder

#

Open text

vocal cloud
round finch
#

java  -jar BuildTools.jar --rev 1.16.5

#

In text file

quaint mantle
#

done that

round finch
#

java -Xmx2G -Xms2G  -jar BuildTools.jar --rev 1.16.5

#

Here is for more memory

quaint mantle
#

right

round finch
#

Ok go to save as

quaint mantle
#

mk

tall nova
#

Click all files

round finch
#

Yes

#

And save the file with .bat behide it

quaint mantle
#

file explorer froze again

round finch
#

Autocorrect being pain rn

quaint mantle
#

fixed

round finch
#

You can also turn a text file to a bat file
If you allowed it in the options in file Explorer

Then you do. Start.txt edit to start.bat

round finch
quaint mantle
#

Keep going with that I'll screenshot it because my computer timed out

#

And yes

round finch
#

So you put the jar file into same folder with ur bat file beside it

#

Make ur file is named BuildTools

#

Precisely

#

With upper case and everything

#

Then you can start your bat file

quaint mantle
#

Ok

spark echo
#

I think there's a bug in the 1.18.1 BrewEvent api

#

you can no longer update the resulting brewed potion, it gets overwritten by the vanilla result. This wasn't the case in 1.17 and 1.16

quaint mantle
#

It was yes

sleek turret
#

did you update you system java version to java 17?

quaint mantle
#

Yes

sleek turret
#

weird, what was the error? essentially

quaint mantle
#

Java exception

#

But that was when i started it with Java 8 i used 17 and it did nothing at all

sleek turret
#

weird, normally updating should fix that

#

what do you get if you run $java -version in terminal?

quaint mantle
#

1.16.5 is working though so

#

Lemme see

sleek turret
#

dont include the $

quaint mantle
#

It said something bout mixed mode

sleek turret
#

hmmmm

#

thats weird

quaint mantle
#

java version "1.8.0_321"
Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)

sleek turret
#

yeah so youre still running java 8

quaint mantle
#

ye i had just installed limura 17 to

boreal sparrow
#

how do i get all the online players, select one randomly, tp him to specific coords, and everyone else that wasnt selected to other specific coords

quaint mantle
#

done

iron tundra
#

Issue: When starting the server, PlayerEvent doesn't work but onBlockBreak does; but when I reload the server it begins to work. As this breaks other plugins, this is an obvious issue.
Use: This code is for enchantments with onBlockBreak being a magnet enchantment and PlayerEvent being used for summoning lightning.

@EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
      //Magnet code here
    }
@EventHandler
    public void PlayerEvent(PlayerInteractEvent event) {
      //Lightning code here
    }
quaint mantle
#

still showing this java version "1.8.0_321"
Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)

sleek turret
boreal sparrow
#

thnx

#

how do i get a event player name in a string

#

so i can use it in a death message

boreal sparrow
#

ty

sleek turret
round finch
#

for(Player OnlinePlayer : plugin.getServer().getOnlinePlayers()) {
}

quaint mantle
#

yes

sleek turret
#

hmmm

#

idk if theres something different when downloading java versions on windows or not

iron tundra
#

Java on windows is pretty easy to get the right version

#

For linux it is a bit annoying

sleek turret
#

thats what i figured

sleek turret
#

i had to update it through command line only

round finch
#

Linux updating version isn't easy

iron tundra
#

Yeah, I love using command line but it's annoying if you get the wrong download

sleek turret
#

its a pain

quaint mantle
#

well i gotta go to bed in a bit

sleek turret
#

i think i spent like and hour trying to get it to actually work

iron tundra
#

How?

#

What distro are you using?

sleek turret
#

ubuntu server

iron tundra
#

ahhhhhh

sleek turret
#

20.something

iron tundra
#

that's why

sleek turret
#

yeah

round finch
iron tundra
sleek turret
#

im to lazy to set up a nice server system, im jsut kinda roughing it with ssh

quaint mantle
#

ill talk to yall ye it booted everything in

quaint mantle
round finch
#

It booting?

quaint mantle
#

Buildtools?

round finch
#

Yes

quaint mantle
#

Yea

round finch
#

Awesome!!

sleek turret
#

is maven easier than build tools?

iron tundra
#

Yeah

#

100% easier

sleek turret
#

good

#

cause thats all ive ever used

boreal sparrow
#

is there any way to colour death messages with the setdeathmessage function?

quaint mantle
#

Computer just timed out because I got a time limit on it from my parents

sleek turret
#

rip

quaint mantle
#

So this is gonna be interesting to wake up to

#

See yall tomorrow at around like 8:30 ish

iron tundra
#

I am so confused why some parts of my plugin require me to reload the server to work

sleek turret
#

ya!

quaint mantle
#

Hopefully

iron tundra
#
    @EventHandler
    public void PlayerEvent(PlayerInteractEvent event) {
        if (!(event.getAction() == LEFT_CLICK_AIR || event.getAction() == LEFT_CLICK_BLOCK))
            return;
        if (!event.getPlayer().getInventory().getItemInMainHand().hasItemMeta())
            return;
        Random rnd = new Random();
        int n1 = rnd.nextInt(-11,11);
        int n2 = rnd.nextInt(-11,11);
        int n3 = rnd.nextInt( 11);
        if (!(event.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasEnchant(Enchants.LIGHTNING)))
            return;
        if (n3 <= 9) {
            event.getPlayer().getWorld().strikeLightning(event.getPlayer().getLocation().add(n1, 0, n2));
        } else {
            event.getPlayer().getWorld().strikeLightning(Objects.requireNonNull(event.getClickedBlock()).getLocation());
        }
    }
#

Don't mind the terrible code

granite burrow
#

Is it possible when using TextComponents hover event that I can pick and choose certain parts of the string to be hoverable, like a string "AT" is the only hoverable thing.

iron tundra
#

It's so weird how another event works but ONLY this specific part needs me to reload

sleek turret
#

like reload the server?

iron tundra
#

yeah

sleek turret
#

what happens if you dont reload?

iron tundra
#

I was thinking maybe it had to do something with unoptimized code?

#

If I don't reload the enchant doesn't work but the weird part is the other enchants do

round finch
#

Why not if Action == an action?

iron tundra
#

Well I am trying to make it only activate the enchant when you swing the item with the enchant

boreal sparrow
#

is there any way to colour death messages with the setdeathmessage function?
becuase i cant use chatcolour 🤔

iron tundra
boreal sparrow
#

hmm ill check

quaint mantle
#

Trying to look through your code a bit weeb but I don't see how it wouldn't work

iron tundra
#

Yeah, I have zero idea why

quaint mantle
#

I'm comparing it to older stuff

iron tundra
#

All the other code works

sleek turret
#

could it be the way youre registering the event?

iron tundra
#

Maybe?

quaint mantle
#

Your trying to get it to strike lightning on a block aimed and clicked on right?

iron tundra
#

Well it randomizes a random area around the player to have lightning strike or a 10% chance of striking the actual thing they are attacking

#

btw the way I am registering the event is this.getServer().getPluginManager().registerEvents(this, this);

boreal sparrow
#

cant i just use &c before the string to make it red?

iron tundra
boreal sparrow
#

thnx ill check if it works :DDDD

quaint mantle
#

Weeb you said you had others that work perfectly fine are there any similar to this one in like randomizer setting?

iron tundra
#

So far I only programmed this enchant and another which just has items go into your inventory instead of on the ground

boreal sparrow
#

CraftPlayer{name=PureEnderman}&cWas Shot By Hunter! wasn't what i was expecting lmao

var deadplayer = event.getEntity();
event.setDeathMessage(deadplayer + "&cWas Shot By Hunter!");

quaint mantle
#

Ok just asking to see a comparison that way I could see if there was a change

iron tundra
#

At least I am pretty sure

iron tundra
boreal sparrow
#

hmm ill try thnx

#

so like this?
var deadplayer = event.getEntity();
ChatColor.translateAlternateColorCodes(deadplayer + "&cWas Shot By Hunter!"));
event.setDeathMessage(deadplayer + "&cWas Shot By Hunter!");

hasty prawn
#

No

#

ChatColor.translateAlternateColorCodes('&', deadplayer + "&cWas Shot By Hunter!")

boreal sparrow
#

thx sm

iron tundra
#

Removing randomization still leaves it needing me to reload the server

quaint mantle
#

Huh

#

That's weird

iron tundra
#

Yeah

#

I am so confused on what caused it

sleek turret
#

so once you reload it work?

iron tundra
#

Yup

sleek turret
#

thats really weird

iron tundra
#

Imma try to remove other code instead to see if maybe that it interfering

boreal sparrow
#

var deadplayer = event.getEntity();
ChatColor.translateAlternateColorCodes('&', deadplayer + "&cWas Shot By Hunter!");
event.setDeathMessage(deadplayer + "&cWas Shot By Hunter!");
didnt work lmao

hasty prawn
#

Well, yeah?

#

You're not doing anything with it.

boreal sparrow
#

i should maybe learn java also

hasty prawn
#

Yep

#

?learnjava

undone axleBOT
sleek turret
boreal sparrow
#

lmao thnx

sleek turret
#
event.setDeathMessage(ChatColor.translateAlternateColorCodes('&', deadplayer + "&cWas Shot By Hunter!"));```
boreal sparrow
#

yay thnx

quaint mantle
#

Hey I'll be back on tomorrow at around 8:30-11:00ish EST so I can get some things done want to get back into coding but it's been years and java had been long forgotten so yqll have a good night

quaint mantle
#

Will do loki

iron tundra
#

Alright I removed all other code, ONLY that part needs me to reload the server

boreal sparrow
#

ok im closer now
CraftPlayer{name=PureEnderman}<this next part is red>Was Shot By Hunter!

iron tundra
sleek turret
#

Alright, im getting off for the night, cya!

iron tundra
#

Goodnight

sleek turret
#

gn!

little elm
#

What's a good place to share plugins? Is there like a forum for that?

#

So far ive found curseforge

iron tundra
#

Well spigot itself is also a good place

#

Ya know, the discord you are on's website

little elm
#

Haha where exactly? All I could find is the archived forums for plugins

tired dagger
#

So... how can I have multiple configs? I was able to to create a custom (main one) but I need another YML file to store data (player name).
I don't think I can use the .reloadConfig() for the second one because its being used by the first (main) config. Here's what I have:

iron tundra
#

Issue: Only this section of code requires me to reload the server, after reloading if I spam the server enough with lightning it gives me the error code of "Could not pass event PlayerInteractEvent to CustomEnchants"
Use: If the player has the enchant Lightning it randomly has lightning spawn around the player with 10% chance of hitting the thing they are attacking

    @EventHandler
    public void PlayerEvent(PlayerInteractEvent event) {
        if (!(event.getAction() == LEFT_CLICK_AIR || event.getAction() == LEFT_CLICK_BLOCK))
            return;
        if (!event.getPlayer().getInventory().getItemInMainHand().hasItemMeta())
            return;
        Random rnd = new Random();
        int n1 = rnd.nextInt( 11);
        if (!(event.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasEnchant(Enchants.LIGHTNING)))
            return;
        if (n1 <= 9) {
            event.getPlayer().getWorld().strikeLightning(event.getPlayer().getLocation().add((rnd.nextInt(-11, 11)), 0, rnd.nextInt(-11, 11)));
        } else {
            event.getPlayer().getWorld().strikeLightning(Objects.requireNonNull(event.getClickedBlock()).getLocation());
        }
    }

Hopefully with this error it gives you a hint

little elm
#

Which Minecraft versions besides 1.18 are commonly used today? I'd like to make my plugin backwards-compatible and I'm wondering what versions to focus on

tired dagger
#

^

quaint mantle
#

How can I get InventoryView of an inventory?

iron tundra
boreal sparrow
#

boolean randomChosen = false;
int randomIndex = 0 + Bukkit.getMaxPlayers() + (int) (Math.random() * ((Bukkit.getMaxPlayers() -0) +1));
var hunter = list.get(randomIndex);

does hunter contain the name of a radom player out of the online ones?

drowsy helm
#

assuming list is Bukkit.getOnlinePlayers(), yes

#

well the Player variable, not the name

boreal sparrow
#

int randomIndex = 0 + Bukkit.getMaxPlayers() + (int) (Math.random() * ((Bukkit.getMaxPlayers() -0) +1));
List list = new ArrayList(Bukkit.getOnlinePlayers());
var hunter = list.get(randomIndex);
onlinePlayer.sendMessage(hunter + " Is The Hunter!");

Gives a lot of errors when i execute it in minecraft any ideas

drowsy helm
#

you can't use var in java

#

you have to also define what type of list it is

#

you are just using a generic list

boreal sparrow
#

*hmm

quaint mantle
drowsy helm
#

and theres no point adding Bukkit.getMaxPlayers() onto 0

drowsy helm
restive tangle
#

I didn't know that, Sound's bad

boreal sparrow
#

ok i just wanna store a variable or string with list.get(randomIndex); so i can use it in a message

drowsy helm
#
List<Player> players = Bukkit.getOnlinePlayers();
Random rand = new Random();
Player hunter = players.get(rand.nextInt(players.size()));```
#

this should do the same trick

#

and is much simpler

boreal sparrow
#

OooOO thnx

drowsy helm
#

i really advise getting to know java better it will help you a lot

restive tangle
#

Didn't this guy ask the same question before?

tall nova
granite burrow
#

How can I make a hover effect for multiple words in a string?

boreal sparrow
#

nobody did thnx

tall nova
#

Reason being is because in Java when you print out a variable it will just print out the object

tall nova
#

Speaking from experience it’s probably more beneficial to learn Java first

maiden thicket
granite burrow
maiden thicket
#

wdym then

granite burrow
#

I wanna make it so that two words in a string can be hoverable, so take for example this:

Would you like to buy or sell this item?

Where buy and sell are on the same line and both hoverable, so far I can only get the entire line to be hoverable

maiden thicket
#

make them separate components and append them together

granite burrow
#

that will make them on the same line?

maiden thicket
#

should yeah

granite burrow
#

alright give me a bit to set that up

maiden thicket
#

it would be addExtra i think

#

not append

#
TextComponent buy = new TextComponent("buy");
buy.setHoverEvent(...);
TextComponent sell = new TextComponent("sell");
sell.setHoverEvent(...);

TextComponent question = new TextComponent("Would you like to ");
question.addExtra(buy);
question.addExtra(new TextComponent(" or "));
question.addExtra(sell);
question.addExtra(new TextComponent(" this item"));```
#

probably like that

granite burrow
#

alright ill try that out, I broke my code so im trying to fix it now lmao

granite burrow
#

welp that's coding for you sometimes

tired dagger
timid moat
#

What plugins that allow not to break and place block?

quaint mantle
#

not here

#

and it is worldguard

#

with worldedit

#

if you config it right

timid moat
#

Oh ok thx

#

Im new to this stuff

timid moat
quaint mantle
#

stop

#

this isnt for you server admin

granite burrow
#

hey how can I make a hover able item in chat

chrome beacon
granite burrow
chrome beacon
#

Show what you tried

granite burrow
#

Right now I have it setup as a ShowText thing, but I tried this:

new HoverEvent(HoverEvent.Action.SHOW_ITEM,new BaseComponent[]{new TextComponent(CraftItemStack.asNMSCopy(ItemStack).save(new NBTTagCompound()).toString())});

^ this one throws errors
I found that one online and am currently trying to make my own since im not too fluent in NMS

chrome beacon
#

Don't make a TextComponent

granite burrow
#

alright let me look into that

mighty pier
#

what is IChatBaseComponent?

chrome beacon
#

It's a chat component

#

It's used for displaying chat messages, item names etc

young knoll
#

The NMS version of a chat component

chrome beacon
#

^

mighty pier
#

how do use

chrome beacon
#

Quick question why do you need it

mighty pier
#

for tablist header and footer

young knoll
#

There’s API for that

chrome beacon
#

What version are you on

mighty pier
#

1.8.8

young knoll
#

Sigh, never mind

chrome beacon
#

Ugh

#

Yeah

#

Google it there are many guides online

blazing rune
#

Uhh how do I spawn lightning in the direction the player is facing?

young knoll
#

Get the players facing vector, multiply it, and then convert that to a location

#

Which you can then use with World#strikeLightning

granite burrow
#

why not p.getTargetBlockExact

chrome beacon
#

You can also just use the rayTrace methods if you want it to stop at closest block

blazing rune
#

Kk

young knoll
#

You could also do that if you want to target a block, yes

granite burrow
#

I have my max distance to 100 blocks

#

then I just do p.getWorld().strikeLightning(location)
after getting the location of the block the player looks at

hollow arch
#

Heyo — Looking for an idea here; what would be a decent way to execute something whenever the player gets a specific amount of an item?

Currently I just check the output of item pickups and crafting but I'm not sure if there is a better way to do this

young knoll
#

That’s probably a decent option

#

Do you want them to have the amount on them, or to have just obtained the amount

hollow arch
#

To have the amount in their inv, so for example if they have a total of 8 sun flowers named "flower" or something

young knoll
#

You could check their inventory with a runnable, but that may not be ideal

hollow arch
#

Yeah :(

#

I suppose the current way will work, I guess since it's a rename, I should also check for anvil renames and such

young knoll
#

I wonder if checking inventories is safe async

chrome beacon
#

Just checking it maybe

hollow arch
#

Yeaaaah I think that might be fine

young knoll
#

Yeah then you can sync back to the main thread to do whatever once the condition is met

chrome beacon
#

I've done world reading async. No issues detected so far but uh I'm aware it's not ideal

young knoll
#

:p

boreal sparrow
#

how send sound to player that sent command

young knoll
#

Make sure the sender is a player, cast, and then use Player.playSound

boreal sparrow
#

ok thanks

tardy delta
#

how to make sure the sender is a player ._.

young knoll
#

instanceof

boreal sparrow
#

not that dumb lmao thnx anyway

tardy delta
#

not that thumb 🤡

boreal sparrow
#

yes.

young knoll
#

Ur a thumb

boreal sparrow
#

index finger best

#

i checked if player

hollow arch
#

ngl coming back to Spigot after using Java 16-17 for so long was great, love the patterns and all the other new features

boreal sparrow
#

um but it says its a non static method (playsound)

hollow arch
#

it's not Player.sendMessage

#

can you show your code?

tardy delta
#

work on a player object

young knoll
#

Player#playSound if you prefer

tardy delta
#

get your player from a command or a listener, etc.

young knoll
#

Yes, you need an instance, hence the casting

boreal sparrow
#

if(sender == instanceof Player){
Player.playSound(Player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
}

no i dont know java how did u know

hollow arch
#
if(sender instanceof Player player){
    player.playSound(Player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
}
tardy delta
#

Player player = (Player) sender;

boreal sparrow
#

lesgo thanks

tardy delta
#

thats java 11

hollow arch
#

sorry I don't speak outdated

tardy delta
#

sorry i dont speak modern java

hollow arch
#

oh my bad

young knoll
#

That’s not how you instanceof

tardy delta
#

LOL

hollow arch
#

lol yeah nvm

young knoll
#

No ==

hollow arch
#

I just copied it all

boreal sparrow
#

lamo

hollow arch
#

there

boreal sparrow
#

i dont know anything help

young knoll
#

?learnjava

undone axleBOT
boreal sparrow
#

nvmind

hollow arch
#

Might want to get started with some of the java stuffs

tardy delta
#

i think i should just continue making my storage 🤦‍♂️

young knoll
#

Can it store memes

tardy delta
#

its designed for users atm

#

bad design

hasty prawn
#

If it can't store memes then whats the point

icy beacon
#

hey

#

was wondering if there was a quick way to turn itemstack into item?

#

or only throwing the itemstack to do it

tardy delta
icy beacon
#

alright ty

#

guess that's the only way

tardy delta
spiral light
#

@ivory sleet 🤡
why is this working .... but the second one not ? why the heck can you set something private final to null but not to smth else ?

young knoll
#

Is one of them static

spiral light
#

its the same field ^^

#

and its just private final

icy beacon
#

one more question

#

how to detect clear weather?

#

i have this to detect rain and it works

pl.getWorld().getClearWeatherDuration() == 0 || pl.getWorld().hasStorm()
#

but reversing it does not help me detect clear weather

!(pl.getWorld().getClearWeatherDuration() == 0 || pl.getWorld().hasStorm())
#

idk what to do exactly

young knoll
#

Check if clear weather duration is > 0

#

And !hasStorm

icy beacon
#

i think i tried this but fine thx

#

will try again

#
pl.getWorld().getClearWeatherDuration() > 0 && !pl.getWorld().hasStorm();
#

this?

young knoll
#

Yes

icy beacon
#

ty

granite burrow
#

how can I get ItemTag from an itemstack?

tardy delta
#

google?

chrome beacon
icy beacon
tardy delta
#

is an itemtag not nbt?

icy beacon
#

ItemTag is a separate class

icy beacon
#

and also this to work with

#
public final class ItemTag {
    private final String nbt;

    private ItemTag(String nbt) {
        this.nbt = nbt;
    }

    public static ItemTag ofNbt(String nbt) {
        return new ItemTag(nbt);
    }

    private static ItemTag.Builder builder() {
        return new ItemTag.Builder();
    }

    public String toString() {
        return "ItemTag(nbt=" + this.getNbt() + ")";
    }

    // removed equals and hashcode to bypass discord character limit

    public String getNbt() {
        return this.nbt;
    }

    private static class Builder {
        private String nbt;

        Builder() {
        }

        private ItemTag.Builder nbt(String nbt) {
            this.nbt = nbt;
            return this;
        }

        private ItemTag build() {
            return new ItemTag(this.nbt);
        }

        public String toString() {
            return "ItemTag.Builder(nbt=" + this.nbt + ")";
        }
    }

    public static class Serializer implements JsonSerializer<ItemTag>, JsonDeserializer<ItemTag> {
        public Serializer() {
        }

        public ItemTag deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException {
            return ItemTag.ofNbt(element.getAsJsonPrimitive().getAsString());
        }

        public JsonElement serialize(ItemTag itemTag, Type type, JsonSerializationContext context) {
            return context.serialize(itemTag.getNbt());
        }
    }
}
#

no ItemStack anywhere there

#

anyways, @granite burrow why do you need to do it?

granite burrow
icy beacon
#

[item] type thing?

granite burrow
#

its basically when you type [item] into the chat it will send hoverable text showing the item

#

let me get you an example

icy beacon
#

yeah i know that

#

why do you need an item interface for it though

#

i don't get it

icy beacon
granite burrow
#

alr that may be my issue let me check my imports

icy beacon
#

yeah i see this

#

hm

#

this is very weird though, where does id come from

granite burrow
#

alr I was on the wrong page, I was using import net.md_5.bungee.api.chat.hover.content.Item; as my imports

icy beacon
#

you were supposed to

#

weren't you

granite burrow
granite burrow
icy beacon
#

oh so the namespacedkey part

#

k

tardy delta
#

should i load all the homes of an user when logs in instead of having to wait until they are loaded from the db when he requests them?

young knoll
#

Yes

gentle oriole
#

then maybe save it so you dont have to make another request everytime he requests it

tardy delta
#

i didnt have the problem before cause they were saved in yaml and i could instantly load them all

#

yea ofcourse caching

gentle oriole
#

if it is stored locally sure load them when logged in

#

only store them when requested if youre using a host

tardy delta
#

but i dont want to have those things like essentials have, to wait two sec before the tabcomplete options appear

#

so i thought maybe load them on login

#

and the max amount per player is 3 so

young knoll
#

I mean unless a user has 10000 homes the amount of data in memory should be tiny

gentle oriole
#

maybe their network is overloaded

young knoll
#

Essentials uses flat file

gentle oriole
#

just load them all on server startup xd

tardy delta
#

not all

#

i will just load them when the player logs in and cache them for a while until they logout

gentle oriole
tardy delta
#

all would mean from every player that has ever played and has atleast one home

gentle oriole
#

fair point

tardy delta
#

i know what to do

boreal sparrow
#

this is the dumbest thing i have ever been stuck on
how to send a sound to a player that executed a command lmao

young knoll
#

We told you

boreal sparrow
#

ik

#

and it didnt work

#

dies inside

young knoll
#

Then you didn’t execute it right

boreal sparrow
#

hmm yes the floor here is made out of floor

#

lmao i just want to give a villager disagree sound to someone that executes a command if theres 1 or less players online

nocturne quest
#

Anyone know why is that? Clearly it's "spigot" not "spigot-api", it was literally working till yesterday, and yes I have built 1.18.1 remapped jar with buildtools, it's looking in the wrong path

boreal sparrow
#

can anyone give me an example of how to send a command executer player a sound

spiral light
#

check if the cmd exe is player, cast it to player and then play sounid

boreal sparrow
#

how lmao

spiral light
boreal sparrow
#

yes

#

hmm how check if player executed (i cant remeber the bukkit.getcommandexecutor thingy)

spiral light
#

do you know instanceof ?

boreal sparrow
#

yea

#

but whats that crappy getcommandexecutor thing

#

i can literally never remember it

young knoll
#

What

boreal sparrow
#

nvmind

tardy delta
#

having this with a mysql and yaml implementation does that looks good?

boreal sparrow
#

if(sender instanceof Player player){
player.playSound(Player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
sender.sendMessage(ChatColor.RED + "You need at least 2 people to start the parkour!");
}

doesnt work and im dying inside

tardy delta
#

are you using java 11?

#

prob not

boreal sparrow
#

ye

#

not using lmao

quaint mantle
boreal sparrow
#

the problem is just that PLayer.getLocation has decided to commit not live

tardy delta
#

i was like "that depends on the user's choice"

quaint mantle
#

Just do H2

visual tide
#

then the question is what type of user do you even want to support

tardy delta
#

i'm probably just going from mysql and h2

#

or sqlite idk

quaint mantle
#

MariaDB tho ^^

tardy delta
boreal sparrow
#

YES

tardy delta
#

ignore those annotations

boreal sparrow
#

THANKS

tardy delta
#

you should better start with learning some basic parts of the api

#

like commands, listeners

quaint mantle
#

🥣

tardy delta
#

its the same as looking on the forum

tardy delta
boreal sparrow
#

it doesnt work

#

why

#

know what no sound im done only message

tardy delta
#

did you register a command?

boreal sparrow
#

yes.

icy beacon
boreal sparrow
#

yes

icy beacon
#

because if it is then your problem is that you do Player.getLocation(), not player.getLocation()

tardy delta
#

you need to check in the onCommand if the cmd.getName() equals the command name you want and then exexute the code to play your sound

icy beacon
#

player is your varibable

forest roost
#

Hello! I try to buy a plugin but it doesn't let me because of a paypal error and I go to a server and it lets me pay.

icy beacon
#

Player is a class

quaint mantle
boreal sparrow
#

fixed

quaint mantle
#

You can support both easily still

icy beacon
#

show your like entire class that you have

forest roost
#

Hello! I try to buy a plugin but it doesn't let me because of a paypal error and I go to a server and it lets me pay.

tardy delta
#

i dont know much about licences lol

young knoll
#

My current storage system relies on turning stuff into strings for storage

#

Usually via gson

quaint mantle
#

🆗

tardy delta
#

lol

quaint mantle
#

Losing all relational database advantages

young knoll
#

It was suggested to me as it’s easy to abstract

icy beacon
#

i am now curious how many times Microsoft developers asked questions on stackoverflow

#

idk why

young knoll
#

Not like various random player data is very relational

quaint mantle
#

For example?

tardy delta
#

i have data that needs to be linked and date that doesnt need

young knoll
#

Homes, balance, punishment info

#

It’s relational to the player, but not really anything else

quaint mantle
#

I don't see any problems of storing this in tables

young knoll
#

It will be stored in tables

tardy delta
#

does h2 uses the same sql syntax as mysql?

young knoll
#

I’m just doing the lazy method of turning it into strings so I don’t need to write adapters for each object type

tardy delta
#

nvm it doesnt

young knoll
#

Adapters for each storage medium and each object type at that

#

Unless you have suggestions to remedy that

tardy delta
#

the amount of storage solutions is sometimes overwhelming

young knoll
#

Indeed

#

Hopefully offering json, SQLite, and MySQL is sufficient enough

fallen grove
#

How can I create this type of spoiler?

#

oh I can't post pictures

tardy delta
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

tardy delta
#

then you can

fallen grove
#

how can I create this?

#

to showcase my config in this format

#

I just know [SPOILER]

tardy delta
#

is this valid yaml?

tardy delta
#

if you want to specify default options

fallen grove
#

eh? I already have config

#

thats not what I am asking

tardy delta
#

then create what?

fallen grove
#

a spoiler on the description that showcase the config in this format

spiral light
#

nms Material to bukkit Material ??

fallen grove
#

Code (Java):

#

I am literally asking about html (i think)

tardy delta
young knoll
#

The editor has a button for that

tardy delta
#

hehe doggo

#

dont see this as spam

fallen grove
#

oi

tardy delta
#

wait wha-

fallen grove
#

🍆

sacred mountain
#

some people on my server are picking up water and it is making ghost air, is there a way to send a block update to revert it back to water/lava on their screen?

#

other players cant see the gaps in the water

#

so its something client side

#

block.getState().update();

tardy delta
#

get the block, the blockstate and update it?

sacred mountain
tardy delta
#

do you block it?

young knoll
#

Alternatively you can use player#sendBlockChange

tardy delta
#

why dont they fix that bug

sacred mountain
#

would that work

tardy delta
#

try and see?

tardy delta
sacred mountain
#

ok ill go see

tardy delta
#

:D

quaint mantle
forest roost
#

Help me pls

sacred mountain
#

whats the ${} thing for project version?

#

that syncs with the pom.xml

tardy delta
#

maven.project.version?

#

iirc

spiral light
#

'${project.version}'

visual tide
#

${project.version}

sacred mountain
#

ty

fallen grove
#

this was the correct answer!
Tap the + in the top menu and select </> code

sacred mountain
#

:)

fallen grove
#

jesus

forest roost
#

someone tell me some plugin to put the /premium on your minecraft server is that all are not premium ie they do not have to autologearte

sacred mountain
#

wut

quaint mantle
#

Offline mode is not supported here

sacred mountain
#

autologearte

sacred mountain
forest roost
#

HelpMe

#

Can you tell me about an autologue plugin?

#

Other than FastLogin

quaint mantle
analog prairie
#

Can I know where the player's damage is coming from?

young knoll
#

Check the damage cause of the damage event

tardy delta
#

wait does yaml needs ' ' for strings?

quaint mantle
#

well

#

they accept both "" and '' i think

tardy delta
#

well this is valid yaml

#

idk if it work as a string

analog prairie
#

Player?Event

chrome beacon
#

?jd-s

undone axleBOT
chrome beacon
young knoll
#

Yaml does not need ‘ or “ for strings

chrome beacon
#

Or BlockDmaage

sacred mountain
#

IT Worked

#

:D

young knoll
#

However if the string contains ‘ then it needs to be wrapped in “

#

Or vice versa

tardy delta
#

oh

young knoll
#

I’m sure there are other cases to use them too

wary harness
#

Any one can tell me how would i send entity meta

#

with packets

boreal sparrow
#

how do i check a event player's gamemode

young knoll
#

Pretty sure it’s just Player#getGameMode

boreal sparrow
#

thnx

young knoll
#

You really should use the javadocs

boreal sparrow
#

this is faster

young knoll
#

Not when we stop helping you answer basic questions

tardy delta
#

just google

boreal sparrow
#

hmm

#

java docs just doesnt tell me how to check it for a player tho

#

ill keep searching

tardy delta
boreal sparrow
#

i did

#

nothing

icy beacon
#

what are you looking for

boreal sparrow
#

can i use this?
public GameMode getNewGameMode()

icy beacon
#

and what are you trying to do

boreal sparrow
#

check player gamemode

icy beacon
#

player#getGameMode()

boreal sparrow
#

in an if statement

icy beacon
#

if (player.getGameMode() == GameMode.CREATIVE)

#

or whatever you want

boreal sparrow
#

ty

icy beacon
#

bro

#

learn java

#

seriously

#

you shouldn't be coding plugins with this knowledge of a language

tardy delta
#

the player.getGameMode() is the current gamemode of the player, event.getNewGameMode() is the gamemode the player will have if the event finished executing

vernal pier
#

how can i get an entity type from its namespace key

icy beacon
#

you can probably try to turn that namespaced key into a name

#

like minecraft:zombie into ZOMBIE, and then EntityType#valueOf("ZOMBIE")

#

should work

young knoll
#

Interesting that there is no getByKey

icy beacon
#

yeah

young knoll
#

Or fromKey or whatnot

icy beacon
#

only fromId and fromName

#

both deprecated

#

so yeah i think you want to turn it into an enum value

vernal pier
#

nvm i found its Registry.ENTITY_TYPE.get(

icy beacon
#

oh damn

#

good one

#

never used Registry 😄

tardy delta
#

why is there file and path?

#

isnt it the same?

blazing scarab
#

file is a parameter name iirc>

young knoll
#

How does H2 compare to SQLite

tardy delta
#

ah what

#

you need to type file or what 🤡

quaint mantle
#

yep:

} else if(type == StorageType.H2) {
            Path path = plugin.getDataFolder().toPath().resolve("clans");
            url = MessageFormat.format("jdbc:h2:file:./{0};mode=MySQL", path);
            username = "sa";
            password = "";
}

tardy delta
#

h2 mode = mysql wha-

quaint mantle
#

idk probably support for some mysql specific syntax

boreal sparrow
#

so i have this:
List<Player> players = (List<Player>) Bukkit.getOnlinePlayers();
Random rand = new Random();
Player hunter = players.get(rand.nextInt(players.size()));

can i teleport or do stuff with the player hunter?

tardy delta
#

please are you still struggling with the same problem

boreal sparrow
#

?

#

no this is the first time

tardy delta
#

also use ThreadLocalRandom.current() instead of new Random()

boreal sparrow
#

ok thnx

icy beacon
#

yeah

#

threadlocalrandom is just a better random

boreal sparrow
#

but can i telport and do stuff with hunter

icy beacon
#

ThreadLocalRandom().current().nextInt(min, max)

#

though the max is exclusive

icy beacon
#

do you know why you put the (List<Player>) there, or just blindly doing it because your IDE told you to?

tardy delta
#

casting isnt even needed

icy beacon
#

lmao

#

?learnjava

undone axleBOT
tardy delta
#

i think he got the links for the fifth time now

icy beacon
#

the unstoppable

boreal sparrow
#

no not the fifth

#

the sixth

icy beacon
#

the seventh?

#

oh shit

#

ok

tardy delta
#

eigth

boreal sparrow
#

well

#

if u count another server i am in

#

10

icy beacon
#

oh my god

#

learn java or we can't help you

snow crow
#
[16:36:30] [Server thread/INFO]: [EnderRider] Langage selected: error ! (English)
[16:36:30] [Server thread/ERROR]: Error occurred while enabling EnderRider v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
    at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
    at enderrider.enderrider.utils.Lang.loadLang(Lang.java:23) ~[?:?]
    at enderrider.enderrider.Main.onEnable(Main.java:55) ~[?:?]
#

help

icy beacon
#

sure

#

one sec

#

let me read your mind for your code

boreal sparrow
#

wow no way u can do that

snow crow
#

lol

#

i could not fix it ._.

icy beacon
#

go ahead

#

fix it or give us the code

tardy delta
boreal sparrow
#

Student: Hello can you help me with this problem?
Teacher: Sure!
Also Teacher: Reads problem

tardy delta
#

i'm better in coding than my teacher 🤡

tardy delta
#

is mv.db some kind of file extension?

quaint mantle
#

i think so, but, you don't have to define it manually

#

just something like/this/should/be/fine

tardy delta
#

so if my h2 db file was called "database.h2" i should do .resolve("database")?

quaint mantle
#

yes. you don't have to create a file manually

tardy delta
#

ah nice

#

thanks

analog prairie
#

Can I just check if the player has this item and ignore the amount?

young knoll
#

isSimilar ignores amount

analog prairie
#
Bukkit.getPlayer("whes1015").sendMessage(String.valueOf(Bukkit.getPlayer(event.getDamager().getName()).getInventory().contains(itemStack)));
#
ItemStack itemStack = new ItemStack(Material.valueOf(String.valueOf("WHITE_BANNER")));
young knoll
#

containsAtLeast exists

boreal sparrow
#

List<Player> players = (List<Player>) Bukkit.getOnlinePlayers();
Random rand = new Random();
Player hunter = players.get(rand.nextInt(players.size()));

Is it possible to teleport everyone except the hunter?

quaint mantle
#

yes

boreal sparrow
#

yay

#

can u show me how

modern vigil
#

for loop

#

and check if the player is the hunter, return

boreal sparrow
#

this is above my braincell capacity google come help

analog prairie
modern vigil
red helm
#

hey

#

help me

boreal sparrow
#

ok and player != hunter

young knoll
modern vigil
boreal sparrow
#

yoo

#

finally its semi like python

vernal pier
#

you can do List<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers()); Player hunter = players.remove(new Random().nextInt(players.size())); // and teleport players

analog prairie
boreal sparrow
#

hmm what do i put in statement 3 of the for loop...
i have:
for (Bukkit.getOnlinePlayers(); player != hunter; propobly like list add nothunters or something){

young knoll
#

What...

icy beacon
boreal sparrow
#

yes

analog prairie
red helm
#

help me

#

This challenge page was accidentally cached and is no longer available.

#

when i go to the webiste spigotmc.org showing like this error

#

This challenge page was accidentally cached and is no longer available.

boreal sparrow
#

guys did i do something i think i did it idk
for (Bukkit.getOnlinePlayers(); player != hunter; player.teleport(new Location(Bukkit.getWorld("Game2"), 0, 65, 0)))

#

soo does this tp everyone that isnt a hunter to 0 65 0...?

quaint mantle
#

it stops if player is hunter

boreal sparrow
#

hn

#

so

#

if it checks a hunter before some other players, they just dont get tp'd?

boreal sparrow
#

how fix help AAAAAAAA

#

i have decided that i want to commit not live

quaint mantle
#
for(Player player : server.getOnlinePlayers()) {
if(player == hunter) continue;
player.teleport
}
boreal sparrow
#

oh

#

thanks :3

#

does that tp everyone that isn't a hunter

red helm
#

help me
This challenge page was accidentally cached and is no longer available.
when i go to the webiste spigotmc.org showing like this error
This challenge page was accidentally cached and is no longer available.

#

help me
This challenge page was accidentally cached and is no longer available.
when i go to the webiste spigotmc.org showing like this error
This challenge page was accidentally cached and is no longer available.

chrome beacon
#

Stop spamming

#

I've already told you what to do

boreal sparrow
#

guys im dying whats wrong with this:

Player nonhunter = (Player) Bukkit.getOnlinePlayers();
hunter.teleport(new Location(Bukkit.getWorld("Game2"), -9.5, 75, -4.5));
for(Player nonhunter : Bukkit.getOnlinePlayers()) {
if(player != hunter) continue;
player.teleport(new Location(Bukkit.getWorld("Game2"), 0, 65, 0));
}

chrome beacon
#

You can't cast multiple players to one

boreal sparrow
#

oh

chrome beacon
#

Avoid casting anything if you don't know what you're doing

boreal sparrow
#

thats me

#

so how can i just teleport all players that != hunter

gritty urchin
#

bit of a basic question

#

but how do I change build path

#

in maven

#

IntellIJ

quaint mantle
#

why

gritty urchin
#

I want to build to plugin folder

#

instead of target

quaint mantle
#

create a symlink

gritty urchin
#

and having to copy and paste

#

nah

#

I just wanna compile

#

to that folder

#

how to I change it?

vernal pier
boreal sparrow
#

wut

#

ok ill try

vernal pier
#

essentially is just creating a copy of the players list and removing 1 player (the hunter)

indigo cave
#

How is the packet called to give a player the freezing effect?

gritty urchin
boreal sparrow
#

yea but i cant teleport a list

#

for loop time