#help-development

1 messages · Page 1571 of 1

ivory sleet
#

you would have to read the file, cache it, make the change and then write it back

quaint mantle
#

al

#

alr

#

read the file, store in ArrayList(?), edit the strings in the ArrayList, and write the ArrayList back to the file?

ivory sleet
#

yeah thats one way to do it

#

if you just change an existing line

#

then maybe a fixed size list or array might do better

cobalt lagoon
#

Is redstoneevents an enum class?

ivory sleet
#

its a public static final field

fluid cypress
#

what should i use instead of PlayerChatEvent? since its deprecated

ivory sleet
#

AsyncPlayerChatEvent

cobalt lagoon
#

Oh, was confused by the field name.

ivory sleet
#

yeah frankly the same lol

cobalt lagoon
#

Was wondering if it was an enum, why not make it an EnumSet, then check the size.

ivory sleet
#

🥲

cobalt lagoon
#

Damn uppercase field name.

#

Well, that is rather pointless when I think about it now

ivory sleet
#

kinda weird java compilers allow that but I guess its for the convention breakers

hasty prawn
#

Would be funny if IntelliJ just yelled at you when you used incorrect conventions LOL

ivory sleet
#

yeah lol

fluid cypress
#

whats the difference between getName and getDisplayName?

ivory sleet
#

name is the actual name

#

like the username

solemn shoal
ivory sleet
#

displayname is the name which is displayed and can be modified server sided

quaint mantle
hasty prawn
#

How is line 32 throwing an error when you're not even calling that method 🤔

ivory sleet
#

because its called async

#

or most of the times

solemn shoal
#

i am

hasty prawn
#

You sure?

#

Should be yellow instead of gray if you are

#

Unless you messed with your colors ig

ivory sleet
#

I would like a rainbow gradient error color

hasty prawn
#

It should do that when you do something really dumb

ivory sleet
#

ye lol

hasty prawn
#

It's way of saying "you're a moron"

fluid cypress
#

how can i do something on each server tick?

ivory sleet
#

🥲

#

runTaskTimer

fluid cypress
#

isnt there any event for every tick?

ivory sleet
#

?scheduling read here

undone axleBOT
ivory sleet
#

no there isn't

fluid cypress
#

anything thats called constantly, within a short period of time?

hasty prawn
#

runTaskTimer

fluid cypress
#

k

hasty prawn
fluid cypress
#

is there something in the spigot api to easily create and parse config files?

ivory sleet
#

YamlConfiguration.loadConfiguration

#

(static method)

#

and then we got Plugin#saveResource (instance method)

#

?jd

ivory sleet
#

check the docs for this stuff

fluid cypress
#

thanks

ivory sleet
undone axleBOT
#

Custom command successfully added.

ivory sleet
undone axleBOT
#

Custom command successfully added.

undone axleBOT
#

Custom command successfully added.

ivory sleet
undone axleBOT
#

Custom command successfully added.

ivory sleet
undone axleBOT
#

Custom command successfully added.

young knoll
#

?jd

ivory sleet
undone axleBOT
#

Custom command successfully added.

quaint mantle
#

?jd-s

undone axleBOT
quaint mantle
#

oh neat

ivory sleet
#

shouldnt

ornate patio
#

how do I disable a specific item from being dropped when a player dies

#

like how do I prevent compasses from dropping on the floor

#

i just want it to get deleted from existence

granite stirrup
#

¯_(ツ)_/¯

#

PlayerDeathEvent?

ornate patio
#

saw that

quaint mantle
#

PlayerDropItemEvent, or EntityDropItemEvent maybe

#

or both

ornate patio
quaint mantle
#

uh, nvm. missed the dies part of ur question lol

granite stirrup
#

PlayerDeathEvent???

quaint mantle
#

probably

ornate patio
granite stirrup
#

PlayerDeathEvent.getDrops().remove(itemStack); maybe

ornate patio
#

hmm lemme try

granite stirrup
#

if you dont have a itemstack to remove you might have to loop through the list and just compare the material lol

#

cuz idk how you remove a specific item

quaint mantle
ornate patio
#

¯_(ツ)_/¯

ivory sleet
#

cant u use getEntity().getInventory().removeItem(stack)

#

or smtng

ornate patio
#

specifically compasses

ivory sleet
#

oh right yeah then just iterate like others told u to

ornate patio
#

yeah thats the part im confused on

#

new to java 😓 (experienced in other languages)

granite stirrup
#
@EventListener
public void iBelieveYouCanNameThisAnythingSoJustGiveItACreativeName(EntityDeathEvent e) {
  for (ItemStack i:e.getDrops()) {
    if (i.getType().equals(Material.COMPASS)) {
      e.getDrops().removeAll(i);
    }
  }
}``` ?
ornate patio
#

i'm just confused on how to remove an itemstack from the list from within the loop itself

ornate patio
#

(referring to ur edit)

granite stirrup
#

yeah but idk if thats gonna work or not but you can try it lol

ornate patio
#

oh that worked thanks so much

#

i'm just not familiar with the java List atm

ivory sleet
#

oh yeah thats just an interface

granite stirrup
#

ArrayList extends it i think

ornate patio
#

ah

ivory sleet
#

yeah well there are other implementations also

#

but arraylist is probably used here

ornate patio
#

ok that makes so much more sense

#

thanks guys

ivory sleet
#

?learnjava if you need I guess

undone axleBOT
ornate patio
#

wait um one issue

ornate patio
#

so if i have a stack of compasses and die it still drops

granite stirrup
#

oh

ornate patio
#

do i just literally loop from 1-64 for each itemstack?

quaint mantle
#

what? just loop the items in the inv, and check the material

quaint mantle
ornate patio
#

i mean

#

i just tested it

granite stirrup
#

maybe replace remove with removeAll?

quaint mantle
#

also, use the .equals method smh

ornate patio
#

oh wait a minute

#

wait wait no i know the problems

ornate patio
hushed garnet
#

How would you recommend grabbing current TPS for 1.17 without NMS?

import net.minecraft.server.v1_16_R3.MinecraftServer; and...
int tps = MinecraftServer.currentTick;```
quaint mantle
ornate patio
#

