#help-development
1 messages · Page 98 of 1
May be dumb but your package names are also fucked don't use capitals in the future though that's prob not the issue
is there a way to cancel a PlayerItemBreakEvent? its not cancelable so i tried to work around that by setting the stack size to 2, but then the durability completely resets and is impossible to change since its reset after the event
im teaching my freind java whilst doing it and he made a few of the packages and im not bothered to refractor
ik its dumb
Doubt it
Cancel the durability event instead
Guys I got a question, if I return false does it use config.yml default usage?
I dont want /tp <player> there
return true then
that event actually works a lot better for what i want to do anyway, didnt know thats a thing
thanks
does PlayerTabCompleteEvent get its name changed?
You can do: event.getPlayer()
This event is no longer fired due to client changes
I think
Oh...
And what you can do for that so?
ohh umm
is there a way around it
there Chat tab complete and Tab complete
chat tab is depreciated and no longer fires
so how can i make my plugin with that event work for 1.8 and 1.19
TabComplete is on commands
yes
What are you trying to achieve?
He is trying to player arg name get uato complete
It used to be fired for tab completing player names in chat
i need the tab completer working for my command as the regular method does not work
But now the client gets all that info and stores it
implement TabExecutor instead of CommandExecutor
What a shity improovement they have been adding to the game
The regular method certain does work
A class cannot have more than 1 super class
? I said implement instead of
i register commands directly too the commandmap
- They said instead
oh i always confuse them
I mean
It still works
I’ve done tab completion with direct injection to the command map
super class is extends and implements is for interfaces
yeah is how you should do it
i need the plugincommandclass for the setTabcompleteor() Method whilst i only have the Command class
What
If you want to remove commands you should remove the command permission from that player.
If you want to simple control tab completion of command arguments then implement TabExecutor
I would just make a class called CustomExecutor (add a better name), implements TabCompleter and CommandExecutor
And then each command extends that class. Finally register each CustomExecutor thru CommandMap
yes but the tabcompletor thing doesnt run
Hmn are u sure?
?paste
I think you are not registering the tab completer for the command
which i cant do
due to not having a command class
is ModularPlugin custom?
I wondering a modular system for spigot and bungee plugins
haha
Like why there is a tab complete method with a location argument
oh
that why :sad:
😮💨
i dont think you can show it to another
This encapsulation will provide them for adding/removing right?
I believe so
I need to buy friends where i can do it?
You should return an immutable copy instead
Do you want to be my friend i can pay you?
Can I somehow add a message to error that comes from shaded library?
Additional message
i.e. a runtime exception?
Let's say shaded dependency throws exception, I want to add few lines to tell people not to report bugs to the library team
So yea
Runtime exception
You can catch and rethrow with a new message if you want
Logger.getLogger("package.LoggerClass").setLevel(Level.OFF);
What why set level off lol
How am I gonna listen to the thing happening tho
try {
} catch (Exception ex) {
}
Are you not running any code that throws it?
And re throw it
Yes kinda
But the library works on its own in meantime
Some errors come from it without my code
Choco do you want to be paid for being a friend?
Bruh

