#development
1 messages Β· Page 14 of 1
I can do that in Forge
there are plenty of people that know how to create a custom entity, even with NMS
Just nobody that is currently helping you...
cj please, he waited 10 minutes, that's plenty of time for everyone to have seen it.
ik im just annoyed
Well no that wont work lol
public GoatSoldier(EntityType<? extends Goat> entitytypes, Level world) {
super(entitytypes, world);
}
}```
uhhh idk if thats it
you will not be able to follow the tutorial you wanted to with Goat
what am I supposed to do
there is a class named goat
and an interface named goat
idk which one to use
I have no clue how to use nms
π’
I am currently googling it
why don't you do the same
instead of trying to go around it
you're also using spigot remapped iirc
If you want to make a custom entity with NMS, you need NMS
and idk if that tutorial uses spigot remapped
If you want to make a custom entity without NMS, follow a different tutorial (if even possible)
ik
I have NMS
that is not the issue
You do not
lmao i literally do
probably renamed in the last 2 years. Forgive me
pig is still EntityPig sooo Β―_(γ)_/Β―
I do have nms
lmao
Going back to this then, is the Goat you used here from NMS?
yes
mb, what is the repo you use?
repo?
for spigot Idk how to get it
what is a repo
ok
hold on
guys idk how to do this ill just ask for help on helpchat
oh no wait
Okay so I'd say continue with your tutorial
EntityGoat seems to just have been renamed
whoever designed nms renaming stuff no one asked for:
what
and EntityPig was just never renamed
Goat was the first time it was added, never EntityGoat
ill have a word to whoever made this like that
gl
i will stay loyal to it
this is a low place to start getting mad at spigot's code π
this is how I know I am becoming a programmer and plugin developer
getting mad with spigot
get your rubber duck
imagine using kotlin and not being embarassed about it π€£
ppl dont rly compare maven and kotlin lmao, its mainly maven vs gradle
ik...
gradle kts > gradle
(System.currentTimeMillis() - time) / 60000f + "m"```why does this only show `#.#`, instead of the full decimal? (`time` is a `float`)
pemdas
o wait
:))
miss-copied
discord said its miss-copied
Hmmm
oh bc of the dash
is time also a System.currentTimeMillis() but at a different time?
also why float instead of double?
yes
well i want #.##
but its casted to float
could also be 0.0205 for example
you don't do anything to limit it at 2 decimal places
unless you don't care about that
I'm confused
im gonna use decimalformat
but first i need to figure out why it isnt showing decimals in the first place
cause when i add decimal format (with #.##) it changes it from #.# to #
ping me if u reply im going to bed π€
i mean, i dont sleep, real devs dont sleep i am real dev
gn
was wondering if I could some implement a placeholder to this
assert player != null;
if (player.hasPermission("adminitem.spacehelm")) {
ItemStack itemStack = new ItemStack(Material.RED_STAINED_GLASS);
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.RED + "Dctr's Space Helmet");
itemMeta.setLore(Arrays.asList(
ChatColor.GRAY + "" + ChatColor.ITALIC + "Drop this item to decrease your FPS",
ChatColor.GRAY + "" + ChatColor.ITALIC + "Immune to drops.",
" ",
ChatColor.DARK_GRAY + "To: " + player.getDisplayName(),
ChatColor.DARK_GRAY + "From: " + ChatColor.RED + "[ADMIN] " + ((Player)sender).getDisplayName(),
" ",
ChatColor.DARK_GRAY + "Edition: Coming Soon!",
" ",
ChatColor.RED + "" + ChatColor.BOLD + "SPECIAL"
));
only the part which says to: and from:
somethign like from: %vault_rank% %player_name%
you could if you want the text to be editable in config
yeah just get the string from config
and then replace placeholder with whatever the value is
name or rank for example
Also maybe don't assert the player isn't null and do a proper check :x
Eh theyβre just following their IDE recommendations if I had to guess lol
Doesn't make it good practice
Gonna crash the server when there's a null player lmao
it may be for the test purposes tho
Yeah again that's what a check is for.
Unless you're testing whether or not assert will crash your environment
so do I just do %vault_rank% %player_name%
using float is generally a bad idea, it's not gonna be very accurate and so you'll probably get rounding or accuracy errors.
data types generally have no correlation to how you're formatting them so decimalformat is definitely what you should do
I can do both?
or you could hook into vault instead of parsing it with papi
how to add placeholder competition for expansion?
Wdym?
like here (i cant send pictures) https://prnt.sc/4bGVSN9QzoHw
and I think you're wrong
@north mortar either you overrride the getPlaceholders method, and if that doesn't work it means that the placeholders are taken from the ecloud
ok
what should i use instead then?
double
doesnt double stop at #.#
what?
they are data types, they have nothing to do with how you print them
but also no
im also not sure what you're doing to make it only print 1 decimal place in the first place
your face is imprecise
actually it isn't
you're biased
How do I create a
thingy
that
gets the current health of a mob
that getHealth() method part
how do I make it get the current health of a mob
I have created a class
with a listener
With EntityDamaged Event
i am not really sure how to do that
probably by getting the entity from the event object and get the health from that
uhh
@EventHandler
public void goatDamaged (EntityDamageEvent event){
GoatSoldier goat;
goat.getHealth();
}
}```
what methods does the EntityDamageEvent have
if you're using intellij it should autosuggest them to you

the event parameter is to get pretty much everything that is passed to the event
event.getEntity() or smt like that
@wintry grove ```package me.systemoutprintln.dev.hornspawn.listeners;
import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.goat.Goat;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class GoatDamageListener implements Listener {
@EventHandler
public void goatDamaged (EntityDamageEvent event){
GoatSoldier goat = (GoatSoldier) event.getEntity();
goat.getHealth();
}
}```
I dont really know what im supposed to do here
that should actually do it
that's gonna error out
you need to absolutely sure your event.getEntity() returns a GoatSoldier
how
wait true
do a if(event.getEntity() instanceof GoatSoldier)
and inside that if add that code
also what is that package name lmfao
me.systemoutprintln.dev
just my minecraft username
i like it
i was literally lazy to think of a name
so I just thought "SystemOutPrintLn"
and it isnt bad
first thing that came into my head, it looks pretty great on minecraft
kk
public void goatDamaged (EntityDamageEvent event){
GoatSoldier goat = (GoatSoldier) event.getEntity();
if(event.getEntity() instanceof GoatSoldier){
goat.getHealth();
}```
how do you add markdown to text blocks
```java
```
like this
it looks nice and more readable
with colors and stuff
aaaaa
oh
π§
they even have kotlin, thats cool
betterdiscord eeeeee
pain
betterdiscord?
not a fan of these themes with backgrounds but this one isnt bad
eeeeee
yeah
yes
betterdiscord isnt bannable
it isnt
modified clients of discord are
it is
only if you install a plugin that violates the tos
it is actually against tos
do people care no
then ban me discord π€‘
they might
yeah im disabling it
betterdiscord
took less time to catch on than expected
does this mean making a brand new client from scratch is not bannable
would still need to use their servers
servers dont sound very clientlike
im pretty sure that is also bannable
imagine banning someone because they wanted to use a background
darn there go my dreams of making twidiscord
but not banning the thousands of servers that promote hate and illegal stuff
so
whats wrong with this
bad
why
you are still running into the issue of putting some random entity type into the GoatSoldier box
think about what would happen if this event was called because a player damaged a pig
a pig is not a GoatSoldier but you are trying to coerce it into being one
that's gonna throw an error and break yer code
you need to make your check to see if it is the right entity type before you try to make it into that entity
just change the first line to be inside the if
@EventHandler
public void goatDamaged (EntityDamageEvent event){
if(event.getEntity() instanceof GoatSoldier){
GoatSoldier goat = (GoatSoldier) event.getEntity();
goat.getHealth();
}```
i did what you said
better, it shouldnt error now
ok now the next part
i still dont know if you will actually ever get a goat soldier from getEntity though
did you actually make a custom entity?
this wonderful custom name here
it should be abe to cast
brb
yep
goat soldier is just a goat
that attacks monsters
hostile mobs
they are actually called soldier goat
I only figured that it was wrong when I was about to start doing what im doing now
it's cause I want to be a programmer not a pro grammar
if (event.getEntity() instanceof GoatSoldier goat) { :3
can you also tell me why sometimes the plugin straight up doesnt work
is it my server
or did i do something wrong?
if you feel like it you can download it and test it by yourself
You get an error when it doesn't work?
nope
i dont get any error messages
it just doesnt work sometimes
I play the horn and nothing happens
not even the cooldown i set to it is applied
also this doesnt work
What version of java you on
delete the "goat" at the end
17
yeah
but if I compile like that
it won't work
What y'all smoking, being able to also create a variable as well as type check has been a thing since java 14 I believe, so y'all hella weird
cries in java 8
common java 8 L
Force them to, if they don't want to, tell them to f off
i couldnt care less on what they use 
Patterns in 'instanceof' are not supported at language level '8'
thats the error it gives me
L
as well as
Set the language to 17..
update ur java
Variable 'goat' is already defined in the scope
Since you said you're using 17 lol
I have both of them installed
did you define
why the fuck is the ide using java 8 for this project
your environment
google.com: how to change java language level in intellij
The what now?
duck duck go
Same shit
are you sure this is correct
what am I doing wrong
I don't read minds, show the entire code
package me.systemoutprintln.dev.hornspawn.customentity;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
import net.minecraft.world.entity.animal.goat.Goat;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.level.Level;
import org.bukkit.ChatColor;
import org.bukkit.Location;
//Goat Soldier made by MouBieCat
public class GoatSoldier extends Goat {
public GoatSoldier(Level level, Location loc) {
super(EntityType.GOAT, level);
this.setPos(loc.getX(), loc.getY(), loc.getZ());
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(50.0f);
this.setHealth(50.0f);
this.setCustomName(Component.Serializer.fromJson(
"{\"text\":\"" + "Soldier Goat" + "(" + getHealth() + "/" + getMaxHealth() + ChatColor.RED + "β₯" + ChatColor.WHITE + ")" + "\"}"
));
this.setCustomNameVisible(true);
}
@Override
protected void registerGoals() {
this.goalSelector.removeAllGoals();
this.goalSelector.addGoal(1, new LookAtPlayerGoal(this, Monster.class, 16.0F));
this.goalSelector.addGoal(2, new RandomLookAroundGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0, false));
this.targetSelector.removeAllGoals();
this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Monster.class, true));
}
}
here's the entire goat soldier thing
package me.systemoutprintln.dev.hornspawn.listeners;
import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class GoatDamageListener implements Listener {
@EventHandler
public void goatDamaged (EntityDamageEvent event){
if(event.getEntity() instanceof GoatSoldier){
GoatSoldier goat = (GoatSoldier) event.getEntity();
goat.getHealth();
}
}
}
and the class with the listener
How can i make something that when a player joins for the first time the players uuid gets loads into a yml file like this:
Players:
uuidofplayer1:
SomeValue: ""
when a other player joins for the first time it needs to be looking like this:
Players:
uuidofplayer1:
SomeValue: ""
uuidofplayer2:
SomeValue: ""
if anyone find out whats wrong with this please tell me
Hronse
hornse
I don't have an issue thank
are you seeing that part that defines entity name for the custom entity i made?
this
getHealth() is supposed to get the current health of the creature
but it's not updating
when the creature takes damage
so it's just
50/50
always
package me.systemoutprintln.dev.hornspawn.listeners;
import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class GoatDamageListener implements Listener {
@EventHandler
public void goatDamaged (EntityDamageEvent event){
if(event.getEntity() instanceof GoatSoldier){
GoatSoldier goat = (GoatSoldier) event.getEntity();
goat.getHealth();
}
}
}
So I made this class
to do that
but it's also not working
Now I'm back with some string work here 
Lets say I have this string "Imagine saying gg"
I want to check if the string has a certain blocked word, for that I could just do a <String>.contains("gg")
it does work, sort of, it does detect that it is a blocked word, but if I use for example something like "eggs", it will also think it is a blocked word, bc it finds the gg on it
so my question here is: is it possible to only check for words? and how would I do so
thanks in advance
could for example the String#matches("hello") work?
depends what you consider a word to be?
if your definition of a word, is 1 or more characters* put together and split by spaces then you can easily just split your text at spaces
something separated by two spaces I guess
loop thru all the words and check if they are your word
I'll try that
why not use regex
Hey guys, does anyone know a good video/documentation about creating an API for your plugin?
regex bad
I would if I knew how to make one to detect words lmao
How can I store a variable in a file?
depends on the variable
Just a standard integer
just write it to a file with a FileWriter or whatever else you want to use
then you can later read it back with a Scanner
thanks
π
are you able to change inventory names after the inventory has been made
where can i find information on how to change a player's skin in 1.19?
i dont think so sadly
i'll use paper as fuel
to run my spigot server
sucks to be you i guess
Imagine running buildtools π
do you think turning off linux animations makes a difference in performance?
Well there's also different desktop environments
Some are more aimed for performance
Oh ur using vim
Wow
Impressove
Press esc
Then :qw
Or smth like tyat
Might be :q
Tried using it today but I'm on phone so I decided to just use nano lol
_ _
Ohhhhh
just :w
What's the q
quit
w for write
unable to acess
spigot.jar
check the file name
what file
oh
wait
Ik what I did wrong
now ill install intellij
Hi! Does anyone here know how to save the contents of a hashmap to a yml file?
Depends more on what is in the map tbh
a player and an integer
store the player's uuid and the interlger
good idea ty
for that type of usage you probably should use a database though
yml is not made for that purpose
Keeping track of how many times a player has broken cobblestone
ahh i see
doesnt matter too much if they use yml tbh
it will stay cached, it kinda does matter
the yml is also cached
exactly what i am saying
you dont want it cached lmao
with a lot of players, thats asking for trouble
the way yamlConfiguration works is that it caches all
when the file is loaded
a server login easily hits thousands if not 100k+
but why though when a perfect solution exists
whats the point of supporting bad practices
effort
barely any honestly
I want to run this plugin on a 1.17 server, but I keep getting the same error despite using the correct version? What is wrong?
[12:58:21] [Server thread/ERROR]: Could not load 'plugins\Cage-1.0.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.18
at org.bukkit.craftbukkit.v1_17_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:304) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:409) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:233) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1010) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at java.lang.Thread.run(Thread.java:833) [?:?]
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
open plugin.yml and set api-version to 1.17
np
says a lot about society
Does it?
yeah
Is there any way to override Event listeners with abstract classes?
wdym
wdym
oh hi Blitz
oh hi Frosty
I have a PlayerAdvancementDoneEvent for 1.17 and want to change what it does when in 1.18. So I have version classes sort of that change the behaviour of different functions depending on version and want to change the PlayerAdvancementDoneEvent from 1.17 and down compared to 1.18 and up.
What is the best approach to do this?
Honestly I'd just have two different listeners, and register the appropriate one
Yeah, that is the thing. If the version is 1.15 to 1.17 it has the same behaviour. So I want to just call the current server version class which calls all lower version classes as I otherwise has to rewrite all code from 1.15 in the 1.16 one and from 1.5 AND 1.16 in the 1.17 one.
So I was hoping I could just override it in the 1.18 and don't have to rewrite everything for every version
Can't you just use a different Listener for each version range that keeps the same behaviour? There's no reason to have abstract classes here
Doesn't even make sense to have abstract classes
Yeah I could, but some versions have a changed behaviour. So I need one for 1.15, one for 1.16 and so on. I could make a "1.15 to 1.17" one but then I would need a "1.15 to 1.18" and a "1.16 to 1.18" etc classes
How would I make it instead
Please read my message
I feel like your versions system is janky
Make it so a listener can specify a range of versions it supports, then just go off of that
Your messages seem to conflict with each other
You want something that works on version ranges but you want something that doesn't work on version ranges?
I want it to work a certain way in 1.15 to 1.17 and I want it to work another way for 1.18 and 1.19.
I could make a version range listener as you suggest
depending on what the listener does, you can also just make if statements in the listener
And also an enum with minecraft versions so you can do like ```java
if (MinecraftVersion.isBetween(MinecraftVersion.v1_15, MinecraftVersion.v1_17)) {
// etc
}
However, I have like 30 listeners I need to do this for which means I have a lot of different classes
you do what emily said
Well yeah, that's multi-version support
I need different classes as the behaviour is change because of API updates.
Versions that behave differently will require different reactions, if there are 30 versions and 10 behave differently you'll need 10 classes for each behaviour
what api updates?
in spigot api at least, it's backwards compatible
besides Sound
you could do what deluxemenus does. π€£ try catch everything :))))
well actually. spigot does remove some deprecated stuff every now and then. but it's rare
o
I want event.getAdvancement().getDisplay() for example, but AdvancementDisplay does not exist pre 1.19
interesting
also yeah new stuff
Oh
There's actually a really really simple solution to this
Yes?
Screw multiversion support 
well. you have a few options here. best one so far is to do what emily said and have a different class for every range of versions
π
Guess I will do that then. Thanks
you could also do what forsty said, and stop doing multiversion support, or you could use a bunch of try and catches
lol
yeah blitz has a lot of experience in that field
As should everyone else.
What's that
Versions my plugin supports
I always knew you were cringe
imma cache all my data in individual yml files and keep all loaded
true
i mean the number of files and the storage method doesn't matter when you're loading all of the data anyway
yes but i can be fancy with it at least
where can i find information on how to change a player's skin in 1.19?
you'll have to use packets (ex using ProtocolLib and you can use PacketWrapper to help) afaik
or use SkinsRestorer (and its api)
how would i use skinsrestorer?
How do I set the yellow number next to a player's name in the tablist?
that's an objective with display set to tablist
Yep found it
I tried downloading spigot remapped
and now theres this error that idk how to solve
Plugin 'net.md-5:specialsource-maven-plugin:1.2.2' not found
also
"The requested profile "remapped" could not be activated because it does not exist."
it says this on the terminal
id say update buildtools
tho when you run buildtools, are you using java 17?
your using buildtools 148 right
if thats the latest version, then I believe it is
I downloaded it today
java -jar BuildTools.jar --rev 1.19 --remapped
try running 1.19 normally
then run the remapped version
so remove --remapped on the end and run, then add it back and run that
I kinda that already did that
what?
First I ran normal 1.19
then I realised I needed remapped
then I tried running remapped
and this happened
im sure i had this conversation with something else because they had the exact same problem
nobody asked you to join helpchat (jk)
did it work for them or not
yk what, try downloading java 1.19.2, then try 1.19 remapped, cus someone else mentioned have the latest version so id assume the latest version of the major version or it just doesnt like working idk
ok
i switched to linux
thats why
idk what i did last time
did it work or does it still complain?
i havent tested it out
ill do that now
java 1.19.2?
does that exist?
yes
wait
im talking about minecraft 1.19.2
not java 1.19.2
k
ill do it now
you built 1.19.2 non remapped, then build 1.19 remapped yes?
you also made sure to update the specialsource plugin to have 1.19 in everywhere
you mean pom.xml?
when i copy and pasted the md5 plugin from the spigot website it had 1.17.1 or whatever by default
if you havent already it needs to be updated to have the right version
ill try that again
idk if i did it correctly
do i need to download spigot 1.19.2?
did you update the 4 locations i just showed you
the project was for 1.19 yes
mhm
actually you might have to build 1.19 regular aswell
what am i supposed to do
build 1.19.2 or 1.19
have you built the remapped 1.19 successfully?
no
it gives me that error
remapped doesnt exist
yes
you havent dont that yet>?
...
i told you to build 1.19.2 regular, then to build 1.19 remapped
i thought you wanted me to download minecraft 1.19.2
i never said download minecraft 1.19.2, because thats irrelevant to this
you asked if java 1.19.2 existed, which made me though you were talking about java jdk 1.19.2
do i have to download spigot or nah
i dont think i have to
since im not running a server
just running bt
you dont download spigot 1.19.2
you use buildtools to build 1.19.2
you dont have to use the jar
if you say thats the same thing, im making sure you understand what i mean cus if you go to getbukkit or whatever website and download 1.19.2 thats not gunna fix your isue
hopefully yes
do 1.19.2, then do 1.19 then do 1.19 --remapped
if that doesnt work idk what will
[WARNING] The requested profile "remapped" could not be activated because it does not exist.
thats what im seeing
why
WHY
ig it just hates you
very few to no one has this issue
maybe you cant get the remapped jar of 1.19 anymore idk
why does this exist
seriously
serves little to no purpose
"hurrr durrr to do this specific thing you gotta use remapped! ur using ofuscated"
and whats the difference?
"good question"
maybe just use 1.19.2 ig
or wait till someone else can say why its doing it
maybe buildtools is bugged idk
Ones mapped one isn't
im going insane
Yeah
why does it complain that remapped doesnt exist?
maybe it requires java 17.0.3 or some bs like that
1.7.3
public static void onSell(Player player, ItemStack itemStack, String title) throws UserDoesNotExistException, MaxMoneyException, NoLoanPermittedException {
if (!SoldItems.containsKey(player)) {
player.sendMessage("1");
List<ItemStack> items = new ArrayList<>();
items.add(itemStack);
SoldItems.put(player, items);
player.sendMessage("2");
List<String> lore = itemStack.getItemMeta().getLore();
int cost = Integer.parseInt(lore.get(lore.size() - 3).replace("Β§6", "").replace(" Coins", ""));
player.sendMessage("3");
Economy.add(player.getName(), cost);
player.sendMessage("4");
}```
why is this hasmap not working
I think its not letting me enter any data coz it doesnt msg me "2"
but it does msg me "1"
Is there an error?
nup
Not in the console?
no
Not sure. I would check the contents of the map and maybe use a logger instead of sending chat messages
I also wouldn't use the player object as a key either
Unfortunately not what you are seeking, but Iβd advise making your map UUID keyed rather than the player object itself. And also donβt make it public static instead have a getter method thatβs public while the map itself is private
As static should not be used as an βaccessorβ aka: βI put it as static cause otherwise I couldnβt access itβ instead statics are for things that should not pertain to any single class and should exist instead outside of classes.
What's the best way to check if a player is a real player?
I'm making a plugin that uses the onPlayerDeath event and during some tests it was triggered by a chunk loader from an another plugin (that creates an invisible npc I guess).
Gonna guess WildLoaders. To make it easy on yourself just use the WildLoaders API and check if its not a chunk loader entity.
If its not wildloaders check if the chunloader plugin has an api
Yeah it's WildLoaders
I was thinking about using its API but I wished I had no other dependencies. That's the only way?
You can check wildloaders src and see if ome_r sets any PDC data to tell if its a fake entity or not.
I would just use the api, optional dep if necessary.
It's already on the server, why not use it
What's PDC?
persistentdatacontainer
^^^
looking at wildloaders very briefly looks like they use nms, so wouldnt suprise me if they dont use pdc at all
NMS is for the spawners (pretty sure)
soo at the end I should use their API to make my life easy?
probably yeah
and one more thing, when I add their api as dependency, the wildloaders plugin will be required to be installed to make my plugin work?
You can add it as soft dependency...also if so remember to do necessary checks to know whether the plugin is enabled or not
new GameProfile(uuid, NPCHandler.getName(location.getWorld().getName()))
Looks like it sets the gameprofile as the location. So you can just check if the gameprofile is the entities location
how?
I have the following problem with org.mongodb:mongo-java-driver v3.12.11 I want to disable the logging but It doesn't work with the config files for logback, log4j or log4j2 it almost looks like it doesn't use those configs at al when I try to log a message it the same format as mongodb.
Setup:
Server: paper-1.19-81
Dependencies: paper-api:1.19-R0.1-SNAPSHOT, spigot:1.19-R0.1-SNAPSHOT, lombok:1.18.24, mongo-java-driver:3.12.11
Is there an event for when the totem of undying is used?
^
you're opening the plugin tag two times
but then I remove one of them and
check if you have a matching clΓΆosing tag
@proud pebble
HEy
I'm really sorry for the ping
But regarding what happened yesterday
That I couldnt use remapped build tools
I just changed the 1.2.2 in my pom.xml
to 1.2.3
and the error is gone
will that make a difference?
oh wait
nevermind
hang on
I changed back to 1.2.2
now the error
is actually gone
programming is pretty much like god ig
it works in mysterious ways
the error legit is gone
i cant believe
That's intelliJ for you if something is weird just invalidate cache
Might just be their build tools lol
Anyone know anything about the memory leak with Bukkit.unloadWorld
Is there a way to decompile spigot projects without losing the methods in the code?
I wrote a plugin
And switched to Linux
but forgot to make a backup of the project
so I had to use a download that I had
decompile it
and copy and paste the code
But all the methods that I've used are basically gone, reduced to atoms
replaced by letters
and I can't remember what I used
and that's why you use github kids
π cries internally knowing he has done the same thing.
thank god I actually stored my project on github
but it was an older version of it
but most of the code was already written
so I only had to copy and paste
I just need help rewriting only a single class
thankfully you cant do the same mistake twice
so from now on
I'll store every single version
of my projects
in github
is there a way to get the MCBrand via Bungeecord or is that only possible via Paper?
So I've dug around a bit since I wanted to edit the MongoDB log format and it seems t be similar to the server log format is it possible that we can no longer change the log format via plugin and need to to change it in the server files?
if by mcbrand you mean the client information
you can pull it from bungee side
How? Yea I need to identify the Client (aka Vanilla, Labymod and so on)
Player.getPendingConnection().version i think
and player.getmodlist afaik
@marble nimbus
then you probably need to check the handshake
some clients send it during it, so you need to read that packet most likely
if its not available in the api itself
edit: look below
Thanky emi
Hello there! Can anyone tell me if there is a support channel here?
"HelpChat"
I mean in what text channel should I ask for support :I
Support with?
DeluxeMenus
ty
Hey guys
Hello guys, so I keep on loading my plugin and it keeps crashing. I've tried to find the issue but I can't find it, I tried commenting out code and seeing if it dissapears but nothing works. Anyone got an idea?
Nevermind that error came bc I didn't have papi installed and I had it as a dependency
at me.gamendecat.prisoncore.PrisonCore.onEnable(PrisonCore.java:146)
whats here?
Oh its fine, I fixed it. But It was a sout.
Is there a good way to reset something every week on Sunday for example?
that might just be the vaguest question i've ever heard
put a reminder on your calendar
They are probably asking how to schedule a task
Sup everyone. Question.
When you get Nitro for the server it doesn't upgrade everyone? I got nitro thinking my admins could post larger videos. But its still gives them the error.
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
you can use crontab if you can reset your thing via the linux shell
Sorry for the vague question haha, I guess I shoulda asked if a task scheduler be the best option? Don't they reset when server crashes/reloads/etc?
you can use a task scheduler in conbination with a persistent storage eg. sql or a file
crontab should persist across crashes
on startup load in the time you want to restart at and set your scheduler up with that
but also complicated
crontab ez
I'm about to boost here and change my name to Professional Regex Idiot.
Now, what things in a regex allow me to parse words in a string?, iirc there were things like \b or smt like that that match the end of a word
would I have to use that to sort of catch every single word in the string?
and also how would I go ahead and make it return a list or array of all words in the string? String#split() or some shit like that?
thanks in advance again
Yeah split with spaces or \\s
There are pretty good regex generators out there. Always used those and they worked well so do some searching
I have been looking at google
it hasnt helped a lot tbh
I'll do a split with space
that should work
but I prefer using a regex
to make sure it works good
thats where my problem is
just use \w+
^
but this matches numbers in the words too
\b[^\d\W]+\b this for matching words without numbers in them
is there nms decompiled code for convenience that i can check for one sec
what
like decompiled nms code with mojang/spigot obfuscation mappings
that actually changes the obfuscated code
paperweight
Paper api plus nms
But decompiled and mapped
oh ok thats cool
thx bro appreciate it
If ur using paper api u can keep that and run reobfJar instead of shadowJar
that doesnt seem to be containing the decompiled code
so i have to run with the mappings myself?
you can not distribute mojang code
alr i will just stick to obfuscated code cuz i know nothing about gradle
thx anyway
Maven?
Spigot has a plugin
But u have to run buildtools again with like a remapped flag and then change the dep to smth
I think it says in 1.17 spigot release post
And the maven plugin
idk about any maven plugin
Basically paperweight but maven
But also made by md_5
It's needed to use that jar
maven dude _5
i did this
oh what does the source do tho?
i know the docs one but what is the source about
where is the remapped code saved in?
i cant find any inside the jar or outside the jar
Where ever the jar saved.
If not you can find it in .m2/repository/org/spigotmc/spigot/spigot-<version>-remapped-mojang idk the exact file name.
you are a life saver
thx a lot
OMG IT WORKS
yw
your welcome for your welcome
pfffft
π
I've recently been saving all the remapped from 1.17+ lol
oh cool
the remaps arent 100% remapped tho
like there are still variables inside functions which are unobfuscated
but anyway i appreciate it so much lol
also is it possible that an eventlistener with priority high gets called BEFORE priority normal in special circumstances, rendering the priority high useless?
Normal basically ignores priorities. It runs when it does lol.
like when a normal has final say over high is it possible in some circumstances?
Actually I'm not sure lol. But based on the above it should run in those orders.
it goes from lowest -> low -> normal -> high -> highest -> monitor
oh alr thx
thx but i was asking if there can be exceptions which breaks these orders
like errors and stuffs
if there's an exception it wont even finish running the other events afaik
actually maybe it will
like exception as in exceptional cases not java runtime exceptions
no
π€¨
they will always be called in that order
idk man sth about these orders are bothering me so much that im starting to feel like its a bug
alr thx
it would be stupid if a deterministic call order was not deterministic
it's not a bug lmao
it's there for a reason, to be deterministic
oh alr true
@edgy lintel you could make a listener with each priority and see the order its sent in if you don't trust it.
nah i know that the order makes sense
but its working the other way round in my server for some reasons
nvm
Local variables arenβt obfuscated, they just donβt have names by default
"βοΈ" is null
how does that actually work?
Snowman is never null.
How does what work?
they are in the LVT yes
there are some javac flags to not save them and stuff like that
so surely after java 15 or whatever, local variables always have names stored
not if you remove them
read please and thank you
no
but you can remove them, so no, not "always"
dunno what the snowman thing is
in the minecraft classes local variable names are remapped to the snowman emoji
and there was a version or two an NPE was thrown and it showed couldn't invoke blah.blah because \βοΈ is null
lol
there should be more funny things in programming languages
little easter eggs for the people who go digging in specifications and source code
why is .getHealth() not getting the current health of the mob?
public void upNewHealthCustomName() {
this.setCustomName(Component.Serializer.fromJson(
"{\"text\":\"" + "Soldier Goat" + "(" + ((int) getHealth()) + "/" + ((int) getMaxHealth()) + ChatColor.RED + "β₯" + ChatColor.WHITE + ")" + "\"}"
));
this.setCustomNameVisible(true);
}
package me.systemoutprintln.dev.hornspawn.listeners;
import me.systemoutprintln.dev.hornspawn.customentity.GoatSoldier;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class GoatDamageListener implements Listener {
@EventHandler
public void goatDamaged (EntityDamageEvent event){
if(event.getEntity() instanceof GoatSoldier){
GoatSoldier goat = (GoatSoldier) event.getEntity();
goat.upNewHealthCustomName();
System.out.println("This event was triggered correctly");
}
System.out.println("Debug message");
}
}
they took damage btw
System.out.println("This event was triggered correctly");
was fired?
if it did, then debug directly getHealth
Would apreciate some help.
I currently have this interface:
public interface PluginCore<T, P, P2>{
// Unrelated methods
List<P> createPlayers(List<String> lines, P2 player, Placeholders... placeholders);
}
My plugin works on Spigot, Paper, BungeeCord and Velocity and P2 is only really used on Spigot and Paper as those are the only platforms that provide usable player data for what I need.
So, I would like to get rid of P2 while still providing OfflinePlayer usage to the Spigot and Paper version...
Is there anything I can use?
Like something similar to this?
<P2> List<P> createPlayers(List<String> lines, /* ...? ,*/ Placeholders... placeholders);
null?
?
not even true, however im pretty sure maven/gradle/maybe both by default set the javac flag to retain them
i worded poorly, i meant they would by default
as opposed to older versions where they presumably wouldnt without a flag, as there would be no point
javac retains plenty of "useless" attributes that are only intended for debugging purposes, i.e. signatures in addition to descriptors
if you invoke javac directly with no extra flags, it doesn't store the LVT
Appreciate feedback: https://github.com/Andre601/AdvancedServerList/pull/16
names are only stored in the LVT when compiling with the -g flag. Even in the jshell, you won't have names for local variable names (besides parameters because jshell uses -parameters by default)
My educated guess would be that by the time you are processing the damage event, the damage is not yet updated to the entity until all event listeners for this event returns
You may need to calculate the updated health of it yourself
Disclaimer:just a guess
just saw your post on spigot and i saw other guys saying the same thing like me
damage applies after the event since the event can be cancelled
but it's deterministic and not a may not have
Any suggestions on how I could improve performance here?
https://paste.helpch.at/voyefemidu.cs
The actual event handling:
https://github.com/Andre601/AdvancedServerList/blob/feature/improve-fakeplayers-creation/bungeecord/src/main/java/ch/andre601/advancedserverlist/bungeecord/events/PingEvent.java
adding a cache perhaps?
I already have a cache for the Favicon itself, which I assume takes the most time
Because after a while is this warning gone, probs because the cache takes action
Profile it to see which part is slow, improve that part
Don't write it at all, it'll be fastest
as someone else said, figure out which part is slow, then itll be a lot easier to improve
How can I get the block the player is looking at?
I know about getTargetBlock but I don't know how to get the block only if the player actually can interact with it (with the black border)
easier said than done for me tbh
this is how i would do it
at the very start of the event, get the current time in ms and store it in a variable
and then randomly go down through your code and just print to the console the difference in time from the current time compared to the start time, add like 5 of those in and you should hopefully see a big difference in one of them. continue to do this on the section of code to determine which method call(s) (if more than one) is taking the most time
@somber gale
I have a problem with PlaceholderAPI using the jar file as library
I'm importing the class of PlaceholderAPI but the import can't be resolved if the version is 2.11.x
For example this is my Main code:
https://paste.helpch.at/osaxemazef.java
My IDE gives error on the "import me.clip.placeholderapi.PlaceholderAPI" saying that the import can't be resolved but if I use the versione 2.10.10 it works fine
As I was saying in #placeholder-api the problem isn't in code but it is that the import doesn't works with the version 2.11.x but using 2.10.10 my code works fine
Use a build system
I was thinking to it but the thing is not that...
I know that I should use a build system but the problem is that at the moment I'm not using it and the problem is in PlaceholderApi 2.11.x, all others placeholderAPI versions work fine