then it bugs out

granite stirrup
hushed garnet
#

i'm using tuinity

granite stirrup
#

ok thats a fork of paper isnt it?

hushed garnet
#

so yeah, i should have access to those classes

quaint mantle
#

no...

#

theres a method to get the tps in paper

ornate patio
granite stirrup
#

Bukkit.getTPS() but idk if tunity has that (paper i know has it)

#

i know spigot doesnt have it

#

it returns a double[]

ornate patio
#

i'll try using a "normal" for loop (dunno what to call it, the thing that uses i=0; ...) and then subtract one from i if it removes an item

granite stirrup
#
@EventListener
public void iBelieveYouCanNameThisAnythingSoJustGiveItACreativeName(PlayerDeathEvent e) {
  for (ItemStack i:e.getDrops()) {
    if (i.getType().equals(Material.COMPASS)) {
      e.getDrops().remove(i);
    }
  }
}``` try this?
ornate patio
#

hmm ok

granite stirrup
#

idk if it will work or not

ornate patio
#

red underline

crude charm
#

show

ornate patio
#

The method removeAll(Collection<?>) in the type List<ItemStack> is not applicable for the arguments (ItemStack)

sharp bough
#
        if (idDoesNotExist()) kits.giveKit(kitID, player); //player never used any kit
        else if (kitIdDoesNotExist()) kits.giveKit(kitID, player); //player never used this kit
        else if (kitIsOnCooldown()) player.sendMessage("kit is on cooldown"); //kit is on cooldown
        else kits.giveKit(kitID, player); //kit is not on cooldown```
is there a better way of doing this?
ornate patio
#

cant

#

cant send ss in this channel

crude charm
#

not you

granite stirrup
ornate patio
#

wat

crude charm
#

oh

#

oops

sharp bough
ornate patio
#

how..-

crude charm
#

just put it in

ornate patio
#

oh im not verified bruh

crude charm
ornate patio
#

yeah

sharp bough
crude charm
#

why

ornate patio
#

ok verified now

ivory sleet
#

@sharp bough tho I guess it’s a little bit repetitive

drowsy helm
#

its a list

#

use .get(i)

ornate patio
#

oh

sharp bough
#

of cant find anything

granite stirrup
#

i guess its fine but yeah dont u normally use int?

ornate patio
#

i did my own strategoy

ivory sleet
#

if (kitIsOnCooldown()) {
sendMessage
return
}
kits.giveKit

ornate patio
#

whats the difference

granite stirrup
#

Integer is the object?

drowsy helm
#

int is primitive

ornate patio
#

oh ok

sharp bough
#

but i cant do || cuz that would return null i think

#

if i try to get a value inside a path that doesnt exist

ivory sleet
#

Yeah well your abstraction made it hard to spot the null checks

ivory sleet
#

var x = !null