Make some get out and socialize
You probably can even if you think you can't slightly altering your personality helps
I have to pay them because they are falser than me getting out with a girl having a gf
Huh that didn't translate well falser not a word
Still doesn't make sense why pay someone to be your friend because they are false
I making ref that a paid friend would be less false than one of those that said that you are his best friend when they are talking in front of your noose
I still don't get that sentence lol but making friends is fairly easy given you are a smooth talker though I'll admit that isn't everyone's thing
Me either but in perfectly willing to talk to someone if they initiate with me
I met my homie when one day he pulled up in programming class and aced the tests after watching a python video over the weekend
I then showed him mzunguhosting (a troll web hosting website) and he thought it was goofy
humans are not real
no
Minecraft apparently has unused dupe fixes
That means they were left in intentionally
They were
TNT dupers are known to be left intentionally now
But sand is too broken
so
It's just laggy
papermc bad
Sliced lime said himself that they're going to leave it in so long as there's no other way to fully automatically mine blocks and get drops
You can disable those patches on paper if you want
Moveable tile entities plz
What about sand
Not sure
But the world is huge
True but does it need to be?
yep but then no support, should be other way around smh
Find one desert and you should literally never run out
Diamond ores are also not renewable
Guys if I do /tp e, How can I make it autofill so when I say in chat arg1 or something it says the full username of the target (ethanog)
Could you elaborate more
Diamond is a basic resource
The world is big enough
Not on servers with a border
Skill issue
Either way idk if that's the reason
Add admin shop then
I'm just guessing
coal should convert to diamond over time 👍
Usage: /tp <player>
If I do /tp E
My chat will say, "You successfully teleported to E"
I want it to autofill and say the full playername that it used, such as EthanOG.
Fax
Ok I'm guessing you did something like Bukkit.getPlayer(args[0])
Loop thru online player names and do starts with
And then sent args[0] as the name too
Correct.
But than it will be set to "e"
That will get the full name of the player
But if I use arg it wont say that
Check what i said
This is what getPlayer is for
Idk how to do that
mhm
I'm new to coding
You don't know how to call getName()?
ya
Rich api
Well if you're that new you shouldn't be writing plugins
getPlayer does some funky stuff
You should learn the fundamentals
I'm not that new
getPlayerExact is well, exact
I know java
Clearly not
I know java
If you don't know how to call getName() on the player object
p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "You successfully teleported " + ChatColor.DARK_AQUA + "" + ChatColor.BOLD + args[0] + ChatColor.YELLOW + "" + ChatColor.BOLD + " to " + ChatColor.DARK_AQUA + "" + ChatColor.BOLD + args[1] + ChatColor.YELLOW + "" + ChatColor.BOLD + ".");
return true;
Holly shit
wha tthe fuck
Ever heard of translating colour codes?
They dont work
Bruh
I know java
clearly does not know java
looks worse than adventure
Go learn java
impossible
ChatColor.translateAlternateColorCodes
alternate
God damn what a long method name
Char, string I believe as args
yeah
bro can you help me with the problems I did not ask for you to rerattle me
Well if you don't know how to call a method
We give good advice
Maybe that's the problem to address first
At least try to
welcome to spigot where we give sarcastic help
If we just tell you what the answer is, you will walk away without any gained knowledge
Increasing your dependence on us
So explain it again.
@waxen plinth there are people for sure that will put Player#getName() in the code literally when you tell them to
You get the player object from Bukkit.getPlayer
With the #
You can then call getName() on the returned player
Which will return the name of that player
I'm not going to break it down any simpler than that because we're already straying into the territory of helping you with fundamental java rather than anything spigot-specific
There's also no real reason to allow incomplete player names in the command
inb4 paint ide
Didn't work yo
Is there player that name starts with et thp
uhh you mean the 300 line madness?
Oh god
Matter of fact, posting the full code is probably the first thing you should have done
you have a 300 line teleport command?
?paste
Sarcastic answer
I wanna see it badly
You don't need to show literally everything, show what's relevant
you literally did not do what redempt told you to do
I expected worse
Call getName() on the Player, it will return the player's full name
Am I tripping or he doesn't even have what redempt said in code
there are 0 occurrences of getName lmao
bruh it deleted let me do it again
I really wish there was a separate help channel for intermediate-advanced questions
need to be verified + min 3 resources
We help as we can
Nah
and pay md_5 10$
Donate*
bribe*
Fixed you mean it works?
no
But anyways that's not even close to what I told you to do and demonstrates a lack of understanding of fundamental java
So again, I'm going to tell you to go back and brush up on the basics
Java rabbit hole
Specifically classes and methods
Remind me to make java iceberg
You're supposed to help me, not rerittle me,
sorry im not trying to like discourage you but you can't say you know java and then do that
I am helping you
If I gave you the answer your understanding of java would not improve
Stop expecting us to just tell you what the right answer is
redempt has given you MORE than crystal clear instructions
My knowledge is not the factor here, My question is.
It absolutely is
The answer is incredibly obvious to anyone who understands the basics of java
You expect us to write it for you?
If you don't understand it, then you don't understand the basics of java
And if you don't understand the basics of java, you shouldn't be trying to write plugins yet
We're not going to sit here and tell you what to type character-by-character
Because if we do that, you're just going to keep expecting that of us
Listen, I've just moved on from script and I wanted to give plugin java development a try.
I didn't know java when I started, I mean I did but not stuff like OOP concepts
That's fine, but you need to actually learn java first
But i knew js that helped me start
If you don't understand java then you won't be able to write plugins effectively
I took a java course for 3 hours
Yeah that's not sufficient
3 hours non stop?
It was a video
I'd say it takes ~1 week minimum to have a solid enough grasp of java to write plugins
first explaining how to start a minecraft plugin
Is this a troll?
Don't use school learning practices
No....
Ethan
I'm sorry that this is going to sound rude
But please stop wasting our time
There are TONS of online learning resources for java
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I'm not going to teach it to you myself because I have better things to do, and I'm not going to give away answers because then you're just going to keep asking us to solve things for you that you don't understand
Codeacademy is good because it teaches by writing
😮💨
Programming isn't something you learn in a day
It's going to take time to develop an understanding of the concepts, especially OOP
Don't let it discourage you, and don't take the easy way out
Some words sounds scary like lambda
It's just a chat command though.
And next time it'll be something else
Yeah totally basics
Look, basically I'm telling you that you have a gun pointed at your foot
tf
And I'm trying to tell you to take a gun safety class, but you're really insisting on shooting yourself in the foot
🦶 🔫
If I give you the answer, that's what happens
Your code works but you don't understand why
I do though
If you would have understood why, then you'd have understood what I said the solution was
Bukkit.getPlayer(...).getName()
Isn't it basically it
On mobile can't tell ya
I need to print spigot javadocs
I've followed the stuff over at ?buildtools but it seems like it is to install the servers? I'm not sure if i'm missing something here, but is that how I install the API to develop?
Ah, I just print them into my head
@gray merlin Google spigot gradle or spigot maven depending what you use
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Ah thank you. The change seems weird though, why did they take 1.15+ it out from the official maven repo? This way we can't install it automatically using ide's
It's been on the Spigot repo since 1.8
Only the API though. The server was never on the repo
DMCA?
I can find the versions up to 1.14.3 on the official one
But I see
No. Minecraft proprietary software
Oh. The CraftBukkit artifacts on Maven Central? Entirely unaffiliated with us and those should not be on there
Ah nevermind, I was thinking of craftbukkit
All our stuff is on our own Sonatype repo
Yee
Nexus, rather. https://hub.spigotmc.org/nexus/
I thought Bukkit, CB and Spigot were all from the same team of people though?
We maintain all three, yeah
Currently yes
Though we've never published on Maven Central
You'll find the Bukkit & Spigot APIs on the Nexus there, but you won't find the servers
Servers are built with BuildTools and installed to your local Maven repo
So, someone else uploaded those without you guys' consent? That's just bad.
Ye
They wouldn't mind I think
Though those people should be less afraid of us, more of Mojang lol
I'll keep that in mind going forward, I thought those were official
Oh? Mojang can take them down?
If it were up to us, we'd have a straight up download for these things.
Only thing stopping us is that CraftBukkit contains Mojang's code
It's modified mojang server at the end of the day
🤓
Even that downloads the vanilla server
Yeah but it's still a straight download to the average user
Building jar is a good lesson
You learn a lot
It's basically the same command as to start server
I see.
Does craftbukkit include apache commons and spigot not?
I think spigot no longer includes apache commons as of pretty recently
Unless I'm thinking of something else
IIrc it does at runtime
They removed apache commons lang
replaced by lang3 iirc
Yeah I have it in gradle as compileOnly
Is it in the libraries folder
Yep
I love how that's a thing now, genuinely great feature
Is there an event to cancel arrow collision?
i left my pc afk for a few hours and my server is slowly getting laggier
is this a sign of a memory leak?
arrow collisions? afaik collision is done client sided no?
mememmemmememory leak
Any know what event is fired when MANGROVE_PROPAGULE grows from MANGROVE leaves? I dont see it fire on GrowEvent, thinking maybe something in hanging, but not see anyting fired
StructureGrowEvent
declaration: package: org.bukkit.event.world, class: StructureGrowEvent
mobs are starting to fall through the map
That is the tree, but i mean the part that grows from under the leaves.
hmmm Idk if that'd trigger an event 🤔
I mean you could see if its under Structure Grow event
That is what i am seeing I can't find it in spigot code anywhere or see a event. And was thinking i might be missing someting. Might need to put in a request for a change to spigot for it
its quite possible it is
it's not
than pr it yourself is probably best option
okey dokey
theres probably no event as its Ageable
Crops are agable and it fired a grow event.
Thinking maybe it was forgotten or missed.
not those either
I have tired the following
BlockSpreadEvent
BlockGrowEvent
StructureGrowEvent
BlockFadeEvent
BlockFormEvent
BlockFromToEvent
I'll assume you also checked the BlockGrowEvent
Yea
I have a plugin i made that lets me listen to those events (along with others) and show me what block its trying to use so I can find it the event and stop it.
Does using § in strings still work in spigot 1.19? Or is it my java version that is breaking it?
just use translateColorCodes
Gross.
I feel bad when I use chatColor since I know it can/could be done with just '§'
But like § worked universally. With fabric, spigot, bukkit, bungee, forge
and windows has a shortcut to type §
and on linux it is easy to add (depending on de)
And it will break entirely if your system encoding is incorrect
ChatColor makes use of the section symbol internally and it's easier to read
^
Okay here is what my issue was.
When checking the name of an item that has a custom name with chat color
using chatcolor translate alternate color codes doesn't return true on a .equals
I'm not sure what pdc is
?pdc
wrapper for nbt
im guessing you are doing custom items?
Yeah
yeah, using nbt allows your items to have any name oyu want aswell
will stop anvil renaming issues
About Scoreboard API integred on Spigot, what is the difference between MainScoreboard and a new scoreboard created?
Could be the main scoreboard always shows at player and a new scoreboard I have to set it to the player?
i can use private methods as event handlers right
Yes
k thanks
https://paste.md-5.net/oxoxafedux.java
Hopefully someone can fix this mess, in the code it's pretty obvious on what i'm trying to do.
If you don't want to use teams i reccomend using something like Fastboard
A usable alternative to the hell hole that is that damn scoreboard api
I for the life of me still can not figure it out ive sunken hours into research and attempts and docs to figure it out and I just can't
I honestly am scared at the nms behind that shit more than anything else on earth
hell yeah, the documentation about scoreboard api is not good at all
But according Mickey (fastboard creator) it can't create teams :(
Why is it I can learn bungee messaging channels faster than damn scoreboards
Why are you going to use teams just curious
anyway thanks for the advice, and yes, scoreboards with Fastboard is veryyy good
something like this
Ahhh yep have fun best of luck to you
thanks man! :)
I spent 5 hours tryna figure that shit out and gave up smh
just use a team prefix
Yeah xD
I spent many hours for three days haha, but today I got an advance
Iirc luckpe3ms is open source it'd probably be very convoluted but check in there code
Okay, really thanks!
bump!
No
Not for free
?
I'm cheap though 15 dollars an hour
Bro it's a syntax error lol
Literally tells you what's wrong mate
Line 20 it says oncommand is already defined
depending on what you do for that I'm sure you will find customers 💀
Saying "I'm cheap" sounds very wrong in that context.
Y2k the error marker isn't fixing it, it's just making more errors
jsut use acf bruh
Lol I'm fucking around I am too busy to take commissions lmao
Also I wouldn't do commissions before actually contributing good open source free content
I'm a lamp kinda guy lol
I was confused for a second lmao I saw my name first than read your sentence
Acf
Again for 15 dollars an hour I can
Hell u know what just for you ill do 14.99 an hour chap
I just want a online player array and picked one to be arg 1
I'll do it for 15.25
Fuck yoh I'll do it for 20
21!
24
I won't touch code before 25
its four fucking lines of code
No one beate my project
ok you win. I can;t beat that
? do it yourself then
oh yeah forgot return true;
all i want is when the player does /tp e the return message will be you teleported to ethanog
u, thats nothign to do with tabcomplete
And we told you how to do it
where in chat was that
nvm that was another guy. I recently read old messages since I just woke up. My bad
should i put that in p.sendMessage(getPlayer(args[0]).getName(); + "");
?
Will that work?
yes it should
ok tyvm
Guess you don't need Bukkit then. I always used it. woops
Bruh remember to try catch player get attempts
it doesn't find a player
Player target = Bukkit.getServer().getPlayer(args[0]);
if (target == null) {
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[0]).getName() + ChatColor.RED + ChatColor.BOLD + "!");
return true;
}```
makes no sense
you are checking if the player is null
then getting the name of the null player
use args[0] instead of getPlayer(args[0]).getName()
ah shit I did mass replace so that's why
Yeah you can only use getPlayer().getName() when it actually found a player
Should I do the same for target2?
otherwise you have to stick with args[0]
keep the second bit the same?
getPlayer(args[0]) is fine. Just don't call getName on it unless it's non null
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[0]).getName() + ChatColor.RED + ChatColor.BOLD + "!");```
right there
you call it
It's trying to call the player's name with the autocorrect
If I give you a book with an empty cover and tell you to tell me the name on the cover you won't be able to either
You can however tell me that you got a book
So as long as nobody asks for the name you are fine. It's the same in here
It's looking for a empty var which nulls
did I do that on the target 2 check?
yes I did
fuck
Well ok my example lacks something. Lets retry:
I'll tell you that I'll give you a book. Then instead I give you nothing and ask you: What's the name of the book?
Ofc you'll say wtf you didn't give me a book, how am I supposed to tell you the title?
Or you still didn't fix it^^
if (target2 == null) {
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[1]).getName() + ChatColor.RED + ChatColor.BOLD + ".");
return true;
}```
also you already have teh target and target 2 variables
use them
instead of getPlayer
each time
what line
Player target = Bukkit.getServer().getPlayer(args[0]);
if (target == null) {
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + getPlayer(args[0]) + ChatColor.RED + ChatColor.BOLD + "!");
return true;
}
You don't wanna use getPlayer here
wait
what does it do
p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Could not find player " + ChatColor.DARK_AQUA + ChatColor.BOLD + args[0] + ChatColor.RED + ChatColor.BOLD + "!");```
@CommandAlias("tp|teleport")
public class TeleportCommand extends BaseCommand {
@Default
public void tp(Player player, OnlinePlayer target){
player.teleport(target.getPlayer().getLocation());
player.sendMessage("Successfully teleported to " + target.getPlayer().getName());
}
@Default
public void tp(Player player, OnlinePlayer from, OnlinePlayer target){
from.getPlayer().teleport(target.getPlayer().getLocation());
player.sendMessage("Successfully teleported " from.getPlayer().getName() + " to " + target.getPlayer().getName());
}
}
same command
uhm yes but doesnt make sense on a tp
code*
make it more complex?
??
in what sense
make it more code?
less complex you mean?
Complex = less space
uhm no
Usually smaller means less complicated
https://paste.md-5.net/hirimuqogu.java
here is my current code btw
everything works, surprisingly
more complex for example, if target == null, We can duplicate that line to also have target2 == null
than the rest of the code is basically the same but for the differences we add a colon
I just- dont know how to do that
if target2 and target == p, they have the exact same lines of code
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.
somethingl ike this
but again, a command framework would be better
How would I make this work/
what are you trying to do
make target 2 and target get checked if they both = p and run that command down on the bottom without using too much space
if(target == p || target2 == p)
tysm
use && if you want both conditions to be true
|| is if one of them (one OR the other)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
learn how to read errors, they are super useful
line 28
with the array index out of bounds?
remember that an array starts at 0
so the first value is array[0]
the error is your trying to call array[1] which is the second value, for an array that has only 1 value
Quick q: anyone have any idea why I'm getting "Cannot create a world while worlds are being ticked"?
I am dead sure I've seen this error before but it's been years
hrm
how i can put custom UUID inside the Item NBT and then check it?
guess I'll ask them
I'm trying to make a plugin with protocollib and trying to modify packets
but I'm having some trouble
?pdc
they can do this too?
so I get a boolean field from a PacketContainer by doing .getBooleans().getField(n) but then I don't get how to use setBoolean()
Yeah
specifically there is an argument that accepts an Object and I don't get what that is for
ohhh
I can do .write
I was confused because of read&write instead of get&set
sorry for the ping but i can't input PersistentDataType.UUID or how i can?
You will need to create your own DataType for UUID
how?
Now I recommend you actually read the page I sent
Byte[]
How would I check if the player has a cracked account or real minecraft account in PlayerJoinEvent
?
does anyone else get this error? idk what to do, I have already relaunched my game and it didn't fix it. please help
i can't join any server
It's nothing related to your game I believe
Can you enter other servers¿
I can't join any server
but anyone else can join servers now
I didn't do anything related to it
Are you running any firewall tho
nope
What OS
what is OS
Operating system
windows
i don't think it is related to the default firewall
Can you try pinging mojangs Auth server?
i'll try restart my pc
it fixed it. thanks for your help anyways @onyx fjord
💀
some servers like hypixel have their own backup authentication method, try a server u know that doesnt do this or spin up ur own and ask someone to connect
how would you clear the console of the server?
send a lot of messages?
i tried that but you can just scroll up
with enough messages not
I noticed that playerInteractEvent would be called twice if you look at the ground with a block underneath you
I think this is because the event checks for both clicking in air and on a block, how do I make it only choose 1 so the event doesn’t fire twice?
no it's for both hands
you will always get 2 events. You have to choose what hand matters for your case by an if statement
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
i recall that i always did some sort of 'right click only' check on my interact events
Yeah but you would still get a right click for both hands
Thanks for the help!
that's dumb tbh
u cant even use both hands
in mc
except for shields and stuff
u cant dual wield
it's not my design that there's always 2 events
also you can technically hold a torch in both hands
- do you have the same plugin on your server multiple times?
- do you create an instance of your main class manually?
- do you have the same package structure for multiple of your plugins?
yeah i created an instance
package com.dami.kingdomManager;
import java.util.ArrayList;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import com.dami.KingdomInfo.Kingdom;
import com.dami.Permissions.Permissions;
public class KingdomManager extends JavaPlugin{
private static KingdomManager instance;
public ArrayList<Kingdom> kingdoms = new ArrayList<Kingdom>();
private Permissions permissions = new Permissions(this);
public KingdomManager()
{
instance = this;
}
public void onEnable() {
getServer().getPluginManager().registerEvents(permissions, this);
}
public static KingdomManager getInstance() {
return instance;
}
public Permissions getPermissions() {
return permissions;
}
}
thats the line saying private Permissions permissions = new Permissions(this);
actually the Permissions constructor should be fine
I think him defining a constructor is the problem
defining this?
Defining
public KingdomManager()
that should be allowed
package com.dami.main;
import org.bukkit.plugin.java.JavaPlugin;
import com.dami.claiming.ClaimSelectedArea;
import com.dami.selecting.CancelEvents;
import com.dami.selecting.Select;
public class KingdomClaims extends JavaPlugin {
public Select select = new Select(this);
public ClaimSelectedArea claimSelectedArea = new ClaimSelectedArea(this);
private static KingdomClaims instance;
public KingdomClaims()
{
instance = this;
this.select = new Select(this);
this.claimSelectedArea = new ClaimSelectedArea(this);
}
@Override
public void onEnable()
{
getServer().getPluginManager().registerEvents(new CancelEvents(this), this);
getServer().getPluginManager().registerEvents(select, this);
}
public static KingdomClaims getInstance() {
return instance;
}
public Select getSelect() {
return select;
}
public ClaimSelectedArea getClaimSA() {
return claimSelectedArea;
}
}
this is another script that does work where i do the same thing
Hmm alright
wait i think i know where i messed up i cant extend javaplugin in permissions unless i put it as main right?
what if you need multiple permissions for subcommands?
wait i need to put in the permissions that are in my config?
I did all the checks myself so far. So if that would work completely from the plugin.yml that would be cool
how would it work for
/money requiring example.money
and
/money add requiring example.money.add ?
just as a basic example
I'll also accept a guide if you have one :)
But you know it works?
can you still change the message?
Like the no permission message
Yeah I'd like my own one. I guess that's configurable?
Yeah makes sense. currently looking for a config with subcommands
usually a placeholder
but like
depends entirely on the config and the plugin that parses it
<number> certainly isn't a yaml level spec or anything
k thx
not even the official wiki says anything about subcommands. I doubt it's possible
hey so I have a listener which listens to when a player right clicks a certain mob and then it runs a piece of code, but the code is running twice
how can I prevent this
I want it to only run once
I hate the offhand
Yea, just check the hand ^
how do I check hands
declaration: package: org.bukkit.event.player, class: PlayerInteractEntityEvent
Use the spawn method with a consumer
That will ensure that the entity properties are changed before the entity is spawned
Yeah that's a functional interface
declaration: package: org.bukkit, interface: RegionAccessor
this is my permissions script
and uh it wont set the permissions
kingdom:
general:
world:
- world.blockbreak
- world.blockplace
- world.iteminteract
- world.animalkill
- world.animalbreed
- world.killplayers
- world.killteam
- world.verified
- world.spawnProt
- world.inventories
- world.respawn
- world.sleep
villager:
kingdom:
- kingdom.maintaintasks
classes:
- class.upgrade
ambassadeur:
kingdom:
- kingdom.maintaintasks
- kingdom.invite
- kingdom.kick
claim:
- claim.claim
- claim.unclaim
- claim.setprovince
- class.upgrade
general:
kingdom:
- kingdom.maintaintasks
- kingdom.invite
- kingdom.kick
claim:
- claim.claim
- claim.unclaim
- claim.setprovince
- class.upgrade
king:
kingdom:
- kingdom.maintaintasks
- kingdom.invite
- kingdom.kick
- kingdom.upgrade
- kingdom.setrank
- kingdom.idiology
- kingdom.maintaintasks
classes:
- class.upgrade
- class.set
- class.remove
claim:
- claim.claim
- claim.unclaim
- claim.setprovince
- class.upgrade
and this is config
What is the best way for naturally spawning a lot of custom mobs? I mean listening EntitySpawnEvent/CreatureSpawnEvent is enough or should I use any other way?
Do you want to spawn many entities or listen to spawn ?
,
It is the issue here
I'm not here to argue
It is the problem
It is you're causing an infinite loop by spawning the entity that way
That error is the only thing stopping the infinite loop
Yeah
The entity is spawned and triggers the spawn event before the name is set
And then repeat that for infinity
Which is why you should do what I said
Oh no infinity loops curse of it
If you just want to replace all vexes what you're doing is fine
I'd still spawn a new one. That helps with other plugins trying to use the spawn event
You're trigger spawnevent with spawning
Well yeah
Then he is spawning again
I've already said how to fix that problem
Example of what values?
Looping
Depends on what you want to track
You can store a UUID for example
Just store entity list outside of event
Make it Accessible to different places
But world is already storing entities
how much does it take for bstats to detect server using my plugin?
30 minutes
at least random spigot post says so
☕ time to drink some java then

