#help-development
1 messages · Page 52 of 1
No
yes
I haven't coped or pasted anything.
and it goes on and on and on
Oh for that
SAYS YOU
i am allowed to say that
Happy birthday!!!
Chad Choco
thanks but you're like 6 months late
I don't see any problem with my code.
Wait Choco can you remove someone's plugin cause it makes me upset that they can't code properly 
you dont user proper variable names.
You use assertions which basically dont do anything to fix warnings
every of those methods is a copy paste of the previous one, changing only the entity type
etc etc
nah that's amateur
switch moment
I remember a guy making a plugin
that sent you a message depending on what version you were on
like a join message
🤔
It's a free plugin. Who cares
You should. Free shouldn't mean bad
This was last week https://paste.md-5.net/oriwadahor.java
Well that's something
lol
wtf
cringe
at least the bungee package uses text components
🤓
wtf
no idea what the purpose of that even is tbh
players know what version they use lol
What now.
what the heck ios that
ah yes i love just being informed of the version i’m on
So bad that it’s good. So useless that it’s useful
Hello mfnalex, you are currently at your PC, in your home
You're running version: "you're mom"
"Hello ImIllusion, you're currently playing on: your pc"
127.0.0.1
Home sweet home
lets now send that to a chinese server
we should try hosting a minecraft network on alibaba cloud
Write good code, publish it, get downloads, then worry about anything remotely related to DRM
and see how long it takes before anything weird happens
yeah also the rules exactly explain what you may do and what not, so just read them
i thought my github repo was dead but a rando suddenly messaged me lol
man's worrying about DRM, doesn't even know what a map is
For how long do you think I code in java?
I don't care how long. Write good code. Write a good plugin.
wednesday?
I can't tell if that's a demeaning question or asking for a suggestion
what day is today even
tuesday I think
Chewsdey innit?
I got charged for my data
noone knows it lmao
so tuesday
It is good. My friends like it.
I have an app on my phone that tells me if it's dark outside
AAH
you must be a linux user
does it also tell you when its time to touch grass?
If your answer to coding java is 2 years or something I've been doing it for 4-6 years and I've only recently been writing code that's anything close to okay
lol
It is less then that.
Been doing java for about 6 years, my code still sucks
and not in the good way ~ like alex would say
I'd say like
don't even try to work on premium plugins until you reach 3-4 years of experience
You have a lot to learn and that's okay. Focus hard on concepts. Learn as many as you can, use them in plugins, if you're writing a bunch of if()s find a concept that makes it easier. Eventually, you'll be able to write good code to write a good plugin to publish.
Then spend a whole year focusing on improving user interactivity
I've been a bit luckier. Been coding for 4 years (of that 3 years seriously) and I'd say my code is acceptable for a good year now. But then I also spend 40 hours a week coding stuff
Stuff like fancy, easy to use GUIs
I have plans for that.
if your code looks like ddlc code, you're doing something wrong
I just wish https://www.spigotmc.org/resources/thirst.3316/ could fix their code.
its good?
Literally rent free in my head
dont parse it twice as we said
I'm breathing mega hard in antecipation
let's see what this is
why is the beer logo built-in to the jar
huh why doesnt that work on paper
crunchy
Idfk why but the guy makes a new scoreboard when the thirst bar ticks so he clears the old ones. 
not so crunchy
Dont wanna sound rude but your code looks really un profesional like if a child without experience trying to make a game. You should learn good practice before comming to complain
I told him what's wrong he wrote code to fix it but he never implemented it
Rent, free
Why can't I cancel AsyncPlayerChatEvent?
I have a question. Can bungee cord servers or sponge or the others software that is not bukkit or paper or spigot run spigot plugins?
reminds me of my first plugin
you can
Actually these 3 plugins are my first plugins and my first java code.
Great, now learn concepts and improve them
no
other plugin?
It's probably the best way to learn
there are some hybrid forks but they all suck ass
nope
e.g. catserver, mohist, all bullshit
even in my ls plugin after updating to 1.19 it stopped cancelling stuff
for asynchat
only for that
am I tripping or did you upvote like 200 messages on spigot in hopes of getting some popularity back?
It's as if AsyncPlayerChatEvent doesn't properly cancel anymore
time to learn sqlite syntax now pff
it works fine
Not for me
you must be doing sth wrong
throwing h2 out
works fine for me using this code:
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Tasks.nextTick(() -> {
Toast toast = new Toast(event.getMessage(), "Description", Material.DIAMOND, Toast.FrameType.GOAL);
toast.send(event.getPlayer());
});
event.setCancelled(true);
}
/relod !!!!
paper
cool toast
spent like 2 hours getting this to work today lol
No.
lol
slightly inconsistent
maybe they just like to give thumbs up to others
I still like to hope that Mojang will do what they did in 1.8 with the /title command, and add a /toast command
Trying with only, only the thingy
maybe they misread spigot as "facebook"
yep it works
and started giving the thumbs up to every post
TAB ?
Do you think if I was to update the docs with @since comments for everything it'd get accepted as a PR?
was like the greatest offender in that direction in the past few days
I sincerely doubt it