sharp bough
#
    UUID:
        kitID: Long
        kitID: Long
        kitID: Long
    UUID:
        kitID: Long```
#

long is when it was used

#

to get the cooldown

#

so if(kits on cooldown) takes the value in kitID, inside the uuid

granite stirrup
#

i think a database would be better for this than a file

sharp bough
#

like sql? never really used it

#

and i dont wanna spend the next few days learning it

#

i gotta finish this first

granite stirrup
#

does it like save to the file constantly ?

#

please do not say yes

sharp bough
#

only on disable

#

or on command

granite stirrup
#

ok

fluid cypress
#

where do i have to put the default config.yml inside my jar?

#

i mean, the intellij project

#

in resources?

granite stirrup
#

in src/main/resources for maven

drowsy helm
#

resources

fluid cypress
#

ok thanks

native bloom
#

Does xenforo support webhooks? I.e. is there any easy way to pipe a thread from the spigot forums onto a discord without needing to write and host a bot?

granite stirrup
#

never used it

#

i dont have money to pay for it so i never used it

native bloom
#

ik, but I am talking about as a user

#

Wondering if I can pipe a plugin's resource thread into its support discord

drowsy helm
#

"Is anyone a doctor here?" - "I'm not!"

native bloom
#

that way responses can be a bit faster

drowsy helm
#

doubt it, and even if you would need some sort of api key

ivory sleet
#

Actually, 100% no

native bloom
#

thanks, looks like it is bot time

ivory sleet
#

🥲

paper viper
#

what

#

lol

native bloom
#

unrelated note, for some reason I am going to write this discord bot in go

#

because why not

ivory sleet
#

Good choice

granite stirrup
#

can you even do that?

ivory sleet
#

I always write in Java which ends with a catastrophe

native bloom
#

I have started disliking oop in general

paper viper
#

verbosity

#

🥲

drowsy helm
#

theres some things java is good at

#

discord bots is not one

ivory sleet
#

I mean it’s very powerful but yeah verbosity and some other things are cons

drowsy helm
#

I just stick with JS for bots

granite stirrup
native bloom
#

to be fair, I think someone wrote a discord bot in bf.
I think someone also tried writing a MC proxy in bf, then found their sanity and decided not to

granite stirrup
#

python is just too easy for discord bots

drowsy helm
#

bf?

native bloom
#

idk, all I know is that I would never want to

drowsy helm
#

whats that

granite stirrup
#

how are you gonna send api requests in brainfuck?

native bloom
#

I am sure someone has done it, and I am also sure that however they did it was probably exceedingly complicated

ivory sleet
#

Sounds masochistic lol

native bloom
#

I think someone also made a webserver in bf

granite stirrup
#

sounds impossible

native bloom
#

one sec, let me find the repo xD

drowsy helm
#

some people have too much time

granite stirrup
#

ah i found one

#

and how they do it

#

is the webserver is in js

native bloom
#

ah

granite stirrup
#

and the brainfuck does the html stuff

native bloom
#

On the positive side, it looks like people have at least some sanity

granite stirrup
native bloom
granite stirrup
#

html 1.0

#

how old is that

#

holly fuck

native bloom
#

older than 1995 at the very least

granite stirrup
#

1993

#

thats old af

native bloom
#

Meh, still easier than working with legacy code

#

still impressive for bf

#

Actually, I wonder what the most complex bf program on github is, one sec

fluid cypress
#

is there any way of getting a persistent server unique identifier?

restive burrow
#

so the nhow do u guys get a lot of stuff done

#

the spigot api and craftbukkit are relatively limiting

granite stirrup
#

well mostly people just use something which is not a api called NMS

#

its not recommended to be used cuz it gets updated every version

#

i guess reflection but mostly people just make separate classes for each version

native bloom
ivory sleet
rocky rampart
#

I rolled my own mixin bootstrapper for 1.16 so I could do the fun stuff, but that requires running a jar that sets up Paper and cpw's modlauncher.

young knoll
#

There is a project that does it already

rocky rampart
#

There are several

#

But they didn't do specifically what I needed.

restive burrow
granite stirrup
#

since its not a api

restive burrow
#

i meant

#

to injecting code

#

not the mappings

granite stirrup
#

¯_(ツ)_/¯

restive burrow
#

have you never used before?

granite stirrup
#

nope

#

but i mean most the time you avoid nms

fickle helm
#

is it possible to get console colors with spigot? When I use the following code:

Bukkit.getLogger().info(ChatColor.YELLOW + "This is a " + ChatColor.GREEN + " test");```
#

nevermind, found that this works:

getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + "This is a " + ChatColor.GREEN + "test");```
restive burrow
wild inlet
#

Is damagemodifier not getting removed then? there are comments saying it is but its now been 5 versions of mc, doubt its going anywhere.

fluid cypress
#

do i need to use this to set an instance property? or both static and non static properties at the same time is not a thing in java and it knows what to do when setting a property?

#

this is the correct way?

public class Message {
    String m_author;
    String m_message;
    public Message(String author, String message) {
        m_author = author;
        m_message = message;
    }
}
#

or this

public class Message {
    String author;
    String message;
    public Message(String author, String message) {
        this.author = author;
        this.message = message;
    }
}
young knoll
#

The second one doesn't have weird prefixes

#

So go with that

quaint mantle
#

2nd would be correct for java

#

we don't prefix with member

restive burrow
#

bro tf why is spigot so limited

#

i just need a way to modify the first packet b4 the player name is sent and shit

fluid cypress
#

the property needs to be public to read it?

#

without specifying private or public, whats the default?

restive burrow
#

well i need to be able to intercept it in the first place

#

but ik i can use reflection and buildtools

chrome beacon
static whale
#

How would I best go about modifying vanilla loot tables? I'm not too keen on using a datapack for it because my plugin generates custom items each with random attributes and such. Making combinations of what each item could be like would stack in the thousands and probably even millions.

chrome beacon
#

Spigot has an API for loot tables

#

Use it to replace the vanilla one

static whale
#

I only saw a way to extend it and make my own

#

Even then I'm not sure how to override the vanilla unless I cancel the event, I'm hoping that's not the only solution because I'll be looking at spaghetti code with all the drops I'm adding/changing.

chrome beacon
#

Ive never used it 🤷‍♂️

#

I mean you don't have to use loot tables

#

Most plugins don't

chrome beacon
#

If you have a lot of drop combinations thats what you need to do

restive burrow
#

then i check back

#

to discord

#

and u reocmmend it to me

#

do you know if it can modify packets that are not player specific yet

#

like LOGIN state

chrome beacon
#

Yeah also use PacketWrapper of you want to male your life easier

restive burrow
#

not just PLAY

chrome beacon
#

You can modify and packet recieved or sent

somber hull
#

please

restive burrow
#

i meant modify the very first packet someone sends

somber hull
#

acnowledge me

restive burrow
#

like C00PacketLoginStart

chrome beacon
#

Yeah as I said any packet

#

Which includes that

restive burrow
#

you sure about that though?

#

cuz it isnt even in the play state yet

#

and not player bound

chrome beacon
#

All packets

restive burrow
#

mk lets see if it works

#

thanks bro

#

does it need buildtools/

chrome beacon
#

No

#

BuildTools isn't hard to use though

#

And It's the only good way to get a spigot jar

#

Everything else are illeagal uploads

#

(Forks like Paper have their own system and are perfectly fine)

somber hull
#

If i have a list being created like this

    public void loadEvents() {
        angryBeeEvent = new AngryBeeEvent();
        events.add(angryBeeEvent);
        summonCreeperEvent = new SummonCreeperEvent();
        events.add(summonCreeperEvent);
        loopTntEvent = new LoopTntEvent(this);
        events.add(loopTntEvent);
        giveDiamondGearEvent = new GiveDiamondItemsEvent();
        events.add(giveDiamondGearEvent);
        giveDiamondEvent = new GiveDiamondEvent();
        events.add(giveDiamondEvent);
        loopSheepEvent = new LoopSheepEvent(this);
        events.add(loopSheepEvent);
        lightningSpawnEvent = new LightningSpawnEvent();
        events.add(lightningSpawnEvent);
        giveAppleEvent = new GiveAppleEvent();
        events.add(giveAppleEvent);
        
        
    }

I want to do event.getEnabled(); wich just returns true or false, and then if its true put it in the list, if false. dont.
Whats the best way of doing that, would i have to create a new List?
Loop through everything in List1 check if its enabled, if true add it to List2?

granite stirrup
#

gtg

restive burrow
#

shit ran into another problem. i need to remove 1 line of code from nms

solemn shoal
#

interesting message there

#
[06:11:34 INFO]: [ProtocolLib] Enabling ProtocolLib v4.6.0-SNAPSHOT-b492
[06:11:34 ERROR]: ******************************************************
[06:11:34 ERROR]: *** ProtocolLib does not support plugin reloaders! ***
[06:11:34 ERROR]: *** Please use the built-in reload command!        ***
[06:11:34 ERROR]: ******************************************************
[06:11:34 INFO]: [ProtocolLib] Disabling ProtocolLib v4.6.0-SNAPSHOT-b492```
somber hull
solemn shoal
#

