#help-development

1 messages · Page 1378 of 1

solemn shoal
#

mine doesnt disable if you dont have vault or economy plugin

#

you need add null checks on econ

young knoll
#

Correct

#

Because you didn’t code it that way

deep solstice
#
    @Override
    public void onEnable() {
        if (!setupEconomy() ) {
            log.severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName()));
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        setupPermissions();
        setupChat();
    }```
this is what the github page told me to do, so i did as it said lol
#

but yeah server starts up fine now, thank you

solemn shoal
#

ah yeah

#

it explicitly disables the plugin if you dont have vault

deep solstice
#

yeah which i guess makes sense

solemn shoal
#

i didnt look at their github

#

i just googled bukkit add economy support to plugin or something like that

young knoll
#

Vault is great

#

saves you from manually hooking 20 different economy apis

solemn shoal
#

yes

humble heath
#

Would anuone be able to write the code i need plz and pm it to me

solemn shoal
#

is there an event for sweeping attacks?

#

@humble heath depends on what you need

drowsy helm
humble heath
#

I need to get the args0 of a command from the com.class to the event.class for my gamemodegui

drowsy helm
#

what

solemn shoal
#

why do you have class called com

#

and a class called event

drowsy helm
#

and why cant you write this yourself lol

humble heath
#

Cmd.class

young knoll
#

Basically they want a map uuid -> uuid that can be set in a command and read in an event

solemn shoal
#

lol

humble heath
#

The class names are examples

solemn shoal
#

depending on whats needed

young knoll
#

No, just a map

humble heath
#

I need the playername /gmg playername

#

Can someone pm me the code plz

young knoll
#

No need to persist the data when the server stops

solemn shoal
#

idk how to use maps lol

humble heath
#

Neather do i

solemn shoal
#

i just use lists

#

List<type> name = new ArrayList<type>();

young knoll
#

Sigh

humble heath
#

But how do i call for that from a different class

young knoll
#

Make a getter

solemn shoal
#

oh yeah nvm

#

ive used maps before then

#

yeah i have a single HashMap

#

public static HashMap<Long, ArrayList<Integer[]>> RedstoneEvents = new HashMap<>();

young knoll
#

Ahh static

eternal oxide
#

@humble heath Have you written a working plugin before?

drowsy helm
#

map of list of array

solemn shoal
#

"ahh static"

drowsy helm
#

stop

young knoll
#

No

drowsy helm
#

D:

young knoll
#

Bad

#

You generally never need static for a plugin

#

Except util methods

drowsy helm
#

what are the variables for exactly?

solemn shoal
#

its all runtime data

eternal oxide
#

or constants

drowsy helm
#

plugins are singletons

eternal oxide
#

or single instance fields

drowsy helm
#

just keep static stuff in your plugin main class

young knoll
#

Okay yes that too

drowsy helm
#

^ but not static

young knoll
#

But you get the idea

solemn shoal
#

itd be a mess

drowsy helm
#

theres better ways lol

young knoll
#

That’s what dependency injection is for

solemn shoal
young knoll
#

I do like the singleton pattern for manager classes, but I still avoid it

drowsy helm
#

why not keep an instance of RuntimeStore

#

and pass it with DI

solemn shoal
#

idk how to DI

drowsy helm
#

just pass it in the constructor

solemn shoal
#

oh that

#

id have to pass it to idk

#

a bunch of classes lol

young knoll
#

Yes that’s generally the idea

solemn shoal
#

which is no fun

drowsy helm
#

just have the instance in your plugin class

young knoll
#

I pass my plugin instance around a lot

drowsy helm
#

then DI your plugin class

#

then you can reference it from plugin#getRuntimeStore().....

solemn shoal
#

its easier to just have a class with static vars

eternal oxide
#

static is always easier, but almost never right

solemn shoal
#

makes for cleaner code imo

drowsy helm
#

and less efficient

young knoll
#

It’s generally the opposite of cleaner code

#

You’ve reminded me I was going to mess with that old bloodmoon plugin today

#

Oh well, always tomorrow

solemn shoal
#

xD

young knoll
#

I had to use wayback machine just to find the old page for it

humble heath
#

@eternal oxide yea

#

All i need is the code to save the playername to a hashmap and how to access that from a different class plz

#

Never used hashmaps b4

crude charm
#
 % brew install maven
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "maven".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
eternal oxide
humble heath
#

I have my gamemode gui working but i am struggling to get the playername from the command in to the event class to run the playername.setgamemode(creative)

eternal oxide
#

if its a gui it shoudl use no commands

humble heath
#

What you mean no commands

eternal oxide
#

And if its just setting a gamemode it should not be done in an event class other than teh gui class

crude charm
#

@eternal oxide can you please help me

eternal oxide
eternal oxide
eternal oxide
crude charm
#

I got a second computer (mac)

#

but ive never used a mac

humble heath
#

So yea that is what i am trying to do when someone clicks the item it changes there gamemode but i need to get the players name to the event class

eternal oxide
drowsy helm
#

try brew install maven@3.6.3

crude charm
#

aight

eternal oxide
drowsy helm
eternal oxide
#

usually event.getWhoClicked()

crude charm
# drowsy helm try ```brew install maven@3.6.3```
% brew install maven
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "maven".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
zoibox@Williams-MacBook-Pro ~ % brew install maven@3.6.3
Updating Homebrew...
fatal: Could not resolve HEAD to a revision
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 7 casks.

==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "maven@3.6.3".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
humble heath
#

lolnot command the cmd i write is /gmg playername to change another persons gammode

drowsy helm
#

no clue then

#

google it

#

this is spigot help not mac help

crude charm
#

this is homebrew

crude charm
#

not mac

eternal oxide
#

Do you mean it pulls up a GUI so you can set that player?

humble heath
#

Yes

young knoll
#

They want to run the command, and then pull up a GUI to set the gamemode for the target player

eternal oxide
#

Then you need to pass the player name from yoru command to your GUI, which is simple dependency injection.

humble heath
#

How

eternal oxide
#

Show your code you use to open your GUI

#

?paste

queen dragonBOT
humble heath
#

I will when i finish work

#

If(args == 1){
Do stuff}

eternal oxide
#

no

humble heath
#

It works

#

Im not home anyway i was just gussing my code

eternal oxide
#

args is an array, it will never == 1

drowsy helm
#

if you dream hard enough it will

cunning cloak
#

How do I make it so then the console can send a message to the people who have the correct permissions?

So you run testmessage hi in console then
[TestMessage] Console: hi <-- Gets sent to the people who has the correct permissions?

If I try player.sendmessage it sends back a null error. Any ideas?

drowsy helm
#

i think Bukkit.broadcastMessage has an overflow method for perm

quaint mantle
#

i'm not good in java, but I think you can get the list of player, you make a for loop for each player, if the player has a permission, send it the message

#

maybe it's wrong what im saying

drowsy helm
#

yeah you can do that aswell, but bukkit has a method for it already

quaint mantle
#

oh okay nice

cunning cloak
quaint mantle
#

show your code

drowsy helm
#

yeah then do what vs said

humble heath
#

I will send u my code tonight @eternal oxide

drowsy helm
#
for(Player player : Bukkit.getOnlinePlayers()){
  if(player.hasPermission("myPerm")
    player.sendMessage("message");
}
sullen marlin
quaint mantle
#

halp how do i fix my scoreboard to not flicker D;

drowsy helm
#

lemme guess 1.8?

rocky glacier
#

Do you guys know why, if I update an armorstand's headpose each tick, it only appear s to update ~5 times per second (very stuttery)?

eternal oxide
#

Don;t recreate scoreboards, update them

drowsy helm
#

teleporting heads doesn't interpolate movement so naturally you are going to get stutters

rocky glacier
#

Uh I am using velocities on entities

drowsy helm
#

for head pose?

rocky glacier
#

Its in a loop each tick

#

No not for headpose

#

There are no velocities for headpose

#

only setHeadpose

drowsy helm
#

this is inside a runnable task?

rocky glacier
#

Yes

#

In a scheduled repeating task

drowsy helm
#

hmm i see no reason why it would be doing that

#

do you have any expensive calculations in your runnable?

rocky glacier
#

Yes. xd

#

Well not thát expensive

drowsy helm
#

what sort of calculations?

rocky glacier
#

But it could be too much

#

lets see

#

You know what ill just past it in here

drowsy helm
#

yeah that would be best

rocky glacier
#

I have some models you wont know about but youll get an idea of it

#

lemme get a pastebin

#

I am also riding the armorstand btw

#

no thats not true

#

I am riding a different armorstand

#

changed that recently lol

drowsy helm
#

nothing in there is really expensive to calculate

rocky glacier
#

Thats what I thought

#

rotations and stuff are smooth

#

Armorstand with velocity updates each tick are too

#

But headpose is just like nah bruh

drowsy helm
#

just head movement?

rocky glacier
#

Yea its an armorstand with fixed yaw

#

and rotating head

drowsy helm
#

im not sure how expensive converting radians to euler is

#

you could try simplify pi to a lower decimal

rocky glacier
#

hmm could be it but i dont think thats causing any problems

drowsy helm
#

how about

#

you try to JUST change the head pose

#

and see how that fairs

#

try and eliminate all other factors

rocky glacier
#

Lets see

#

Good thinking lol

#

its early in the morning for me

drowsy helm
#

best time to code imo lol

rocky glacier
#

woops falling through the world xD

#

Whats the minimum headpose incremental?

#

is it just 1 degree radians?

drowsy helm
#

I'd assume so

rocky glacier
#

Still same problem rip

#

I could try a different task thats rotating it incrementally

#

see if thats smooth

drowsy helm
#

i doubt that owudl do much

#

if you've cut down everything else

#

can i see what code you have now

rocky glacier
#

Well its kinda hard to cut down everything since its a few files working together

#

difficult to explain

drowsy helm
#

everything as in velocity n such

#

just break it down to the headmovement alone

rocky glacier
#

Yea but it makes me fall through the world

#

Velocity is keeping me in place

drowsy helm
#

oh right

#

so getSteer() is deg right?

rocky glacier
#

Yep

drowsy helm
#

my only idea is the eulerAngle

#

because its calculating pi

#

but that really shouldnt be that expensive

rocky glacier
#

lets try to fix that then

drowsy helm
#

not much you can do for it

#

EulerAngle is the onyl arg it can take

rocky glacier
#

nah i mean radians calculation

#

but i doubt thatd do anything

#

maybe eulerangle is just slow ye

rocky glacier
drowsy helm
#

but if changing the headpose is laggy, that means everything else would lag

#

since its on the same thread

rocky glacier
#

Yea thats the weird thing

drowsy helm
#

so I'm assuming you're not incrementing the headPose enough

rocky glacier
#

that could be it honestly!

#

That it only updates if change is higher than 0.1 for example

#

lets see

drowsy helm
#

maybe clamp it

rocky glacier
#
float eulerRot = modelRotationOffset - steerRadians;
        if(curTurn != 0 && speed > 0){
            double newTilt = turnSpeed * curTurn *.04;
            if(Math.abs(eulerRot - prevEulerAngleRot) > 0.1){
                vehicleModel.setHeadPose(new EulerAngle(0, modelRotationOffset - steerRadians, 0));
                prevEulerAngleRot = eulerRot;
            }
        }else{
            if(Math.abs(eulerRot - prevEulerAngleRot) > 0.1){
                vehicleModel.setHeadPose(new EulerAngle(0, modelRotationOffset - steerRadians, 0));
                prevEulerAngleRot = eulerRot;
            }
            turnSpeed = minTurnSpeed;
        }

changed it to this

#

but now its more stuttery lol, lets try to reduce it

drowsy helm
#

hm other than that i dont think it's possible to smooth it anymore

#

unless you have a way to interpolate your movement

rocky glacier
#

hmm damn

drowsy helm
#

iirc head movement has a "catching point"

#

so you have to move the camera enough from the intial head rotation for it to actually move

#

thus, why you're gettign that, because you arent incrementing enough, by the time you do increment by enough it snaps to that point

rocky glacier
#

also, the setting headpose makes the armorstand velocities shake more than if theyre gone

#

Can I share my screen with you real quick in personal call? Ill mute myself, just for the screen

drowsy helm
#

I can't atm sorry.

rocky glacier
#

Np

#

This is just so frustrating hah

drowsy helm
#

yeah minecraft does some dodgey with small values lol

#

ran into similar issues when trying to animate armorstands a bit ago

rocky glacier
#

yeah thats similar to what im doing

drowsy helm
#

does the rotation of your armorstand's body matter much?

rocky glacier
#

nop

#

only head

drowsy helm
#

im thinking maybe you can teleport the entity instead

#

to that rotation

rocky glacier
#

It also needs tilt in the end :/

drowsy helm
#

ah damn

rocky glacier
#

but if i scratch the tilt, i could definitely do that

drowsy helm
#

because i use teleportation for my animation and it works 100% smooth

#

and that minimum head movement thing wouldnt be a problem at that point

rocky glacier
#

Hmmm

#

Lets try that then i guess

#

im out of options here really

drowsy helm
#

may i ask

#

what is this for?

#

i see vehicle in your code so i was thinking cars or something

rocky glacier
#

Yep something like that hah

#

Bikes to be precisely

#

Thats why the tilt

drowsy helm
#

right

#

yeah but teleporting seems the smoothest way of doing it

#

if i had videos of my system i would should you, but it works great

rocky glacier
#

Cool

#

I wil ltry to implement it quickly

#

rotation is muuuch smoother

drowsy helm
#

awesome

rocky glacier
#

But now the tilting, lets see

drowsy helm
#

for tilt you can probably still set head pose

#

but that will be stuttery

rocky glacier
#

Thats ok

drowsy helm
#

i think thats a compromise you have to make

rocky glacier
#

Yea

#

Its minecraft after all lol

drowsy helm
#

yeah lmao

rocky glacier
#

Oh right, when im setting headposes and yaw

#

it glitches

#

rotation is like: nah bro now im 45 degrees off of what you tell me to do

#

i can make screen

drowsy helm
#

pitch is offset by like 45 deg i think

#

its weird

#

or 90, i forget

rocky glacier
#

its nothing to do with pitch tho :/

#

its just yaw

#

Can i send you a picture quickly

drowsy helm
#

sure

solemn shoal
#

ok but how do you mean intellij

drowsy helm
#

whats that from?

eternal oxide
#

Looks pretty self explanatory.

quiet ice
#

Sometimes you can ignore such warnings

solemn shoal
#

oh wait

#

heres where it complains

eternal oxide
#

Looks liek you are doing some instanceOf on a type you already know from line 105

solemn shoal
#

yes i know duplicate piglin check

drowsy helm
#

monster will encapsulate all of those other checks wont it

solemn shoal
#

line 105 is that entire instanceof block btw

ivory sleet
# solemn shoal

thats a lot of checks ngl maybe use an EnumSet<EntityType> for a bit faster performance?

quiet ice
#

yeah, it will look at the e instanceof Monster operation and waste processing power for the rest if I am not wrong

eternal oxide
#

its going to pass on Monster and never get to any of the Piglins

drowsy helm
#

you do realise e instanceof Monster will be true for all of those other checks

#

so you onyl need the one check

eternal oxide
#

or if it fails on Monster its never going to pass Piglin

solemn shoal
#

no it wont

#

Slime, Boss, Ghast, Shulker and Phantom arent subtypes of Monster

drowsy helm
#

ah yeah

#

piglin is tho

solemn shoal
#

yeah

#

i just removed that one

drowsy helm
#

weird how phantom isnt part of monster

#

or ghast

quiet ice
drowsy helm
#

I sort of get why slime wouldn't be

solemn shoal
#

phantom extends Flying

#

which extends Mob

#

Slime is mob too

#

Shulker is Golem and Colorable

#

Ghast is Flying

quiet ice
#

let me see

#

?stash

queen dragonBOT
drowsy helm
#

so stupid coding lel

ivory sleet
#

lol

quiet ice
#

Yep, you are correct. Even though this is really stupid, I'd PR that but I don't have the needed accounts so ¯_(ツ)_/¯

quaint mantle
#

?

quiet ice
#

Bukkit is irrelevant, cb is more important

solemn shoal
#

essentially the same no?

drowsy helm
quaint mantle
#

they go hand in hand

drowsy helm
#

not really

quiet ice
#

Not really, there are a few differences

quaint mantle
#

i mean its irrelevant as you say it is

#

not*

quiet ice
#

In this case it is irrelevant, the only thing that would complain is the IDE as you know more than it

solemn shoal
#

strider too

drowsy helm
#

public class UrMum extends Rideable

solemn shoal
#

imagine

#

imagine implementing a block and extending rideable

drowsy helm
#

make a plugin for it lel

eternal oxide
solemn shoal
#

definitions stay the same

#

i mean it didnt really matter as for this convo right now

quaint mantle
solemn shoal
#

scoreboards arent THAT hard

quaint mantle
#

pfft i hate them xD i always sucked at making them ¯_(ツ)_/¯

solemn shoal
#

this is made with nothing aside the bukkit api

quaint mantle
#

non flickering? 🤔

#

that was my issue tried so many ways non of them solved

#

so ended up with using api

eternal oxide
#

it only flickers if you create new ones

quaint mantle
#

even with buffer and teams it flickered

eternal oxide
#

No flickering.

#

And thats just the Bukkit API

solemn shoal
#

yeah non flickering lol

quaint mantle
#

then ig i have no luck with bukkit scoreboard api

solemn shoal
eternal oxide
#

^ do once per player per scoreboard and never again

solemn shoal
#

i havent had flickering

quiet ice
#

No flickering here too

quaint mantle
#

jealous noises xD i legit ended up with using api ;-;

quiet ice
#

Though how do you make use of the scores? Or do you create objectives for that?

solemn shoal
eternal oxide
#

yes if you set it up correctly

#

each line is a scoreboard entry

solemn shoal
#

ah

quaint mantle
eternal oxide
#

um, thats not how to use Placeholder API

quaint mantle
#

oh idk because it worked for me all time

eternal oxide
#

Check for the plugin not reflectively look for the class.

quaint mantle
#

my plugin isnt the bad side i think papi is

eternal oxide
#

you shoudl set a flag field in your onEnable to say if you have the plugin

quaint mantle
#

flag field?

#

oh this

#

nah thats not the problm

eternal oxide
#

what is all? in PlaceholderAPI.setPlaceholders(all, line)

#

That should be a Player or an OfflinePlayer

solemn shoal
#

i wonder

quaint mantle
#

its Player

eternal oxide
#

what are you currently seeing as the end result?

quaint mantle
eternal oxide
#

add debug to see which section of code is being run. The placeholder code or the exception code

quaint mantle
#

the placeholder

#

already tested it

eternal oxide
#

in that case its going to fail to get teh line as you changed it

summer scroll
#

Why he's using try catch to check If PAPI is enabled/installed on the server?

eternal oxide
#

because he's not too good at programming?

quaint mantle
#

...

#

and why would i wanna check if i dont need it

eternal oxide
#

As I said earlier you need to test in onEnable and set a flag if its present

#

you just then check yoru flag to see which code you need to run.

quaint mantle
#

i did this and it returns works

#

if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
/*
* We register the EventListener here, when PlaceholderAPI is installed.
* Since all events are in the main class (this class), we simply use "this"
/
setupScoreboard();
log("works");
} else {
/

* We inform about the fact that PlaceholderAPI isn't installed and then
* disable this plugin to prevent issues.
*/
log("Could not find PlaceholderAPI! This plugin is required.");
Bukkit.getPluginManager().disablePlugin(this);
}

eternal oxide
#

you could replace all that by adding in your plugin.yml a depend: [PlaceholderAPI]

quaint mantle
#

rly

eternal oxide
#

a depend means your plugin will not start if the depend is not satisfied

eternal oxide
quaint mantle
#

i know

eternal oxide
#

else you'd not be doing a try/catch

quaint mantle
#

well ya

eternal oxide
#

So, if your plugin can run without placeholder you need to flag ifd its found. Else just add a depend and you can completely ignore any tests

quaint mantle
#

okay

humble heath
#

Any idear how i can fetch the name from the second part of my command in the cmd in my lisener class to be able to set the player name

#

@eternal oxide do you understand what i am trying to do

eternal oxide
#

If (args.length() > 0) Player player = Bukkit.getPlayer(args[0]);

humble heath
#

Yes but it is a gui

eternal oxide
#

then check if player != null

humble heath
#

I have all that works

#

But when i do catch 5: target.setgamemode(Gamemods.creative); it cant find set gamemode in listener class i need to get the player name over from commandexecuter class

eternal oxide
#

you need to pass the player to the gui you open for the command issuer

humble heath
#

Yep that is what i need to know hpw to do

eternal oxide
#

I'm going to assume you use something like new GUI() instead do new GUI(player)

humble heath
#

Im can’t remember i will send you cmdexecuter code when i get home

#

@brave glenhandeler

solemn shoal
#

huh

#

they joined like, an hour ago lol

#

their fault for being called "event" xD

#

wait nvm

#

that was 2 months ago

#

and its not even 4am

#

im retarded :LUL:

#

oh, no external emotes, ok

humble heath
#

Public void onClickinventouryevent(Inventoryclickevent e){
Switch slot(){
Catch 1: target.setgamemode(GAMEMODE.CREATIVE);
e.setCanceld(true);
Break;

eternal oxide
#

until you show how you are opening your GUI we can go no further

humble heath
#

@Override
public boolean onCommand(CommandSender sender, Command cmd, String lable, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
int i = 1;
String pname = p.getName();
if (!p.hasPermission("ee.gmgui")) {
sender.sendMessage(Utilities.color(Prefix + NoPerm));
return true;
}
if (cmd.getName().equalsIgnoreCase("gm")) {
if (args.length < 1) {
sender.sendMessage(Utilities.color(Prefix + SpecifyPlayer));
return true;
}
if (args.length == 1) {
Player T = Bukkit.getPlayer(args[0]);
if (T == null) {
sender.sendMessage(Utilities.color("&4Player Not Valid"));
return true;
}
ArrayList<String> lore = new ArrayList<String>();
Inventory inv = Bukkit.createInventory(p, 18, "GamemodeGui " + T.getDisplayName());
//Player skull
int lifePlayer = (int) p.getHealth();
ItemStack item = new ItemStack(Material.PLAYER_HEAD);
SkullMeta skull = (SkullMeta) item.getItemMeta();
skull.setDisplayName("§c§l" + T.getName());
lore.add("the player you are going to punish");
skull.setLore(lore);
skull.setOwner(T.getName());
item.setItemMeta(skull);
inv.setItem(4, item);
//item 1
ItemStack item1 = new ItemStack(Material.RED_CONCRETE);
ItemMeta meta1 = item1.getItemMeta();
ItemMeta im = item1.getItemMeta();
meta1.setDisplayName(Utilities.color("&4Gamemode Creative"));
meta1.setLore(Arrays.asList("Set "

ivory sleet
#

jesus

eternal oxide
#

?paste

queen dragonBOT
eternal oxide
#

ok you have the name on your skull ItemStack

humble heath
#

I don’t want the skull anymore

eternal oxide
#

its in your GUI

#

so when its clicked get teh name off it

humble heath
#

That i used that code and removed the skull

#

Can i do that a different way

eternal oxide
#

ok, then set meta on the itemstack you are putting in yoru UI

humble heath
#

Like

eternal oxide
#

or put it in the lore

#

why are you getting the meta twice? meta1 and im

humble heath
#

O ok but how i ref it in the listener I tryed with the skull but could not change the gamemode can i use the tital

eternal oxide
#

set meta for the player name or uuid on the itemstack. Then in teh click event you read that same meta to get the name back

#

heck you already set it in the lore

humble heath
#

Put the name in the gui title ie change planame gamemode

eternal oxide
#

you could

humble heath
#

Could you right out the two lines for me plz

#

I am a little stuck here

ivory sleet
#

what u wanna do

humble heath
#

Elgarl knows

eternal oxide
#

You have already set teh name in multiple places. Just read it back

humble heath
#

@ivory sleet i am here

ivory sleet
#

ok

#

so send what u wanted to do here

quaint mantle
#

hi i have a problem with placeholderapi not working with Bukkit.getOnlinePlayers()?

humble heath
#

/gmg playername player name in gui tital. Then in event class pull the playername out the title so i can change the gamemode

#

@ivory sleet

eternal oxide
#

event.getView().getTitle()

humble heath
#

I have all the gui set up

#

But how do i remove the rest of the gui title or do i just set it as the playername

eternal oxide
#

you could use String.split

humble heath
#

How

#

E.getview().getTital().split

#

@ivory sleet are you there

eternal oxide
#

split is a basic java method google will tell you all about it

humble heath
#

Don’t get that can you write the code i need plz

eternal oxide
drowsy helm
#

does spigot have gson inbuilt?

#

I've always shaded it but never really cared to check if i needed to

humble heath
#

I still don’t understand

#

Can someone plz just write the code i need thank you

ivory sleet
#

sry jai

drowsy helm
#

epig

ivory sleet
#

had to finish assignment

humble heath
#

Sorry

#

Do you understand what i need

ivory sleet
#

u wanna make a gui?

humble heath
#

I have the gui i just need the name in the event class

ivory sleet
#

ok

#

Send what u got so far and we'll work it out

eternal oxide
#

@ivory sleet he already had a GUI, However I don't know how. He's just not willing to read how to use String#split

ivory sleet
#

lol

humble heath
#

I have I don’t understand it

ivory sleet
#

What you dont understand?

#

Can you elaborate or like specify

lost matrix
sleek pond
#

its so easy

#

u can even use intellisense

eternal oxide
# sleek pond lmao why

He seems to have almost zero java knowledge. Its all copy/paste and he's unable to understand something very simple such as passing a variable between classes or String#split.

sleek pond
sleek pond
#

unless that's not what he wants

#

idk what he wants

eternal oxide
sleek pond
#

why would he need to split?

eternal oxide
#

because the title isn;t just the name

sleek pond
#

oh

eternal oxide
#

the name is in the title and in every line of the Lore.

sleek pond
#

?

#

wdym by that

#

like of all the items?

eternal oxide
#

yep

#

he added comments to teh lore on every item that includes the player name

sleek pond
#

why?

eternal oxide
#

I suggested just add the name itself as meta but he didn;t understand that either. Just wanted me to give him the code.

sleek pond
#

wait let me get this straig

#

lets say we have an inventory with tile Suitcase

#

we have a vanilla (non-edited) stone sword, then an empty space, then a peice of bread

#

what would the name be

eternal oxide
#

His inventory has blocks for each gamemode. so he added lore to each for "set gamemode Survival: playername"

sleek pond
#

or is there just a getTitle to remove the hassle of that

#

?jd

eternal oxide
#

he also set a title that has the players name on the end

sleek pond
#

god this is dumb

#

im at school

eternal oxide
#

he simply can't understand how to get the name off the end of a string

sleek pond
#

and the school wifi doen't let u visit spigot cuz it thinks its forums

eternal oxide
hollow arch
#

Is there a way to force-update light on the client side?

hard raft
#

idk if anyone can help but

#

there's an error with my plugin?

eternal oxide
#

Magic 8 ball says...

outer crane
#

is the error your computer melting?

hard raft
outer crane
#

does it rm -rf your drive?

hard raft
#

i think you're joking but at this point i have no idea

eternal oxide
#

read your latest.log on your server

outer crane
#

show plugin.yml too

hard raft
#

ok

#

ill get screenshots one sec

outer crane
#

no not screenshots

#

use a paste site

eternal oxide
#

?paste

queen dragonBOT
hard raft
#

wait it just worked :0

#

idk how, before it was showing an error

humble heath
#

I I struggle with understanding things i am still only learning

eternal oxide
#

You need to stop copy/pasting code and try understanding what each line does

humble heath
#

I do

eternal oxide
#

then you'll understand the lines where you added Lore

humble heath
#

I know that

#

I used lore with the head and when I tried target it still didn’t work

#

Im on my way home now anyway

sour rampart
eternal oxide
#

CreateRecipe.java:18

sour rampart
#

plugin.getCommand("createrecipe").setExecutor(this);

outer crane
#

is that command in your plugin.yml?

sour rampart
#

yes

eternal oxide
#

bet its not

outer crane
#

send that over too

eternal oxide
#

or plugin is null

sour rampart
#

sending it one sec

outer crane
#

the entire class

#

and the entire plugin.yml

eternal oxide
#

?paste

queen dragonBOT
eternal oxide
#

or drop the plugin.yml in chat

#

it will auto format

sour rampart
outer crane
#

plugin is null

eternal oxide
#

Your plugin field is null in CreateRecipe.java

sour rampart
outer crane
#

well then thats very cursed

sour rampart
#

?

quaint mantle
pure glacier
#

you're referring to the event as e, not event

eternal oxide
# sour rampart ?
    public CreateRecipe(Main main) {
        this.plugin = plugin;``` You call it main and try to use plugin