Is data container permeant on entities?
I forgor ☠️
Yes ty
I were thinking about tracking data
hey spigoteers,
I'm trying to make my custom mob break doors but it's obviously not working, I'm not sure what's with this difficulty stuff
could I get some insight on this?
you return false if the you don't want the mob to break doors on that difficutly
pretty sure
PDC != 1.13
what
Bigpro lem
but if it's not working maybe it's the other way around
reject legacy
my difficulty is on hard, no matter if this being true or false, the zombie is still not breaking (oak) doors I place around him
are you in survival?
what about for a Hashmap uuid, ítemstack
yes
hmmmm hmmm
maybe look how it's used in nms code
i can't look at the code rn
school blocks spigot dependency download 😭
Do you want to store that on the item?
This isn't needed
Hmm?
They're already doing a name check which should be sufficient
though I would use a PDC tag
Kinda thought about that
Then i asked.. 😂
my apologies for confusing
Very tired
No on a file
I want to track each item that player have or give yo another player
Good job!!
You're better off looping online players
Also why do you need the player?
Just to send a message?
(Player p : Bukkit.getOnlinePlayers)?
loop thru online players and check if theyre in the chunk ig?
more efficient it sounds
there can be a lot of entities in chunk 😄
Uh
🤣
use more proper variable names
like entity instead of loc LOL
i rather avoid short var names too
proguard should be the one minifying if ever doing so
but proguard shouldnt be used for such small projects
ye but what if chunk is very very loaded with entities
doesnt sound efficient to me
is there a way to detect whenever cobble is formed from a cobble gen? (and get the formed blocks' position)
chunksnapshot is thread safe
and it still allows you to look up entities in the chunk
you can use it async, but recommend using a separate thread
check block event might be a interface of that
how can I allow a void parameter to be any object type ?
public class database{
private static FileConfiguration config;
private static File database;
public database(){
File dataFolder = Main.getFolder();
database = new File(dataFolder, "data.yml");
config = YamlConfiguration.loadConfiguration(database);
if (!database.exists()) {
try{
database.createNewFile();
}
catch (IOException e){
System.out.println("cannot create a data file Exception:" + e.getMessage());
}
}
}
public void update(String path, String data){ // how to allow "data" to be any object type, not just string
config.set(path, data);
try{
config.save(database);
}catch (IOException e){
System.out.println("could not update database" + e.getMessage());
}
}
}
while that may be true, have enough entities in the chunk and it will lag the main thread while its searching that chunk 🙂
ah yes naming conventions are gone again
Data object
not much you need to do other then just using it and either toss it into an async task or in a separate thread
Set a object
Object instead of String
Yes
declaration: package: org.bukkit, interface: ChunkSnapshot
is this for me ?
the only difference between a chunksnapshot and a chunk, is that a snapshot isn't live which makes it safe for async
thanks
it will contain all the entities up until you called that method
do not do these:
- writing uncommented code
- using unclear variable names
- trying to use fancy stuff (three element operator for more complex things for example)
- using if else if a switch could be used
- being incosnsitent with naming stuff, especially in the same project
- using static variables if theyre not necessary
- violating the one-function-rule (there should only be one function for a class, and only one reason for it to change)
there is quite a lot really. Like calling toString() when it isn't necessary, casting instead of using appropriate methods if they are available. There is a long list
what's the one function rule?
why?
i said it right there
I do have plenty
Loop all players in the world and determine the closest using distanceSquared?
Location closet?
So, what you do is create a boundingbox around the location of the boss and keep a reference to that. The box can be as large as you want. Then just listen for playermoveevent, and check it against your boundingbox if they are inside it. If they are, initiate the boss fight, if not ignore it.
declaration: package: org.bukkit.util, class: BoundingBox
close enough with key?
Click to start?
Or command
Different ways to interact
Sounds pretty cool
Inventory way
So freaking Tru
Bahaha
If snow ball hits freez effect
Custom attacks?
Throw snow block 🤨
Nice rewards
Yeah sounds like a idea making it more fun and interesting
New stuff to do besides default
You still have that useless array of entities from the chunk
why not make a player wrapper that keeps track if they have a key or not
then when you use playermovevent, its just a matter of using your player wrapper to check if they have a key or not
this eliminates having an item specifically as well as not having the need for a command
how do i get the height of the water in a cauldron