there goes your dream
Yeah 
Do you guys like minigames?
no
As nice as that may be, sweeping Javadoc changes like that are not very likely to get merged. You could ask md directly, but I've a feeling his answer will be no
Why not?
all PR I ever did were javadocs related lmao
idk I think survival is way better than minigames
lol yeah, they were clarifications/corrections, yeah? Those are usually small enough to be worth merging in without issue
cuz i never win kekw
Sad lol. It'd be nice to have
yeah exactly lol
yeah I also would like this
but it'd be a shit ton of work
I have no life.
me neither
I'd also contribute to this
first thing i'd do
PersistentDataContainer @since("1.14.1")
most of my prs have been for grammar/spelling corrections
Best way to ask the md_5
open an issue maybe 🤔
The largest sweeping change that was ever approved, and probably the only sweeping change that was ever approved, were the nullability annotations
At least in recent history that I can recall
oh yeah IIRC in 1.8 there were no annotations yet
Correct. I want to say it was 1.10 they were introduced?
Well, it's docs comments not annotations
bukkit uses javax annotations
We use Jetbrains annotations
I know but they're both sweeping changes,
huh
I am pretty sure bukkit uses javax
because the jetbrains ones have this weird javadocs bug
Nupe. JBA
whut
ik, what would be the best way to ask?
smh you are wrong alex
The Javadoc bug was actually present for a while until md and I figured out the issue was because of the annotation targets
Our fix was to backport. We're using JBA for Java 5
explain it to me pls
I also always have this problem
that's why I used javax annotations because md5 told me they dont have this problem
thats also why I thought bukkit uses them lol
I'll find you the commit. 1 sec
that would be nice ❤️
thx!
I remember trying to figure out with md why what that was happening lol
I'd be willing to do the work if I could get md_5 approval 
ask him then
Yeah I'd just give him an @ later in the day
Closer to 5pm EST is when he's around