#

you set plugin to itself

outer crane
pure glacier
#

sorry bossman oskar

outer crane
#

oh i forgot that im on crack

eternal oxide
pure glacier
#

oskar you're always on crack

#

remember that fact

outer crane
#

no

pure glacier
#

remembering it or not doesnt change it

#

🤷

thorn beacon
#

How do people here go about adding config values once their plugin's been released, without the users needing to add the config values manually?

eternal oxide
#

most plugins tell users to delete their config when upgrading

thorn beacon
#

Oh really? Fair enough then lol

outer crane
#

just remember to include a config version

#

makes it so much easier

thorn beacon
eternal oxide
#

If your config gets big you can programatically update

#

but its not simple

thorn beacon
#

no, I've gathered from 3 hours of trying lol

outer crane
#

i can send demo of how i do it, but it isnt a spigot plugin

outer crane
#

nope

thorn beacon
#

If you wouldn't mind, that would be great

thorn beacon
#

thank you very much \o/

lean bone
#

Im running into problems setting the helmet of my Giant, I can set it to a Diamond Helmet without problems, but when I try to set it to a block (like a carved pumpkin) or a player head, it doesn't show up. Does anybody know how I can fix this issue?

#

Here's my code (Kotlin):

            entity = origin.world!!.spawnEntity(origin, EntityType.GIANT) as Giant
            entity!!.isInvisible = true
            entity!!.customName = "discoDomeBall"
            entity!!.equipment!!.helmet
            entity!!.equipment!!.setHelmet(ItemStack(Material.PLAYER_HEAD), true)
            //entity!!.equipment!!.setHelmet(Util.urlHead("456df2ff06e0713819ae062899130ae0bfc67c5121db7ce951f4aaa3b20f072c"), true)
            entity!!.setAI(false)
            entity!!.isSilent = true
            entity!!.isInvulnerable = true
        }```
quaint mantle
outer crane
#

what are the exclamation marks for?

eternal oxide
#

getConfig().getStringList("HisenCZ.buildedMaps")

quaint mantle
#

ik that but im trying to check from the stringlist if there is a string "map4" in the list

eternal oxide
#

.contains("map4")

lean bone
outer crane
#

oh it would be useful if you stated that :p

quaint mantle
#

okey ill try

lean bone
#

But the most important line is entity!!.equipment!!.setHelmet(ItemStack(Material.PLAYER_HEAD), true), which in java is entity.getEquipment().setHelmet(new ItemStack(Material.PLAYER_HEAD), true);

#

I just cant get it to work when I change the material from DIAMOND_HELMET (or another type of helmet) to a block

eternal oxide
#

I think I remember md_5 saying something about blocks as helmets do not scale

woeful crescent
lean bone
woeful crescent
#

As you can probably tell, I am trying to replace the name of a ChatColor typed in the chat with it's corresponding color, unless there is a backslash before it

#

but the error only occurs when processing the replacement for the color BLACK

woeful crescent
cloud current
#

Hi, why when I change player's gamemode on respawn event he has not the noclip

woeful crescent
#

?

#

Please be more descriptive

cloud current
#

me ?

woeful crescent
#

Yeah

lean bone
woeful crescent
#

You mean, it doesn't change them to spectator?

cloud current
#

When a player die I want him Gamemode Spectator

#

it changes

#

but it's glitched

eternal oxide
woeful crescent
#

ahhh

#

tysm @eternal oxide

woeful crescent
eternal oxide
#

no, two \

woeful crescent
#

I do have that already

eternal oxide
#

you posted a single here

woeful crescent
#

the compiler will throw an error if you just have a lone backslash anyway

#

Nah, what I posted is what the compiler sends through the regex

#

In most compilers, backslashes are a compiler-side escape token, so if you just want to leave one in a string you have to put another backslash before it

eternal oxide
#

yes, you need two as it has to be escaped

#

only escape the second

woeful crescent
#

@cloud current Still need help?

#

Can you give me the part of your code that contains the event?

cloud current
#

@woeful crescent ```java
@EventHandler
public void onRespawn(PlayerRespawnEvent event) {

Player killer = event.getPlayer().getKiller();
Location location = event.getRespawnLocation();

if (killer != null)
location = killer.getLocation().add(0, 3, 0);
else if (CashPrice.getInstance().getManager().getSpawnPoint() != null)
location = CashPrice.getInstance().getManager().getSpawnPoint();

event.setRespawnLocation(location);
event.getPlayer().setGameMode(GameMode.SPECTATOR)
}