"Please use the build-in reload command!"

somber hull
#

...

#

yea

sharp bough
#

so im testing with IF but for some reason its adding another line in my inv called "server name", i did do that but i already removed it but its not updating. i removed the plugin, built it again and its still there, even if i make the pane or gui smaller

#

code

#

that code is from the last SS

restive burrow
#

send me.paradis.aurorakits.UTILS.ItemGenerator

sharp bough
#

i dont think it has to do anything to do with the item generator

restive burrow
#

odd

#

hold on

#

also why not use primitives?

sharp bough
#

its just a test

#

quick code

#

to understand how IF works

granite stirrup
#

Line 35 change the 9 in there to s 8 maybe

sharp bough
#

thats the lenght

granite stirrup
#

Yeah try 8

#

What if it's 0-8 and not 1-9

sharp bough
#

i already checked that

#

it starts at 1

granite stirrup
#

Try with 8

restive burrow
#

oh u have that library

sharp bough
#

aight

restive burrow
#

sec

granite stirrup
#

See if it will work

sharp bough
granite stirrup
#

Then idk

sharp bough
#

xd

granite stirrup
#

I normally use bukkit to make inventorys

#

I don't use a framework

sharp bough
#

1s ec

#

i copied and pasted

#

oh

#

LMAO

#

i had the items in my inv

#

for some reason they got added

#

and when i clicked them it would take it as an item of the created inv

#

ahahaha

#

thx everyone

#

oh i had the global thing

#

gui.setOnGlobalClick(event -> event.setCancelled(true));

misty zenith
#

which passhfinder do i need to call for entity go to locatioon that i give ?

quaint mantle
#

?image

#

how to remove this

#

enchantment and when in hand

crude charm
restive burrow
crude charm
#

wdym

ornate patio
#

how can i create a config file if it doesnt exist

crude charm
ornate patio
#

i want to do it automatically

#

if a user drag/drops

crude charm
#

yeah

#

you make it

#

on start

ornate patio
#

thats

#

what

#

im asking

crude charm
#

yeah

ornate patio
#

.

granite stirrup
#

saveResource?

crude charm
crude charm
quaint mantle
crude charm
wraith finch
#

Hey guys, what's the 1.17 method to get the full NBT tag for an inventory item?

ornate patio
#

i want the user to be able to change the config

ornate patio
#

then how do i make it save the file like every other plugin

granite stirrup
ornate patio
#

i got this from https://spigotmc.org/wiki/config-files

final String fileName = "manhunt-config.yml";

configFile = new File(getDataFolder(), fileName);

if (!configFile.exists()) {
    configFile.getParentFile().mkdirs();
    saveResource(fileName, false);
}

config = new YamlConfiguration();

try {
    config.load(configFile);
} catch (IOException | InvalidConfigurationException error) {
    error.printStackTrace();
}
#

just throws an error

#
java.lang.IllegalArgumentException: The embedded resource 'manhunt-config.yml' cannot be found in plugins\Manhunt.jar
granite stirrup
#

Does the file exist?

#

In your jar

ornate patio
#

no..

granite stirrup
#

Well you need it

ornate patio
#

i said i wanted to save the config outside the jar

granite stirrup
#

It's for the default

crude charm
#

BUMP

crude charm
ornate patio
granite stirrup
ornate patio
#

wat

#

like

#

src/resources?

granite stirrup
#

Src/main/resources

ornate patio
#

nice

granite stirrup
#

Stupid autocorrect

ornate patio
#

could it also be that im reloading with plugman

ornate patio
#

b r u h

granite stirrup
#

Maybe but you also need it in the plugin jar

ornate patio
granite stirrup
#

That's where it copies it's content from

crude charm
#

can someone please help me

#

or I will cry

#

actually

#

CRY

granite stirrup
#

Pom.xml?

crude charm
#

no

granite stirrup
#

?paste

undone axleBOT
crude charm
granite stirrup
#

Remove sonatype repo

ornate patio
granite stirrup
#

Are you using maven?

ornate patio
#

no

crude charm
granite stirrup
crude charm
#

idk why it's therre

granite stirrup
#

What build tool are you using gradle ?

limber dust
#

