#help-development

1 messages · Page 1569 of 1

haughty plover
#

What a bummer

limber dust
#

so had to do it all out of packets

quaint mantle
#

any idea why .createNewFile() doesnt work?

chrome beacon
#

Yeah you need to handle that exeption

quaint mantle
#

oh what

opal juniper
#

Lmao

quaint mantle
#

i should try{ then?

opal juniper
#

Yeah

quaint mantle
#

ah

#

try{
createnewfile
catch{?

chrome beacon
#

Ima give myself ★★★★★ for that explination

opal juniper
#

Mhm

quaint mantle
#

agreed

quaint mantle
chrome beacon
#

Lmao

granite burrow
#

How can I get the spawndata of an item?

chrome beacon
granite burrow
#

can I get it from a spawner?

chrome beacon
#

No spawners have their own thing

#

Let me check

granite burrow
#

okay 😄

chrome beacon
#

Last time I worked with spawners I had to use NMS

#

API can be a bit limited at times

granite burrow
#

dam alright

chrome beacon
#

Alright so for spawners use CreatureSpawner for block and I'm not sure about the item

granite burrow
#

alright, ima try some stuff then. I basically just wanted to allow players that aren't in creative to place a spawner that wouldn't turn into a pig

proud basin
#

Don’t spawners have nbt tags

chrome beacon
#

They do

rocky rampart
chrome beacon
#

But you need NMS to work directly with them

granite burrow
#

time to learn about nms lmao

whole stag
#

Wait, spawners aren't in the spigot API yet?

granite burrow
#

they are but I dont think you can get the mob that would spawn out of it in item form

whole stag
#

What do you mean by Item form?

granite burrow
#

in that

#

not placed

whole stag
#

Gotcha

granite burrow
#

yeah so I couldn't find a way to do it with the spigot api and so Im trying with NMS

#

but idk how to use it

solemn shoal
#

question, where did CraftServer.worldServer go?

fluid cypress
#

what happens if a player connects before my plugin is loaded? should i iterate over each connected player somehow inside onEnable and call the join event?

solemn shoal
#

i have my join event stuff in a separate function

#

that takes just the player

#

keep in mind if the admins do /reload it will be called aswell

hasty prawn
unreal quartz
hasty prawn
#

So you'll have to find it's new name

unreal quartz
#

otherwise you can just iterate over the already connected players on the first tick

solemn shoal
#

ah it moved to getWorldServer

hasty prawn
#

Ah

fluid cypress
#

thanks

solemn shoal
#

playerjoinevent wont fire for players in the server before the plugin loaded

#

in my experience at least

unreal quartz
#

it's almost like i said that

hasty prawn
#

Can they even join if the server hasn't loaded all the plugins?

solemn shoal
#

no you said it will fire

unreal quartz
#

no i said it will fire unless it's due to a reload

fluid cypress
#

the event will be fired or not?

unreal quartz
#

no players can be connected first if the server is just starting up

hasty prawn
#

^

#

Just don't /reload and you won't have problems

#

They can't join before your plugin loads

solemn shoal
#

they can connect tho

fluid cypress
#

so, if the server is just starting up, the event will be called for the already connected players?

hasty prawn
#

Connect and Join aren't the same

unreal quartz
#

they won't be logged in until the server is ready

fluid cypress
#

i never do /reload

solemn shoal
#

true

fluid cypress
#

thats bad, i read that somewhere

unreal quartz
fluid cypress
unreal quartz
#

it's impossible

#

no logins are processed until the first server tick

fluid cypress
#

so? no ticks until all plugins are loaded?

unreal quartz
#

a connectoin can be established but the player will just see "logging in" until the server is ready

#

yes

fluid cypress
#

ok

unreal quartz
#

the server doesn't tick until it's ready

solemn shoal
#

hmm apparently something changed in 1.17 in terms of loading plugins

#

calling PluginManager#getPlugin results in an error

unreal quartz
#

when are you calling it?

#

i do not have that problem

solemn shoal
#

during onEnable

#

calling on itself

unreal quartz
#

as in youre trying to get your own instance?

solemn shoal
#

yep

#

from a static context

unreal quartz
#

i am pretty sure that should only return a plugin if and only if it is loaded

solemn shoal
#

it used to work in 1.16

#

i think ill just add a static variable that i set to this in the first line of onEnable

#

i'd assume loaded != enabled

urban lava
#

?jd

urban lava
#

ok i just needed the link

solemn shoal
#
[01:30:55 INFO]: [EssentialTools] Enabling EssentialTools v1.0
[01:30:55 ERROR]: Error occurred while enabling EssentialTools v1.0 (Is it up to date?)
java.lang.ExceptionInInitializerError: null
    at net.thearcanebrony.essentialtools.mechanics.BarrierView.Start(BarrierView.java:35) ~[?:?]
    at net.thearcanebrony.essentialtools.Main.onEnable(Main.java:87) ~[?:?]```
blissful saffron
#

s there a way to make is to custom mobs spawn in worldguard regions or is there another way of doing that?

solemn shoal
#

fun

#

seems this returns null now

unreal quartz
#

do you use paper

solemn shoal
#

fork of it, yeah

#

but i just found another issue

#

private static final String bukkitversion = Bukkit.getServer().getClass().getPackage().getName().substring(23); fun stuff

unreal quartz
#

i heard that they are altering the plugin lifecycle slightly, but i don't know the details

solemn shoal
#

ah possible

#
public static int pingPlayer(Player p) {
        try {
            Class<?> craftPlayer = Class.forName("org.bukkit.craftbukkit." + bukkitversion + ".entity.CraftPlayer");
            Object handle = craftPlayer.getMethod("getHandle").invoke(p);
            Integer ping = (Integer) handle.getClass().getDeclaredField("ping").get(handle);
            return ping.intValue();
        } catch (Exception e) {
            return -1;
        }
    }```
#

why was i ever using reflection for this??

proud basin
#

Is there a reason why you are making it static?

solemn shoal
#

so it can be accessed without a context

#

man some of this code is so naive lol

#

why am i using reflection when i can just Player#getPing()

unreal quartz
#

didn't exist in earlier api versions

solemn shoal
#

right

#

oh its really not happy

granite stirrup
#

Hello, is this sus???||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||||​||https://gstudiosx.cant-even-afford.rocks/​‌‌‌‌​​‌​​‌‌​​‌‌​‌‌‌​‌​‌​‌‌​‌‌​‌​‌‌​‌​‌‌​‌​​‌​‌‌​‌​‌‌​​​​​‌‌​​​​

torn shuttle
#

strings are genuinely the devil

#

they are the enemy

#

I think we should get rid of strings

#

I fuck up comparing two strings about 1/10 times

#

and I never notice it

#

specifically because there is a typo in one of the strings and I don't notice it

quaint mantle
#

any idea why OfflinePlayer is red?

rocky rampart
torn shuttle
#

I did C# intensively for a week then I went back to doing java intensively for a week and managed to spend 5 hours slamming my face against the correct way of using java generics

rocky rampart
#

I feel that pain. Java is rough around the edges, we need Sun Microsystems to come back and save us

quaint mantle
#

so why is OfflinePlayer red

rocky rampart
#

Hover over it, what does it say?

torn shuttle
#

hover over it, pretty sure it says deprecated

rocky rampart
#

Your IDE will usually tell you what's wrong

quaint mantle
rocky rampart
#

You need to add an import for it

quaint mantle
#

is it org.bukkit; ????

rocky rampart
#

Imports don't quite work like that in Java

limber dust
#

You need offlineplayer import

quaint mantle
#

org.bukkit.OfflinePlayer ?

rocky rampart
#

Yep

torn shuttle
#

yeah this is just not right

quaint mantle
#

thats so weird lmao

rocky rampart
#

You import specific classes in Java, so you add an import statement per class you need from elsewhere

torn shuttle
#

also your IDE should automatically suggest the correct import just fyi

proud basin
#

hey joshua

torn shuttle
#

I think I can count on one hand how many times I manually imported things

limber dust
#

I never manually import

rocky rampart
#

I feel spoiled with IDEA, it'll just import for me.

quaint mantle
limber dust
#

Screw manual importing

proud basin
#

manual importing is the best

rocky rampart
proud basin
#

gives you so much potential in life

quaint mantle
#

yeah, but normally it'll show the import at the bottom

#

well not the import but the name of the class

limber dust
#

It slows me down cause I just use the keybind for importing

rocky rampart
#

Actually that big bold part tells you as well

#

Package is org.bukkit, it's an enum called ChatColor

quaint mantle
#

i dont think you get what im saying LOL

#

thanks for helping tho

torn shuttle
#

finally

#

I am done fixing stuff

rocky rampart
torn shuttle
#

time to create new things that I'll then have to fix

rocky rampart
torn shuttle
#

ok there is no way that I am using java the way it is meant to be used lol

#

but hey it works

granite burrow
#

How can I use NMS to get the spawn data of a spawner?

proud basin
granite burrow
#

I want to get the entity of a spawner item inside of the players main hand

buoyant viper
#

if im using EntityDamageByEntityEvent, will that still trigger if damager == arrow?

#

second, if damage by entity is called for arrows, does damager get set to the shooter?

torn shuttle
#

man my code is so clean

#

it's mah baby

#

so precious

buoyant viper
#

i was thinking something like this?

torn shuttle
#

?paste

undone axleBOT
buoyant viper
#

can snowballs kill?

granite burrow
#

its just good to have a catch all

ornate patio
#

I'm a little bit new to Java (expierenced in other languages so dw) and I'm getting this error:

Test v1.0 attempted to register an invalid EventHandler method signature "public void me.okay.Test.Main.onEntityExplode(org.bukkit.entity.Entity,org.bukkit.Location,java.util.List<org.bukkit.block.Block>,float)" in class me.okay.Test.Main

I feel like theres something wrong with this line:

@EventHandler
    public void onEntityExplode(Entity entity, Location location, List<Block> blocks, float yield) {

any thoughts?

buoyant viper
#

i just realized my redundancy in getting the player when setting the owning player, woops

ornate patio
#

hm wait

#

so

#

like this?

@EventHandler
    public void onEntityExplode(EntityExplodeEvent event) {
buoyant viper
#

yes

ornate patio
#

so how would i grab the entity, location, whatever

buoyant viper
#

wish me luck ig xd

ornate patio
#

oh i see

#

thanks 🙂

robust crypt
#

is there anything wrong with this

#

?

buoyant viper
#

interesting choice to make the class final

#

are you registering those commands in plugin.yml @robust crypt ?

robust crypt
#

ye

#

ye

buoyant viper
#

what issues

robust crypt
#

wait

#

Error occurred while enabling DrDukyGud v1.17 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "drdukygud.me.cringe.Main.getCommand(String)" is null

indigo iron
#
    
    @EventHandler
    public void blazeSpawn(PlayerMoveEvent e) {
        
        Player player = (Player) e.getPlayer();
        Integer chance = getRandomNumberInRange(0, 100);
        
        if(chance <2 && player.isFlying() || player.isGliding() || player.isRiptiding()) {
            return;
        }
        
        if(chance < 2){
            SummerBlaze firedude =  new SummerBlaze(e.getPlayer().getLocation());
            WorldServer newworld = ((CraftWorld) e.getPlayer().getWorld()).getHandle();
            newworld.addEntity(firedude);
            
        }
         
    }
    
    @EventHandler
    public void onSpawn(EntitySpawnEvent ee) {
        
        Entity blaze = (Entity) ee.getEntity();
        Location loc = blaze.getLocation();
        double locx = loc.getX();
        double locz = loc.getZ();
Line>>>45    if(blaze.getCustomName().contains(ChatColor.GOLD + "fire dude") && !(locx < 101 && locx > -101 && locz < 101 && locz > -101)) {
            ee.setCancelled(true); 
            
        }
    }

    private static int getRandomNumberInRange(int min, int max) {
        if (min >= max) {
            throw new IllegalArgumentException("max must be greater than min");
        } else {
            Random r = new Random();
            return r.nextInt(max - min + 1) + min;
        }
    }
}```
I am getting a lot of null exception errors in line 45 not sure why
buoyant viper
#

?paste

undone axleBOT
buoyant viper
#

does /nick get registered at least @robust crypt

#

or neither

robust crypt
#

ye

buoyant viper
#

neither?

robust crypt
#

./nick work but not nick2

buoyant viper
#

@robust crypt perhaps its a format issue, try encompassing the aliases in [ and ]

#

that shouldnt b the issue i think but

buoyant viper
proud basin
#

What's the driver for mysql?

buoyant viper
proud basin
#

Thank you just needed com.mysql.jdbc.Driver

hasty prawn
#

Send your onEnable @robust crypt

indigo iron
hasty prawn
robust crypt
#

no

proud basin
#

DrDuky you should stop naming your Main classes Main

#

bad practice

urban lava
#

how woudl i get a potion effect from its ID, like 1 is speed, 2 is slowness etc

hasty prawn
#

Try taking the "2" out of the command? Maybe it doesn't like that for some reason?

robust crypt
torn shuttle
#

naming convention dictates your main class should be your project's name

proud basin
#

naming convention

#

oh

#

^^

granite burrow
#

ah makes sense then

hasty prawn
buoyant viper
proud basin
#

god damn Max Bans Plus doesn't look like works with my sql

#

rip

urban lava
#

because i also only want it to be positive

robust crypt
#

it worked out thx

hasty prawn
robust crypt
#

:)

hasty prawn
#

Could even make a static List<PotionEffectType> of all the positive effects and randomize from that one

urban lava
#

i know its not good practice but im stupid

hasty prawn
#

Hmm... alright then I guess. Won't work for potion effects past 1.13 probably.

#

Unless Spigot assigns them an ID

#

Which it does :l

buoyant viper
#

i think spigot assigns

#

yeah

#

PotionEffectTypeWrapper

hasty prawn
#

Mhm

#

Fair enough I guess lol

urban lava
#

:)

hasty prawn
#

smh

#

😂

urban lava
#

java with curly brackets is actually nice

#

i feel like its more organized than python indents

#

and all the chads write the code in one line

sharp bough
#

if i have a hashmap and i define it as private final, like this
private final HashMap<UUID, HashMap<Integer, Long> kits = new HashMap<>();, the private means that no other class can acces it, the final means that it can only be assigned once and that it will always contain this value, does this mean that it will only create this hashmap once or that it will always be an empty hashmap? if so why does this code work?https://paste.md-5.net/asofitataw.cs
its creating a new instance of the hashmap without making it final.
if i make it final and add a value inside this class in a method, will this produce nullpoint because you cant edit the final value of the variable? im so confussed rn

hasty prawn
#

It creates it once, but doesn't make it Immutable

buoyant viper
#

@sharp bough setting kits to final means you cant run something like kits = value at any other point in the code

hasty prawn
#

So you can still add things to it, you just can't set it as another HashMap object

sharp bough
#

you guys just said opposite things lol

buoyant viper
#

no

hasty prawn
#

We said the same thing

buoyant viper
#

we both said you cant reassign kits to another value

sharp bough
#

ooh

#

sorry

#

but i can edit the hashmap related to kits

#

so i can do kits.put...

buoyant viper
#

yes, you can edit all of its elements

hasty prawn
#

Yes, you can still add/remove to it.

sharp bough
#

k thanks

#

wait no , so how does the code i sent work

#

the link

#

its creating a new instance of the class

#

but still keeps the data

buoyant viper
#

the code you sent initializes kit as an empty HashMap

#

you can then put/remove elements in and out of it later

#

but you cant reassign it to another HashMap

#

so having kit = new HashMap<>(); anywhere else would throw i believe a runtime error

hasty prawn
#

Also static & final aren't the same. If it's not static, a final variable still gets created for each instance.

buoyant viper
#

but stuff like kit.put(key, value) will work

torn shuttle
#

?paste

undone axleBOT
torn shuttle
hasty prawn
#

Why aren't all the variables at the top

torn shuttle
#

there are enums in there

buoyant viper
torn shuttle
#

I don't use enums for paths anymore because it takes up too much space at scale

torn shuttle
#

essentially they are above the methods that actually use them

hasty prawn
#

ehhh still think they should be at the top

#

Maybe in the right order still but it looks weird IMO

torn shuttle
#

I'd rather retain the execution order, also less scrolling as more stuff gets added

haughty plover
#

Does anyone here help with protocollib or is this just strictly spigot?

torn shuttle
#

one of my classes was getting so large I had three windows of the same class open at once to add new fields symmetrically

hasty prawn
#

As long as you know what you're doing I guess. ¯_(ツ)_/¯

torn shuttle
#

I'm going to have so much fun redoing all of my configs in this format...

#

even with all the fields on there I think I'll be able to cut those 850 lines down to 400-500 with the new format

sharp bough
#

when you register a command using ...setExecutor(new CommandExecutorClass()) does this create a new instance of the entire class or just the method defined with @Override onCommand?

dusk flicker
#

that would be a new instance of the class as you are doing new ClassName()

sage swift
#

what is a clase

#

!learnjava

#

?learn java

#

?vagina

sharp bough
#

?learn commands

#

lol

#

look at this guy

#

indian accent 13 min video

#

10/10

ornate patio
#

so i have this basic plugin:

public class Main extends JavaPlugin implements Listener {
    
    @Override
    public void onEnable() {
        Bukkit.getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {

    }

    @EventHandler
    public void onEntityExplode(EntityExplodeEvent event) {
        // ... stuff
    }
}

how can I seperate the onEntityExplode event into another file?

restive mango
#

how would i go about creating a plugin mob which is literally just a mob with a different model? like is there any way i can make a zombie where the only diff is that it uses the model of an ender dragon?

sharp bough
#

lol

restive mango
#

because i thought there was a giant wall of text

#

that was longer than my display

restive mango
#

the model.

#

like idc if it doesnt move even

sharp bough
#

implement listenner

restive mango
#

a zombie has a 'zombie' model

#

like the zombie

sharp bough
#

and make the listener

restive mango
#

the creature

#

in the wrodl

#

world

sharp bough
#

getServer().getPluginManager().registerEvents(new ClassName(), this);

ornate patio
#

but like do I need to do anything in Main or no?

sharp bough
#

yes in the main add getServer().getPluginManager().registerEvents(new ClassName(), this);

#

then create a new class

restive mango
#

literally all im tryna do is make falling blocks which don't collide with things 😭

sharp bough
#

in the class you created

#

you need to implement listener

ornate patio
#

ill try this

#

ye i get it

sharp bough
#

and then do
@fresh templetHandler
public void MethodName(EventType event){

#

sorry even didnt mean to tag you lol

ornate patio
#

alright

restive mango
#

ah yes

#

now that you have bestowed your genius upon this gentleman please bequeath unto myself some of your awesome intellect

#

thanx

sharp bough
#

you want to remove the AI of the zombie?

#

you just want a zombie

#

but you dont want it to move

#

attack

#

or anything else?

restive mango
#

oh

#

haha

#

the reality is

#

i want to make a falling block entity

#

that doesn't collide

#

with blocks

restive mango
#

i've thought about making them ride vexes

sharp bough
restive mango
#

but

#

it's tuff

sage swift
#

@fresh temple do you enjoy this

ornate patio
#

just one question, how is onCommand different?

#

i've searched up online and the process for splitting up commands is very weird

sharp bough
#

and in the class you do

  @Override (if you just type @Over it should autocomplete the onCommand)
  pulic boolean onCommand(...){
  return true; always return true here, if you dont it will send the usage message in the plugin.yml

and then you register the command in the plugin.yml file

#

using

commands:
  COMMAND:
    description: 
    usage: 

etc theres a bunch of things you can add there

ornate patio
#

ok thanks so much

#

also one more thing

#

how can i customize this list of suggestions?

sharp bough
#

if you made the plugin you can

#

otherwise you cant

#

maybe this can help

#

but never really made a suggestion

#

yooo realLine, what happend yesterday? did you manage to fix your error?

#

i was so tired i couldnt even read

#

but what was it?

#

hahaaaa nice

#

about this, i have no idea

ornate patio
#

doesnt really matter for now

#

anyways i want to split up my plugin into two:
one file for handling commands
and the other for tracking a specific player, where the player to be tracked is set by the commands

granite burrow
# ornate patio how can i customize this list of suggestions?

Learn how to add tab completer to your commands! Super fast and easy :)

~ Sorry I missed last week, been super sick. More videos coming soon once I'm fully healed :D
CodedRed.setHealth(20.0);

------ Links ------

Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-developers

Download Spigot: htt...

▶ Play video
#

idk if its the best practice but it works

ornate patio
granite burrow
#

alright if you need to know how to add more tab arguments message me and I can help

ornate patio
#

👍

granite burrow
ornate patio
#

two classes

granite burrow
#

idk if this is the best way to do it but I use this

I just add this right under the class declaration so

public class testClass {
  private ClassName variableName = new ClassName (); // This will get the class
}
#

then you can call that class by whatever variableName you use

ornate patio
#

hmm

#

ok i don't see how it would work

#

i have Commands.java and Tracking.java

#

so if i do /track someGuy, tracking.java should somehow pick that up

ornate patio
granite burrow
#

so you want to run a method from tracking.java in your main class?

ornate patio
#

well

#

yeah

#
public class Main extends JavaPlugin implements Listener {
    Player trackedPlayer;
}
#

as in

#

I want Commands to be able to update trackedPlayer

#

and then have Tracking do whatever with that

quaint mantle
#

pass it as an argument to Commands? kinda depends on your code

granite burrow
#

Main.java

public class Main extends JavaPlugin {
  private Tracking tracking = new Tracking(); // Get the tracking class
  Player trackedPlayer = tracking.getPlayer();
}

Tracking.java

public class Tracking {
  
  private Player target = blah;

   public Player getPlayer() {
      return Player;      
    } 
}
#

would look something like that

#

if you wanted to get the target from the tracking class

ornate patio
#

oh i see

#

so correct me if i'm wrong main.java would look something like this:

#
package me.okay.Manhunt;

import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    Player trackedPlayer;
    TrackCompass trackCompass = new TrackCompass();
    Commands commands = new Commands();

    @Override
    public void onEnable() {

        getCommand("tracking").setExecutor(commands);
        getServer().getPluginManager().registerEvents(trackCompass, this);
    }

    @Override
    public void onDisable() {

    }
}
#

so then, when I want to get the player

faint vector
#

is there any event to check when someone opes a book

ornate patio
#

i just do commands.getTrackingPlayer() and pass that in to some method of trackCompass?

granite burrow
faint vector
granite burrow
#

uh after I finish with okay ill look more into it for you 😄

faint vector
ornate patio
granite burrow
#

im confused by what your asking sorry

#

if you want to get something from your main class then you can do something like this:

    private static Main plugin = Main.getPlugin(Main.class); // Get this from main
#

that will make it so plugin will be the one to get any of the methods in main

ornate patio
#

ok lmao here lemme make it as clear as a i can:

granite burrow
quaint mantle
#

but

#

no

granite burrow
#

then whats the right way?

#

im all ears lmao

quaint mantle
#

dependency injection or static singleton

#

preferably the first

granite burrow
#

how would you do it?

quaint mantle
#

dependency injection

granite burrow
#

oh alright

#

ill look into that and try to implement it later

ornate patio
#

I have this Commands class:

package me.okay.Manhunt;

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

public class Commands implements CommandExecutor {
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (label.equals("manhunt")) {
            // set the tracking player
        }

        return true;
    }
}

Now, at the comment in the code shown above, I want it to update a variable inside my Main class

public class Main extends JavaPlugin {
    Player trackedPlayer;

After that, Main should invoke a method of another class, TrackCompass, and pass the information originally given from Commands over to TrackCompass

granite burrow
ornate patio
granite burrow
#

oh lmao cool so that would be the proper way?

#

im gonna read more later but that was what I got from a glance

quaint mantle
granite burrow
#

Id listen to him he wrote on spigot wiki knows alot more than me for sure

quaint mantle
forest edge
#

Is anyone aware as to the possibility of sending boss bar text without a boss bar?

granite burrow
#

imagine can my name be changed back to my discord username by chance?

quaint mantle
#

?namechange

granite burrow
#

cool thank you 😄

quaint mantle
#

?changename

undone axleBOT
#

Name changes on the forums are granted to those who have donated to the project. Donations are processed manually and generally take up to 24 hours. The donation widget can be found on the home page of SpigotMC at: https://www.spigotmc.org/.

granite burrow
#

any ammount? or is there a threshold?

quaint mantle
#

5 usd or more i think

proud basin
granite burrow
#

okay cool ill do that in a bit I gotta figure out if theres another way to track if a book is opened other than right click event

granite burrow
granite burrow
#

no problem sorry I couldnt do more

faint vector
#

its fine

granite burrow
#

ight brb

faint vector
#

THANKS

granite burrow
#

no prob

buoyant viper
buoyant viper
proud basin
#

Yea I'm trying to figure out what it is

buoyant viper
#

whats it from

proud basin
#

A value from mysql

#

from a plugin storing data

buoyant viper
#

what kind of value are u grabbing

proud basin
#

I'm not too sure

#

It's not my plugin

quaint mantle
#

is it possible to add Strings to String[]

#

is this channel dead wth

proud basin
#

What do you mean? @quaint mantle

quaint mantle
#

is that a collection

#

idk if it is

#

String[] === multiple strings, as mpst poeple know

#

is it possible to like, loop lines of a file.. and add them to a String[]

midnight galleon
#

What is the entity class for Furnace minecart, I cant seem to find it

young knoll
granite burrow
#

uh

#

they do...

quaint mantle
#

any idea why this wont work..?

#

the top String[] ri = Main.blahblah

#

oh im stupid nvm

proud basin
#

sir

#

yea

young knoll
#

Huh, forgot you could stick the data tag on items

#

Anyway you can’t read that without NMS I would guess

quaint mantle
granite burrow
#

Yeah im using nms

young knoll
#

Well you’ll have to work your way through the compound tags

granite burrow
#
net.minecraft.world.item.ItemStack spawnerNMS = CraftItemStack.asNMSCopy(spawner);
        
        if (!spawnerNMS.hasTag()) { return; }
        
        NBTTagCompound spawnerTags = spawnerNMS.getTag();
        
        NBTBase spawnerNBT = spawnerTags;
#

thats the code im using

fluid cypress
#
[01:34:39 INFO]: Thread RCON Client /127.0.0.1 started
[01:34:39 INFO]: Thread RCON Client /127.0.0.1 shutting down
[01:34:39 INFO]: Thread RCON Client /127.0.0.1 started
[01:34:39 INFO]: Thread RCON Client /127.0.0.1 shutting down
[01:40:24 INFO]: Thread RCON Client /127.0.0.1 started
[01:40:24 INFO]: Thread RCON Client /127.0.0.1 shutting down
[01:40:24 INFO]: Thread RCON Client /127.0.0.1 started
[01:40:24 INFO]: Thread RCON Client /127.0.0.1 shutting down
[01:40:24 INFO]: Thread RCON Client /127.0.0.1 started
[01:40:24 INFO]: Thread RCON Client /127.0.0.1 shutting down

any idea why the server is not shutting down?
from a python script:

with mcrcon.MCRcon('localhost', 'SqrzrjiE6nH9jju5phNc', port=25585) as mcr:
    mcr.command('/stop')
#

ive set rcon.port to 25585, enable-rcon to true, and the rcon password in server.properties, do i need to change anything else?

mystic sky
#

LunarClient users cannot join trougth domain IP (Custom build)

quaint mantle
#

how can i loop something multiple times

hasty prawn
#

?learnjava

undone axleBOT
quaint mantle
#

im not sure why

hasty prawn
#

What are you doing

quaint mantle
#

i think i fixed it

#

im doing the

#

for(int i = 0; i < 100) i forgot the rest

#

im just gonna while(i != 100)

#

and add to i

hasty prawn
#

That works I guess

quaint mantle
#

thats what i thought

#

its only registering rank 0

#

twice? (3x actually)

#

pardon the reload, its an air world and test server

#

the yellow 0, and 1 are the integer rank

hasty prawn
#

It's not registering 0 twice, 0 and 1 have the same name

hasty prawn
#

They're both named "L"

quaint mantle
#

theres more

#

none of them are L aside from rank 0

hasty prawn
#

What does it return if the id isn't found?

quaint mantle
#

it wont return

#

it'Ll just return {""}

hasty prawn
#

What is this? Send that whole file in a paste

#

?paste

undone axleBOT
quaint mantle
#

the this."fewofkofw are strings because for some reason it wouldnt work if i just used String color = "whatnot"

hasty prawn
#

Can you still send the entire file?

quaint mantle
#

OH yeah

#

sorry im such a noob

#

im just trying to make something "cool"

hasty prawn
#

You should create a Rank class/enum and use these values in that

#

Enum would be the best.

quaint mantle
#

ahh

#

for now, the rank sSystem aside

#

any idea whats with the while()?

thorn linden
#

Help! I wanna dev who can make a minecraft server for me

#

Any here?

hasty prawn
quaint mantle
#

how do u remove all dropped items?

hasty prawn
#

Look through the World's entities, check if it's an Item, Item#remove

undone axleBOT
quaint mantle
hasty prawn
#

So loop through all the worlds and do it

grizzled scroll
thorn linden
proud basin
#

this this this

quaint mantle
#

?

buoyant viper
buoyant viper
quaint mantle
#

...

#

udumb

buoyant viper
#

its not wrong

quaint mantle
#

tru

quaint mantle
buoyant viper
#

its w/e

granite burrow
#

Whats the best way to get players health on leave

#

and restore it on join

#

(reason: In my plugin I give players an extra bar of health)

hasty prawn
#

Listen to PlayerJoinEvent and PlayerQuitEvent

granite burrow
#

yeah but how can I restore it when they leave and join? im already listening to it

hasty prawn
#

Just apply it like you did the first time?

#

I assume you're already giving them the extra bar, just do that onJoin

granite burrow
#

that wouldn't be taking into account any of the health they had in the second bar

#

I want them to keep the same health like if they had 2 hearts missing out it would be 36/40 health but if I do the logic that I have now since their health bar would still be 20/20 on join it would add back the extra 2 hearts that they lost

#

like the get the extra bar on join but they don't keep the health they had

harsh ibex
#

qHey I have a Weird Issue,

  • Players rubberband
  • when they rubberband it usaully says "Your teleport was a Success!"
  • There is no rubberbanding or teleport was a success for OP
hasty prawn
proud basin
#

no don't remove plugins

#

are you on crack dessie

hasty prawn
#

How else do you recommend figuring out what plugin is causing issues?

proud basin
#

Just disable them

hasty prawn
#

That works too I guess, if you know how to do that.

proud basin
#

I mean it isn't that difficult

#

It's much more efficient

hasty prawn
#

Sure ¯_(ツ)_/¯

proud basin
#

🤷

granite burrow
hasty prawn
#

Yeah, I think you're just gonna have to save how much extra health they had when they left & then add that to them when they rejoin.

#

Health boost is really weird with how it works.

granite burrow
#

alright, an extra file but should be a couple kiobytes

granite burrow
hasty prawn
#

I remember I made a Spigot patch to fix Health Boost resetting when re-applied lmao

#

It's a really buggy effect IMO but oh well

granite burrow
#

yeah, its the only way to give hearts tho so its the only thing I can use :/

young knoll
#

You can use attribute modifiers

ancient kiln
quaint mantle
#

How can I set block's skullmeta with value? (not like setOwner())

#

there is no google results (for setting block's skullmeta with value)

granite burrow
#

is it possible to cancel Bukkit.getScheduler().runTaskLater

quaint mantle
#

or just cancel()

granite burrow
#

can I cancel it outside of the scheduler?

ornate patio
#

is it possible to make compasses work correctly in the nether?

proud basin
#

I believe so yes

ornate patio
#

I tried using setLodestone but the compass is still spinning all over the place

quaint mantle
#

What is the limit of GENERIC_MAX_HEALTH?

proud basin
ornate patio
quaint mantle
ornate patio
#

I did some quick reading online, do I need to have an actual lodestone block in order to use setLodestone?

proud basin
#

What’s setLodestone?

#

Never heard of that

quaint mantle
#

ah, theres your answer

silk mirage
#

,

quaint mantle
proud basin
#

Why not just use Player#setCompassTarget

quaint mantle
#

well if you put a huge number, and it only spawned with a number LESS than it

#

clearly that must be the max

ornate patio
proud basin
#

Can I see some code?

quaint mantle
ornate patio
#

I wish I could but I’m not on my pc atm

chrome beacon
#

In the nether you need to set the lodestone

proud basin
#

I thought you didn’t Olivo

chrome beacon
#

If you are on an old version the compass won't work

ornate patio
silk mirage
chrome beacon
#

^^

proud basin
#

I always thought lodestone was useless

chrome beacon
#

No need for a block there

ornate patio
silk mirage
#

Lodestone is really usefl

silk mirage
ornate patio
#

Location location = (Location) player.getLocation()

proud basin
#

chrome beacon
#

Why are you casting

proud basin
#

^

ornate patio
#

Well I probably wasn’t then i don’t remember what I put

silk mirage
quaint mantle
#

wt

#

lol

quaint mantle
ornate patio
quaint mantle
#

kinda cringe

silk mirage
proud basin
#

dweam

silk mirage
#

Oh Dreamm!

granite burrow
ornate patio
chrome beacon
#

There are already like a 100 tracking plugins

ornate patio
#

or something like that

silk mirage
ornate patio
chrome beacon
#

I even made one (private)

ornate patio
#

I’m doing more than tracking

chrome beacon
#

Hence why I know the need for lodestone location

ornate patio
proud basin
#

Olivo will give you his/her source code 🙂

chrome beacon
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

granite burrow
silk mirage
ornate patio
# chrome beacon ?spoon

it’s not really spoonfeeding I’m gonna legit try to make sure I understand ¯_(ツ)_/¯

ornate patio
proud basin
#

He did ?spoon because of what I said

chrome beacon
proud basin
#

although they will grow out of it

#

It’s like feeding a baby

chrome beacon
proud basin
#

they grow out of it at some point

proud basin
#

copy and pasta

ornate patio
#

god that’s hard to type on mobile

silk mirage
#

Also, To update the compass, you'll have to do a loop through online players

silk mirage
#

hm, Alright, So what is being wrong?

ornate patio
#

hmm do I have to set lodestonetracked to false?

silk mirage
#

CompassMeta#setLodestoneTracked(false)

#

Go to javadocs

chrome beacon
#

Yeah

#

Also don't forget to save the item meta

ornate patio
ornate patio
#

thanks so much though, will try it out when I can

quaint mantle
#

Block#setType(); not working!

Hi, spigot this is my code.

                        block.getLocation().getBlock().setType(Material.BEDROCK);```

player teleports well, but
block isn't changing. (location, block isn't null)
chrome beacon
#

Anyway it should just be set lodestone tracked

ornate patio
#

is it also possible to get rid of the enchanted glow with the lodestone

silk mirage
chrome beacon
#

It can be

quaint mantle
chrome beacon
silk mirage
quaint mantle
#

as I said, teleports player works well

silk mirage
#

do a log of location, block and block type

#

check if it works

quaint mantle
#

yeah I already do it

#

do you want see it?

quaint mantle
#

here you go!

#

wait

#

type=BEDROCK what

#

block isn't updated in game

silk mirage
#

Umm, intresting

quaint mantle
#

yeah also, we haven't event.setCancelled(true) or another replace

chrome beacon
#

Make sure you're looking at the right block

quaint mantle
#

ok! i made sure

#

It's correct

#
                        SkullMeta skullMeta = totoAPI.setSkullByValue("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzVlMmUwOTU5NzEyZGNkMzM1N2NjM2NlYTg1Zjk5YjNmZDgwOTc4NTVjNzU0YjliMTcxZjk2MzUxNDIyNWQifX19");
                        skullMeta.setDisplayName("apple");
                        skullMeta.setLore(Arrays.asList(" lore"));
                        itemStack.setItemMeta(skullMeta);
                        // event.setCancelled(true);
                        event.getPlayer().teleport(block.getLocation());
                        block.getLocation().getBlock().setType(Material.BEDROCK);
                        Bukkit.broadcastMessage(block.getLocation().toString());
                        Bukkit.broadcastMessage(event.getBlock().toString());
                        event.getBlock().getWorld().dropItem(event.getBlock().getLocation(), itemStack);``` here is my full code
silk mirage
#

So

#

Can you show your plugin.yml

#

and what version are u using

#

@quaint mantle

tardy delta
#

yes or if it's from a sapling placed by a player

quaint mantle
#

yoo

#
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at com.ankledev.nectar.serverevent.Server.onJoin(Server.java:77) ~[?:?]
        at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor71.execute(Unknown Source) ~[?:?]
        at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.17.jar:git-Paper-79]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.17.jar:git-Paper-79]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.17.jar:git-Paper-79]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.players.PlayerList.postChunkLoadJoin(PlayerList.java:357) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.players.PlayerList.lambda$placeNewPlayer$1(PlayerList.java:299) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.tick(ServerGamePacketListenerImpl.java:308) ~[?:?]
        at net.minecraft.network.Connection.tick(Connection.java:399) ~[?:?]
        at net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:196) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1576) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:477) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1404) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1180) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-79]
        at java.lang.Thread.run(Thread.java:831) [?:?]```
#

any idea why thats happening

#

i dont have any length checkers.. so idk what Index 1 out of bounds for length 1 is

#

i also double-checked, and none of my indexes are out of bounds lol

rigid otter
#

Hello! Should we cancel BukkitScheduler.runTask()? I mean it will run forever or it will stop after what done in lambda? If it run forever, we should .cancel it.

quaint mantle
#

i dont have anything that checks for the length of an Array[1] for the length of 1 though

chrome beacon
quaint mantle
#

i know it wont work

#

but the error claims i have something that checks for the length of Array[1] i think??

chrome beacon
#

No you're accessing something out of bounds

#

I.e larger than the array

quaint mantle
#

i wonder what 😱

chrome beacon
#

Show your code and maybe we can help

quaint mantle
#

i think i'll debug first?

chrome beacon
#

Aight

quaint mantle
#

i did the bad thing

#

i split something by "" without noticing 😳

runic mango
#

hi, sorry for the late response, i got the expected response but things that depend on the config don't change

unreal quartz
#

.___.

chrome beacon
runic mango
#

omg

#

that fixed it

chrome beacon
#

Great 🙂

runic mango
#

thank you so much god i spent way too long on trying to fix that

supple elk
#

xd

runic mango
#

wait

#

h it doesn't seem to have actually saved to the file

#

hi @chrome beacon sorry for the ping but I'm getting nowhere with this :c

#

or it could just magically fix itself apparently

#

ok then

chrome beacon
#

um k?

burnt current
#

Hey, I would like to program a method in my plugin that I could call in the joinlistener, which then saves the player's values in a MySQL database when a player joins the server for the first time. I have already dealt with JDBC and know how to create a table via JDBC, but I got stuck when reading and inserting data, because somehow nothing really works and every tutorial says something different. Can anyone help me with this?

quaint mantle
#

How do i set server resource pack without using Bukkit.getPlayer().setResourcePack()?

burnt current
#

So first I tried to create the following method in an extra class:

public class addPlayer {
    public static void addPlayer(String username, UUID uuid, int coins) {
        Database.update("insert into playerdata (username, uuid, coins) values ('"+username+"','"+uuid+"','"+coins+")");
    }

My idea was to call it later in the right place.
However, this had not worked. Then I got the recommendation for another tutorial. There it says as an example that the same class should be made as follows:

public static boolean addPlayer(String username, UUID uuid, int coins) {
        try (Connection conn = conn(); PreparedStatement stmt = conn.prepareStatement(
                "INSERT INTO playerdata(username, uuid, coins) VALUES(?, ?, ?)")) {
            stmt.setString(1, username);
            stmt.setString(2,  uuid.toString());
            stmt.setInt(3, coins);
            stmt.execute();
            return true;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;
    }

But with this method, my IDE gives me the error "Method call expected" in the try block when calling con().

quaint mantle
#

Can someone help me? After formatting the file, it shortens the code. How do I use my full screen?

ivory sleet
#

Probably some setting for hard wrap line length

quaint mantle
#

Hello, spigot!

How do you place the player's head? (but I want to set the head skin with value instead of 'setOwner()' like )

#

eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzVlMmUwOTU5NzEyZGNkMzM1N2NjM2NlYTg1Zjk5YjNmZDgwOTc4NTVjNzU0YjliMTcxZjk2MzUxNDIyNWQifX19 << value example

#

We can't use ItemStack because we'll place it

#

we can't place itemstack right?

vernal pier
#

if you using paper you can setplayerprofile

tardy delta
#

is this something bukkit that when you place gravel in the air (for example with worldedit) it just falls down and it breaks?

#

could also be a plugin causing it

quaint mantle
quaint mantle
#

there is 0 tutorial/thread on spigot database 😦

urban lava
#
package io.github.Epicmania.randompotionplugin;


import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;

import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;

import org.bukkit.persistence.PersistentDataType;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public class RandomPotionEvent implements Listener{
    

    
    @EventHandler
    public void on(EntityDeathEvent event) {
        boolean randomPotionGive = event.getEntity().getKiller().getPersistentDataContainer().has(new NamespacedKey(RandomPotionPlugin.getInstance(),"randompotionplugin"), PersistentDataType.INTEGER);
        if (randomPotionGive == true) {
            
            int potionIDNum = effectRandom();
            PotionEffectType effect = PotionEffectType.getById(potionIDNum);

            
            
            int newEffectLevel = effectLevel(effect,event.getEntity().getKiller()) + 1;
            
            event.getEntity().getKiller().addPotionEffect(new PotionEffect(effect,Integer.MAX_VALUE,newEffectLevel));
            }
        }
    public int effectRandom() {
        while (true) {
            int[] goodPotionEffects = {1,3,5,8,10,11,12,13,14,16,21,22,23,24,26,28,29,30,32};
            int randomNum = ThreadLocalRandom.current().nextInt(1,33);
            if (Arrays.asList(goodPotionEffects).contains(randomNum)) {
                return randomNum;
            }
        }
    }
    public int effectLevel(PotionEffectType effect, Player player) {
        int effectLevel = 0;
        if (player.hasPotionEffect(effect)==true) {
            effectLevel = player.getPotionEffect(effect).getAmplifier();
        }
        else if (player.hasPotionEffect(effect)==false) {
            effectLevel = 0;
        }
        return effectLevel;
    }

}

Are there any issues with this code that would crash the server, because paper crashes when the event is called.

ivory sleet
#

public int effectRandom() {
while (true) {
int[] goodPotionEffects = {1,3,5,8,10,11,12,13,14,16,21,22,23,24,26,28,29,30,32};
int randomNum = ThreadLocalRandom.current().nextInt(1,33);
if (Arrays.asList(goodPotionEffects).contains(randomNum)) {
return randomNum;
}
}
}

#

that while loop

#

also randomPotionGive == true

#

is redundant

#

just check (randomPotionGive)

urban lava
#

wait does that auto check if its ture

ivory sleet
#

mhm

#

well

#

auto check is the wrong word

urban lava
#

whats wrong with the while loop tho

tardy delta
#

is there some method to check if a player has a scoreboard?

#

xd

urban lava
#

you should probably use persistent data

#

cuz i dont think spigot interfaces well with mc commands

silk mirage
#

that while(true) is making my head die

ivory sleet
burnt current
# burnt current So first I tried to create the following method in an extra class: ```java publi...

Oh I think I found out what the problem was. I have now replaced what was in the parenthesis directly after try with

PreparedStatement stmt = Database.getConnection().prepareStatement(
                "INSERT INTO playerdata(username, uuid, coins) VALUES(?, ?, ?)")

now this error doesn't come up anymore. But when joining the server I now get the following console output:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''false)' at line 1

does anyone know how i can fix this?

ivory sleet
#

assuming that your predicate is fale (the contains thing) then it will try again until its true right

#

and its just once it can return that the server thread execution can continue

silk mirage
urban lava
#

can i pikc a random number from an array?

ivory sleet
#

yeah

urban lava
#

wait

#

i can just gen a random that is in the index

#

ok ill just do that

ivory sleet
#

thats how I would do it too :]

urban lava
#

does this look better

    public int effectRandom() {
        int randomNum = 0;
        int[] goodPotionEffects = {1,3,5,8,10,11,12,13,14,16,21,22,23,24,26,28,29,30,32};
        randomNum = ThreadLocalRandom.current().nextInt(0,goodPotionEffects.length+1);
        return randomNum;
    }
#

oops

#

i forgot to sort through array

#

im stupid

ivory sleet
#

Just return goodPotionEffects[ThreadLocalRandom.current().nextInt(goodPotionEffects.length)]; ?

urban lava
#

or 1

vernal island
#

Hi conclure please check your pms mate

urban lava
#

cuz ik it excludes the last number

ivory sleet
#

That would grab a random element in the array

urban lava
#

no but would the randomize generator from 0 or 1, because if it starts from 1 then you would never get speed

ivory sleet
#

Random#nextInt(int number) generates from 0 to number-1

urban lava
#

ok

#

thanks

ivory sleet
#

So nextInt(5) can give u 0-4

opal juniper
#

but what if i wanted it inclusive Sadge

ivory sleet
#

just + 1

opal juniper
#

yeah but that is stupid

ivory sleet
#

I mean it's not really an issue

opal juniper
#

lmao im just joking with u

ivory sleet
fathom island
#

I have a doubt, can you make an enderpearl invisible?

opal juniper
#

technically yeah i guess

quaint mantle
#

How can i disable /[tab] and show the commands that i listed in config without protocollib

tardy delta
#

finally fixed :p

reef wind
tardy delta
#

xd true

#

only one with altmanager

#

😄

quaint mantle
reef wind
#

Future has alt manager too

tardy delta
#

also usefull for tesing the anticheat

reef wind
#

yeah ik ik i was joking

tardy delta
#

😂

opal juniper
#

Not familiar with databases, so no

ivory sleet
#

I believe someone already responded to that anyways

burnt current
#

yes but he had not answered me again

ivory sleet
#

Would be helpful if you could show some more code

burnt current
#

ok. What do you need?

urban lava
#

@ivory sleet the randomization works but now the potion effects dont stack, this is my code

@EventHandler
    public void on(EntityDeathEvent event) {
        if (event.getEntity() instanceof Player) {
            boolean randomPotionGive = event.getEntity().getKiller().getPersistentDataContainer().has(new NamespacedKey(RandomPotionPlugin.getInstance(),"randompotionplugin"), PersistentDataType.INTEGER);
            if (randomPotionGive) {
            
                int potionIDNum = effectRandom();
                PotionEffectType effect = PotionEffectType.getById(potionIDNum);

            
            
                int newEffectLevel = effectLevel(effect,event.getEntity().getKiller()) + 1;
            
                event.getEntity().getKiller().addPotionEffect(new PotionEffect(effect,Integer.MAX_VALUE,newEffectLevel-1,false,false));
            }
        }
        }
    public int effectRandom() {
        int randomNum = 0;
        int[] goodPotionEffects = {1,3,5,8,10,11,12,13,14,16,21,22,23,24,26,28,29,30,32};
        return goodPotionEffects[ThreadLocalRandom.current().nextInt(goodPotionEffects.length)];
    }
    public int effectLevel(PotionEffectType effect, Player player) {
        int effectLevel = 0;
        if (player.hasPotionEffect(effect)==true) {
            effectLevel = player.getPotionEffect(effect).getAmplifier();
        }
        else if (player.hasPotionEffect(effect)==false) {
            effectLevel = 0;
        }
        return effectLevel;
    }
chrome beacon
#

Why are you using == true and == false :sadge:

runic mango
#

q: im trying to listen and modify AsyncChatEvent but im a bit lost:

public class inline_dice_listener implements Listener {
    @EventHandler
    public void onChat(AsyncChatEvent event) {
        String msg = event.message().toString();
        if (msg.contains("[[") && msg.contains("]]")) {

            TextComponent new_msg = new TextComponent("Hello ");
            event.message(new_msg); 
            // requires component, not TextComponent but no clue how to create that
            //.message is private and .setmessage() doesn't exist
        }
    }
ivory sleet
#

Isn’t it called AsyncPlayerChatEvent

runic mango
#

h

urban lava
#

i can jsut do else

runic mango
#

is there a paper support discord somewhere

chrome beacon
urban lava
#

and no equals true

#

ig

quaint mantle
#

Can you provide a reload code for the plugin please?

chrome beacon
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

chrome beacon
urban lava
#

thanks

chrome beacon
#

This should have been covered in java basics

urban lava
#

ill keep that in mind

tardy delta
#

does this looks like a good check for permission?

#

name is the plugin name

chrome beacon
#

isOp check isn't really needed

#

But other than that looks fine

quaint mantle
#

How can I do reload config.yml?

tardy delta
#

but for some reason people cant access player commands

quaint mantle
chrome beacon
tardy delta
#

like i put this in my onCommand and all the permissions are also defined in the plugin.yml

urban lava
quaint mantle
ivory sleet
#

runTask just queues that runnable command to the server thread which is to be executed the next tick and that’s it

tardy delta
#

this will give default access right?

#

and still it doesnt work

ivory sleet
#

You’d use runTaskTimer if you want to run something with a fixed interval

quaint mantle
#

How could i update a specific line in my scoreboard im trying to put money in the scoreboard and making it update but it just adds the line and doesnt delete the old one

rigid otter
#

Ok thank you!

quaint mantle
#
Score s = o.getScore(C.Cl("&eMoney: " + d.money));
s.setScore(0);
p.setScoreboard(board);

o is the objective p is the player

#

d is the data of the player

quaint mantle
#

oh

crude charm
#

and then update the team

ivory sleet
crude charm
#

it removes flickering

quaint mantle
#

how do i use teams?

crude charm
quaint mantle
#

my update code:

#
Bukkit.getOnlinePlayers().parallelStream().forEach(p -> {
            PlayerData d = PlayerData.getPlayerData(p);
            Scoreboard board = d.board;
            Objective o = d.obj;



            o.setDisplaySlot(DisplaySlot.SIDEBAR);
            Score emptyScore = o.getScore("");
            emptyScore.setScore(1);

            Score s = o.getScore(C.Cl("&eMoney: " + d.money));
            s.setScore(0);
            p.setScoreboard(board);
        });
ivory sleet
#

Why are you paralleling that

crude charm
quaint mantle
#

idk my friend told me its faster

ivory sleet
#

It’s also unsafe, I don’t believe the scoreboard implementation is thread safe

quaint mantle
#

idk how i would do that with money tho

#

bc i need a different scoreboard for everyone

crude charm
#

removes flickering

#

easy and stuff

crude charm
quaint mantle
#

ye idk how that works the docs dont help me they are confusing

chrome beacon
#

What part is confusing

crude charm
#

^

quaint mantle
#

it just not clear for me

#

it doesnt explain it well for me

#

i just want examples

#

so i can understand it better

chrome beacon
#

You're going to have to learn to use those sooner or later. I recommend taking the opportunity and letting us explain things for you

crude charm
#

^

#

they are the same as java docs

#

I mean

#

they are java docs

burnt current
# ivory sleet Would be helpful if you could show some more code

What code should I send you?

I still have, the class that connects to the database, the class that creates a config file with the data needed to connect, and just the joinlistener, where so far I have just called
addPlayer.addPlayer(player.getName(), player.getUniqueId(), 100);
in relation to it. Otherwise, in the joinlistener there is a method that creates a custom head, a PlayerJoinEvent method that contains my above call and opens an inventory for the player where he can choose his language. There is also an InventoryClickevent method.

undone axleBOT
chrome beacon
#

Even better upload the entire project to github so we don't have to ask you for everything

quaint mantle
#

me or him?

crude charm
#

him

quaint mantle
#

ahh

burnt current
#

okey

quaint mantle
#

Do u guys have an example how i would use the teams thing

crude charm
quaint mantle
#

I just dont get how i would use it in my playerdata

#

or just at all how i would use it

crude charm
#

That's called spoonfeeding

quaint mantle
#

im just asking for an example

crude charm
#

I mean

#

what don't you understand

#

about the docs

#

you need to learn to use them

burnt current
crude charm
#

what ide

#

@burnt current

burnt current
#

Intellij

crude charm
#

Press the button the put it on github

burnt current
#

ohh ok thanks

tardy delta
#

is there also a way to get the player name from an uuid?

#

while that player is possibly offline

ivory sleet
#

yeah

#

make a request to mojang and cache

#

assuming you it to be up-to-date

tardy delta
#

or does this also work?
plugin.getServer().getPlayer(owner).getName();

eternal oxide
#

getPlayer can be null, if they are not online.

chrome beacon
tardy delta
desert lichen
#

Hi what is the best way to delete a world (world, world_nether and world_the_end) ? with onLoad, in the onEnable, onDisable, a separate program ?
I want the server to regenerate one after

waxen plaza
#

How do I use chatcolors when using plugin logger? I tried and it didn't work

tardy delta
#

Bukkit.getConsoleSender().sendMessage(chatcolor.idk + "")

waxen plaza
#

I can't use console sender

#

nvm

tardy delta
#

with the plugins logger it wont work

waxen plaza
#

I tried a couple mins ago and for some reason bukkit.getConsolerSender wouldn't work

#

now it does

tardy delta
#

oh

quaint mantle
#

How do u set head textures without using setOwner, so by using a minecraft link
if i try it it just makes it a steve head

#
 SkullMeta headMeta = (SkullMeta) m;
        GameProfile profile = new GameProfile(UUID.randomUUID(), null);

        profile.getProperties().put("textures", new Property("textures", url));

        try {
            Field profileField = headMeta.getClass().getDeclaredField("profile");
            profileField.setAccessible(true);
            profileField.set(headMeta, profile);
        } catch (IllegalArgumentException | NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
#

i have that

visual nimbus
#

bro what is the command to activate this plugin

proud basin
#

What plugin?

visual nimbus
#

👆

#

this one

proud basin
#

do /help BlockShuffle

visual nimbus
#

thank u

sharp bough
#

whats a simple way to allow users to edit messages without using the config file?