#

I won't upgrade the plugin

compact haven
outer crane
#

yeah the other person told me

compact haven
#

basically if the variable is null then it'll stop

#

oh

cloud current
#

oh yes normally why

quiet ice
#

It depends

#

Plugins making use of NMS will not be compatible

cloud current
#

I'm not using any NMS

pure glacier
#

net.minecraft.server

quiet ice
#

And plugins making use of legacy code might not be compatible as there is a vocal amount demanding a sweep of old code

#

If you cannot do anything otherwise

pure glacier
#

its mojang's code so its not provided in the api maven repos

#

so other than installing the repo locally you cant really use it

quiet ice
#

well, you have to build spigot/craftbukkit in order to use it

pure glacier
#

yeah

#

been using paper for too long 😅

quiet ice
#

Or use repositories that I would consider to be illegal

long portal
#

Hey, im currently Developing a "The Bridge" Plugin. I wanna reset the World after a Round finished, how can i do that?

pure glacier
#

the whole world?

quiet ice
#

Disable autosave and restart the server :thinksmart:

sleek pond
#

save all blocks placed/removed

#

and blown up

#

and place them back

long portal
pure glacier
#

no need for a plugin

sleek pond
#

but he probably wants it to auto do that

#

not manually

outer crane
#

i use it for all my minigames and lobbies