atleast from the image im thinking you've put it there sooo

ornate patio
#

it is tho

limber dust
#

resources folder isn't meant to be in there

#

eg

granite stirrup
#

Put it in src?

ornate patio
#

lemme try

limber dust
granite stirrup
ornate patio
#

i see

limber dust
#

yes i know

#

but its the same layout

exotic scroll
fluid cypress
#

how do i strip colors from a string? like a display name ie

crude charm
ornate patio
#
[22:51:43] [Server thread/INFO]: [Manhunt] Enabling Manhunt v1.0
[22:51:43] [Server thread/ERROR]: Error occurred while enabling Manhunt v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'manhunt-config.yml' cannot be found in plugins\Manhunt.jar
        at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:192) ~[spigot-1.17.1.jar:3178-Spigot-eac3cd9-a6292cc]
        at me.okay.Manhunt.Main.onEnable(Main.java:57) ~[?:?]
   
limber dust
limber dust
ornate patio
limber dust
#

also send whats on line 57

#

of your main class

ornate patio
#

manhunt-config.yml is my "template" config

#
final String fileName = "manhunt-config.yml";

configFile = new File(getDataFolder(), fileName);

if (!configFile.exists()) {
    configFile.getParentFile().mkdirs();
    saveResource(fileName, false); // line 57
}

config = new YamlConfiguration();

try {
    config.load(configFile);
} catch (IOException | InvalidConfigurationException error) {
    error.printStackTrace();
}
limber dust
#

open your exported jar and check if the file was exported with the plugin

ornate patio
#

how do you "open" an exported jar..

#

new to java here

limber dust
#

do you have winrar?

ornate patio
#

yeah

quaint mantle
#

any file opener like winrar or 7zip should work

limber dust
#

right click the jar and do open with winrar

ornate patio
#

alright

ornate patio
#

the .yml is in resources

#

seems about right

limber dust
#

the yml shouldn't be in a separate folder unless specified

ornate patio
#

brug

limber dust
#

in this instance it should be in the same as plugin.yml

quaint mantle
#

looks like it's in a seprate folder

ornate patio
#

should i also keep it config.yml or manhunt-config.yml

#

like whats more usual

limber dust
#

resources isn't technically a folder that gets exported when you compile the plugin

quaint mantle
ornate patio
#

like whats the standard most plugins use

#

i called it manhunt-plugin because i was worried it might interfere with other plugins

limber dust
#

it won't

ornate patio
#

ah ok

limber dust
#

your plugin creates its own dir folder with your plugin name

quaint mantle
#

It's in its own data folder so there will be no issues

limber dust
#

^

ornate patio
#

ok yeah that makes sense

#

got mixed up with forge

limber dust
#

the issue with your instance is that its actually exporting the resource folder, when it should just be compiling the files inside the folder

ornate patio
#

ye i understand

limber dust
#

move the config so its in the same page/dir as plugin.yml

ornate patio
#

🙂

#

i got it ye

limber dust
#

alright glad to hear

ornate patio
#

wait one more thing

limber dust
#

ye?

ornate patio
#

how do i actually grab diff values

#

like i have this:

#
FileConfiguration config = new YamlConfiguration();
#

so i'm assuming just

#

config.getBoolean("track.distance")?

limber dust
ornate patio
#

my bad i had this underneath it

#
config = new YamlConfiguration();

try {
    config.load(configFile);
} catch (IOException | InvalidConfigurationException error) {
    error.printStackTrace();
}
limber dust
ornate patio
#

and how do i change values of it?

limber dust
#

config.set(location, value);
config.save(file);

ornate patio
#

what is location and value

#

oh wait my bad ye

#

i understand

#

thanks so much 🙏

limber dust
exotic scroll
limber dust
#

whats the error

exotic scroll
#

Cannot resolve method 'registerEvent(github.bubzhome.combatplusa.Main.PluginListener, github.bubzhome.combatplusa.Main)'

limber dust
#

registerEvents

#

you need the s

exotic scroll
#

wow

#

sometimes I am amazed by my own genius

#

hey I am making a combo plugin, how would I assign a value to a player's name in order to keep track of it's combo?

limber dust
#
  1. assign it to their uuid
  2. hashmaps
exotic scroll
crude charm
#

Does anyone have the symbol for a splitter?

exotic scroll
limber dust
#

its just a uuid object UUID

crude charm
#

That doesn't show it too well

limber dust
#

you'll see it if you do player.getUniqueId()

crude charm
#

like that

exotic scroll
#

this?

limber dust
crude charm
#

do you have the symbol for it

limber dust
#

this? |

crude charm
#

no

#

that looks like this in mc

#

need a special one

#

which is straight

limber dust
#

thats legit |

crude charm
#

no

#

it's a special symbol

exotic scroll
# crude charm no

you are going to get better luck finding it in a utf-8 symbol list than asking it here

limber dust
#

its not utf-8

#

Message: '&3Level: &b{level} &3|&b {exp}/{required_exp}'

#

|

crude charm
#

I'll try it

#

but pretty sure it's a special one

limber dust
#

its not

crude charm
#

pretty certain

limber dust
#

there are ones that are utf-8/special

#

but the one you sent is just |

crude charm
#

ok

crude charm
limber dust
#

for me its whole

#

heres a unicode table

exotic scroll
limber dust
#

key or value?

exotic scroll
#

key

limber dust
#

map.containsKey(value);

#

will return a boolean

restive burrow
#

does anyone know how to fix the error cannot access net.minecraft.world.INamableTileEntity?

#
 EntityPlayer ep = ((CraftPlayer)player).getHandle();
            GameProfile gp = ep.getProfile();
