#help-development

1 messages · Page 1634 of 1

silver shuttle
#

change = ((randomamp / 100) * stock * variance);
Why does this statement, if variance is between 0 and 1, always return 0?

#

all values are doubles

hazy igloo
silver shuttle
#

randomamp is Math.random()
stock is a positive integer cast to double

#

variance is double, and the result of the calculation is 0 if variance is between 0 and 1

#

it shouldnt return 0, right?

#

and no, without the variance in there or if the variance is above 1 it works fine

hazy igloo
#

which exact value has stock

silver shuttle
#

currently 1000005

#

variance is 0.1

silver shuttle
hazy igloo
#

try change randomamp to 5 @silver shuttle

prime mountain
#

fuck yea

silver shuttle
hazy igloo
silver shuttle
#

ok

#

Still 0

#

OMG

#

variance = result.getInt("variance");

#

might be able to see where I'm going

#

😂

silver shuttle
quaint mantle
#

im just wondering how i can make pages of text.. something like

text here or something, and then:

  1. text here
  2. other text
  3. more text
  4. even more text
  5. etc.
quaint mantle
#

anyone?

quaint mantle
#

nevermind

#

i fugured itut out

vast sapphire
#

?paste

undone axleBOT
vast sapphire
#

trying to set a material to the config java Rewards.getInstance().getConfig().set("Reward", Material.getMaterial(args[0].toUpperCase())); is this correct?

#

it's for a command to set the material

#

i had to change it to an itemstack

restive dove
#

Hi, I am developing my plugin which connect to mongodb using mongodb-driver. I notice that there would be many spam info log print by the mongo driver, and I almost tried all solution from the web but nothing works.

The solution which seems most feasible is found in this page https://stackoverflow.com/questions/30137564/how-to-disable-mongodb-java-driver-logging and it says I will need to using ch.qos.logback to set the log level:

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import org.slf4j.LoggerFactory;

LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger rootLogger = loggerContext.getLogger("org.mongodb.driver");
rootLogger.setLevel(Level.OFF);

But with this method I am getting the error about I can't cast org.apache.logging.slf4j.Log4jLoggerFactory into ch.qos.logback.classic.LoggerContext because they are loaded by different loader:

[12:36:35] [Server thread/ERROR]: Error occurred while enabling MainSystem v0.1 (Is it up to date?)
java.lang.ClassCastException: class org.apache.logging.slf4j.Log4jLoggerFactory cannot be cast to class ch.qos.logback.classic.LoggerContext (org.apache.logging.slf4j.Log4jLoggerFactory is in unnamed module of loader 'app'; ch.qos.logback.classic.LoggerContext is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @3cff08b5)
        at com.linyuanlin.minecraft.App.onEnable(App.java:59) ~[?:?]

Can anyone help me pls 😭 😭 😭 😭

quaint mantle
#

[WARNING] .... Nag author(s): '[Baylorai]' of 'FirstPlugin' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).

#

i dont understand it

analog inlet
#

I do nothing with my plugin and mongodb prints really few

quaint mantle
#

?

vast sapphire
#

yes

restive dove
analog inlet
#

Latest

#

But is sync version

restive dove
#

I think I am using latest too

            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.3.1</version>
            <scope>compile</scope>
        </dependency>
#

And it's keep log like this

[13:05:57] [cluster-ClusterId{value='61135ab53d48fe7f95ba56a5', description='null'}-cluster0-shard-00-00.c5tdo.mongodb.net:27017/INFO]: Monitor thread successfully connected to server with description ServerDescription{address=cluster0-shard-00-00.c5tdo.mongodb.net:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=103416067, setName='atlas-5lf7u6-shard-0', canonicalAddress=cluster0-shard-00-00.c5tdo.mongodb.net:27017, hosts=[cluster0-shard-00-02.c5tdo.mongodb.net:27017, cluster0-shard-00-00.c5tdo.mongodb.net:27017, cluster0-shard-00-01.c5tdo.mongodb.net:27017], passives=[], arbiters=[], primary='cluster0-shard-00-01.c5tdo.mongodb.net:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AZURE'}, Tag{name='region', value='ASIA_EAST'}, Tag{name='workloadType', value='OPERATIONAL'}]}, electionId=null, setVersion=7, topologyVersion=TopologyVersion{processId=610bfdc47ec55924b37dd449, counter=4}, lastWriteDate=Wed Aug 11 13:05:56 CST 2021, lastUpdateTimeNanos=311005845050051}
quaint mantle
#

Thank you czkn that seemed to remove the error

#

1.17.1 got me confused with the coding hahaha

analog inlet
#

using latest non sync version with Ktor level is debug not info

restive dove
#

Thank you very much @analog inlet !!

silk mirage
#

oo

quaint mantle
#

i can find the code changes in the javadoc right?

vale ember
#

hey
is used this code to hide armorstand for all players except one, but armorstand custom name not working
for (int i = 0; i < armorStandLocations.length; i++) {
armorStands[i] = (ArmorStand) player.getWorld().spawnEntity(armorStandLocations[i], EntityType.ARMOR_STAND);
EntityHider entityHider = new EntityHider(Test.getPlugin(Test.class), EntityHider.Policy.WHITELIST);
entityHider.toggleEntity(player, armorStands[i]);
armorStands[i].setGravity(false);
armorStands[i].setCustomName(text.get(i));
armorStands[i].setCustomNameVisible(true);
armorStands[i].setCanPickupItems(false);
armorStands[i].setVisible(false);
}

bright jasper
#

I feel like this is overengineering and i could just make a static global instance of my main plugin to get these instances

public class JoinEvent {
    @Inject(optional = true)
    private TextChannel channel;

    @EventHandler
    private void onPlayerJoin(PlayerJoinEvent event) {
        channel.sendMessage(event.getPlayer().getName() + " joined the server").queue();
    }
}

should i do it this way or just pass the TextChannel in constructor

#