long portal
quiet ice
#

Well, it still has the same effect

outer crane
#

yeah, advanced slime world manager + readonly world will work

long portal
#

The world should be restored to its old state

#

Thats what i want

quiet ice
#

By not saving the state it will revert to the old state

long portal
#

But it needs a restart?

#

or not?

quiet ice
#

Alternatively you can store all the blocks in an arraylist and remove the blocks, but what's the fun in that?

long portal
#

You could play "The Bridge" on Hypixel

#

and look what the gamemode is

quiet ice
#

I know what it is dummy

long portal
#

Sorry

quiet ice
#

Why can't you store all placed blocks to an arraylist?

long portal
#

xD

outer crane
#

mfw not listening to my solution

long portal
#

So, i'll add every block to a ArrayList and remove every block from the world, and add the ArrayList in?

#

?

#

But how do i add the Blocks?

for(Block b : ???)

#

Or world.getBlock

outer crane
#

do it the other way round

#

get every placed block

sleek pond
eternal oxide
woeful crescent
#

I got it, but thanks so much anyway.

long portal
#

SO SMART

#

OMG

#

SMART

outer crane
#

wanna know what else is smart

long portal
#

SOOO SMART

long portal
outer crane
long portal
#

Thats SMART

#

Too Smart for me

outer crane
#

