#help-development
1 messages ยท Page 7 of 1
wut
this is a funny one
and ;;;;;;;;;;;;;;;;;;;;;;
yeah lol
i wonder
if you can increase java code execution time by adding enough () {} and ;;
it gets lost on compilation
man
Without a decent compiler you could
fuck javac
it would be a NOP in assembly
optimizing things and stuff >.<
NOP=no operation
I also find it funny how sometimes people bother to turn their math into bitshifts, thinking that it makes it faster
?paste
Depends on the math
do any of ya know why my code looks so bad!? https://paste.md-5.net/uqaqifalij.bash
join spam bots does not works on online mode servers?
no.
not really
clearly because of the temperature outside. Try coding in the winter instead
why
ahh
nots reach servers yah?
because theres a thing called authentication
Fixed
I once did this thinking its faster than doing %16 lol. but thats bs
doesnt server auth players itself?
8:20am actually
it's 5:20 EVERYWHERE
7:20 actually
no
Where are you from?
5:20 pm
germany
germany
close to germany
aaaaayyy
5:20pm here from Italy
high five
5๏ธโฃ
normal 5
high โต
Actually not high five
you two can be on same meridian
it has syntax errors
no it dont
sober 5?
high three
Yeha its slower
high five and twenty pm
everyone pretend to be innocent
i cant zoom out far enough in my ide but it has no errors!
what I wanted to say is that bitshifting e.g. when you wanna /2 isn't faster because the CPU uses bitshifting anyway, if possible
wait you are not coding in windows default editor? Shame
Oh yeah
127.0.0.1
im coding in microsoft word
oh
okay then
oh shit
Assuming you dont use a potato cpu
I didnt mean to send this gif
that just looked weird to me lol
ban em
ye idk, still fine tho
I just wanted to send localhost in ipv6 lol
hahahaah
lol it does same for me
stupid
::1
;c
you should use PowerPoint so you can split your code into one line per slide and can present it easily
^^^
also store it on seprate machines
so your storage space on one doesnt always fill up
Why not use ms paint
use code corrector
i did
gud
ok
@gleaming grove heres your cue
hit them with the piano in minecraft
hit them 
I have a piano app for my macbook's touchbar and it suuuucks
this is the old one plugin
that's the current one => https://www.spigotmc.org/resources/piano.103490/
help guys. I can't use my note block in minecraft to take notes. It always plays a different saving sound but I can't find my note anywhere.
Is it some plugin that breaks it?
anyone know where the compile button is?
imagine pointing with => instead of ->
"B"
call a new instance of it
and and cache it in flat file json
should work then
the compiler is faster if you increase the font size. Makes it easier to read for it
also 100% useless lmao
indeed xD
but intelliJ's buttons are useful
it lets you run tests, compile/build etc, start the debugger, bla bla
yeah I think it's customizable but havent checked
thats cool asf
photoshop etc let you customize the buttons, at least
now i want a mac
Until is sends too much power to the SSD and kills it
atleast im not the only one with a dirty keyboard
no, but I get a load of 200 when running MC
my keyboard dirty too
how tf my 100 npcs use less ram and cpu power than your mc and intellij
no idea lmao. I think it was indexing the JDK when I took that screenshot (it was a few hours ago)
but the funny thing is, mac stays 100% usable even with that fucking 260 load
multithreading 
I really love macOS
no way
btw... bump ^
Just run your servers on macOS
proper type as in T?
and for design, music, ...
iirc chars have a numerical value
it has something to do with something I forgot
dont they?
writeChar should take a char, not an int
because int is the code of the character
ofc, chars are basically 0-65k
it's still weird that it says "writeChars" and takes an int
same for byte
writeByte(int), that's weird
yeah that ones weird
I would understand if it is like writeChar(byte) or writeByte(char)
arch linux
you can also do a for loop based on characters since they are basically numbers.
Like
for(char c = 'a'; c <= 'z'; c++) {
System.out.println(c);
}
ew c++
Javascript ๐
lmfao c++
Hey, Ive been trying for a few days to make it so if somebody dies it basically has a firework instantly detonate where they were killed, Im having trouble with the instant detonation, at first I used firework.detonate() method and it worked for sometime but then for some reason it stopped. Ive done some research and ive seen that this method is not the best and u have to delay the detonation in a few ticks so it will work, so I did that and it didn't work and now im stuck. Can anyone help me please
why not
https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#getNumericValue(char)
IIRC this is the method
@tender shard theres a few like this
but here they say getNumericValue
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I have this error message
it is implied the return type is Number
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
trying to serialise/desirialize this object
well, lucky for us Number works for all digit types
:))
for a moment I thought yaml has become a programming language
did you store that serialized class under your own extended class
^
I'm guessing it's something to do with the registration?
I thought that static{} was ran the first time a class is referenced
yeah one can also just cast the char to int, short, or whatever
thats true
well
it runs when the class is loaded
it does but constructors help you understand better
i wouldnt use records for this imo
mk
hi a question is possible to make some people show a tag that other will not see and if yes how?
depends
You can do that with scoreboards and scoreboardteams probably
^
Theres also ways to have names show on hover, or the way without scoreboards which is packets
im trying to do it for a faction plugin to only faction member see ally in 1.19
Yo what can i use for gradients in the newer versions to work? Chatcolor.translatelaternateshit doesnt work
Ok I'll try this, though it shouldn't make a dif
Yes that can be done using scoreboards. You can even hide their nametag completely for the enemy team (but hack clients can re-display it obviously)
nah i don't care about them how i can do that? if you can link me javadocs or something like a thread post
Hey, Ive been trying for a few days to make it so if somebody dies it basically has a firework instantly detonate where they were killed, Im having trouble with the instant detonation, at first I used firework.detonate() method and it worked for sometime but then for some reason it stopped. Ive done some research and ive seen that this method is not the best and u have to delay the detonation in a few ticks so it will work, so I did that and it didn't work and now im stuck. Can anyone help me please
same thing happens
show code
?
^there code
?paste
it's cause of the static {}
I registered it outside of that and it now works
This should give you a push into the right direction https://www.spigotmc.org/threads/hide-nametags-with-teams-and-scoreboards.170719/
also there's more posts like that aswell
thanks for the help
people dont see to know that return is a thing
So if i right click with my custom item gh it should replace ice in a certain radius to farmland but it does not (CODE BELOW)
https://paste.md-5.net/lobaconumo.cs
This doesn't seem to be working, anyone know why?
do L and R also need to implement ConfigurationSerializable?
your "deserialize" method has a typo btw
oh you already fixed it, mb
yes
kk
you can just do L extends ConfigurationSerializable
same for R
SerializablePair<L extends ConfigurationSerializable, R extends ConfigurationSerializable> implements ConfigurationSerializable
pain
and suffering
there's no loop. You would only replace one block (if the rest of your checks is working and it actually reaches it)
only the one at the players location + 3 in each direction
If a number is taken from configuration, is it parsed as a double regardless?
fuck no
Arc<Mutex<mpsc::Receiver<Box<dyn FnOnce() + Send + 'static>>>>
i made a Message type to make it shorter lmfao Arc<Mutex<mpsc::Receiver<Message>>>
So i have done this but still dosen't work
https://paste.md-5.net/codivajaxo.cs
wtf lol
what exactly doesnt work
bruh how am i playing ij i dont even have it enabled
so i have a item gh and i want it to replace ice with farmland in a certain radius when right clicked
but dosent
what does it do instead?
nothing
yes
add a debug message inside every if statement
wait let me check
sth like this
public class PlayerEvents implements Listener {
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
System.out.println("Test1");
if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
System.out.println("Test2");
if (event.getItem() !=null) {
System.out.println("Test3");
if (event.getItem().getItemMeta().equals(PlayerHandler.gh.getItemMeta())) {
.......
so you can see which if statement fails
I also suggest you to read this quickly @lone ore https://blog.jeff-media.com/avoiding-the-arrow-anti-pattern/
alex has an article on everything
arrow anti-pattern. I always named it using guard clauses
i didnt nice
yeah well "guard clauses" are the things you use to avoid the arrow pattern
happens to everyone sometimes ๐
what should i do to register it
new PlayerEvents();
right? (very new to spigot started today)
and lol i fixed it in intellij
Bukkit.getPluginManager().registerEvents(yourPlugin, yourListener)
?events
?event
?eventapi
read this pls @lone ore
do the "debugging" stuff I suggested above
like, add a message before and after every "if(...)"
then you can see where your code stops
That is the problem @tender shard
it's saying a double cannot be cast to a float
meaning it's read it as a double
How can I make e.setFormat from asyncplayerchatevent work with hex colors?
e.setFormat(Utils.color(getConfig().getString("chat-format")).replace("%player%", p.getDisplayName()).replace("%message%", msg));
Hey, Ive been trying for a few days to make it so if somebody dies it basically has a firework instantly detonate where they were killed, Im having trouble with the instant detonation, at first I used firework.detonate() method and it worked for sometime but then for some reason it stopped. Ive done some research and ive seen that this method is not the best and u have to delay the detonation in a few ticks so it will work, so I did that and it didn't work and now im stuck. Can anyone help me please
show the full stacktrace pls
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
wait do i have to do something in the .java file where onEnable() thing is there
bec Test 1 didnt even run
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
yes you have to register it as an event listener
GameMap shouldn't be influencing anything
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Position is what I am trying to serialise/deserialize
well, just cast it to double then, and then again to float
lol ok
float myFloat = (float) ((double) map.get("mydouble"));
org.json/simple moment
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
``` will work right?
yes, thats fine
does this work?
float f = ((Number)json.get("smth")).floatValue();
I am not sure
will test ig
they dont use json. it's a normal Map for ConfigurationSerializable
ye was talking bout json simple
ty
yeah it's working now
override toString kek
though I have another problem
so it's the same object
when I load the metadata I store it into 2 lists, spawns and checkpoints
Omg tysm to whoever helped me it worked
those are the same lists which are saved when I write meta data
What would be the performance impact of registering a listener while the server is already running versus doing it on startup and adding multiple if checks to every event to see if it can proceed
perfect
however, when I save the lists are now empty even though they loaded in the data correctly. So somewhere in between loading and saving the lists are cleared
I can't see anything in the uses though
I have a plugin that constantly registers and unregisters listeners. At the end it is just saving an instance and calling it when an event is fired. So registering them at runtime is not a problem at all.
Here are the uses
it never gets cleared in any of these uses so I don't understand what's happening
print out the list in your serialize() method, see if they actually contain data
It shouldn't be a problem to have a lot of ifs either. If you really want to save on performance you can definitly register it at a later time.
However: You will still run into the "worst case" after registering it. So basically: If one option will cause lag - both will.
hello gyus, can i reload the bungeecord config with a bungeecord plugin? if yes how do i do it?
I do
when I load the data I print the new contents of the list
and likewise when I save
that's what that screenshot is
you can see it obtains objects in it when it's loaded
but nothing when it's saved
hm that is weird
show your "Position" serialize() and deserialize() methods again pls
if I do spigot-api nms gone
and if I do spigot then EntityTypes.ENDER_DRAGON goes
it happens on the SerializablePair<> too
ofc spigot-api doesnt have NMS
you need spigot for NMS
it's just got weirder too
does
tbh @supple elk the ConfigurationSerializable thing is very weird. I always just write my own serialize and deserialize methods that do not use the builtin serialization. I normally do it like this (one sec, I'll send some code)
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
kk
same thing happened
and I made it secure this time
it clones the arrays
and uses an add function now
so I don't think it's external..
Is that the entire class?
no
shit I don't find anything rn lol
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
I have a hunch
I'm just testing
wefoiwejfoipewjifoje woifjewoi w
ok it's not fixed
this is weird af
anyway I usually just do sth like this
my-custom-object:
something: asd
and then I have method like this
public static MyObject deserialize(ConfigurationSection section) {
...
and then I use it like this
MyObject thing = MyObject.deserialize(config.getConfigurationSection("my-custom-object"));
it's a bit dirtier but at least it always works
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
same thing happens
same object
so how does the list empty????
it can't be external
and I don't see anything internal
Youโre not multithreading this right?
no
at least I don't think so
unless there's some weird multithreading going on with the saving/loading
Have you tried testing this without reloading
This clones an array right?
It does
no though it should be the same. Def worth testing
kk
will do this npw
for some reason every time I launch the server for the first time I get the same error
which fixes after reloaded
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
This ^
That seems like an important error we shouldnโt be overlooking
Whatโs minecrell
Or at least I can't discern anything from it
no clue
Ok letโs ignore that one for now since it seems unrelated
Letโs look at the error from your plugin
What is JetCore.java:33 ?
Whatโs on JetCore line 33
NO worlds are loaded when Static
is the world loaded when onEnable() is called?
yes
ok will put it in there then
Depends on if you tell your plugin to load before or after world load
But generally yes
?paste
I just realised I didn't need to do that stuff anyway
that wouldn't have affected my other issue though I wouldn't have thought
will test again now
but maybe it's the reloading which is the issue
Iโm thinking itโs the reloading yeah
not the reloading
that depends
Already beat you to it @tender shard
if you set "load" to "STARTUP", then non., if you set it to "POST-WORLD" (default), then nyes
oh
onEnable(), values are loaded. It's a fresh launch
I then save, the values have gone from the list
I don't see how this happens
๐ข
I have a suspicion
I swear that's the only bit :<
static abuse where
the spawn thing
wanna see too
You missed it
@tender shard
Letโs see your command class @supple elk
for which command?
so I wouldnt consider this static abuse. but yeah, getting a world in the class init, ofc that cannot work
Let me see whatever class prompts the saving of the data to file
ok
im trying to create a custom serializer with GSON, some reason I keep getting the InaccessibleObjectException error even when I've registered the adapter. https://paste.md-5.net/obeyaneduv.java
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
it's a little big...
oh wait sorry
wrong bit
just stop getting the error then, duh
(SCNR lol)
is AsyncPlayerPreLoginEvent good for doing some player related checks with a database? will it also ensure the player is online or i have to go sync with main thread again? // posted in wrong section, oops...
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Here
Oh also I wanna do a magic trick @supple elk so after you send me that put a logger in the constructor of your BoatMap class
fr
lol sorry
It gets called before their login completes
alright
what am I logging?
no, you don't have any player object there yet
only the uuid I need
Anything, just a log message when the class is constructed
but I'm doing something with the player after checking a database
Also where in the class you sent me does the save get triggered
i could get the player later
I would just use the normal join event
doesn't matter, it's not critical, only opening books to joining players, but I want to squeeze as much performance as I can
but doesnt it also get called when "cracked" versions try to joinn?
yeah then, no problem
Not to my knowledge
I'm exactly sure in which the order of stuff is created
iirc the event is after authentication but before join
ah ok
No, trigger the save
ok
yeah anyway, my tip is always:
- Do stuff
- If it works, nice
- If it causes problems, fix it then. Don't worry too much BEFORE you encounter problems
Otherwise you spend more time thinking about stuff than actually doinng stuff
I always just start to code sth and then fix problems as soon as they get reported lol
Ok yep Iโm right
I think the issue is that it reads the values, tries to save to fields which don't exist yet
Your issue is that youโre assigning spawn and checkpoint to empty lists
I have a spawner plugin where i need to calculate the drops of a spawner based off of a entity NBT tag wich just saves the spawners entitytype as a string. What would be the best way to calculate drops? Make a class for each one, and load those classes into a map with the key being their name as a string on startup?
Why do custom channel names (plugin messaging) need to contain a colon?
And then calculate the drops in each class?
Which happens after theyโve been assigned by the deserialize function
when?
drops of what? the spawner block?
SHIT
private List<Blah> bla = new ArrayList<>();
That happens after
No, the spawner gets put into an inventory, and then you click a button to collect its drops
I still dont understand what you mean with drops. A spawner spawns mobs, and doesnt drop anything, are we talking about different things? o0 ๐
hmm, how worse could it be to get a serial id from a database for each player joining directly in the main thread ๐ค
Very bad
Donโt do it
very bad
Ty so much @brave sparrow + @tender shard
use Futures for stuff like this
No worries
did you get your serialize thing fixed?
Or just use the async event and cache the data
I tihnk
testing
yes
๐
it is fixed
Excellent
ford prefect
I put the spawner in an inventory
Not inthe world
And calculate drops from there
such a dumb mistake
To reduce lag
it happens lol
That was a non-trivial issue
dumb mistakes are the worst to fix
I wouldnโt even call that a dumb mistake
You have to know a decent bit about execution order to realize what the issue was with your code
I already have it working with XP https://www.spigotmc.org/resources/better-spawners.103145/
I ran into this same mistake ealier kinda
I was trying to call spawn.addAll()
and was confused cause I initialised spawns to a new list
in the constructor
but of course the readMetaData() is called form the super constructor
so you want to get the hypothetical drops of a mob? Sorry for being so dumb but I really don't unnderstand what you're trying to do lmao
Yup
so before the lists were initialised
so I made it create a new list on readMetaData()
which then overwrites, which works
but then forgot to remove the initialisation of the lists in the constructor lmao
which is what caused that mess
so I feel like I should have seen that
Is the Player object thread safe enough for checking isOnline() method?
oh well
Kinda, for XP i have it give one XP every minute with a cap, and some multipliers. All available to change in the config
you should NEVER access ANY api async. even if it might work now, it might break in the next version
I'm pretty pleased with what I've made overall though. Storing and reading minimaps and metadata for them from files
public void onEntityDamage(EntityDamageEvent e) {
LivingEntity monster = null;
if(e.getEntity() instanceof LivingEntity) {
monster = (LivingEntity) e.getEntity();
}
if(monster == null) {
return;
}
if(monster.getCustomName() == null) {
return;
}
if(!rpgMonstersManager.isRpgMonster(monster)) {
return;
}
RpgMonster rpgMonster = rpgMonstersManager.getRpgMonster(monster.getUniqueId().toString());
rpgMonster.setHp((int) (rpgMonster.getHp() - e.getFinalDamage()));
rpgMonster.updateDisplayedHp((rpgMonster.getHp()), monster);
Bukkit.getServer().getConsoleSender().sendMessage(String.valueOf(rpgMonster.getHp()));
}``` did anyone knows why when i'm calling that event hp displayed updates late
when hp for example equals 23 then hp displayed is 24
only i hit mob, the hp that displays is 23 and the actual is 22
Right, so I go sync, but not sure if the player object and that method gets preserved if I go async and then sync again
public boolean isOnline() {
for (Object obj : server.getHandle().players) {
EntityPlayer player = (EntityPlayer) obj;
if (player.name.equalsIgnoreCase(getName())) {
return true;
}
}
return false;
}
Look safe to you?
you can get the mob's LootTable
public void updateDisplayedHp(int hp, LivingEntity monster) {
String name = ChatColor.GREEN + "[" + ChatColor.YELLOW + level + ChatColor.GREEN + "]" + ChatColor.WHITE + " Zombie "
+ ChatColor.GREEN + (int) monster.getHealth() + ChatColor.YELLOW + "/" + ChatColor.GREEN + maxHp;
monster.setCustomNameVisible(false);
monster.setCustomName(name);
monster.setCustomNameVisible(true);
}``` update method
and then use that to get "random" drops
not using remapped ๐ฅฒ
How would i do that exactly
It does, you still point to the same object in memory
are you fine with using NMS?
No
Got that straight from spigot stash, itโs 2012 code lol
What ill do
Is ill do what another plugin i saw did
They had a foilder with every mobs loottable in a file
LootTables.<ENTITY_NAME>
But i wont do it like that, ill do it in classes
e.g. LootTables.ZOMBIE
And then have a config option to chanmge them
No NMS tho
LootTables.valueOf(myEntity.getEntityType().name())
not sure if there is a table for EVERY mob type, so you might wanna try/catch this
Alr
and then you can get a random drop from the table like this (1 sec ill send a link)
Hmm, or I could save the player uuid and get the player and check for nullity, looks like same thing with isOnline() method
You could, you donโt need to though
I gfound it
The only issue is that i would need to generate a bunch of loot depending on how long the spawner has been in the inventory
https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/LootUtils.java this is how to get a random drop from a loot table
Would i have to run populateloot a bunch of times?
tbh, no idea
I think that "populateLoot" returns exactly one "list of items"
e.g. kill one zombie = populateLoot
kill another one = populateLoot again
so for 10 zombies, you gotta call it 10 times
btw Hyper huh
why is your discord name different from your spigot name
arent you verified
[24.07 13:10:56] [Server] [ERROR] Could not load 'plugins/SwornGuns.jar' in folder 'plugins'
[24.07 13:10:56] [Server] org.bukkit.plugin.InvalidPluginExceptionjava.lang.UnsupportedClassVersionError: net/dmulloy2/swornguns/SwornGuns has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
``` anyone know how I fix this
I think they just changed their spigot name
I havve changed so many values relating to JDK idk how it still builds
you compiled your plugin with a newer java version than your server is running
how do I change it? Ive tried to change some values inside of intellij/maven to 11/15/1.8
are you using maven?
yep
ok 1 sec
read the third headline
Are you compiling swornguns?
instead of "17", use "1.8"
Ok so that is the one youโre compiling, good
looks like my blog is popular among russian bots lmao
hmm thats weird lemme get some ss
that should work right?
yet its still the same error sadly
how are you compiling? @raw sky
Maven -> LifeCycle -> Install
Is it possible to parse a JSON string to a List<Object> with Jackson?
you definitely need a Mapper / TypeReference
do you need a List<Object> or a List<MyCustomObject> ?
List<Object>
I'm trying to get as barebones as possible
I'm benchmarking Jackson against my own parser
Damn
that's a quite unusual question ๐
most people want to get a list of some specific class
Well yeah, for benchmarking I don't care about its conversions or anything
I just want to compare its raw speed
Rebuilding project does come up with some errors, but I think that works?
what about sth like this? Haven't tested though
ObjectMapper mapper = new ObjectMapper();
List<Object> stuff = mapper.readValue(someJson, mapper.getTypeFactory().constructCollectionType(List.class, Object.class));
Ill try and fix them, I believe java 11 is the closest I can get to my server version
whats your sever version anyway, btw?
all spigot versions either require java 8, 16+ or 17+
is there a way to set the world in a BlockVector3?
1.16.5 (server is paper but the plugin is in spigot)
im guessing i need too
no. a BlockVector is only 3 numbers, nothing else
okay
ah ok. You can then basically use any java8+
what was the error?
org.bukkit.plugin.InvalidPluginExceptionjava.lang.UnsupportedClassVersionError: net/dmulloy2/swornguns/SwornGuns has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
If i want to get the material value of a string
How do i chekc if the material does not exist
Like say sopmeoen types in Dir instead of Dirt
How would i add a check fro that
Would valueOf return null?
would valueOf return null?
it snot sending wtf
yeah you still compiled it using/for java 18
so I can write in say java 17 and compile with java 11?
version 61 = you compiled using java 18
send your whole pom.xml pls @raw sky
?paste
valueOf throws IllegalArgsExc
that was from before, I changed it to be a difference version
but I can still send it
yeah pls just ?paste your pom
Should i catch the NPE in this case? And tell the player that they inputted it wrong?
yes
check out my Enums class
just do a try catch and in the catch do your error handling
1 sec
Alright
https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/EnumUtils.java this is how I turn string -> enum
so i m using teams to setup a prefix for each players, but how can i make it so that "Prรฉfix" is on top of the players name. Like there is the "Prefix" and bellow it the player's name
heres the part of the code :
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
org.bukkit.scoreboard.Team team = scoreboard.getTeam(sender.getName());
team.setPrefix("Prefix \n ");
team.addEntry(sender.getName());
you set it to 11. set it "1.8" instead
enumClazz edgy hehe
how would you call it? ๐
the quality of this code though is pretty great
for loop > forEach
I'm not using any foreach in that class, do I?
no, exactly
I havent checked this code since months
thats one of the reasons your code quality is quite high imo
forEach does have some useful cases but not if you just wanna loop over a collection lmao
exactly
Ok I just checked and it was "17" in the version I had before which ruined some of the code switching to 1.8, is there any way to get around that?
people abuse it too much
forEach = if you use a stream already anyway
everythingElse -> normal for loop
true
show the exact error pls
if the code uses java 17 features, ofc you cannot compile it for java 8
Ok ty!
btw doesnt 1.16 support java 17 anyway?
server is running java 11, I might be able to get java 17
tried to run it with paper and it just crashed
anyone has a way to put smth on top of the players name?
invisible entities with a custom display name
there is no other way
I suggest to use AreaEffectClouds
instead of armor stands
why that?
it's better for client FPS
armor stands cause huge FPS drops if you use many of them
area effect clouds dont
what are the pickup statuses?
there is one downside though - the effect clouds only get rendered up to 48 blocks
nvm found it
Can someone help me with this, im trying to make a teleport ability but i dont get the teleport to work, do anyone know how to do this? https://pastebin.com/Kr12uawA
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I'm getting compilation issues for some reason anyone have any idea what this Means
java.lang.Error: Unresolved compilation problems:
The type net.minecraft.world.entity.Entity cannot be resolved. It is indirectly referenced from required .class files
The type net.minecraft.world.phys.AxisAlignedBB cannot be resolved. It is indirectly referenced from required .class files
why isn't this working? No errors but its not setting the blocks
Json json = getPminejson();
double jsonx = json.getDouble("pmines." + name + ".loc1.x");
double jsony = json.getDouble("pmines." + name + ".loc1.y");
double jsonz = json.getDouble("pmines." + name + ".loc1.z");
Bukkit.broadcastMessage(jsonx + " // " + jsony + " // " + jsonz);
double jsonx2 = json.getDouble("pmines." + name + ".loc2.x");
double jsony2 = json.getDouble("pmines." + name + ".loc2.y");
double jsonz2 = json.getDouble("pmines." + name + ".loc2.z");
Bukkit.broadcastMessage(jsonx2 + " // " + jsony2 + " // " + jsonz2);
BlockVector3 blockVector31 = BlockVector3.at(jsonx, jsony, jsonz);
BlockVector3 blockVector32 = BlockVector3.at(jsonx2, jsony2, jsonz2);
World world = BukkitAdapter.adapt(Bukkit.getWorld("pmines"));
try (EditSession editSession = WorldEdit.getInstance().newEditSession(world)) {
RandomPattern randomPattern = new RandomPattern();
Pattern pattern = BukkitAdapter.adapt(Material.STONE.createBlockData());
Pattern pattern1 = BukkitAdapter.adapt(Material.SEA_LANTERN.createBlockData());
randomPattern.add(pattern, 99.5);
randomPattern.add(pattern1, 0.5);
Region region = new CuboidRegion(world, blockVector31, blockVector32);
editSession.setBlocks(region, randomPattern);
editSession.flushQueue();
}```
is that gson?
i guess that means yes
๐
okay now this isn't working for some reason
Location pasteloc = new Location(Bukkit.getWorld("pmines"), (500 * pminejson.getInt("pminecounter")), 50, 100);
owner.teleport(pasteloc);
firstloc = pasteloc.add(21, 2, -20);
secondloc = pasteloc.add(121, 46, -120);
pminejson.setDefault(location + "loc1.x", firstloc.getX());
pminejson.setDefault(location + "loc1.y", firstloc.getY());
pminejson.setDefault(location + "loc1.z", firstloc.getZ());
pminejson.setDefault(location + "loc2.x", secondloc.getX());
pminejson.setDefault(location + "loc2.y", secondloc.getY());
pminejson.setDefault(location + "loc2.z", secondloc.getZ());```
but they are both the same
plugin.getDescription().getPermissions() does getPersmissions method is used by permissions management plugins?
i mean should I fill this array with the permissions that my plugin use?
is there some legal way to doing that or i need to use refrections, sice setPermissions not exists
ok then reflections
it is if plugin has version checker like -> use reflection if verions is 1.16
Why isn't this coloring the action bar message?
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Action bar message", ChatColor.RED.asBungee()));
Hey I'm having a problem testing my plugin.. I am making it compatible for 1.8 - 1.19 but I ran into an error when testing with 1.8.8
Basically it looks like guava library is not loading correctly, because I get this error.
java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object)
But it makes no sense why this method would throw because when I decompile the spigot-1.8.8.jar I can see that the method indeed exists...
bro why isn't this adding to the location?
firstloc = pasteloc.add(21, 2, -20);
secondloc = pasteloc.add(121, 46, -120);```
someone knows how to change player display name? (using packets maybe?)
I also used
for (Method method : Preconditions.class.getDeclaredMethods()) {
getOutput().info(method.getName());
getOutput().info(Arrays.toString(method.getParameterTypes()));
}```
And as a result I indeed got the method that is throwing this error
does spigot use com.google.common namespace or it is external dependecy in your project?
It does use it
It worked with other projects
No idea why it doesn't work with this one
I wouldn't come here otherwise
The class itself exists and the method itself
So it's not like spigot is using an outdated version or something
Of course I could probably shade guava into my plugin but I don't want to make my jar bigger than needed
You can double check for yourself on get bukkit
might sound like a stupid question but if a project compiles to java 1.8 it cannot use an api made with java 17 right?
I Just need to make sure
because who ever made this plugin needed to make it in java 17
in the file there is method public static void checkArgument(boolean expression, @Nullable String errorMessageTemplate, @Nullable Object... errorMessageArgs)
but you are trying to find java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkArgument(boolean, java.lang.String, java.lang.Object)
i mean here last argument is array of objects not the single object
i guess maybe this is the case
i had one configuration yet but i wanted to add one more. i did but...
That shouldn't be the case
Because when you compile a project using that method
It automatically converts it to an array
Like this
org.bukkit.scoreboard.ScoreboardManager sm = Bukkit.getScoreboardManager();
Scoreboard s = sm.getNewScoreboard();
Objective h = s.registerNewObjective("showhealth", Criterias.HEALTH);
h.setDisplaySlot(DisplaySlot.BELOW_NAME);
h.setDisplayName(ChatColor.DARK_RED + "โค");
so i have this , how to attribute it to a player?
Like I said it works with 1.17 and below
maybe try to put array as last argument worth to try
It's redundant tho
how do i copy the resource folder config.yml into my plugins?
;/
add the player to the scoreboard
itโs a method in player iirc
And anyway it doesn't help
lol
Hey, Ive been trying for a few days to make it so if somebody dies it basically has a firework instantly detonate where they were killed, Im having trouble with the instant detonation, at first I used firework.detonate() method and it worked for sometime but then for some reason it stopped. Ive done some research and ive seen that this method is not the best and u have to delay the detonation in a few ticks so it will work, so I did that and it didn't work and now im stuck. Can anyone help me please
https://paste.md-5.net/egocatujam.cs
What is it denotation or denotate?
exploding a firework
isnโt there a particle effect and sound you could play ?
^
Is there a way to nullify an item based on its enchants
Like if it has sharpness 255 I can set itโs damage to 0
Check if it has an enchantment above the max level if it does nullify it?
ok so, i m using this to like show health bellow players health.
Objective h = scoreboardd.registerNewObjective("showhealth",Criterias.HEALTH);
h.setDisplaySlot(DisplaySlot.BELOW_NAME);
h.setDisplayName(ChatColor.DARK_RED + "โค");
player1.setScoreboard(scoreboardd);
but how can i display smth else without any number
anyone know why these locations are the same?
Location pasteloc = new Location(Bukkit.getWorld("pmines"), (500 * pminejson.getInt("pminecounter")), 50, 100);
owner.teleport(pasteloc);
firstloc = pasteloc.add(21, 2, -20);
secondloc = pasteloc.add(121, 46, -120);
pminejson.setDefault(location + "loc1.x", firstloc.getX());
pminejson.setDefault(location + "loc1.y", firstloc.getY());
pminejson.setDefault(location + "loc1.z", firstloc.getZ());
pminejson.setDefault(location + "loc2.x", secondloc.getX());
pminejson.setDefault(location + "loc2.y", secondloc.getY());
pminejson.setDefault(location + "loc2.z", secondloc.getZ());```
What are you doing?
Location#add mutates the original location
your code makes firstloc = secondLoc = modified pasteLoc
clone pasteLoc before altering it
= pasteLoc.clone().add(...
i have a code that displays health under players name (using scoreboard).
Anyone please knows how to make it so that only certain players see that scoreboard?
Is this the sound of a tool breaking?
How can I reenable old sword blocking?
Ohhh, okay thanks
you canโt do that since it was client side, the only alternative would be to use packets to give a player a shield in their offhand everytime they right click with a sword
i saw some plugins use 1.8.9 pvp
including that blocking
but thx
do anyone know how to teleport someone a specific amount of block in the direction they are looking?
get the player's location's direction, normalize it, multiply it with the "target distance", add that to their original location, ???, profit
I think this is a bug, this method give paths to C:\server\update but it should gives to C:\server\plugins\update
i did it, but it didnt really work. I might have done something wrong but i just land in the same place as i used it
sorry
I doing this right now
players dont accept velocity
You need citizens or need to look into citizens
to make server player move
without it, its gonna be aids
its a lot of work to get players to move
well what I descibried should work. Pls show your code and tell us what exactly didnt work
did you emigrate?!?!
thought he said walk
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
and i meant teleport, not walk, sorry for being unclear
any error msg?
I having an issue with mongo, for some reason is not loading correctly each document from the database into the cache
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
nope
well if it's "not not" working, everything's fine I guess ๐
so what exactly doesnt work?
How can I make this method multithreaded? The main thing Iโm concerned about is reading the file which causes the server to freeze (itโs a bit large, around 100kb). The MultiBlockStructure utilizes RedLib which converts the string in the file to an object to paste, but that doesnโt really cause any issues. Itโs the reading file part that causes lag and TPS drops.
Trying to make a lifesteal plugin. When you die you lose 1 permanent heart. If you kill someone you gain a permanent heart. What events is best to listen to? DeathEvent but I dont know
a few things, but mostly the part that the teleport just teleports me to the same block, instead of adding the distance. I also have a few other problems, it doesnt add the cooldown and on row 53, the right_click_air doesnt work
then your math is off
how do i fix that?
print out the calculated result, then check if its correct
depends, lol. first, check out what the result is. then, if its wrong, we can check what's wrong with your math
PlayerDeathEvent is all you need
lifesteal plugins are pretty easy to code
24.07 20:47:09 [Server] INFO [CradleAbilities]: Teleporting from: -947, 73, -2629
24.07 20:47:09 [Server] INFO [CradleAbilities]: Teleporting to: -947, 73, -2629
and the multiply int is set to 30
sent it earlier but here you go https://pastebin.com/idWbrqBe
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
adding 10 shouldnt really do the same thing, or do you mean just for testing?
Mongo data not loading back when servers get restarted
am too lazy to upload to server... would this work? the char part
What does that do?
Me when i see people who just say โits not workingโ
How would I remove / give player permanent hearts?
^ how does that relate to question?
give me more context then?
Wow thanks!
WHAT THAT FUCK lmao
ok everyone forget this confusion
i was confused
confusion is a common thing of our lives
I dont understand what happening
just move on
Can someone explain to me
Yeah he was doing the noice when you f**
๐
That was a really out of context
So out of context that i forget what do i need to fix now
I'm good lol, thanks
attributes
how to make only certain players see a certain scoreboard? (the BELLOW_HEAD) type.
in 1.8.9
like i wanna make it so that only selected players see players health
Packets :)
Eh you're on an 7-8 year old version not going to look that up
i know its possible
Well yeah
by sending the custom scoreboard only to those who you wanna have see it?
ofc, just dont send the scoreboard to everyone
ok but then how to make it so that only other selected players have their life shown
like Player A has no life and cant see any, Player B has can see life of players (except player A) and player C has life but cant see it
public static String getPermanentHealth(Player player) {
return String.valueOf(player.getAttribute(Attribute.GENERIC_MAX_HEALTH));
}
I have this but it just returns "CraftBukkit.AttributeInstance bla bla"
How would I make worldedit only count the blocks in a region and only replace the blocks in a region?
go to EngineHub's discord
and ask there
Okay
does a player removing an armor stand in creative trigger EntityDeathEvent?
how to disable attack cooldown?
Increase the attack speed attribute
is there a way i can get like a list of paths in my file?
getConfigurationSection("my.path").getKeys(false)
then you can loop through them
@NotNull
public static ConfigurationSection[] getConfigurationSections(@NotNull ConfigurationSection section) {
return section.getKeys(false).stream()
.filter(section::isConfigurationSection)
.map(section::getConfigurationSection)
.toArray(ConfigurationSection[]::new);
}
oh thx
you can use true for deep to get all paths in the file, not just the children of the root level
It probably is sending them the last color
But you have no text after it, so itโll just be blank
Does spigot provide a means for customizing an ItemStack's NBT data? I'm attempting to spawn an elytra item with a random ammount of durability, though I'm not sure how I'd change said durability
player.addPotionEffect(PotionEffectType.NIGHT_VISION);``` is there anything wrong with this code? it keeps giving an error
the item stacks item meta can be cast to damageable
on it you can define damage
Thank you so much ๐
You need to construct a PotionEffect
Which also has the duration and amplifier
ah i see can a duration be infinite?
No but you can set it to be a super long value
And continuous give the effect after some time in a task
Can someone help me with MySQL?
I have a problem where the resultSet is empty but if I execute the statement by hand I get a result?
"false" = resultSet.next()
What event is called when an explosion causes a block to break
declaration: package: org.bukkit.event.block, class: BlockExplodeEvent
show the code you are using
// Build sql command
StringBuilder sqlBuilder = new StringBuilder();
sqlBuilder.append("SELECT ").append(String.join(", ", primaryKeys)).append(" ");
sqlBuilder.append("FROM `").append(database).append("`.`").append(table).append("` ");
sqlBuilder.append("WHERE ");
for (int n = 0; n < primaryKeys.length; n++) {
sqlBuilder.append(primaryKeys[n]).append(" = ").append(values[n]);
if (n < primaryKeys.length - 1) {
sqlBuilder.append(" AND ");
}
}
// Prepare statement and execute query
PreparedStatement statement = connection.prepareStatement(sqlBuilder.toString());
ResultSet resultSet = statement.executeQuery();
System.out.println(">" + sqlBuilder.toString() + "<");
System.out.println(resultSet.next());
statement.closeOnCompletion();
.
why are you using stringbuilder for this o.O
also don't think your loop works like you think it does either
the error occurs because I insert smth to the database instead of updating the values. But I have to check if there is anything with the primary key already inside (which returns false). And that's my problem. The primary key is in the database and I get the error when I insert data with the same key but it doesn't tell me that it's inside
my problem causes the error. The error ain't the problem
as you can see in the console the SQL statement is perfectly fine