This is essentially how the dep injection thing is used ```java
InjectionContext injectionContext = new InjectionContext();
injectionContext.registerDependency(Database.class, database);
injectionContext.registerDependency(Config.class, config);
injectionContext.registerDependency(Locale.class, locale);

    JoinEvent joinEvent = new JoinEvent();
    injectionContext.load(joinEvent);
    eventbus.register(joinEvent);
bright jasper
#

for anyone who wants it

#

i think im deciding to not use it but yeah

#

if anyone wants to convince me otherwise feel free

marble granite
#

so, i am trying to give a villager custom pathfindergoals, but it spawns and has its own AI. this is my class:

public class AggressiveVillager extends EntityVillager {
    public AggressiveVillager(Location loc, VillagerType villagertype) {
        super(EntityTypes.VILLAGER, ((CraftWorld) loc.getWorld()).getHandle(), villagertype);

        //setting the location of the EntityVillager in the EntityVillager class.
        this.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getPitch(), loc.getYaw());

        this.setHealth(20.0f);
        this.setCustomName(new ChatComponentText(ChatColor.translateAlternateColorCodes('&', "&caggressive Villager")));

        this.setCustomNameVisible(true);
    }

    @Override
    protected void initPathfinder() {
        super.initPathfinder();
        this.targetSelector.a(0, new PathfinderGoalNearestAttackableTarget<EntityHuman>(this, EntityHuman.class, true));

    }
}
#

(its 1.16.5)

#

i have no idea what im doing wrong..

reef wind
#

you need to register the FOLLOW_RANGE and ATTACK_DAMAGE attributes.

#

@marble granite

steady rapids
marble granite
#

makes sense

#

kinda

#

NMS is tricky

dreamy scarab
dreamy scarab
#

I said I am new

#

soo..

reef wind
#

your point?

dreamy scarab
#

Idk how to add recipes and how to make the custom abilities

dreamy scarab
reef wind
#

learn spigot and read the docs

dreamy scarab
reef wind
#

I am sure spigot has an official tutorial on how to make crafting recipes too

dreamy scarab
#

oo

#

can you send the links?

#

to those

#

and btw shall i use spigot or paper what will be better/what is the difference in both?

reef wind
reef wind
dreamy scarab
#

will spiogot plugin work with paper?

reef wind
#

and paper has a few more features at least they had idk now.

dreamy scarab
#

and will there be any difference in coding

#

?

reef wind
#

paper plugins will not run on spigot if it uses papers api though.

dreamy scarab
#

oo

dreamy scarab
dreamy scarab
reef wind
#

not really paper just adds more features

dreamy scarab
#

oo

dreamy scarab
reef wind
#

API stands for application programming interface

dreamy scarab
#

oo

#

but will there be any difference in coding a spigot plugins

reef wind
#

I’m easy terms, it lets you communicate with other services.

reef wind
dreamy scarab
#

ooooooo

tidal skiff
#

how do i get the 2nd object of a hashmap

eternal night
#

hashmaps are not ordered

tidal skiff
#

like if i got replyMap.get(sender.getNam()) how would i get the second value

eternal night
#

there is no "second" object

tidal skiff
#

oh

#

ok well its a whisper command, how do i store for every player which player messaged them last?

#

i thought a hashmap could do that

eternal night
#

oh

#

it could

tidal skiff
#

o, how

hybrid spoke
#

store both with each other in the hashmap

eternal night
#

I mean a map like you proposed earlier would do it

hybrid spoke
#

player - player1
player1 - player

eternal night
#

Map<UUID, UUID>

#

sorry, maybe I understood your "second" question wrong then 😅

tidal skiff
#

ok wait im so confused

#

gimme a minute

grim ice
weak mauve
#

i want to get these "locations", what is the best way for me?

potent pecan
#

is it possible to collect a drop async?

silver shuttle
#

wait whats wrong here?

#

It says to do it that way on the Spigot docs

potent pecan
high pewter
#

Not sure if this is a suitable place to ask but does anybody have any ideas how I would format a Map<UUID,Long> in YAML? Not for saving but for loading

ivory sleet
potent pecan
ivory sleet
# high pewter Not sure if this is a suitable place to ask but does anybody have any ideas how ...

Yeah so loop through the keys and the values, I believe ConfigurationSection::getValues returns a Map<String,Object>, then check if each String key in an entry in fact is a valid UUID, then check if the Object instanceof Number, if that’s the case cast and invoke Number::longValue, else call toString on the object and see if the value there is by any chance a number which can be tested with something like Longs.tryParse(input) != null.

ivory sleet
#

It involved the world to an extent

#

But worth a try

#

Why would you do this async btw

potent pecan
ivory sleet
#

It could only hurt performance by computing such micro tasks off the server thread

high pewter
#

Thanks!

ivory sleet
#

Then split the task up into smaller ones Lorenzo

high pewter
#

Would I have to wrap the UUID in quotes?

hybrid spoke
#

a loop which loops throught every drop in a chunk isnt expensive at all. its like a split of a split of a split of a milisecond

hybrid spoke
#

but no

high pewter
#

I mean in the file

hybrid spoke
#

ah

#

yes

#

#toString

high pewter
#

Alright, thanks!

hybrid spoke
#

and deserializing it : UUID#fromString(String uuid)

ivory sleet
potent pecan
hybrid spoke
potent pecan
hybrid spoke
#

yeah no it shouldnt do anything to your performance

potent pecan
#

ok ty

dreamy scarab
#

oo wait I made a plugin
but how to add spigot in my server?
(I am hosting server on my pc not at any website)

cyan oyster
#

java.lang.IllegalArgumentException: ChunkNibbleArrays should be 2048 bytes not: 0

hybrid spoke
#

throw it in there

dreamy scarab
cyan oyster
#

[15:50:54 ERROR]: Encountered an unexpected exception
java.lang.IllegalArgumentException: ChunkNibbleArrays should be 2048 bytes not: 0
at net.minecraft.server.v1_12_R1.NibbleArray.<init>(NibbleArray.java:14) ~[server.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.ChunkRegionLoader.a(ChunkRegionLoader.java:402) ~[server.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.ChunkRegionLoader.a(ChunkRegionLoader.java:94) ~[server.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.ChunkRegionLoader.loadChunk(ChunkRegionLoader.java:72) ~[server.jar:git-Spigot-79a30d7-acbc348]
at org.bukkit.craftbukkit.v1_12_R1.chunkio.ChunkIOProvider.callStage1(ChunkIOProvider.java:21) ~[server.jar:git-Spigot-79a30d7-acbc348]
at org.bukkit.craftbukkit.v1_12_R1.chunkio.ChunkIOProvider.callStage1(ChunkIOProvider.java:1) ~[server.jar:git-Spigot-79a30d7-acbc348]
at org.bukkit.craftbukkit.v1_12_R1.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:336) ~[server.jar:git-Spigot-79a30d7-acbc348]
at org.bukkit.craftbukkit.v1_12_R1.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:295) ~[server.jar:git-Spigot-79a30d7-acbc348]
at org.bukkit.craftbukkit.v1_12_R1.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:16) ~[server.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:137) ~[server.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:120) ~[server.jar:git-Spigot-79a30d7-acbc348]
at net.minecraft.server.v1_12_R1.ChunkProviderServer.getChunkAt(ChunkProviderServer.java:116) ~[server.jar:git-Spigot-79a30d7-acbc348]

etc..

hybrid spoke
#

?paste

undone axleBOT
hybrid spoke
hybrid spoke
dreamy scarab
#

soo

cyan oyster
dreamy scarab
cyan oyster
#

my anti virus block due to torjan

steady rapids
#

can anyone help me? I did a teleport plugin that teleports you when u click a sign, problem is that if you click it 2 times, you get kicked for interacting with a block too far away

cyan oyster
#

Website blocked due to trojan

Website blocked: paste.md-5.net
Malwarebytes Browser Guard blocked this website because it may contain malware activity.

dreamy scarab
cyan oyster
#

ill use paste bin

grim ice
dreamy scarab
cyan oyster
dreamy scarab
#

its not working... :V
I did put my plugin file
(I am using a vanila server)

dreamy scarab
#

and thats why I am asking how to change this server to spigot

dreamy scarab
grim ice
#

@cyan oyster No, are you?

#

@dreamy scarab google it

cyan oyster
dreamy scarab
grim ice
#

Then search more

cyan oyster
dreamy scarab
grim ice
#

If you're not even familiar on how to make a spigot server don't bother making plugins

dreamy scarab
#

thats why I am asking how to change my server to spigot instead of vanila

grim ice
#

Google it

dreamy scarab
#

got it

grim ice
#

see?

steady rapids
#

anyone knows what is giving limits like: "moved too quickly" or "intereacted with block too far away"?
like this:
[12:25:00 WARN]: giuseppe tried to break a block 3.874818100690011E7 square blocks away from their position
I'd like to disable this or to know how to bypass it

dreamy scarab
tidal skiff
#

how do i make text italic

#

nvm

#

how do i make text have a colour AND be italic

dreamy scarab
#

so I made a plugin
and its not even showing in the plugins when i do /plugins in the server

#

how can I fix it?

#

ahmm?

hazy igloo
#

?paste

undone axleBOT
dreamy scarab
#

??

hazy igloo
#

paste it there

dreamy scarab
#

oo

hazy igloo
#

and are there some errors in the console?

dreamy scarab
hazy igloo
#

Whats about your plugin.yml?

#

Is there everything correct?

dreamy scarab
#

ahm

#

I cant paste anything here

#

i wana share a ss

#

nvm

undone axleBOT
hazy igloo
#

nvm

dreamy scarab
#

Its Showing :-
Class 'Main' is never used

#

and Method invocation 'setDisplayName' may produce 'NullPointerException'

#

last :- Typo: In word 'Namespaced'

#

uhmm?

dreamy scarab
#

any1?

silver shuttle
#

Can someone explain to me why the Long class exists?

#

And how do I properly turn a string of "20" into a Long of 20L

hidden delta
#

Long#parseLong

silver shuttle
#

yeah that dont work

#
public class xvartoggle implements CommandExecutor {
    private konstanius myplugin;

    public xvartoggle(konstanius plugin) {
        this.myplugin = plugin;
    }

    public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
        xvar = !xvar;
        if(xvar) {
            sender.sendMessage(messages_prefix + config.getString("messages.xvartoggle.toggleon").replace("&", "§"));
            variationspeed = Long.parseLong(args[0]);
            sender.sendMessage(String.valueOf(variationspeed));
            variationtoggle();
        }
        else {
            sender.sendMessage(messages_prefix + config.getString("messages.xvartoggle.toggleoff").replace("&", "§"));
        }
        return true;
    }
    public void variationtoggle() {
        scheduler.runTaskTimer(myplugin, task -> {
            if (!xvar) {
                task.cancel();
                return;
            }
            naturalvariation();
        }, 0L, variationspeed);
    }
}
#

Or something else is wrong

hidden delta
#

?paste

undone axleBOT
hidden delta
#

😞

dreamy scarab
#

can any1 help me?

hidden delta
#

Go ahead

silver shuttle
hazy igloo
silver shuttle
#

no, I mean into the delay

dreamy scarab
hazy igloo
silver shuttle
hidden delta
#

Just add parameter to your method

silver shuttle
hazy igloo
undone axleBOT
hidden delta
#

Are you execute the command without arguments?

silver shuttle
#

no

#

I did /xvartoggle 20

#

and it toggled on, but gave that error

#

and the runTaskTimer didnt start

hazy igloo
#

BukkitScheduler is null

silver shuttle
#

oh ffs

hidden delta
#

Line 34

silver shuttle
#

lemme test

hazy igloo
hidden delta
silver shuttle
#

I read that line and thought it was bs because i defined BukkitScheduler as a static

#

but i had onmly defined it empty and moved my code from main to this class

#

whilst deleting it by accident

#

thanks tho

barren moon
#

im using protocolLib and i dont understand what is bit mask and how to use it

cyan oyster
hazy igloo
barren moon
hazy igloo
dreamy scarab
#

uhmm?

dreamy scarab
silver shuttle
#

Whats wrong with this code? It is an exact copy from the Spigot Resources

narrow furnace
#

the variable is called task

silver shuttle
#

and?

narrow furnace
#

is the error there if u change it

silver shuttle
#

yes, and even worse because it wouldnt be a BukkitTask

#

but as soon as I define it as a BukkitTask the same error appears

eternal oxide
#

You are creating an Anonymous task called task when you are already using a variable called task

silver shuttle
#

Well it doesnt let me fix it

eternal oxide
#

what do you mean? just change its name

narrow furnace
#

BukkitTask task

#

change to

#

BukkitTask task2

silver shuttle
#

wtf but why can i not change the task before the arrow

#

wait no

eternal oxide
#

you can, you can name it whatever you want

narrow furnace
#

did that work

silver shuttle
hybrid spoke
silver shuttle
#

it says so on spigot

hybrid spoke
#

but you are trying to let your task2 refer to that returned BukkitTask

#

?scheduling

undone axleBOT
silver shuttle
#

what is it then

silver shuttle
#

from exactly there

hybrid spoke
#
BukkitRunnable runnable = new BukkitRunnable() {
  @Override
  public void run() {
    //TODO
  }
};
silver shuttle
eternal oxide
#

return is void

silver shuttle
#

Okay and how do I apply it to a timer instead of runTaskLater? I'm trying to be able to cancel this task from the outside

cyan oyster
vale ember
#

how to smooth rotate armorstand's right arm

silver shuttle
#

get its position and make a for loop

vale ember
#

how much each loop and what delay?

silver shuttle
#

What's the equivalent of config.getString() except to write to a String in the config?

silver shuttle
#

Changing a value in the config

#

say change this to 10

hazy igloo
#

config.set("data.variance-speed", "10"); ?

silver shuttle
#

thanks

#

I only found something completely different

#

That somehow doesnt update it

hazy igloo
#

you have to save the config

silver shuttle
#

oooh f

#

ty

#

but umm

#

wait

#

If theres other data in the config will it overwrite the rest with the default config?

silver shuttle
#

okayy

#

is there something wrong here?

#

it doesnt modify the data in the file

hazy igloo
silver shuttle
#

that gives a cant resolve

hazy igloo
#

nah sorry

silver shuttle
#

cannot resolve method save()

crude charm
#

show code for the method

silver shuttle
crude charm
#

ye

silver shuttle
#

how do you do that in IntelliJ again?

crude charm
#

?

silver shuttle
#

how do I navigate to the save() code

crude charm
#

same as any ide

silver shuttle
#

Its in the bukkit class files, not my own

crude charm
#

middle click

silver shuttle
#

thanks

crude charm
#

send error

#

?paste

undone axleBOT
silver shuttle
#

there is no erorr

crude charm
silver shuttle
#

i never compiled it with only save()

crude charm
#

what do you need help with then?

silver shuttle
crude charm
#

yeah it says what to do

hazy igloo
silver shuttle
crude charm
silver shuttle
#

I'm modifying a value in the config and trying to save it afterwards

silver shuttle
crude charm
#

whats the error

silver shuttle
#

no error, i never compiled it

narrow furnace
#

how does it not work if there is no error?

crude charm
#

...

silver shuttle
#

bro if the IDE says its not the correct way to use the method then I cant even compile it

hazy igloo
crude charm
silver shuttle
hazy igloo
# crude charm ?

he means he already tested config.save("config.yml") but it didnt work

silver shuttle
#

and gave no error

crude charm
#

is it setting?

hybrid spoke
narrow furnace
#

^

crude charm
hybrid spoke
crude charm
#

?

#

I thought he could and it didnt work

#

im so lost

silver shuttle
#

ok wait

hybrid spoke
#

I cant even compile it

silver shuttle
#

wait heres the situation

hybrid spoke
#

Challenger show us your code

narrow furnace
#

start from the beginning

hybrid spoke
#

i am to 99% sure that you just forgot the try catch

narrow furnace
#

this is confusing

silver shuttle
#

I tried to compile it with the save("config.yml")

  • it worked, but didnt save to config and gave no error

Then I tried save()

  • It doesnt compile
crude charm
hazy igloo
hybrid spoke
hybrid spoke
hazy igloo
silver shuttle
silver shuttle
#

what do I use as path then

hybrid spoke
#

plugins/YourPlugin/config.yml is meant

silver shuttle
#

ok

#

lemme try

quaint mantle
#

my Clearlagg having problems

hybrid spoke
#

also you won't evne have to do that

quaint mantle
#

when i will save a File

hybrid spoke
#

your main provides a #saveConfig method for you

#

which you can just use

quaint mantle
#

403 Invalid Coded

hybrid spoke
silver shuttle
#

like this?

hybrid spoke
silver shuttle
#

that completely overwrites the entire config tho

hybrid spoke
#

because you didn't load it before, did you?

silver shuttle
#

no?

hybrid spoke
#

see

silver shuttle
crude charm
#

just use main.saveConfig

hybrid spoke
# silver shuttle ?

a possible but probably not good way for your config.yml.
everything you need is being provided by the JavaPlugin class

    public void loadConfig() {

        getConfig().options().copyDefaults();
        saveDefaultConfig();
    }

so just add this method to your main class and use it

silver shuttle
#

okay but

#

no wait

#

I have comments in my config

#

theyre getting deleted

hybrid spoke
#

not if you use that method

silver shuttle
#

do I use the method before I modify and save or just once in the main class?

hybrid spoke
#

at first in your onEnable

#

so it preloads

#

then everytime you need to load it

silver shuttle
#

still overwrites everything

#

from this

#

to this

#

Like - I just want to modify the one Integer in data.variance-speed

eternal oxide
#

wrap all your strings in ' ' not "

#

then they will not be removed upon save

vale ember
#

Difference of PlayerInteractEntityEvent and PlayerInteractAtEntityEvent?

hybrid spoke
vale ember
#

@hybrid spoke only?

hybrid spoke
#

Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked.

silver shuttle
vale ember
#

and also how to get all mobs in range of another entity?

hybrid spoke
eternal oxide
hybrid spoke
hybrid spoke
vale ember
#

ty

silver shuttle
#

I'm just gonna store my variable for the speed in the MySQL

minor fox
#

Does anyone know of a place where you can listen to all the sounds in org.bukkit.Sound

vale ember
#

how to get which button clicked on PlayerInteractEvent and PlayerEntityInteractEvent?

vale ember
#

ty

hybrid spoke
#

but it just returns the action like air, block, physical

tidal skiff
#

'MuteChatCommand(me.catlovergammayt.doubledrops.Main)' in 'me.catlovergammayt.doubledrops.MuteChatCommand' cannot be applied to '()'

#

any help?

hybrid spoke
#

and the full exception

#

?paste

undone axleBOT
tidal skiff
#

its 2 classes

#

do i just post the 2 classes?

hybrid spoke
#

so merge them in the paste

tidal skiff
#

aight

hybrid spoke
#

you just have a constructor with a parameter

#

you need to pass the parameter

tardy delta
#

how can i write a new "root key" to the config.yml file?

tidal skiff
#

whats even a constructor wait

hybrid spoke
#

?learnjava

undone axleBOT
tidal skiff
#

im defo just stupi

#

d

hybrid spoke
#

wha..?

tardy delta
#

hey instead of this

if(isMuted == false){

                    isMuted = true;

                }else{

                    isMuted = false;

                }

use isMuted = !isMuted

tidal skiff
#

oh true

#

forgot you could do that

narrow furnace
#

...

tardy delta
#

dont make instances of the command class

#

put the muted players inside a set or something

#

and test if they are in and if so cancel the chatevent

#

😄

tidal skiff
#

well the command isnt for that it was to mute the chat in general but thx

#

then remove them when theyre unmuted

tardy delta
#

yes

#

and dont check if true == true

#

just check if true

#

💀

hybrid spoke
#

~ Confusius

tardy delta
#

anyways is event.setCancelled(false) actually a thing?

tidal skiff
#

also yes

#

it is

tardy delta
#

or it is just to provide the check direct inside it?

#

instead of an if

narrow furnace
#

if(test.getIsMuted() == true)

hybrid spoke
#

you can monitor an event and undo cancelling it iirc

tardy delta
#

if (test.isMuted() != false) 😳

narrow furnace
#

😳

tardy delta
#

😳 😄

hybrid spoke
#

this is too much input for him guys. lets concentrate on his core issue

tidal skiff
#

couldnt u just do if(test.isMuted()) and itd run if it was true but not if it isnt

narrow furnace
#

Yes

ornate heart
#

If(test.isMuted() == true && test.isMuted() != false)

tidal skiff
#

lmfao what??

tardy delta
#

😳

tidal skiff
#

i put what now

hybrid spoke
narrow furnace
#

lmao

tardy delta
#

if true && true

ornate heart
#

🙂

narrow furnace
#

test.isMutted == true

tardy delta
#

imagine having a third boolean value 🤔

hybrid spoke
#
if(true == (test.isMuted == (test.isMuted == true)) {}
tardy delta
#

🧠

ornate heart
#

clean code

tardy delta
#

if (test.isMuted == (test.isMuted == true && test.ismuted != false))

narrow furnace
#

the brain is huge

tardy delta
#

its exploding

tidal skiff
hybrid spoke
#

reminds me of a builder pattern

SomeBuilder sb = new SomeBuilder();
sb.setName("name").setName("name").setName("name").setName("name").setName("name").setName("name").setName("name");
narrow furnace
#

do you know what a constructor is

hybrid spoke
#

he don't

narrow furnace
#

learn java

#

its very basic

tidal skiff
#

bruh

hybrid spoke
tidal skiff
#

"how do i do this"
"learn the language dumbass lmao"

silver shuttle
#

Why am I getting an Empty ResultSet Error? This clearly contradicts each other

hybrid spoke
#

we are here to troll

#

and help at spigot/bungee dev.

hybrid spoke
silver shuttle
#

oh fuck

#

forgot the result =

tidal skiff
#

lmao i literally just was on w3schools

#

before u sent it

tardy delta
#

😳 😂

#

bruh i placed them horizontal is this optifine bugging or what

hybrid spoke
#

maybe that helps

tardy delta
#

yes sir smh

#

🤔

#

i remember someone told me a better one

#

something with f10

tidal skiff
#

also i cant use constructors

#

because for commands you already need a constructor

            public MuteChatCommand(Main main){

                this.main = main;

            }
#

and Main gets mad when it has more than 1 thing in it

#

and i cant exactly have 2 constructors

#

unless u can

#

idk how to tho

unreal quartz
#

what

true perch
#

How do you store an object within mysql?

unreal quartz
#

usually with each field as a column

true perch
#

and each column will store the member variables?

unreal quartz
#

that's what i said, yes

true perch
#

Thank you

quaint mantle
#

I'm using VScode for creating a spigot plugin,
c:\Users\name\Desktop\Project\Minecraft\Plugins\ProximityChat\proximitychat\src\main\java\zoony\proximitychat\ProximityChat.java:3: error: package org.bukkit does not exist

Found this error when I use a jar compiler plugin, I've set my pom.xml file correctly and even imported spigot as a maven dependency so it should work.

fading lake
#

have you downloaded all the stuff from the buildtools jar

quaint mantle
fading lake
#

they should automatically place into your .m2 folder

quaint mantle
#

Let me see.

fading lake
#

it'd be much much better if you were using intellij for this to be fair

dusk flicker
#

Use an ide not vsc

unreal quartz
fading lake
#

^

quaint mantle
unreal quartz
#

mvn package

quaint mantle
#

Alr.

barren granite
#

So I tried to make a player open a book after they run a command, using the player.openBook() thing, yet when I run the command, it comes up with an error. How do I fix it? A link to the code used: https://pastebin.com/VQeZ8snH

fading lake
#
  • delete visual studio code and burn it with fire
dusk flicker
#

Send us the error

opal juniper
dusk flicker
fading lake
#

having an aneurysm

narrow furnace
fading lake
#

okay well thats even worse

quaint mantle
#

Maven executable not found in PATH. Please specify "maven.executable.path"

fading lake
#

you havent added maven to PATH

vast sapphire
#

How do I add an enchantment through args

quaint mantle
#

Oh, bruh 1 sec.

fading lake
opal juniper
#

you need Material.WRITTEN_BOOK

#

wait

#

what is line 37

barren granite
#

player.openBook(book);

fading lake
#

thats odd lol

opal juniper
#

myeah... hmmm cause you do have a written book

fading lake
#

are you using net.minecraft.server.version.item.Material or org.bukkit.Material

#

wait your imports are there

opal juniper
#

bukkit

barren granite
#

yea

fading lake
#

@barren granite do you know how to get into spigots source code?

barren granite
#

no

fading lake
#

we could try and distinguish it that way

#

ok have you imported spigot or spigot-api

barren granite
#

into the referenced libraries, i imported a spigot file

fading lake
#

type, net.minecraft.server., do you see any minecraft versions pop up?

barren granite
#

into where?

fading lake
#

into your coding window

#

anywhere'll do

chrome beacon
fading lake
#

oh?

#

what happens in 1.17?

opal juniper
#

removed teh nms versioning like this

chrome beacon
#

1.17 uses normal packages instead of moving everything

fading lake
#

oh

#

interesting

opal juniper
#

very helpful

fading lake
#

yeah

barren granite
#

im using eclipse, and while looking through the packages from the spigot .jar, i found a package named net.minecraft.server

#

is that what you need?

fading lake
#

good yes type and import CraftPlayer

barren granite
#

into the java class where im coding the plugin?

fading lake
#

yes

#

hold ctrl and click it, it should open a window of code that you can't change

barren granite
#

I typed in import net.minecraft.server.CraftPlayer; and it has a red line under it

fading lake
#

yes, remove the net.minecraft.server

#

just CraftPlayer on its own

barren granite
#

ok

fading lake
#

then import it

barren granite
#

changed it to import CraftPlayer; and pressed ctrl and clicked it, I can now see a new window

fading lake
#

okay, press ctrl + F to bring up the search bar, type in openBook

#

can you find the method with that name?

barren granite
#

it wont let me do ctrl + f in that window for some reason

fading lake
#

ok, just scroll and see if you can find it ig

barren granite
#

ok

#

copied all of that to notepad++ and found the openBook thing

fading lake
#

ok, can you post its code? (Just that method)

#

in pastebin

#

or something

noble spire
#

?paste

undone axleBOT
quaint mantle
#

does it matter whether m2_home and maven_home is a sys var or a user var?

barren granite
vast sapphire
#

Why can't i send a json message? java String string = "§bClick here for the discord"; TextComponent msg = new TextComponent(TextComponent.fromLegacyText(string));

fading lake
#

@barren granite well the eclipse decompiler messed that up, I need to go take my drivers test, if you don't fix it after about 2 hours from now, @ me

vast sapphire
barren granite
#

ok

rare cave
#

ok then

barren granite
#

gl on your test!

unkempt ore
#

How could I go about making a double jump?

#

I need some way to see if they cycled jump in midair…

#

Tricky

tidal skiff
#

so im making a mute command and im putting the muted persons username in an array. this is all well and good but i made a check to see if the player is already muted but it doesnt work because this: "Ljava.lang.String;@440ed504Imlahi" is whats being put into the array instead of just this "Imlahi"

#

Player muteReceiver = Bukkit.getPlayer(args[0].toString()); and i'm doing this: mutedPlayers = new String[] {mutedPlayers + muteReceiver.getName().toString()};

hybrid spoke
#

remove that #toString

tidal skiff
#

why? is it automatically set to string? i just put it there in case someones username is 10925 or something

hybrid spoke
#

a String is a String

narrow furnace
#

a string is an object

tidal skiff
#

well no kidding

hybrid spoke
#

#toString returns a debug String

tidal skiff
#

alr so .getName() only ever returns a strnig?

hybrid spoke
hybrid spoke
tidal skiff
#

although that still returns Ljava.lang.String;@122643d1Imlahi even without the .toString()

hybrid spoke
#

remove every #toString

narrow furnace
#

so still an object

hybrid spoke
#

everything is an object in java

narrow furnace
#

not really

#

string literals

tidal skiff
#

...it still comes up with Ljava.lang.String;@2eaa94Imlahi

narrow furnace
#

what does muteReceiver.getName() return

hybrid spoke
tidal skiff
#

mutedPlayers = new String[] {mutedPlayers + muteReceiver.getName()}; is the right way to do it right

tidal skiff
#

oh

#

lemme check

#

i thought u said 'why'

tidal skiff
hybrid spoke
#

just use a List

#

instead of doing exactly what a List does for you

#

and even mutedPlayers +... is wrong

#

this adds the array to the array

narrow furnace
#

is the username a string

#

because that happens when you use toString on an array

tidal skiff
#

i removed the tostring

hybrid spoke
#

he adds the array to the array

#

thats the issue

narrow furnace
#

i would help a lot if we could see the rest of the code

tidal skiff
#

how would that be an issue tho 😭
im just setting the array to itself + another value

narrow furnace
#

not how arrays work

hybrid spoke
hybrid spoke
tardy delta
#

whats the best way to disable entity pushcing?

hybrid spoke
tidal skiff
#

ok the arraylist worked, ty ^^

grim ice
#

is it possible to make all living entities attack a player? like making a cow attack a player

tardy delta
#

:/

tardy delta
#

i did it on playerjoin

minor garnet
#

is it possible to make the players in the tablist be other players

vale ember
#

how to prevent player from chaning it slot

minor garnet
cyan oyster
#

caps

ivory sleet
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

opal juniper
shut field
minor garnet
#

i dont know

ivory sleet
#

Why not

minor garnet
#

ask for md_5

ivory sleet
#

PlayerItemHeldEvent is more suitable imo

minor garnet
#

or creator of bukkit

cyan oyster
#

i not gonna make that public

#

im gonna use it for my test server

shut field
ivory sleet
#

Justify

cyan oyster
#

backdoor

rapid rock
#

can someone check my bungee config cause i think i messed bungee config but idk where exactly

rapid rock
opal juniper
#

for someone

shut field
# ivory sleet Justify

"fires when a player changes there currently held item" I think that playerChangeSlotEvent would be better

ivory sleet
#

You think? That’s not an argument really

shut field
#

more descriptive, tells what it does

rapid rock
opal juniper
#

this is for plugin dev

ivory sleet
#

PlayerItemHeldEvent kinda says that the players item changed tho, "held"

vale ember
rapid rock
shut field
cyan oyster
#

sorry if the description is rude

vale ember
#

what is your package dir?

cyan oyster
#

?

vale ember
#

your Main.java is in com.backdoor?

rapid rock
#

wtf is abckdoor

cyan oyster
ivory sleet
cyan oyster
cyan oyster
rapid rock
cyan oyster
#

no

quaint mantle
#

Show packages

cyan oyster
quaint mantle
#

Dm

vale ember
#

maybe try adding this:
api-version: <mc-version>

cyan oyster
keen obsidian
#

Does someone know how I can remove armorstands with a specific name?
But they dont despawn

quaint mantle
keen obsidian
quaint mantle
#

My dm open

cyan oyster
#

my dms are off

quaint mantle
#

Bruh

reef wind
undone axleBOT
ivory sleet
heavy void
#

Someone knows why:

Code: ```java
private static String xor(String s1, String s2) {
Main.getInstance().getLogger().info("a");
StringBuilder result = new StringBuilder();
Main.getInstance().getLogger().info("b");
for (int i = 0; i < (Math.min(s1.length(), s2.length())); i++)
result.append(Byte.parseByte("" + s1.charAt(i)) ^ Byte.parseByte(s2.charAt(i) + ""));
Main.getInstance().getLogger().info("c");
return result.toString();

It returns **a b c** **a b c** **a b** java.lang.NumberFormatException
ivory sleet
#

Yes looks logical

#

Use Bytes.tryParse instead

heavy void
#

I forgot to say, it is looping

#

2 times

#

In that for

#

and in another for

heavy void
ivory sleet
#

yes switch out that method

#

It yields an derivative of IllegalArgumentException if the input isn’t a valid byte

#

Or well can’t be parsed

heavy void
#

Cannot resolve method 'tryParse' in 'Bytes'

#

Im using JDK 8 with Spigot 1.8.8

ivory sleet
#

Oh just the api?

#

wrap it in a try catch then

ivory sleet
#

byte b = 0;
try {
b = Byte.parseByte(...);
} catch (NumberFormatException e) {
//HANDLE
}

main dew
#

how disable falling gravel and sand?

rapid rock
main dew
#

disable block physics

#

freeze as block yea

fathom merlin
#

What mapping does spigot use in 1.17? Spigot or Mojang?

warm galleon
#

idk

eternal night
#

For runtime ?

#

Or development

fathom merlin
#

For runtime

eternal night
#

None

#

While classnames seems to somewhat follow mojang mappings, neither fields or methods are mapped

heavy void
quaint mantle
#

Hey does it matter whether M2_HOME and MAVEN_HOME are in sys or user variables?

waxen plinth
#
private static String xor(String s1, String s2) {
  return Integer.toBinaryString(Integer.parseInt(s1, 2) ^ Integer.parseInt(s2, 2));
}```
proud basin
#

Are you able to rename a armorstand after its been renamed

waxen plinth
#

Of course

#

You can just do setCustomName

opal juniper
#

So like what is the best way to see if an inventory is empty?

onyx basin
#

Hi, could be possible that two async tasks trying to getString from the FileConfiguration causes conflict and one of them returns null?

quaint mantle
hybrid spoke
opal juniper
#

bruh

hybrid spoke
#

otherwise check if the Contents have a length of 0

opal juniper
#

no

hybrid spoke
#

or loop through

opal juniper
#

that doesnt work

quaint mantle
#

yes it does

#

if you want to see if its empty

#

use Inventory#isEmpty

opal juniper
#

cause it returns [null, null, null]

#

but yea

summer scroll
opal juniper
#

i will use isEmpty

onyx basin
#

So I have to do it synchronously, right?

#

Or there is any other option?

#

That one task should wait for the other one to execute the code

quaint mantle
#

why are you doing this async anyways

onyx basin
#

To prevent lags

#

If it would have to loop through thousands of files, it probably would cause lags

opal juniper
opal juniper
#

yep

#

i hate it

quaint mantle
#

but still

#

use common sense

opal juniper
#

yeah i will loop

#

and just see if there is a non null

quaint mantle
onyx basin
#

I have to store players data in the yaml files

#

I think I just should use SnakeYAML or something like that

quaint mantle
#

please

#

do not

#

store a file for each player

#

please do not, use bukkit configuration api to store this data

onyx basin
#

I think it isn't that bad when it runs async

unreal quartz
#

it isn't

onyx basin
#

But maybe I have to move to the local database storage

unreal quartz
#

it is something which people just enjoy to continously echo around here

quaint mantle
hybrid spoke
#

IO operations should be done async

quaint mantle
#

im not storing a file per player

hybrid spoke
unreal quartz
#

good on you

quaint mantle
unreal quartz
#

how

hybrid spoke
quaint mantle
#

you gonna store the UUID as the name

unreal quartz
#

so?

hybrid spoke
#

wheres the problem?

quaint mantle
hybrid spoke
#

your plugin does everything for you

#

you dont have to look it up manually

unreal quartz
#

you store the UUID as the primary key in the database

hybrid spoke
#

and if you have to there is a thing called search function

unreal quartz
#

where is the problem

quaint mantle
unreal quartz
quaint mantle
#

🤨

unreal quartz
#

uuid as pk in database
uuid as file name for flatfile

#

it is the same principle

hybrid spoke
#

he compares it

unreal quartz
#

what is the problem

hexed hatch
#

I always store a JSON file with the uuid as the name for player data

#

Explain to me why this is a bad practice

unreal quartz
#

using the uuid as the file name means faster lookup since you already know what it is going to be called

#

also why you use uuid as the primary key for a table since it is indexed

hexed hatch
#

I don't have to iterate through an array

hybrid spoke
#

yeah you have to iterate through a list

quaint mantle
#

do it your way

unreal quartz
#

if there is one thing you shouldnt do it's to keep everything in one file

quaint mantle
#

im just saying i'd wanna use a db

unreal quartz
#

you will have to load the entire file into memory

quaint mantle
hybrid spoke
unreal quartz
#

a database is ideal but for some applications it is overkill

#

or not worth the time to implement

unreal quartz
#

which it isn't

tardy delta
#

does someone knows if you're added to a worldguard region you can build and break things by default?

hybrid spoke
#

just store everything local and never reload or restart your server

main dew
#

how disable falling gravel and sand? disable physics?

hybrid spoke
quaint mantle
#

i think thats only for liquids

hexed hatch
#

BlockPhysicsEvent iirc

quaint mantle
#

^

main dew
hexed hatch
#

Test harder then

#

Show me the code

unreal quartz
#

you need to test it at least 16 times for it to work

hexed hatch
#

It's worked every time I've worked with it so it's most likely on you

hybrid spoke
main dew
main dew
hexed hatch
#

Again

#

BlockPhysicsEvent

main dew
#

yea I now test again this

hexed hatch
#

Are you registering your listener?

main dew
#

yea

#

a sorry I send bad code

#
    @EventHandler
    public void physicsDisable (BlockPhysicsEvent e) {
        System.out.println("WORK");
        e.setCancelled(true);
    }```
#

this

main dew
hexed hatch
#

If you're registering the listener that should work

surreal vale
#

where can i learn about packets and how to use them

main dew
#

yea I register this

hexed hatch
#

And blocks are still falling?

main dew
#

yea

hexed hatch
#

Latest version?

main dew
#

I test this on spigot paper 1.17.1 , 1.12.2

#

nothing works

main dew
hexed hatch
#

I don't have an IDE open right now, a bit busy right now. I'll test it soon. I've used it in the past and it worked so I'll see what I did.

main dew
hasty prawn
#

That's cursed

hybrid spoke
#

no thats minecraft

hazy igloo
tidal skiff
#

yo i have this command "/w" and its checking if args[0] is "r" and basically

                if(args[0] == "r"){

                    sender.sendMessage("yes u said r");
                    return true;

                }else{


                    whisSender.sendMessage(ChatColor.RED + "This player either doesn't exist or isn't online.");
                    return true;

                }

even when i type in "/w r" it still goes with the else part

#

is there a proper way to check if an argument is an exact string

fierce swan
#

.equals

#

If that doesn't work then there's something up with your arguments

tidal skiff
#

ok thank u u actual life saver

fierce swan
#

I would recommend learning basic Java before working on a spigot plugin lol

tardy delta
#

what do they mean with ambient?

quaint mantle
eternal night
#

"Makes potion effect produce more, translucent, particles."

#

according to the docs

#

basically a middle point between normal and hidden

tardy delta
#

oki

#

three times false XD

eternal night
#

there are default constructors for this aren't there ?

tardy delta
eternal night
#

yea, sweet

tardy delta
#

i also want to hide the icon 😛

eternal night
#

cool kids use effect builder anyway pfft

main dew
#

how disable falling gravel and sand? disable physics

eternal night
#

maintain your own server fork and disable falling blocks

tardy delta
#

for some reason sand and gravel on my server break when falling 😳

#

probably not the default behavior

proud basin
#

Why is setCustomName not updating the armor stand name when its already named something

ivory sleet
#

Because it’s not the display name

#

It’s a name for other plugins to interact and integrate with merely

tardy delta
#

phone is 1% run

proud basin
#

so what would I use then?

#

to update the armor stand custom name

eternal night
#

setDisplayName ?

proud basin
#

no

#

isn't that for Users

eternal night
#

oh right, mb

#

yea custom name seems to be the right one anyway

ivory sleet
#

jtx what are you trying to do in the long run?

eternal night
#

conclure was prolly thinking about players

ivory sleet
#

Yeah

proud basin
#

I'm trying to update the name of the armorstand whenever a certain event happens

#

but whenever I do it doesn't update it

eternal night
#

is the armor stand loaded ?

#

what version of spigot are you running

proud basin
#

yes and I don't think you want me to say the version

eternal night
#

oh

#

welp rip you then xD

#

try if you can reproduce it without any other plugins

ivory sleet
#

@proud basin the name is ambiguous

#

What name and for what purpose

hazy igloo
proud basin
heavy void
#

Somoene say to me a good obfuscator please, i already searched too much, and i dont found no one obfuscator that works without errors. (Ill not publish to spigot.)

torn shuttle
#

I feel like I just spent 2 hours writing a mistake

eternal night
heavy void
#

I already tried them.

#

Proguard gives me a Main.class method error

native nexus
#

Why would you want to obfuscate your code…

heavy void
#

Im trying to make a private plugin store.

#

And im brazilian, and brazilians are so...

#

DECOMPILERS and CRACKERS

#

You understand?

eternal night
#

Well pretty sure proguard works usually 😅

#

You might just not be using it correctly

heavy void
#

I tried 1 tutorial on youtube '-'

#

"How to obfuscate client/plugins using Proguard" or something close that.

torn shuttle
#

tas fodido

#

this is the everyone in uganda knows kung-fu meme but with br

main dew
#

how disable falling gravel and sand? disable physics

ivory sleet
#

Teleport it back every tick maybe

#

Probably no clean way of doing it considering it’s falling

torn shuttle
#

wasn't there a block property for disabling physics?

ivory sleet
#

Hmm maybe

#

But idk if that’s for falling ones

#

They’re entities after all, right?