useful for storing small worlds with readonly functionality

#

see where im going?

long portal
#

Yeee

#

you are too smart

outer crane
#

i could nuke my lobby server and after a restart or reload via a plugin its as good as new

#

something you probably are looking for

long portal
#

Is there any Tutorial? Or any Tutorial Code? I dont find a Tutorial online

#

Only how to install

#

im dumb

outer crane
long portal
#

k

#

thank you soo much for helping me

sour sand
#

is there a way to make the plugin add a datapack

crude charm
#

does anyone here use mac?

eternal oxide
#

are you still stuck installing maven?

woeful crescent
#

@eternal oxide wait, why does my regex match ermRED for something like ermREDhuh...

#

why not only RED?

crude charm
#

which IS spigot related

eternal oxide
woeful crescent
#

?

eternal oxide
#

all attached characters count as the word

woeful crescent
#

hmmm

#

is there any way to fix this?

eternal oxide
#

you want to to ONLY match that soecific patern?

woeful crescent
#

I'm not very familiar with regexes

#

I want to only match GREEN if it's something like heyGREENhello

#

but not match it if it is hey\GREENhello

eternal oxide
#

replace the w with b

woeful crescent
#

I'll try that

eternal oxide
#

are you trying to replace words with colours?

woeful crescent
#