I'll nudge in priv too
getting md_5's approval is like asking a brick wall to move, change my mind
Well, I have hope a dream
That one day, when giving help, I can finally know when a method was impl'd
fuck
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(args.length == 1 && sender instanceof Player p && p.getGameMode() == GameMode.SURVIVAL) {
int amount = Integer.parseInt(args[0]);
if (p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= Integer.parseInt(args[0]) * 2) return false;
ItemStack heart = new ItemStack(Material.NETHER_STAR, amount);
ItemMeta heartMeta = heart.getItemMeta();
heartMeta.setDisplayName(ChatColor.RED + "Coração");
heart.setItemMeta(heartMeta);
if (amount*2 < (p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue()) && amount > 0) {
p.getInventory().addItem(heart);
double pHealth = p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(Bukkit.getServer().getPlayer(args[1]).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() + amount * 2);
}
}
return true;
}```
is this good
?
?paste it
so much better
if (p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= amount * 2) return false;
i'd put the whole itemstack stuff into its own method. also you must catch the NumberFormatException
handle cases where the player is null
player can't be null
uhh
but it can be only a consolecommandsender, yes
i mean the Bukkit.getPlayer
or a commandblock
ooh havent even seen that
also whut
you do args[1]
after checking whether args.lengh is 1
so will never have args[1], only args[0]
im fixing it
where the problem at ?
and dont call Interger.parseInt twice for the same string
You're not Santa don't need to parse it twice
he's checking his list
hmm
Santa Claus is comin to town
santa claus is such a jerk
I mean yeah, what do you expect from a fat guy watching you sleep
early returns
Wait, you don’t have to define types in lambda methods?
I know but is it required?
no
I don't fully understand why they did it like that in the first place however
🤓
and how i use else
Believe it or not - I am being taught at school that you should not do it that way
if(args.length == 0) {
// Send error message
return true;
}
if(player == null) {
// Send other error message
return true;
}
// Do the rest
Implementing this has been such a mental issue with me for so long.
same lol
Why?
why that? every book I read told me to do it
i didnt even learn that you could use return without returning smth
and common sense told me too
Because it increases the work that is put in in debugging the code flow at first glance
using blueJ at school 🤓
i think it's way easier
someone I knew called this castling but I just call it "doing the thing" kekw
As long as code is relatively short
i only know it as using "guard clauses" or sth like that
That's the one
Do note that schools try to prepare you for enterprise code. Not solo dev code
probably send a messagr that ths user should specifiy a player
you should just learn basic java instead of random code and then asking "?"
smh i really cant type on this keyboard
I wonder how 10 nested if's are easier in any case though
hit numblock twice by typing this
Because types are annotatable. If I want to do List<@NotNull String>, that's valid and should be valid.
Code size
how is the size of the source code relevant
It's a javadog bug as far as I'm concerned
javadog
javadog, new mascot?
So why are methods annotable?
doge
No, it's a JBA issue
Methods are anotatable because of return types
Eclipse has trouble dealing with it too
eclipse also has some serious issues with itsef
fwiw, javac might also have an identical bug
or @Deprecated on a method ? 😅
i know that you like that, lol
:>
I just silently remove the extra annotations, but I guess I'll need to PR to eclipse eventually to fix that issue
In my experience, nested ifs clog your screen but if you know how to read them it’s not that bad
thanks eclipse, really useful hint lol
Not to mention most ides will highlight if statements closing and opening brackets
Eclipse does that too 
lets cast a string
I myself use the arrow pattern quite a lot in really big (up to 2k lines) methods that cannot really be boiled down into many methods in a sensical manner
for (Node block : new IterableNodeList(project.getChildNodes())) {
if (!block.hasChildNodes() || !(block instanceof Element)) {
continue;
}
Element blockElem = (Element) block;
if (blockElem.getTagName().equals("properties")) {
for (Node property : new IterableNodeList(blockElem.getChildNodes())) {
if (property instanceof Element) {
Element propertyElement = (Element) property;
out.putIfAbsent("${" + propertyElement.getTagName() + "}", propertyElement.getTextContent());
}
}
} else if (blockElem.getTagName().equals("parent")) {
parentArtifactNode = blockElem;
}
}
Loops are also one cause of me using that pattern heh
Eclipse needs to step up its game in terms of quick fixes. I say that as an Eclipse user of 7 years. Though in this situation, what else is it meant to suggest? The only other option would be "Create method getName()" but it can't do that in a compiled class on the class path
It is adding some very, very useful quick fixes every update though
Ctrl + 1 is a life saver
what is that?
Quick fixes
idk, intelliJ understands that an ItemStack is never instanceof PluginBase
F
switch to notepad
switch to nano
intellij simply tells you "nope. not going to work"
ah shit i forgot to install linux this afternoon
I liked Ctrl+shift+o
what does that do
tbf, those suggestions are equally as ass
F3 is my favourite shortcut
optimize imports
yeah the proper quick fix wouild be to tell "ItemStacks have no item, however their meta might have a name", but yeah that's some copilot level of quick fixes
- Adds new imports
- Removes unused imports
- Organizes your import order
I have that as a save action it's so useful lol
yuh
ah ok, I have imports set to "on the fly"
I still press it in intellij
Doesn't quite like generics though if the type of the genericed type cannot be resolved
Even tho it's not the same keybind
I think IJ has a similar button but you can rebind it to CSO
whats that doing?
At least if I recall correctly from my week or two using it
I'll show an example
hmm anyone knows if i need to manually create db when using hikaricp with sqlite?
i didnt have to wih h2
created the file automatically and created the database
it simply automatically adds imports without you having to choose the exact class
oh
Eclipse does that too provided you auto-complete the suggestion
e.g. it's so annoying when doing List<String> list = ...
obviously I need java.util.List
and not some random other list thing
do yall know the sound that hypixel uses for like a "invalid" sound
is it just me or is that video without sound
ij likes to give me a javax.xml.stream.Location instead of a bukkit one lol
it works for me
oh it' sjust extremely silent
idk im listening music lol
that sounds like some weird enderman thing lol
my volume was max 😀
which one
i cant tell the difference
Eclipse's solution: blacklist the entire java.awt package from being able to get auto-completed
not sure, just try around with the /playsound command until you find it
its none of them
unless im using the cmd wrong
/playsound minecraft:entity.enderman.teleport hostile kobeeeef
they dont sound like it at all
hm it's definitely something fro mthe end, I guess
yeah
sqlite not having uuid as datatype?
how to do that
just use strings
tbh not sure, havent done this in years
whats the name? i only found entity.ender_pearl.throw
hmm im wondering cuz i couldnt find it for h2 either but it still worked
https://hypixel.net/threads/whats-the-sound-name-for-when-youre-on-ability-cooldown.3823097/ found this thread, might be useful to read through
how tf do they make a slowed down sound
they probably mean lower pitch
changing the pitch also changes the speed
it's how high the sound is
it's like when you play a vinyl record fster thn usual, than it's faster and the pitch is higher
if you play it slower, the pitch automatically gets lower
oh
i thought pitch was another form of volume or smth lol
can locations have decimals
?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.
shulkerboxes are blocks, rent they?
pff why did school never learn me how to write good consistent database tables
yeah they automatically use the next "actual" block pos
maybe there's some NMS stuff to avoid this
shulkers are basically blocks without being a block
tile entities?
more like entities with the hitbox and collision of a block
it’s definitely possible to put them in non-whole block locations though since i had some command block thing a few years ago that made circles with them
helpp
i have this in the pom
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.8.8-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
but it's giving error
Unresolved dependency
run buildtools
wrong artifactId
?bt
and yeah normally you want to use craftbukkit or spigot instead of "minecraft-server"
Wrong version too ;p
is there a method to await a message? or will i have to get it from the event
type is also unnecessary. Really that whole dependency is wrong
ok
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <!-- or use "spigot" if you want server internals -->
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
Literally everything in your dependency except for "groupId" was incorrect lol
haha
but i dont need api
i need the whole server
erm
to compile my spigot
then use spigot
<!-- or use "spigot" if you want server internals -->
instead of spigot-api
Oh... you're making a fork
yes
👀
Well, version of that dependency should still be 1.8.8-R0.1-SNAPSHOT iirc
when i use that import
but I'm going based on 7 year old information here
Did you run buildtools for it?
Im trying to set a receipe on a merchant but when i do merchant.setRecipe(1, recipe); or merchant.setRecipe(0, recipe); it just says its out of bound
oh no
i never used that
how can i use it
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Then the list of recipes is too small...
?1.8
Too old! (Click the link to get the exact time)
You run that with buildtools
how do i set the recipes then
okok
but i dont have buildtools
Then get it
do getRecipes(), add something, then use setRecipes again I guess
?bt
Check the recipe count and if its 0 you create a new list and set the whole list of recipes.
You can also get the whole list, add something to it and then set the whole list again.
List<MerchantRecipe> recipes = new ArrayList<>();
merchant.setRecipes(recipes);
like that?
yee
work
thanks
whats most acceptable?
class PlayerData {
Map<String, Home> homesMap = new HashMap<>();
PlayerData(Collection<Home> homes) {
for (Home home : homes) {
homesMap.put(home.name(), home);
}
}
}```
or
```java
class PlayerData {
Map<String, Home> homesMap = new HashMap<>();
void addHome(Home home) {
homesMap.put(home.name(), home);
}```
im trying to avoid taking multiple maps as constructor parameters in my playerdata class
A constructor should mainly be used for immutable data. (final field initialisation)
The latter approach makes the PlayerData class easier to serialize.
mmmh ye lets call methods then instead of calling the constructor when loading from database
now you're done
which error exactly?
cannot resolve org:spigotmc:spigot:1.8.8-R0.1-SNAPSHOT
why use 1.8.8
click on the maven reload button in intellij
Why do you need the spigot artifact?
for my fork
same error
If you think about it
what's the output of this
mvn dependency:get -DartifactId=spigot -DgroupId=org.spigotmc -Dversion=1.8.8-R0.1-SNAPSHOT
it should print this
public static String square = "■" does somebody has this emoticon with outline border and transparent body?
□
thx
what
what what?
what what what?
HandlerList.unregisterAll(listener) or smth
ugly asf 💀
i hate exposing collections for serialisation
Hello, is it possible to have a firework not play the explosion effect?
but still want the particles after explosion effects going out, just dont want the "EXPLOSION_HUGE" particle alike happening because takes away the beauty of a firework.
It allows you to make events without a class, and also stop the events
is NMS EntityHorse now just net.minecraft.world.entity.animal.horse.Horse ?
oeh i wish i had discovered this earlier
Is it possible to listen for when a block created by sendBlockChange is broke?
How would I force load a spawner? Basically make a spawner still work even if a player is farther then 16 blocks away
Load the chunk it’s in
is passing an instance of the main class any different in bungeecord than spigot?
Passing as in as a parameter?
Oh you’re attempting to make a singleton?
hmm
yes
Is it possible to listen for when a block created by sendBlockChange is broke?
not sure what that means here, but i guess so
i just want to be able to use things like configuration.getString etc
It means you store a static instance of the class. And only allow one instance to ever be created
Creating a staffmode plugin, (Im new to java) just wondering why it won't give me the itemstack (compass) everything else is working perfectly
yea so whats exactly the problem with my code?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
does that work the same for bungeecord ?
let your condition be if (staff.remove) {} else {}
you clear the inventory after adding the compass
no need to check contains before removing
It doesn’t rely on spigot so yes.
Shit yeah...
still doesnt work
You need to read the documentation first
Ohh yea I got it, thanks!
Why I keep getting the same error when I import VaultAPI even if I have the plugin is enabled, this is the code to setup the plugin:
no vault or economy plugin installed?
how to unregister listener class
i just told you
I do
Sure?
.
And the economy plugin?
Same
Vault does not provide an economy by default
shut the fuck up
hmm i will
Okay, do you initialize your vault integration lazily (i.e. definitely after the economy plugin loaded)?
💀
In the onEnable method?
and there we have it. Your eco plugin loads after your plugin
So what I'm supposed to do
Load the integration as late as possible (the first tick at the very earliest)
dependencies
Good luck supporting bazillions of economy plugins
I mean you have to manually add support regardless I'm not sure how you would make a catch all for economy plugins where you set it and go with 0 matinance
or just load ur plugin last 🙂
Depend on vault and load the integration late
if you can cuz idk
(that is what I am saying not to do)
No idea of how doing it
With bukkit scheduler?
Yeah
1 tick should be enough
Otherwise listen for the Service registration events
are we actually allowed to ask for support with Bungeecord here too?
Read the channel topic
Oh yea
yes though I feel like bungeecord devs are much less common
so you might have to wait a bit
that is the case
The class that it has a problem with: https://pastebin.com/kCe1Q2pP
Pastebin
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.
Did you mistype something in the plugin.yml perchance?
Actually you did there is no mistake to be made here
class that doesnt have a life and does problems
Ohh yea, I earlier misspelled my plugin name when creating it, and I forgot to fix it, thanks
turned out its not the class ig, lets make sure
saffchat
ye
Who would've thought
You should read error messages more frequently
reading is useful
yea umm now how do I rename a package, i dont seem to have an option for that
Java is not like C/C++ where the error message is basically just "Recieved SIGSEG: Core dumped"
or c#
?
intellij ofc
they never taught me that in school
Hello, I'm trying to create custom items in spigot (with custom texture), I need to know if it is possible to add a texture to a placed block with spigot 1.8.8?
I already use this for my items
you cant add custom texture with spigot
No problem, thanks 🙂
thats forge or other mod loaders
You can define resource packs
Thanks man
Even delaying it with 1 tick that works
But the blue bedrock has an custom nbt tag
as shown here
hello, I wanted to know how I can create a skript using the Skript Spigot plugin, to make a system that leaves items scattered around the map inside chests and that these items automatically reset within a certain time, how can I do that?
But how to do it on only some items, not all my bedrock, like on the screen above
You use the custom model id
Because when I pass it, the block loses its nbt (I use meta data instead) but I lose my blue texture
You probably need to work with tileentities/tilestates there, but idk. This whole topic was always far beyond my comprehension
you cannot define a method in a method
Ignore the space ive amended that. still an issue
hello, I wanted to know how I can create a skript using the Skript Spigot plugin, to make a system that leaves items scattered around the map inside chests and that these items automatically reset within a certain time, how can I do that?
Okay, thank you very much
Wdym?
Well you can, but first you need to define a local class
Trace back your brackets
well now that just doesnt return anything no matter what perms a player has? https://pastebin.com/w30JqW1f
Pastebin
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.
But I have the correct amount of brackets between each method no?
After a few checks, it is optifine and not bukkit itself, Sorry for the inconvenience
(you open your if statements with two brackets)
I've added added another
wha
the java version on your local pc is too high
me/goldgamerpt/goldplugin/Main has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0
running your server with java 17 while compiling to java 18 will break
tho if youre making a public plugin id recommend putting 1.8 unless your plugin requires a high version which i doubt
1.8 is not a minecraft version here, its java 8
not sure tho
only really makes sense if you also depend on a api version under 1.16.5
yea
bump (bungeecord btw)
Java 11 is the minimum java version I'd ever go for
Force load or just load
I'm ngl I tried using java 8 recently, painful
To be blunt: Then you are stupid
force
Though to be fair I do a lot of classloading / IO shenanigans, where features implemented in Java 9 to Java 11 are very much needed, other people will probably not need those APIs as much
cast it
i am staff over at command panels and one of my users are getting this error they have no tab spaces i need to know why they are getting this error
#help-server @atomic swift
oops
when i do /withdraw give me the heart item but dont remove me a heart
well we cant help you without the code here
ig
if I'm making an exact copy of Hypixel skyblock do I make it in a single plugin or multiple different projects?
for simplicity and maintainability purposes
can u help me?
There isnt the one best approach for this. But i prefer one plugin with a good package structure or a multi module project setup.
het
well we cant help you without the code here
hey*
lovely
.
Are you using maven?
@cobalt tinsel
Ill take a look at it
ok thx
yep
How do you compile?
mvn clean install
Any exceptions?
Did you add any jars manually to the project?
nope
Then show your pom pls
no
ok 7smile7 which project structure would YOU choose
if you wanted to make a complete replica of Hypixel skyblock
one core project or many
Oh 1.8... Support for that version was dropped years ago. You are on your own if you want to use such an
ancient piece of software. Maybe there are some forum posts from half a decade ago in the forums.
I would have two projects. One library and one plugin.
can you elaborate just a spoonful
So you want to basically set the health of the command sender to the health of another player + amount * 2?
Anyone give me guidance? I have a command class which has an arraylist in it, im wanting to also use this arraylist in my listener class, how can i get access to it?
intiialise that arraylist in the main class
and use that arraylist in the command and listener classes
or wherever else
I usually have a core library that provides common functionality that can be used for any type of plugin/server.
So guis, holograms, item builder block data and so on. And then one project which depends on the library and
has the actual feature implementation. Btw you should do an estimate for your project.
If you are really dedicated then you can get about 15 - 20% done per year. So expect this to be a 5 to 6 year long process if you are alone.
How do i initialise , the way i am doing it is wrong
I love you so much
I did it here and didn't need to do anything, it just found it
public static List<> randomList in the main class
This is a really basic java question.
Usually you have a data or manager class which contains your data structures. (lists, sets, maps etc)
Then you enforce it to be a singleton (only one instance is ever created) and pass this
instance to both your listener and command class.
the list is uppercase
And do NOT use static for that
and what do you want to store in the list?
I am learning... lol
It's cool done it
um
is it possible to make placeholderapi listen to messages outputted by another plugin that didn't add support for it?
or if i can code something to do so
to catch the message and then add placeholders
?paste
wht
First of all placeholderapi doesnt listen to any messages. It requests placeholders.
Is your question if you can add placeholders for other plugins that didnt add any support for papi themselves?
technically you can, but it'd be extremely hacky~ i.e. intercepting packets and replacing placeholders in them before they reach any clients
and even then
you'd not get full capabilities if there's no player context in the packet
Well the placeholders are replaced even before the packet is being sent
@Override
public void execute(CommandSender commandSender, String[] strings) {
if (commandSender instanceof ProxiedPlayer) {
ProxiedPlayer p = (ProxiedPlayer) commandSender;
System.out.println("yo yo yo my dudes4324");
if (p.hasPermission("staffchatbungee.use")) {
System.out.println("yo yo yo my dudes134");
for (ProxiedPlayer all : ProxyServer.getInstance().getPlayers()) {
System.out.println("yo yo yo my dudes431");
if (all.hasPermission("staffchatbungee.use")) {
all.sendMessage(new TextComponent(ChatColor.translateAlternateColorCodes('&', "&cTestmsg")));
System.out.println("yo yo yo my dudes");
}
}
}
}
return;
}```
so basically even tho i am op, it still only prints `yo yo yo my dudes4324` which means i dont have perms???
bungeecord ^
like you can't parse a target placeholder without the target player in the outbound packet
I'm talking about plugins that don't support placeholders
Ah i see
if you put %blah% into the config, and it sends "%blah%" to the client, you can replace that in packets
You need the perms on your bungeecord
Either of those will do
(as long as luckperms is on the bungee as well)
yea
Ok so umm it works, thanks!
i didnt ever use bungeecord i have no idea how to use this
Does someone know if biome updating with spigot doesn't need the player to reconnent on newer minecraft versions such as 1.18 & 1.19?
Yo, noob question, whats the method to get the dimension type from a world? (e.g. nether end overworld)
its the Environment
getEnvironment or something like that
Ah, yeah Thanks
how easy would it be to make a player completley invis when they chug an invis pot
like is there an event for it
Thats also not needed for older versions if you just resend the chunk
resend the chunk with? like unloading/loading it again?
Quite easy. Which version?
Well then you just listen for the EntityPotionEffectEvent and hide him from all other players using the hide method.
setInvisible might also work.
does setInvisible hide the nametag
Yes. Its as if the entity does not exist for players.
Player#hidePlayer()
can someone help me test something please?
how would I use JDA in my plugin?
shade it
okay literally have no idea what that means imma google it
include the library in your plugin’s jar
You can shade it, or use Spigot's library feature
I'd opt for the latter. If you can use it as a library, you should
EntityPotionEffectEvent
would you use unload and load chunk?
why does it generate the file in the /plugins/ folder instead of /plugins/mypluginname/ ?
so would that work?
ProxyServer = the bungeecord server
its plugins forlder = bungeecord/plugins
adding a config to this folder = bungeecord/plugins/config.yml
?
?tas
Plugin#getDataFolder()
So no
Its the same as in spigot
so file = new File(Plugin.getDataFolder(), "/config.yml");?
I don't see the point of that, if there are "experts" here that can tell if something would work, I don't need to risk wasting my time
new File(yourPlugin.getDataFolder(), "config.yml");
or use ./bungeecord/plugins/plugname/config.yml
thank you!
so for some reason, my event listener is being not called but only some of the time
the rest of the time it's called and works fine
Context
@EventHandler
public void onPlayerDoorOpen(PlayerInteractEvent event)
``` here's the signature of the event handler if that helps at all
it's to catch a door being opened
if((action == Action.RIGHT_CLICK_BLOCK)) {
assert clicked != null;
if (isDoor(clicked.getType()) && /* ignore this */ Bizzare.tolls.containsKey(clicked.getLocation())) {
here's how i check it's a door
isDoor is just a function that switched on Material enum
Full method and spigot version pls
so it's deterministic and isnt' the problem
@EventHandler
public void onPlayerDoorOpen(PlayerInteractEvent event) {
Action action = event.getAction();
Block clicked = event.getClickedBlock();
if((action == Action.RIGHT_CLICK_BLOCK)) {
assert clicked != null;
if (isDoor(clicked.getType()) && Bizzare.tolls.containsKey(clicked.getLocation())) {
Toll toll = Bizzare.tolls.get(clicked.getLocation());
if (toll.currentPlayers.contains(event.getPlayer())) {
event.getPlayer().sendMessage("Door opened.");
} else if (toll.onePerson && !toll.inUse) {
event.getPlayer().sendMessage(String.format("Purchasing door until %d for %f", toll.resetTime, toll.price));
EconomyResponse response = Bizzare.econ.withdrawPlayer(event.getPlayer(), toll.price);
if (!response.transactionSuccess()) {
event.getPlayer().sendMessage("You don't have enough balance to pay the toll.");
event.setCancelled(true);
} else {
toll.currentPlayers.add(event.getPlayer());
toll.inUse = true;
}
} else if (toll.onePerson) {
event.getPlayer().sendMessage(String.format("This door is already in use by %s.", toll.currentPlayers.get(0).getDisplayName()));
event.setCancelled(true);
} else {
event.getPlayer().sendMessage(String.format("Purchasing door until %d for %f", toll.resetTime, toll.price));
EconomyResponse response = Bizzare.econ.withdrawPlayer(event.getPlayer(), toll.price);
if (!response.transactionSuccess()) {
event.getPlayer().sendMessage("You don't have enough balance to pay the toll.");
event.setCancelled(true);
} else {
toll.currentPlayers.add(event.getPlayer());
}
}
}
}
}
First
((action == Action.RIGHT_CLICK_BLOCK))
to
(action == Action.RIGHT_CLICK_BLOCK)
Debug if this returns true.
Bizzare.tolls.containsKey(clicked.getLocation())
Also send the isDoor method and your spigot version pls
ahh ok
you can just use Tag.DOOR
spigot 1.19 and ```java
public static boolean isDoor(Material mat) {
switch (mat) {
case DARK_OAK_DOOR:
case ACACIA_DOOR:
case BIRCH_DOOR:
case CRIMSON_DOOR:
case IRON_DOOR:
case JUNGLE_DOOR:
case MANGROVE_DOOR:
case OAK_DOOR:
case SPRUCE_DOOR:
case WARPED_DOOR:
case ACACIA_FENCE_GATE:
case BIRCH_FENCE_GATE:
case CRIMSON_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case MANGROVE_FENCE_GATE:
case OAK_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case WARPED_FENCE_GATE:
return true;
default:
return false;
}
}
lol
i didn't know, thanks!
ik
ok
Either use a Set<Material> or simply use Tag.WOODEN_DOOR.isTagged(Material)
I have a question. because when I put a negative coordinate with the ZNPCS, it tells me Player not found.
What do I have to do to solve it?
Code pls
does this work for gates too?
public boolean isTollMaterial(Material material) {
return Tag.DOORS.isTagged(material) || Tag.FENCE_GATES.isTagged(material);
}
sorry i worded it sort of wrong, Is it possible to hook onto placeholderapi and intercept any incoming messages by modifying through the AsyncPlayerChatEvent, or packet interception?
Read the channel name again
that appears to me when I try to put a negative coordinate on the npc to teleport
thank you!
ok
Thats possible. But what are you trying to achieve?
this plugin has a messaging system where they use their own internal placeholders, but the message doesn't support placeholderapi
it's a /message, but it's not opensource so i'm not sure about how it's done
Oh I've found the problem
The top half of the door doesn't trigger the event
But the bottom one does
Thats what i thought
how would I work around that?
The Tag should solve that
or in general, if a player sends a message and i want to edit it, maybe add asterisks where a player swears.
ah ok, thank you!
i was thinking just cancelling the asyncchatevent and then resending to all recipients
but it doesnt even seem to be firing the event when i type in chat or run the command
Listening to incoming chat packets by using ProtocolLib and changing them that way is probably better.
Or make sure that you are using a low priority for your listener.
now the bottom of the door doesn't work LOL
oh right
woops
set it to highest, i thought it would be best to modify afterwards no?
On the vault plugin page
latest vault version works fine, also #help-server
Highest will modify the results after every other plugin modified them first
isn't that what i want though
after everyhting has modified it, it will change the placeholders
Not if you want to replace the placeholders. Otherwise the main plugin will replace them first.
And then you have no placeholders to detect
Should work
so the plugin won't even replace them hence why it's just the plain text in the screenshot i sent
that version work
s
vault isn't really dependent on server version too much
yes
Ok so the other plugin has placeholders but you dont want to use them. You would rather register your own placeholders
using papi?
the other plugin doesn't support placeholders. I've already made my own expansion
they work
incase you were gonna ask
/papi parse me
Well nice. Whats the problem then?
If you attach some data to a shulker box item through PDC, then place it and pick it back up, will it still have the metadata?
erm
Are you speaking about the pdc of the ItemStacks ItemMeta or the pdc of the BlockState of the BlockStateMeta?
the plugin sending the message has no placeholder support and i'm trying to add my own placeholders, or any placeholders for that matter, and edit that message
I didn't know they were separate, I'm hoping PDC attached to the BlockState will persist?
Can you edit the message in a config file?
yes that's what i've done , it's relative
check my screenshot
Im actually not sure. But def tell me if it does.
they have their own placeholder - <target> and <sender> which i presume returns the player name
i can grab that and maybe use it in the placeholderapi setplaceholders method
when editing the message
PDC on block state persist
every PersistentDataHolder has an NBT compound, and all PDC data goes into that
Well then prepend the message from the plugin in the config with an "##", listen to
outgoing packets, check if the message is prepended and let papi parse the content in this case.
nvm it returns the rank and the name, but i can strip that off easily
There’s a resource here that abuses the chunk PDC to store PDC in every block tho
Not just ones with a BlockState like tile entities
oh
do i need protocollib
abuse wasn’t negative btw
lol
it was an explanation xd
I'm sure there are multiple resources that do that
Mine is just one of them I suppose
I was taking about one from mfnalex, I didn’t know u had one as well tho
If the ItemMeta is an instance of BlockStateMeta then there are two separate pdcs
how should i listen to that?
ItemMeta {
PDC {
},
BlockState {
PDC {
}
}
}
Something like that
ProtocolLib -> outgoing packets
does World#getEntities return entities in unloaded chunks?
no
Would be funny. Imagine having a huge world from years of play and every time some plugin
calls this method the server crashes with an OutOfMemoryException
Yeah now that I think about it that's abit stupid lol
Where is World#loadAllChunks()?
I'm trying to find a way to remove all entities on startup that are not armor stands or item frames
even in chunks that are not loaded
World#getAllBlocks() when
Why? Maybe there is a better solution.
Bukkit.getWorlds().stream().flatMap(w -> w.getEntities().stream()).filter(e -> !Set.of(EntityType.ARMOR_STAND, EntityType.ITEM_FRAME).contains(e.getType())).forEach(Entity::remove)
👍
xy maybe
Why do you call stream() after getEntities(). Doesnt flatMap work with collections in Java?
Don't think so
hello, how would I make my IDE know I'm using the dependency? i'm using Discord Bot API V 5.3 (DiscordBotAPI)
Nope
Damn... Was still on kotlin in my mind
🥲
It's a minor thing but would be nice to have
You’d make it a dependency like normal, just would not shade it