#

all im doing

#

ping me if u know the answer please, ill look at it tmr

#

imma bout to pass out im so tired rn

indigo iron
#

?paste

undone axleBOT
indigo iron
exotic scroll
#

line 9 is broken

limber dust
#

see if it throws a error then

limber dust
indigo iron
exotic scroll
#

How to get UUID for a player?

chrome beacon
#

getUniqueId

exotic scroll
#

hmm

#

I throught that was for all entities 😂

chrome beacon
#

It is

#

And players are entities

exotic scroll
#

How to make a timer in plugin

chrome beacon
#

?scheduling

undone axleBOT
exotic scroll
#

TY

#

sry caps

crude charm
exotic scroll
#

spigot

#

sry low sleep me = low iq me

crude charm
#

ok

exotic scroll
#

haven't slept in 3 days

chrome beacon
#

If you're a beginner avoid NMS

restive burrow
#

cant use protocollib to edit fields

#

but

chrome beacon
#

What can't you edit

restive burrow
#

cant get that far

chrome beacon
#

And I'll prove you wrong

restive burrow
#

EntityPlayer ep = ((CraftPlayer)player).getHandle();
GameProfile gp = ep.getProfile();

#

its self

#

causes an error'

#

cannot access net.minecraft.world.INamableTileEntity

exotic scroll
#

Lmao 3 ppl typing

chrome beacon
#

Yeah that has nothing to do with tile entities

restive burrow
#

tf then

#

it says its that line