yep

eternal oxide
#

then do a pattern match on a delimited list

woeful crescent
#

I can show you the code, hold on

#
public String colorSupporterMessage(String msg){
        for(ChatColor c : ccList){
            if(!c.equals(ChatColor.RESET)){
                msg = msg.replaceAll("\\b*(?<!\\\\)" + c.name(), c + "");
                msg = msg.replaceAll("\\b*(?<!\\\\)!" + colorShortcuts.get(c), c + "");
            }
        }
        msg = msg.replaceAll("\\", "");
        return msg;
}```
#

ccList is a list of all the ChatColors

eternal oxide
#

theres a simpler way I think. sec

sturdy elk
#

obfuscation in free plugins is prohibited?

paper viper
#

not prophited, but strongly discouraged

#

by the community

#

you should also take a look at the obfuscation rules

ivory sleet
humble heath
#

if (e.getView().getTitle().contains("Creative Gui Other")) {
final ItemStack targetHead = e.getClickedInventory().getItem(10);
final String targetName = ChatColor.stripColor(targetHead.getItemMeta().getDisplayName());

        if (e.getCurrentItem().getItemMeta() != null && e.getCurrentItem().getItemMeta().getDisplayName() != null) {
            switch (e.getSlot()) {
                case 0:
                    e.setCancelled(true);
                    break;
                case 1:

                    e.getWhoClicked().sendMessage(Utilities.color(Prefix + " " + "&b You Are Now in Survival!"));
                    targetName.set
                    e.setCancelled(true);
                    break;
#

,paste

sturdy elk
humble heath
#

@eternal oxide

#

@lost matrix

near crypt
#

what event could i use in 1.8 for a player entering water like in sumo duels

humble heath
near crypt
#

when the player fall into the water the player die is my end result and what is the event for this?

humble heath
#

im home now

eternal oxide
eternal oxide
humble heath
#

how

eternal oxide
#

or I think you put the name in teh GUI title, so get the name from there

near crypt
#

@eternal oxide and what is with my problem?

eternal oxide
#

you already know how to get Lore. You set it when you created your GUI

eternal oxide
near crypt
#

okay but every pvp server is on it

#

what event could i use in 1.8 for a player entering water like in sumo duels when the player fall into the water the player die is my end result and what is the event for this?

eternal oxide
#

around 8% of servers run 1.8

near crypt
#

no... pvp servers are running 1.8

#

and also hypixel

#

anyways i need a sulution

#
  • solution
fathom timber
#

He said it plural. He wasn't describing just 'pvp' servers. Just CTRL + F and look if others had your problem.

near crypt
#

no there is noone

fathom timber
#

It's also probably Entity collision. They usually have custom arenas.

#

So if you get the y level underneath the map and set it to where water is you could probably do whatever you plan on doing.

eternal oxide
fathom timber
#

^

near crypt
#

okay

glass pike
#

I joined a server and noticed that when you type a command "/help" for example, the text when you are typing it shows up as blue instead of the usual gray, how is this achieved?

quiet ice
#

Probably brigadier

glass pike
#

how do I use it?

quiet ice
#

Only god can help you with that

humble heath
#

when i pull the name off the head i cant get target name to work with the targetname.setgamemode(Gamemode.Creatine);

#

ity comes up in red

glass pike
#

creatine

eternal oxide
#

you have to get teh player with the name

paper viper
#

or in the api at least

fathom timber
#

Whats brigadier?

glass pike
#

Ill grab a screenshot from the server

near crypt
#

@eternal oxide but the == does not work just .equals()

paper viper
#

actually nvm i think you can support it?

#

let me take a look

eternal oxide
#

no Material is an == comparison

near crypt
#

hmm

#

if(event.getTo().getBlock().getType().equals(Material.WATER)) {
if(event.getFrom().getBlock().getType().equals(Material.WATER)) {

        }
eternal oxide
#

I missed () off getType()

quiet ice
eternal oxide
#

and thast wrong

quiet ice
#

== can be used for enums as they are singletons, .equals() is slightly slower and is not null-safe

near crypt
#

if(event.getTo().getBlock().getType() == Material.WATER) {
if(event.getFrom().getBlock().getType() == Material.WATER) {

        }
#

like this it is red

#

underlined

glass pike
#

@paper viper @fathom timber

quiet ice
#

Your IDE says why

glass pike
#

see how when I type /help

#

it is blue

paper viper
#

im trying to find the part

#

where it does that

quiet ice
#

Well, aqua. But isn't that default behaviour?

paper viper
#

in brigadier

glass pike
#

default would be red or gray

eternal oxide
#
if (event.getFrom().getBlockY() != event.getTo().getBlockY()) {
  if (event.getTo().getBlock().getType() == Material.WATER) {```
paper viper
#

i dont think its gray?

#

hm

glass pike
#

red for an unknown command and gray for a known command i think

quiet ice
#

If the command is parseable I think it's aqua

glass pike
#

or white

#

well here

#

it doesnt matter what text I enter, it is blue

#

now forgive me if I am wrong, but I dont think adhiuahsiudhaihds is parsable

#

^ that is my server

#

gray vs aqua

quiet ice
#

That probably means that some plugin is intercepting the command completion

fathom timber
#

Yeah

#

I would also blur out your links in your chat for that image

glass pike
#

am I gonna get in trouble for advertising or something?

fathom timber
#

Nah better to be safe than sorry

#

Yknow

glass pike
#

true

paper viper
#

i think its fine

#

i mean he isnt shoving it into our face

#

or chatting the links directly

fathom timber
#

Yeah he had a reason

#

But if they didn't read the context of his issue they could've seen it wrong

glass pike
#

but anyway, I have been trying to change the color of that for days now and there are ZERO answers anywhere

#

I could try using Denizen but im not sure if its capable of that

fathom timber
#

Do you know of any other servers that do that

#

Or just that one?

quiet ice
#

It's not documented interface

glass pike
#

Havent really tried any others

paper viper
#

i suspect its some intercepted packet

quiet ice
#