iron condor
#
            UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getId());
            if (uuid != null) {
                String playerName = Bukkit.getOfflinePlayer(uuid).getName();
                #do stuff
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null

works only when I'm in the server

restive burrow
#

GameProfile gp = ep.getProfile(); causes it

chrome beacon
#

Well yeah

chrome beacon
#

You will have to cache it or send request to mojang api

iron condor
#

Other plugins works the same thing when im not online

#

With the same code I mean

#

(that I made)

chrome beacon
#

Actually where are you using the player interface

iron condor
#

and that what getOffline player is for, no?

restive burrow
#

does anyone know why GameProfile gp = ep.getProfile(); causes cannot access net.minecraft.world.INamableTileEntity?

chrome beacon
#

Where is player

chrome beacon
#

Also use Protocollib

restive burrow
#

i am

#

and i did

#

i ran build tools

#

and using that spigot

#

instead of thr api

#

unless there is more to import nms

iron condor
chrome beacon
restive burrow
#

imma sleep but olivo please help

iron condor
#

also this

    /**
     * Gets the player by the given UUID, regardless if they are offline or
     * online.
     * <p>
     * This will return an object even if the player does not exist. To this
     * method, all players will exist.
     *
     * @param id the UUID of the player to retrieve
     * @return an offline player
     */
    @NotNull
    public static OfflinePlayer getOfflinePlayer(@NotNull UUID id) {
        return server.getOfflinePlayer(id);
    }
chrome beacon
#

Use Protocollib

midnight galleon
#

Is there any event that is fired when player exp changes?
I know about PlayerExpChange event but that doesn't account for enchanting which makes player lose exp

chrome beacon
#

Then listen to the Enchant event?

iron condor
#

Do you always lose at least 1 level when enchanting?

chrome beacon
#

No you can loose 1-3 levels

#

Depending on which slot you choose

iron condor
#

if so PlayerLevelChangeEvent

chrome beacon
#

top = 1
second = 2
third = 3

iron condor
#

at least <<<<<

chrome beacon
#

oh xd

chrome beacon
# iron condor nope

So just dump your whole class. You're still not sending the right information

#

?paste

undone axleBOT
midnight galleon
iron condor
chrome beacon
#

^^ if that doesn't work then listen to anvil event too

midnight galleon
#

Is there an anvil use event the only one I found is PrepareAnvilEvent

iron condor
#

Called when a players level changes

midnight galleon
iron condor
#

doesnt say naturally

chrome beacon
#

Yeah naturally probably only means picking up xp orbs

iron condor
#

dont ask my methods

#

only if its related to the problem please

midnight galleon
#

PlayerLevelChange only works when the player changes level

#

not exp

chrome beacon
quaint mantle
chrome beacon
#

Because the player variable is null and you don't have that one

iron condor
midnight galleon
chrome beacon
iron condor
chrome beacon
#

Copy pasting other peoples code doesn't make you "cool"

iron condor
#

I feel so sumb

#

I had the same exact problem

quaint mantle
#

and challenge

iron condor
#

yet I managed to forget it

iron condor
midnight galleon
iron condor
#

you cant enchant with half a level

#

or do you??????????????

midnight galleon
#

no

iron condor
#

check when PlayerLevelChange

chrome beacon
# quaint mantle thanks you for reply, but I want to experience

Well you should know what you have to do.

  1. Loop all blocks in cuboid region with simple loop
  2. Save that to a list
  3. Write it to a file somewhere
  • for loading
  1. Read that file in to a list
  2. Loop through that list
  3. Place the blocks with an offset from original position
iron condor
#

that means they probably used anvil or enchantment table

midnight galleon
#

when they use table

#

I lost 3 levels

quaint mantle
midnight galleon
#

but still

iron condor
#

ok

chrome beacon
quaint mantle
#

oh why?

chrome beacon
#

It's really advanced and you are not ready for that yet

quaint mantle
#

oh

#

thanks you

midnight galleon
iron condor
#

check player events

midnight galleon
#

there isnt something there

#

related to anvil

exotic scroll
#

how to make a class excute a method when player attack at the right time

#

I don't get the scheduler thing

chrome beacon
#

Do you want to keep track of their attack timer?

exotic scroll
#

I want to make a custom attack timer

chrome beacon
#

oh

#

Well all you do is Store the timestamp + cooldown

#

And then if you want to check how much is left just do that stored value - timestamp

exotic scroll
#

so I am making a combo plugin

#

and you only get a combo when you attack at the right time

#

and the timer gets incrementally smaller

iron condor
#

anything time related is the scheduler thing

#

afaik

chrome beacon
#

Not really

#

Scheduler is bad for what Bubz is doing

limber dust
#

not just scheduler

quaint mantle
iron condor
#

I don't know of any

exotic scroll
#

yeah i look at scheduler and it is not good

quaint mantle
chrome beacon
#

Yeah which is why WorldEdit can crash your server with large selections

#

Now if you want to do things like FAWE you will have to read/place a certain amount of blocks per tick so the server doesn't do that

#

FAWE also does some other magic that you shouldn't to make things faster

exotic scroll
#

alr

exotic scroll
#

I will look ty 😂

exotic scroll
#

oh

chrome beacon
#

Not good for what Bubz is doing

quaint mantle
#

oh

iron condor
#

Please offer a solution, I want to know as well

chrome beacon
#

I've told you what you need to

#

You need to work with timestamps from everytime an attack is called

iron condor
#

oh I see this now

exotic scroll
#

timestamps hmmm

#

docs?

limber dust
#

@exotic scroll are you doing it so if a player attacks and kills a diff player or whatever, and if they are in a certain time, then add combo and shrink time?

exotic scroll
#

it gets smaller as the combo value goes up

limber dust
#

so after x time has passed add combo?

#

then Olivo is the best solution

chrome beacon
#

Actually no

#

I'm dumb

limber dust
#

XD

chrome beacon
#

My solution is what you were looking for

limber dust
#

im looking at it like, create new date, then on attack check if date has passed, if so add combo then new date but smaller diff

#

simple solution

chrome beacon
#

Yeah

limber dust
#

ye a scheduler is terrible for that

exotic scroll
#

after x time have passed, there is a timeframe where when you attack again, it will increase the combo

chrome beacon
#

Yeah

#

This is exactly what my solution will do

exotic scroll
#

if you get damaged or stopped attacking, the combo will get cancilled

chrome beacon
#

Don't use Scheduling here

exotic scroll
#

kk

#

imma look at time stamps

waxen plaza
#

do devs still support 1.8 plugins?

chrome beacon
#

Depends

limber dust
#

^

chrome beacon
#

With 1.17 it will be harder to support older versions

#

So it might finally be time for it to die

waxen plaza
#

Yes, I was trying to add some features to a plugin, but 1.8 didn't work

limber dust
#

i can understand somewhat why people still use 1.8, but simply cause i use alot of 1.12.2 and 1.16.4

waxen plaza
#

I believe 1.8 because of old combat

chrome beacon
#

^^

ivory sleet
#

You like block hitting?

#

🥴

limber dust
#

lol

exotic scroll
#

some ppl does

#

bc that is the only way to display their skills , this gives them confidence when they are insecure irl

#

or they just like hurting their fingies

#

or smth else , i am not assuming this

ivory sleet
#

I mean I have nothing against block hitting

#

Tho I do think people should stop using 1.8 still regardless

waxen plaza
#

it's been so many years since new combat, people should just switch to new versions

limber dust
#

tbh i still support 1.8 in my main plugin

#

no clue why

waxen plaza
#

I would to, but I will probably only 1.13+

limber dust
#

ye mines 1.8-1.17

#

i understand why people do 1.13+ now cause it becomes a pain to do more

summer scroll
#

As long as the plugin doesn't use nms, why not add 1.8 support

exotic scroll
#

how to make a player's next attack stronger?

chrome beacon
exotic scroll
#

I already got the listener

limber dust
#

thats how

#

heres the docs

chrome beacon
#

?jd

exotic scroll
#

ty

limber dust
#

forgot that was a command

exotic scroll
#

so

#

EntityDamageByEntityEvent.setDamage(Base type, double (EntityDamageByEntityEvent.getDamage*multiplier))

limber dust
#

please tell me thats EntityDamageByEntityEvent isn't what you called the event object

exotic scroll
#

me?

#

yeah

limber dust
#

what does your constructor look like?

exotic scroll
#

I called it PlayerDamage

exotic scroll
limber dust
#

oh you called it entity fewwwwwwwwwww

#

i felt so bad for ya

#

if you called it EntityDamageByEntityEvent

exotic scroll
#

it will be hella confusing lol

#

and it will mess up

quasi flint
#

am i retarded or does it miss the @EventHandler

limber dust
#

i think they just sent the method

quasi flint
#

makes sense. i just shove it over the method every time

limber dust
#

waittttttttttt

#

they did

#

i didn't notice they sent the whole class

#

XD

quasi flint
#

so i am right ?

#

:C

limber dust
#

yep XD

#

im blind

exotic scroll
#

stupid me

#

fixed now

limber dust
#

i only realized they sent the whole class when i looked back and saw Listener at the top

exotic scroll
#

forgot the @override on enabled and disabled too

exotic scroll
#

like what goes in the parenthesis?

limber dust
limber dust
exotic scroll
#

I know it is a bad practice but I am confused and i just put static for all

exotic scroll
#

i know i need a double

quasi flint
#

set the health to 0

exotic scroll
#

is it just a multiplier

exotic scroll
quasi flint
#

i think so

summer scroll
#

@exotic scroll i suggest you to take some java courses before jumping into spigot plugin development.

limber dust
#
public void setDamage​(double damage)
Sets the raw amount of damage caused by the event.
For compatibility this also recalculates the modifiers and scales them by the difference between the modifier for the previous damage value and the new one.

Parameters:
damage - The raw amount of damage caused by the event```
#

^^

quasi flint
#

oh that is what it does

exotic scroll
#

entity.setDamage(EntityDamageEvent.DamageModifier.BASE , (entity.getDamage*multiplier))

quasi flint
#

?learnjava

undone axleBOT
exotic scroll
#

kk

waxen plaza
#

This should change the item name, but it doesn't

limber dust
#

whats the full method

#

?paste

undone axleBOT
waxen plaza
iron condor
#

how can I get a players head?

chrome beacon
#

But a space in there

#

" "

waxen plaza
#

ok

oblique pike
#

Guys, if there anybody who understands how the spigot messaging channel works, i would like to ask you a couple of questions, thanks

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.

oblique pike
#

okay, if i do player.getServer().getInfo().sendData() from bungee, and catch the event on spigot, what player will be passed in the event on spigot

chrome beacon
#

Well you're not sending any players with that

#

You're not really sending anything with what you've shown

oblique pike
#

The player is in the events params

chrome beacon
#

Send the player UUID instead

oblique pike
#

I mean that one

chrome beacon
#

I see

#

That one will be sent if you use player.sendPluginMessage

oblique pike
#

So, when i send data from bungee (as on bungee there is no sendPluginMessage method on bungee) the player is just a random player from server that received the message?

chrome beacon
#

I'm not entirely sure

#

Let me check Javadocs

waxen plaza
#

can I set an inventory items to be unmoveable?

oblique pike
limber dust
#

^

waxen plaza
#

ok, I thought there would be a property..

limber dust
#

na

oblique pike
#

you can add one using PersistentDataContainer 😄

chrome beacon
#

But you need to use sendData on the ProxiedPlayer object not server

oblique pike
#

oh, that makes sense

chrome beacon
#

I'm not sure what happens if you just send it to the server without the player

chrome beacon
#

I see

oblique pike
#

At least i could not find any logic in that choice XD

waxen plaza
#
    public static void InventoryClickEvent(InventoryClickEvent e){
        if(e.getClickedInventory().getName().equalsIgnoreCase(ChatColor.RED+"ADMIN STUFF")){
            e.setCancelled(true);
        }
    }``` Is this how to cancel an inventory click event? and why it doesn't work
oblique pike
hasty fog
#

Uhh its static

chrome beacon
#

^^

chrome beacon
oblique pike
#

i only changed the method, the channel stayed the same

#

And yes, it is registered

chrome beacon
#

hm

oblique pike
#

And thats a message sending method from bungee plugin

chrome beacon
#

Looks fine

#

I mean I've never really done this before

oblique pike
#

and if i just change player.sendData to player.getServer().sendData it starts receiving those messages

#

The hell is that

chrome beacon
#

uh

oblique pike
#

i guess i will just have to send needed players name as a string for every message

#

thats weird

chrome beacon
#

Maybe it's a bug?

#

Make sure Bungeecord and Spigot are up to date

quaint mantle
#

Hello how i get Player2?

Player fall from high place when trying escape Player2

I am using EntityDeathEvent
and use event.getEntity().getLastDamageCause()

chrome beacon
#

getKiller?

#

I'm not sure actually but you can try

quaint mantle
#

ik have that but
what about arrow? i dont know if arrow detect the shoter

#

what about this?

if(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
                EntityDamageByEntityEvent damager = (EntityDamageByEntityEvent) event.getEntity().getLastDamageCause().getDamager();
                console.info(damager.getName());
            }
exotic scroll
#

@quaint mantle

    public void EntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
        if(e.getCause() != EntityDamageEvent.DamageCause.PROJECTILE) {
            Projectile projectile = (Projectile)e.getDamager();
            if(((projectile.getShooter() instanceof Player)) && ((e.getEntity() instanceof Player))) {
                //TODO: YOUR CODE HERE
            }
        }
    }```
#

Entitydamagebyebtityevent, check if the damager was a projectile and if it is you can get the shooter

limber dust
#

i think you meant to write ==

exotic scroll
#

oh sry

#

?md paste

limber dust
#

?paste

undone axleBOT
exotic scroll
#

does this work?

quaint mantle
#

Someone know what the error here?

DamageCause deathCause = player.getLastDamageCause().getCause();

waxen plaza
#

I am testing plugins and everytime I need to change client to join older version, how can I just join with 1.17 on all servers?

quaint mantle
#

I using Intellij IDEA

sender.sendMessage(ChatColor.translateAlternateColorCodes('&', this.getConfig().getString("reload-message")));

Error: https://imgur.com/a/N81fgqo

opal juniper
#

It is not ur main class

eternal oxide
#

getConfig() is a method only available in the class that extends JavaPlugin

opal juniper
#

so therefore it does not extend JavaPlugin

#

yes

ivory sleet
#

I mean there’s no such instance method called getConfig

exotic scroll
#

public class Main extends JavaPlugin implements Listener {

#

example

#

i guess

opal juniper
#

for a main class yes

#

but this is a command class

eternal oxide
#

Your code is in ReloadCommand

opal juniper
#

so just use the instance of the plugin

exotic scroll
#

is there any configless plugin out there?

opal juniper
#

what?

ivory sleet
#

Configless?

quaint mantle
exotic scroll
opal juniper
#

wdym by that

ivory sleet
#

What does that mean

opal juniper
#

as in a plugin with no config?

exotic scroll