Wiki vg lists nothing that could do that

glass pike
#

to be fair, even hypixel uses gray and red

paper viper
#

I remember Choco mentioning something about this

#

let me try to find the message

glass pike
#

but idk that aqua looks so good for some reason, I just really want it haha

young knoll
#

Gotta hire a full graphic designer for colors

paper viper
fathom timber
#

Lol

paper viper
#

found the message

fathom timber
#

Noice

paper viper
#

not possible within api

fathom timber
#

It is what it is @glass pike sorry. I'd just stick with what you know

glass pike
#

word

humble heath
#

so how do i fix this

paper viper
#

you could code your own api for it

#

lmao

humble heath
paper viper
#

this makes no sense whatever

#

how can string have that method

fathom timber
#

Why do some people do:

//
//
//
//
//
Instead of 
*/
/*
paper viper
#

idek

fathom timber
#

I see it so often

unreal quartz
#

because that is what IJ does when you ctrl + /

fathom timber
#

oh fr weird

paper viper
#

tho,

/*
 *
 *
 */
#

this is pretty common

fathom timber
#

Lol

paper viper
#

javadocs uses it

#

but with /**

#

at beginning

fathom timber
#

I did the wrong args sorry I did */

eternal oxide
# humble heath

As I told you that is just a name, you need to get teh player for that name.

paper viper
#

teh gang

fathom timber
#

Player player = player sender or sender player 🤔

eternal oxide
#

bukkit getPlayer

fathom timber
#

I haven't done development for mc in like 1 month

paper viper
#

god there are so many warnings in there

#

can you fix em

fathom timber
#

What does != do again

paper viper
#

._.

fathom timber
#

Its anjoke calm down

#

:/

burnt totem
fathom timber
#

Oh lol

#

I've been doing to much rust shit

#

Just to get the entity that killed the player

burnt totem
#

Tf does that even do????

fathom timber
#

Its for the game rust lol

#

The hooks are weird

paper viper
#

is this C#?

#

cause that naming convention lol

fathom timber
#

Dude its deadass like that

#
var attacker = info?.InitiatorPlayer;
if (attacker == null)
    return;
//From here on we have attacker
``` @PulseBeat_02#9425
#

How tf did that not mention you👀

ivory sleet
#

??????????????????????

jaunty folio
#
public class Core extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        this.getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        if (!(event.getCursor()).getItemMeta().hasEnchant(Enchantment.VANISHING_CURSE)) {
            if ((event.getCursor()).getItemMeta().getEnchantLevel(Enchantment.DURABILITY) >= 10) {
                event.getCursor().getItemMeta().addEnchant(Enchantment.VANISHING_CURSE, 1, true);
            }
        }
    }
} ```
#

this is my first plugin

#

i know java though

paper viper
#

lmao

jaunty folio
#

not sure why its null

ivory sleet
#

not too bad

#

what is null

fathom timber
#

What is the last arg

#

What does 1 do?

jaunty folio
#

event.getCursor()).getItemMeta()

#

is null

karmic citrus
#

what is a simple plugin that adds /r as in /reply to 16.5

ivory sleet
#

though jake I'm surprised someone uses Plugin#getServer as opposed to just the Bukkit class so I like you now ok 🙂

#

Essentials mb

jaunty folio
crude charm
#

https://github.com/lucko/helper

it should be working but for some reason its giving me this

jaunty folio
#

i assume its the level

fathom timber
#

Like /pm (target)

karmic citrus
#

just normal spigot mc

fathom timber
#

Ik

jaunty folio
#

lol

#

probably

#

ive inherited a server

#

and essentials sucks

#

but the server depends on it

#

and the old owner couldnt code

#

so he just pasted random ass plugins

ivory sleet
crude charm
#

maven

fathom timber
#

@crude charm

eternal oxide
fathom timber
#

Remove that line of code then build your app

crude charm
fathom timber
#

And besides make sure to build after adding a dependency

ivory sleet
#

Zoi you have to pass what type of Event by its class I think

eternal oxide
#

you need to pass an event class

ivory sleet
#

and then maybe some consumer or smtng

crude charm
#

but then it would error the brackets not the method

#

but ill try

fathom timber
#

Even then I'm on mobile so I can't see much

ivory sleet
#
Events.subscribe(PlayerJoinEvent.class).handler(e -> e.setJoinMessage(""));

example tho

crude charm
ivory sleet
#

PlayerJoinEvent**.class**

crude charm
#

ik

#

it errored

ivory sleet
fathom timber
#

Ohhh

crude charm
#

ive read it like 10 times

ivory sleet
#

BRO

#

not PlayerJoinEvent, its PlayerJoinEvent.class

fathom timber
#

Did you put .class

ivory sleet
#

I literally marked it bold jfc lol

crude charm
#

ye

#

I told u it errors

dusk flicker
#

whats the error

fathom timber
#

Did you import what it asked and that too^

dusk flicker
#

Prob has to be in a method

crude charm
dusk flicker
#

that isnt even loading for me

crude charm