#help-development
1 messages · Page 536 of 1
or at least thats my idea
private JavaPlugin arenaAPI;
public ConfigManager(JavaPlugin plugin) {
this.arenaAPI = plugin;
}
public void createConfig() {
this.file = new File(arenaAPI.getDataFolder(), "arenas.yml");
if(!this.file.exists()) {
this.file.getParentFile().mkdirs();
this.arenaAPI.saveResource("arenas.yml", false);
}
this.configuration = new YamlConfiguration();
YamlConfiguration.loadConfiguration(this.file);
}
I know I should rename the variable but I want first to make it work lol
well once you make it once itll be easy to manipulate into multiple sessions. use the world as a template, copy it, create the session, wants someone wins, teleport them out, and delete that world.
what doesnt work about that
I get a NullPointerException, but I think I just saw where's the problem, let me try to fix this and I'll tell you
nah, can't fix it @pseudo hazel but I know where's coming from the error
Ok so I have a problem.
I've got a Listener, and am listening for the PlayerToggleSneakEvent. Other Listener classes are working perfectly fine. Here's my listener
`public class GameListener implements Listener {
@EventHandler
public void onSquat(PlayerToggleSneakEvent e) {
e.getPlayer().sendMessage("Aha, you squatter you!");
}
}and here's where I register it (along with other listeners)@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(new BannerListener(this), this);
Bukkit.getPluginManager().registerEvents(new EditListener(), this);
Bukkit.getPluginManager().registerEvents(new GameListener(), this);
}`
Now the really unusual thing here is that the events in the BannerListener and the EditListener are working just fine. I've verified that I am exporting to the correct location, that I can modify code and have it work in the server, but anything in my GameListener class is simply not being called. I've registered the event, I've implemented the listener, and I've used the annotation. All my marks are checked. No compilation errors, no errors in console. Idk what's going on here.
as you can see in my API main class I have this in the onEnable:
configManager = new ConfigManager(this);
and I was using in my main plugin the ArenaAPI.configManager.createConfig() so I was using the API instance instead of my main plugin instance
put your onEnable in your api constructor
you arent storing that config after its loaded
loadConfiguration returns the config
FileConfiguration myConfig = YamlConfiguration.loadConfiguration(myConfigFile);
Kot fuck
thx that's fixed but will not fix my initial issue (I'm testing something rn)
np, only read that far tho so i didnt read ur initial problem yet
Are there any tutorials for using the spigot API with kotlin?
Right now on youtube theres only a setup tutorial
In case it got missed ^
ok thanks it seems to be everything working correctly now
thanks again for helping me ^^
check your imports. i see no reason for it to not work
would it be an eventhandler to do something based off of time? to make a mob attack someone no matter how far they are away.
Bump
@zenith gate
Kind of. my goal is for every 50 minecraft days spiders will attack every single person no matter how far away they are for the duration of the night.
literally just search “spigot api kotlin” but, as a kotlin developer, spigot development with kotlin sucks ass
is there any known list of strings that can be sent into PacketPlayOutCustomPayload? wondering what's possible with it
Imports have been checked, nothing out of the ordinary (don't see how there could be, tbh).
pretty sure anything can? It’s for server -> modded client communication I believe
the only thing i wouldve thought of wouldve been a conflicting eventhandler annotation (which is why i said to check imports), but other than that i literally see no reason for your code not to work
the knowers of what
Wanted to say a good bye for now, wanted to thank you all for helping so much learning MC dev
@gray narwhal add another event in there that’s more common like a chat event and see if it’s the event itself that’s broken instead of the listener
I was hired as a full time full stack dev so gonna be leaving mc development for now
where at
Goodluck man
@tall furnace I meant to tag you
this is why i reply instead
yeah I really need to do that lmao
@remote swallow @tender shard @young knoll @wet breach @tardy delta @echo basalt
Sorry if I’m missing some, but thank you for always answering the weirdest of questions, got me to where I am now. Take care!
Local company, 6 figures
damn
W
holy shit, congrats
I put the sneak event there for that purpose; I was initially listening for a custom event firing from another plugin I made, and all of THAT seems to be working. Just the listening from this plugin isn't. I'll try another.
ew you’re doing frontend
Nope
ikr
Backend
oh
oh thank god
Not PHP I hope
Nah
nasty stuff
Phthon django
what language/framework?
you said full stack so I thought u meant both
ah
okay that’s still detestable
It's 6 figures tho
I see nothing wrong with php (im a laravel user)
you’re high
Django is like the only decent alternative for python
Even after building 3 projects in PHP, I hate it.
It's so ugly
PHP wasnt even meant to be a language in the first place
Wasn’t really my choice either
I wouldnt know lol, im not updated on PHP lore
either they have existing tech or they read that python is good somewhere online
Existing
Something only python users say
personal home page (╯°□°)╯︵ ┻━┻
What's up with Korea and Iran's name? Lao doesn't adhere to that scheme
@EventHandler public void onChat(AsyncPlayerChatEvent e) { e.getPlayer().sendMessage("AHHHHH YOU TALK SO LOUD"); }
Seems to have worked with the chat event. Not sure why the others aren't, but at least I know the listener is functioning.
Is there a way to confirm that an event was called other than by listening for it?
Perhaps add an EventListener LOWEST and ignoreCancelled parameter
Only way to know for sure is to inject a listener first in the static list pretty sure
🥰
I do check whether it is cancelled, and these two plugins are the only two on the server so I would know of anything was cancelling it.
Where the event is called: https://paste.md-5.net/fiqecekedi.java
The custom event: https://paste.md-5.net/okomekujoq.java
what
I just thought of a great way to kill a server. Listen to every event on lowest priority and unregister all events
Good luck getting it posted on SpigotMC lol
Wouldnt post it anywhere i just thought of it
okay besides the section codes for colors and the illogical comment, and probably the weirdest tabs, it looks fine
I may be wrong (been like 3 years since ive used custom events, my memory of it is... well its shit), but shouldnt there also be a getHandlersList function that returns the same as getHandlers?
uh actually yes
how did you not get an error in console for that
There’s definitely a message in console
(unless the event api changed since I used it as well)
Uh... not sure. It wasn't one of the "unimplemented methods" to add that I got an error for.
I always use section codes for non-configurable colors because it takes up WAY less space and makes my code cleaner.
Opened the declaration of an existing Spigot event; sure enough, they have that method.
`@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}`
Thanks for the tip; will return with a definitive result.
Ayyyyyy my squatter code worked XD
And yes, that did solve my problem. Thanks for the tip! Wonder why it's not automatically added in with the other unimplemented methods?
Probably because it's static..?
Because there is no contract at the JLS level
Java (the language) does not know that it needs that method
Ah, duh. Thanks.
Now that I'm sufficiently humbled, time to get back to work. Thanks again for your help, and yours @compact haven.
I'm wanting to use IntelliJ IDEA build artifacts to easily test, debug and hot-swap my plugin. However, I'm wanting to use aikar's commands library, so I need to shade that into the JAR. I am using Maven, and when I use mvn package, the JAR works fine. However, if I use the build artifact, even though I have checked Delegate IDE build/run actions to Maven, it doesn't seem to use Maven and the JAR produced is not shaded. How can I hot-swap a shaded JAR?
wdym also - dont? Don't what?
hotswap
How come?
close the server and restart. If you are using /reload or plug(man/woman) it can introduce issues
they are talking about JVM-level hotswapping
I'm not using /reload or plugman, I'm using IntelliJ's own hot-swapping which lets you know if you make incompatible changes
oh okeee
If you can, use ACF as a standalone plugin
Otherwise you can add it on the runtime classpath, but for building public releases you can use outside your IDE you'd need to use maven or gradle.
What do you mean by adding to the runtime classpath, sorry?
use the libraries entry in plugin.yml
I'm happy to use Maven for public releases, though
Oh right, I'm happy to do that for testing I suppose, but I just would have thought IntelliJ would use the same workflow for both test and public artifacts
Under eclipse you can add external jars in your run config. Under IJ there should be a similar solution
Ohh right ye, I know what you're on about now. I'll try that!
what is better? making my Utils class all static or interface/abstract?
I have multiple Utils classes btw
If it it truly a Utils class (stateless) then static
stateless?
doesn't require initializing ^
Not a utils class
I will be using it in a lot of classes
remove all teh statics and make it a singleton
alr thanks I am trying to enhance my code
can you review my code in github and tell me what should I do?
oh alr thanks anyways
How can I import NMS classes using gradle? I've tried running java -jar BuildTools.jar --rev latest --remapped in my project directory and then compileOnly 'org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT' in my build.gradle dependencies, but I can't import any classes.. What should I do?
for remapped you need to use paperweight or another 3rd party special source plugin
?nms
you missed that its gradle, that guide doesnt work for gradle
Meh
how do I load a resource pack from code?
I have one in my resources folder but idk how to load it
The client has to have your resource pack not your plugin
if you have it in your resources folder you are gonna need to host a webserver on the server to deliver it to the client
or just, yaknow, use dropbox or sommin
dropbox works for years
I don't wanna rely on random file hosting services so Ig
i used it
I'll switch to maven then.. Where should I run the BuildTools java command? In the plugin directory?
?nms
Thanks
Is there a generic way to tell if a PlayerInteractEvent causes something to happen? E.g. if it is a villager interaction, door, container or anything?
no
just not at all? It just cannot be done? I'm trying to find out when a player is using a goat horn
thats not generic, thats specific
oh just check if their main hand is holding a goat horn and they right click air or a block
I mean trying to ignore everything else
But if you click a chest or something it doesnt use the horn
Or if you click a villager it doesnt, but a mooshroom it does
is there something that would break if the horn doesnt go off?
I'm trying to make a custom effect that triggers when you use a goat horn
might need to listen to sound packets or whatever they're called, might be wrong
is there no way to do it other than sound packets?
You could try if the target is an entity or the Material#isInteractable() the horn won't sound
https://paste.md-5.net/uyuvozimuy.java for some reason the playerJoin and playerChangedWorld events aren't triggered. I put them in the same paste but they're in different files actually
Which jar should I use for the nms? I am guessing the remapped obf one, but I just want to make sure:
original-Test-1.0.jar
Test-1.0.jar
Test-1.0-remapped-obf.jar
what should I debug? I did everything I could do
Test-1.0 and -remapped-obf should be the same thing with most build configurations but yeah
Why? which part
setPlaceholders takes an offline player as an argument
Or if the plugin parses the player name separate you can just include that in the placeholder I guess
You need to do the first steps https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI#first-steps
Not really
Earlier I was asking about how to fix my attempt at hot-swapping Maven and I tried all your suggestions but I couldn't get it working. I feel like it would probably make more sense for me to just ask the best way to do it rather than why what I'm doing won't work, especially since there seems to be a variety of ways to do it. So how should I test/debug/hot-swap a shaded Maven plugin?
can i need get playername.tostring ? for insert to database or only p.getname fine ?
uuid
bro don't hate me but
getName should be fine then

THIS
😄
i have minecraft
rlyy
i liked this emoji
Probably head to #help-server . The current channel is reserved to spigot and bungee development
Then you should probably look at their wiki
Actually, I forgot to try this, but I'm trying it now. When you said "If you can", did you mean if a plugin version exists or if I am personally able to? Because I can't seem to find a plugin version and the JAR provided by Maven doesn't even have a plugin.yml
The former. So there probably isn't a standalone plugin out there at which point you cannot really try that route
Ah dang 😕
Hi, I've made custom events in my plugin and was wondering how I handle those events from another one of my plugins? Do i just need to import it kinda like a library?
Do you even have the handler list and everything set up in the first place?
If so - yes. Though depending on your setup you may need to invoke ./gradlew publishToMavenLocal or mvn install beforehand
why doesnt this work
no errors in consol
just simply doesnt work
whole class if yall wondering what this is
?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.
Superperms is always a bit iffy
But are you really sure that the permisison exists in the first place?
yes
but thats literally all i know. I debuged as far as possible and its that one line that doesnt work
what more do you want me to tell uou
Is the issue in the filter or in the teleportPlayer method?
Do you think a chat control plugin should have features other than profanity protection, clearing chat, locking chat?
so the players dont have that permission?
and teleportPlayer gets called?
no it doesnt because the filter doesnt work. No players survives the filter. No matter if they have the perm or not
probably suiff like spam prevention, regex detection (for links and stuff), etc.
or at least thats my interpretation
ooh you're right
when and where are you calling teleportPlayers() ?
oh dont get me wrong teleport playerS gets called i checked with a consol out print
Also, does it work if you are in OP?
when are you calling it?
just on command rn
how are you assigning the permission?
i just assigned the permission through luckperm rn because im testing around
the web editor
then you either typed teh permission wrong or there is code you are not showing which is relevant
couldnt you just filter(...).collect().forEach(...) or does that not make any difference?
why would you collect
idk eveywhere i see for this sorta thing collects before looping through
(i never really use this myself so i wouldnt know lol)
nvm i figured it out. While it did trigger the teleport player it for some reason stoped while loading the config but also didnt trwo an consol error
ima try to figure out why that happens now
thx for the help tho
Why are these recipes not registering/working when using the items:
NamespacedKey T1KeyTirFrostd = new NamespacedKey(this, "t0t1tirfrostd");
NamespacedKey T2KeyTirFrostd = new NamespacedKey(this, "t1t2tirfrostd");
NamespacedKey T3KeyTirFrostd = new NamespacedKey(this, "t2t3tirfrostd");
NamespacedKey T1KeyTirFrostn = new NamespacedKey(this, "t0t1tirfrostn");
NamespacedKey T2KeyTirFrostn = new NamespacedKey(this, "t1t2tirfrostn");
NamespacedKey T3KeyTirFrostn = new NamespacedKey(this, "t2t3tirfrostn");
RecipeChoice TirFrost0d = new RecipeChoice.ExactChoice(TirFrostItem(0, 1));
RecipeChoice TirFrost1d = new RecipeChoice.ExactChoice(TirFrostItem(1, 1));
RecipeChoice TirFrost2d = new RecipeChoice.ExactChoice(TirFrostItem(2, 1));
RecipeChoice TirFrost0n = new RecipeChoice.ExactChoice(TirFrostItem(0, 2));
RecipeChoice TirFrost1n = new RecipeChoice.ExactChoice(TirFrostItem(1, 2));
RecipeChoice TirFrost2n = new RecipeChoice.ExactChoice(TirFrostItem(2, 2));
Recipe upgradeT0T1TirFrostd = new SmithingRecipe(T1KeyTirFrostd, new ItemStack(TirFrostItem(1, 1)), TirFrost0d, T1Upgrade);
Recipe upgradeT1T2TirFrostd = new SmithingRecipe(T2KeyTirFrostd, new ItemStack(TirFrostItem(2, 1)), TirFrost1d, T2Upgrade);
Recipe upgradeT2T3TirFrostd = new SmithingRecipe(T3KeyTirFrostd, new ItemStack(TirFrostItem(3, 1)), TirFrost2d, T3Upgrade);
Recipe upgradeT0T1TirFrostn = new SmithingRecipe(T1KeyTirFrostn, new ItemStack(TirFrostItem(1, 2)), TirFrost0n, T1Upgrade);
Recipe upgradeT1T2TirFrostn = new SmithingRecipe(T2KeyTirFrostn, new ItemStack(TirFrostItem(2, 2)), TirFrost1n, T2Upgrade);
Recipe upgradeT2T3TirFrostn = new SmithingRecipe(T3KeyTirFrostn, new ItemStack(TirFrostItem(3, 2)), TirFrost2n, T3Upgrade);
getServer().addRecipe(upgradeT0T1TirFrostd);
getServer().addRecipe(upgradeT1T2TirFrostd);
getServer().addRecipe(upgradeT2T3TirFrostd);
getServer().addRecipe(upgradeT0T1TirFrostn);
getServer().addRecipe(upgradeT1T2TirFrostn);
getServer().addRecipe(upgradeT2T3TirFrostn);```
else >:(
jesus fuck
?paste
do you want me to paste my entire onEnable event?
https://paste.md-5.net/eveyuxerib.cs all other recipes register, just not those ones
some extra info:
- sometimes it appears for a few ticks then disappears
- all other recipes work just not the ones under the comment with (broken)
wowoowow. Easy mate
? im confused 😂
Just filled my screen np
ah
time to buy a bigger screen
was feeling goofy
what is this
i tilted
omg
spoon me for fix this
Hey guys can some one help me drm rules...
My plugin was just took down and I don't know how to comply with the rules
I have been working on this plugin for over two year so I would be really glad that some one can help me
omg db master writing
Just put it through proguard but there isn't much you can DRM/Obfuscate
drm is stupid anyways
btw it's a premium plugin
even then not much can be done
bruh. The first time I touched a DB was last week. And even then I didn't do any java integration
damn I expected more of you
but what is the query? From what I know this looks like it's missing a few keywords
Hey, I would never have touched one if it wasn't because I am forced due to school
wait i will show u
SELECT * FROM players.playerstats WHERE name ?
wait will send
code
name = ?
PreparedStatement statement = getConnection().prepareStatement("SELECT * FROM players.playerstats WHERE name ?");
statement.setString(1, name);
ResultSet result = statement.executeQuery();
if (result.next()){
int level = result.getInt("level");
statement.close();
return new Stats(name, level);
}
return null;
}```
change it to WHERE name = ?
they took down my plugin and I want to comply with the rules...
I have a way to remove access from the plugin is this the issue ?
i do with preparestatement
uh, most likely
no the actual statement itself, you missed the = before the ?
especially if it requires an internet connection
it should be SELECT * FROM players.playerstats WHERE name = ?
getConnection().prepareStatement("SELECT * FROM players.playerstats WHERE name ?"); => getConnection().prepareStatement("SELECT * FROM players.playerstats WHERE name = ?");
setstring isnt set player name ?
As I said, there is almost nada you can do in terms of DRM and obfuscation
it just replaces placeholder (?)
i will try ur method 1m
Also, be very aware that tools such as Recaf exists to remove your DRM within minutes if people really wanted to
also it doesnt matter, but why select * if you are getting just level
you're gonna blow his mind
alrighty in the silence ill ask my quick question
whats the bungee equivalent of a configurationsection
The best way to prevent that is to make your plugin rather uninteresting/unappealing to reverse engineer. So ironically don't obfuscate or hide anything because people that try to do nefarious stuff get a kick from reverse engineering. If there isn't anything to RE they won't bother doing anything
you should put a comment in some of the obfuscated files saying "if you're trying to reverse engineer this, you need to re-evaluate your life choices"
I didn't offuscated it
But you probably did hide something
I use intellij and compily the plugin that's all
I have multiple time opened the plugin from online web site to check some errors
sry guys i was ask this question but im forgot
how to control world datapacks with plugin ?
i wan't to control minecraft biome colors with plugin
bump
so i know static abuse is bad and all, but does anyone know why static abuse is bad? what issues does it cause?
It limits testability and tightly couples your code
so basically is makes it harder to change code later on?
Mhm
oh yeah I wrote that
ur a clown
@echo basalt they ruined ur perfect search
bump 🥲
NOO MY SEARCH INDEX
@sullen marlin I'll give you 20 bucks if you can blacklist anyone else from typing those 3 specific words
Static is the easiest source that cause code symptoms in principle
I think static abuse is a bad term, it entirely depends on what you’re doing, but more often when someone refers to static abuse they mean you probably cluttered every variable in ur code with static or sth like that (I like to call it under engineered design choice or similar along those lines)
Edit:
It limits testability, reusability, often thread safety also (hermmmm SimpleDateFormat fuck you).
Choice of static implies you write a type poor system thus can’t take advantage of generics, which means clumsier usage if Optional, generic functional interfaces, Streams and so on.
It can also makes your code less defended since everything becomes more accessible since its global now. This makes it so that one part of the code that breaks easily when another part of the code is touched since depending on more classes becomes more susceptible and tangible. But also makes a shit ton of stuff break when changing small stuff just.
I could go on more about it but I think this should be convincing enough.
If your code is displaying code symptoms please see a code doctor
Sounds static
i remember when i didnt know what static was so would just see any static i saw static abus
its generally a mistake by beginners who don't understand getters
Dw had it deleted just this once
conclurusion search index
Hmm, I may be able to look into it through the bot
Now how did u come up w that huh?
What about an illusion smearch smindex
smearch smindex
Scoll scearch scindex?
epic crunch windex
ishmooshon smearch shmindex
How can I check if the current world's day ends in a 0?
The last digit is 0?
yes
day % 10 == 0
like 140 or 50
private static void currentTime() {
long worldTime = Bukkit.getServer().getWorld("world").getFullTime();
if (worldTime % 10 == 0) {
System.out.println("The day has ended");
}
}
So this would work?
oh shit you right
if (worldTime / 24000 % 10 == 0) {
System.out.println("The day has ended");
}
That'll do it?
I'd be careful with that lol
Why's that? lol
Depends on order of operations. (worldTime / 24000) % 10 to be safe
BEDMAS doesn’t cover modulo
PEMDAS! I thought i was rid of you
Brackets
Powers/Indicies
Division
multiplication
addition
subtraction
Regional terminology and order of operations aside, it's just more clear to read is all
At least your intentions are clear, that is
Well I am always eager to learn eligible code.
I think its even an item in effective java
Im just trying to create an event that would happen every 10 minecraft days.
BEDMMAS
Sorry, "the quotient", not "the product". If you want to get technical
Theres like 10 different variations
And none of them convey that multiplication/division and addition/subtraction are grouped
they are?
See what happens when you don’t go to school

would setting an entity to be aware to true, make them globaly angry? meaning they will start to attack you no matter how far away you are?
anyone know why this
@EventHandler
public void updateHead(InventoryClickEvent event) {
Inventory inv = event.getClickedInventory();
if (event.getSlotType() == InventoryType.SlotType.OUTSIDE || event.getCursor() == null || event.getCursor().getType() == Material.AIR)
return;
ItemStack item = event.getCursor();
NBTItem nbtItem = new NBTItem(item);
if (!nbtItem.getBoolean(NBTConsts.GLITCH_ITEM))
return;
if (!nbtItem.getBoolean(Consts.playerHead))
return;
if (event.getSlotType() == InventoryType.SlotType.ARMOR) {
event.getWhoClicked().getInventory().setHelmet(Heads.updateHeadWorth(item));
return;
}
inv.setItem(event.getSlot(), Heads.updateHeadWorth(item));
}
is now doing this (worked perfectly fine last night) https://cdn.discordapp.com/attachments/809570302572625990/1112893725887184986/2023-05-30_12-01-45.mp4
updateHeadWorth does this btw just incase you think it could bethat
public static ItemStack updateHeadWorth(ItemStack item) {
OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(((SkullMeta) item.getItemMeta()).getOwner());
double worth = HeadHunterMain.getEco().getBalance(player) * Config.get().Percent_Of_Player_Value;
String[] loreLines = new String[get().Player_Lore.length];
Map<String, String> placeholders = new TreeMap<String, String>() {{
put("%headhunter_player_worth%", String.format("%,.2f", worth));
}};
for (int line = 0; line < loreLines.length; line++) {
loreLines[line] = ContentUtils.color(Placeholders.placeholder(get().Player_Lore[line], placeholders));
}
ItemMeta meta = item.getItemMeta();
meta.setLore(Arrays.asList(loreLines));
item.setItemMeta(meta);
NBTItem nbtItem = new NBTItem(item);
nbtItem.setFloat(Consts.playerHeadWorth, (float) worth);
item = nbtItem.getItem();
return item;
}
well now its just doing it visually
is there a tutorial to add apis with gradle?
like maven, add the repo and the dep with compileOnly if its a plugin api or implementation if its a library
What is the difference between libraries and plugins?
libraries you would shade and include inside your plugin, plugin api would be a plugin that you access, either designed for that or just as a way to access stuff relating to a plugin
send the link
that would be a plugin api, in its current state you would need to mvn install it or use a file dep, ill see if i can find a better one
which is easier?
file dep
okie, so Im pretty sure I need to go to project settings -> libraries?
file dep can be done through gradle and is better to be done through gradle
i just found this online which actually has a repo it just needs gradle conversions https://github.com/TheLuca98/TextAPI/blob/master/README.md
ok, so how do I do that?
iirc its compileOnly file("path")
this is also fairly lightweight
why cant I use my own one?
you can by all means
with gradle it should be like this
thats it, just add it to build.gradle?
use BountifulAPI
is thejar the plugin or something else
ig its vbetter idk
the plugin
add depend: [ActionBarAPI] to your plugin.yml, and then also add the plugin to the server
I did the plugin.yml thing, but what else do I have to do?
just need to add the jar to the server plugins
ok, but when I use the method, I get this error: error: package me.Senneistheboss.abapi does not exist
import me.Senneistheboss.abapi.ActionBarAPI;
I imported it too
So your saying I just need to add it to my pluin.yml, and then add it to my plugins folder? Thats it, nothing with build.gradle or my editor?
yah you have to
°
what's this error?
Code> https://paste.md-5.net/inipipedur.java
Look at your getConfig method and your load method
What do you notice being different?
(you actually are trying to define two load methods, one of which is incomplete)
getConfig isnt void
goddamn
right
have to do what?
Well, sure, but specifically,
getConfig() {
load {
but yeah, that aside, you have two load methods lol
i checked on it
look
idk if im using abstract classes the way are supposed to, i only use it to create a certain of DataType for the proyect lol
You're using them fine but I think in this case specifically you're likely better off using just a concrete class that accepts an argument via a constructor
The only variable thing in your subclass (Messages) is the string
Anyone know of I plugin that I could use that would allow me to enchant items that blast players into the air and other custom things?
In the future, #help-server. But you're probably looking for something like EcoEnchants
There are free alternatives as well. A quick Google for "Spigot custom enchantment plugin" will bring up plenty
Thank you
well
ig yes
but this works
It does. It's just a little wasteful is all. Generally you would use an abstract class for a type that shares functionality with numerous subclasses, but the subclasses add more specific methods
(When I say wasteful, I don't mean wasting memory or resources or anything. Just wasteful design-wise)
public class Config {
private FileConfiguration config;
private final Plugin plugin;
private final String name;
private final File file;
public Config(Plugin plugin, String name) {
this.plugin = plugin;
this.name = name;
this.file = new File(plugin.getDataFolder(), name);
}
public String getName() {
return name;
}
public File getFile() {
return file;
}
public FileConfiguration getConfig() {
if (!file.exists()) {
Console.send(CC.translate("&c&l[Pantech] &f" + name + " didn't exist! Creating it..."));
plugin.saveResource(getName(), true);
}
config = YamlConfiguration.loadConfiguration(file);
return config;
}
}```
You get the same sort of thing just out of a single class
public final class YourPlugin extends JavaPlugin {
private final Config messagesConfig = new Config(this, "messages.yml");
}```
Im managing IPs like with strings bc i dont know at all what package to use i type IP in Intellij and there so many options, what do u recomend?
well
thats easier
maybe im modifying it
InetAddress is how you would represent an IP address in Java
Thanks
Is there someone here that got the Java SE17 certification?
Like the education certificate?
Yeah, the one you get from oracle
That's something I've honestly forgotten about but should probably do
how do I add the dependency to build.gradle?
Its a jar?
@worldly ingot Oh wait I asked it in the wrong group my bad, I'll ask it in general
for some reason this dosent work. (supposed to check if user has item in their main hand when the event triggers. does anyone know whats wrong here?)
getItemInUse() probably isn't what you want
getKiller().getInventory().getItemInMainHand() perhaps
ah thanks ill try that
Just as a note by the way... I'm assuming you're extending ItemStack given that you're doing an instanceof check. This won't ever work. You'll always get an internal ItemStack instance, even if you passed in a custom ItemStack type into setItem(), setItemInMainHand(), or some other method to set items
If you want to keep track of a special item, you'll have to do it either by name, lore, or preferably, its PersistentDataContainer
yep
oh thats actually a mistake that i didnt notice. its not extending ItemStack, the code there is just wrong and i never noticed
no wait
nevermind it is
Thou shall not extend Bukkit classes
items is a hashmap
(Mostly)
Item is my own interface
so im checking if that Item object is an instance of BulldozerItem @worldly ingot does that make sense?
Its a jar, what do I do?
check on google "Add libs folder to gradle"
hm still dosent work
Oh, my mistake
I see the Map#get() call now
Uncertain how well ItemStacks will play as Map keys though
it works fine considering i have other working items using my system
Then disregard
this is one of the working ones*
Unconventional but if it works, it works. Just keep this in mind if things fail to work in the future. I'd still personally opt to look into the PersistentDataContainer for a more consistent means of tracking custom items
didnt know that existed when starting this lol
Just custom NBT 🙂
not sure why but for some reason the issue is that its doAction is never called
odd since other items work completely fine with the same logic
maybe the event listener is wrong?
What does that mean
I can identify if an Entity is passive (for the most part) by checking if it is an instanceof Monster, but can I do something similar given an EntityType? I'm trying to spawn a random entity and want to control the chance of the entity being passive or not so need to identify which entity types are considered passive
uhm great question
you can call EntityType#getEntityClass and do a little reflection to see if it inherits Monster
should work async, cant see any reason why couldnt
Hello guys, im going thru a lot of changes in my code trying to load some configuration from a file.
public Map<String, String> getRoleMappings() {
Map<String, String> roleMappings = new HashMap<>();
// Retrieve the "roles" section from the configuration
ConfigurationSection rolesSection = DiscordRoles2.getInstance().getConfig().getConfigurationSection("discord.roles");
System.out.println(rolesSection);
if (rolesSection != null) {
System.out.println("RoleSectionNoNulo");
// Iterate over each role in the "roles" section
for (String key : rolesSection.getKeys(false)) {
ConfigurationSection roleSection = rolesSection.getConfigurationSection(key);
if (roleSection != null) {
// Retrieve the role-id and group values for each role
String roleId = roleSection.getString("role-id");
String group = roleSection.getString("group");
// Add the role mapping to the map
roleMappings.put(roleId, group);
}
}
}
System.out.println("RoleSectionNulo");
return roleMappings;
}
This is my role mapping trying to get a section from my config.
discord:
bot-token: BOT_TOKEN
guild-id: 'GUILD_D'
roles:
- role-id: 'ROLE_ID'
group: GROUP
For some reason the roleSection variable comes null when i try to load that section...
yeah so
Your formatting's wrong
Or well, your code doesn't match what the formatting's for
You want to get a map list in this case
But i dont get to formatting since roleSection does not even get close to populate
Well
one:
two:
three: "Hello!"
makes one and two sections
and three as a string inside the two section
one:
two:
- three: "Hello!"
four: "there!"
- three: "Hello again!"
four: "whatever"
makes one a section and two a maplist
So i got to load the discord section and then make a maplist with the two, right?
Yeah so roles in your case is a maplist
So you call section#getMapList
loop through the list
and get the values from the map
Ooh, got you, let me try that out
I had hours trying to fix this.... made it work, thanks! ❤️

To whoever said "use Lua" for my mask effects thank you so much lol I have managed to do it
Not sure if only applies to Minecraft display entities but for some reason I cannot manage to make a display entity to do a full rotation with interpolation
I am expecting it to do a 360 rotation around the Y axis but maximum angle is 180 per rotation. So I thought about splitting the rotation in two interpolations but then I figured out that in second interpolation it reverts back (lets say it first rotate clockwise on first interpolation but on second interpolation it rotates counterclockwise so it never completes the full rotation...)
This is my code (took from the following thread https://www.spigotmc.org/threads/how-do-you-manipulate-display-entities.599735/)
BlockDisplay call = decorator.call();
call.setInterpolationDuration(20);
call.setInterpolationDelay(-1);
Transformation transformation = decorator.transform()
.verticalRotationLeft2(90)
.build();
call.setTransformation(transformation);```
TransformationBuilder (class that holds verticalRotationLeft2)
https://paste.md-5.net/laxuwaguge.java
what the fuck
something I just discovered
you can declare a class inside of a method
public void doWhatever() {
class Entity {
public int x;
public int y;
public EntityType type;
public Entity(int x, int y, EntityType type) {
this.x = x;
this.y = y;
this.type = type;
}
}
new Entity(0, 0, EntityType.ARMOR_STAND);
}
this is valid syntax
yeah
I know about this, never seen it aynwhere tho
saw it in minecademy source code
they did a little math evaluator and declared the parser class in the eval method
virtually no usecases where you use that over a private class declaration
just makes the method more complicated imo
yeah bound to the method's scope
but if its your own code and you're declaring it private anyway who cares lol
boy java is the The language ever
How do you create a customhead from a website
Here I am rotating it 90 degrees over the Y axis. Whenever I attempt rotating it 360 degrees, it does nothing lol. It stops working at 180 degrees.
private void generateHeadFromURL(String url, SkullMeta headmeta) {
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
Field profileField = null;
try {
profileField = headmeta.getClass().getDeclaredField("profile");
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
profileField.setAccessible(true);
try { profileField.set(headmeta, profile); }
catch (IllegalArgumentException | IllegalAccessException e) { e.printStackTrace(); }
}
This doesn't seem to work
I'm trying to get the head from this url https://namemc.com/skin/04991de0b7103657
What isn't working?
What error are you getting?
you can only pass skin links from minecraft's cdn
Paste stacktrace if possible, use md5 paste
no error
not namemc
Why are you not returning the GameProfile?
Then you'll have to debug, check what is not working, or at least at what part
I don't need to return it
how
Omg
u mean this? GameProfile profile = new GameProfile(UUID.randomUUID(), null);
No, why are you using reflection?
Your method should return a GameProfile... Then with a new method, prolly with a new class, pass the URL and the SkullMeta and use the previous method.
I recommend failing fast in the method that fetches the GameProfile
Copy pasted code from the internet
In case it cannot find the player texture...
Now if you don't know any about it, there's an already working, great library regarding getting skulls
no need to return a gameprofile
it automatically applies the changes
into headmeta
It's not necessary, but what Pro is telling is that is way much cleaner and "safer"
Just look for SkullCreator#itemWithUrl
cleaner?
how
You did need us to read your code in order to find an issue. It's a 100% possible that you are able to read your code, but not a 100% possible that average programmer can read your code.
Don't make it harder for us. Also, it will help you in the future whenever you need to read it again (trust me you'll improve)
I know from first hand writing that bad back in the day and then having to check what the heck I did and wasting a couple minutes figuring out what I did 🤷🏻
i dont get it how is creating
separate
methods
makes it cleaner
if i were to return GameProfile
that means
ill need to do the rest of the code
somewhere else
I will explain it simple
and the method name generateHeadFromUrl() seems a pretty straightforward name
applyTextureToHead would make more sense
Because generate implies you would return a newly thing
The idea is to split algorithms in steps in a way that you can give each step a name
Lets say that you have a Drone class. Now you are in charge to create a method that makes it fly/move to a specific location.
Instead of writing all logic inside the specific method, you can split it in multiple methods so you can later reuse any of the methods.
Even better if you share many of these steps in a library.
yea but its pretty small
This is modularity. It allows many things:
- your code is way more readable by you but also by others
- you maybe won't need to comment your code
- it is easily debuggable and fixable
- if you want to change a feature it's quick and efficient, error free
why make another one and make your code bigger
I mean, your way works
Nowadays, we don't seek for something to work only. We seek for something maintainable
unless some part of the logic will be reused somewhere.
What if the GameProfile class changes tomorrow? You'll have to rewrite the whole thing even though the "URL" stuff doesn't
good point
well thanks anyways ill look forward into those
but i guess for now imma stay with my approach
Great, we say that not specifically for this code you shared, but for all your future codes. At first it's hard and may seem illogical, but this is a great advice for your future works and it will become 100% logical soon
You'll see that in most of the code you may find in GitHub etc
How would i make is sp when you close a gui it gives the items in the gui to the player?
So was mucking around with a way to find chunk coordinates faster than "are coordinates in chunk X".
int chunkX = (x < 0) ? (x - 15) >> 4 : x >> 4;
int chunkZ = (z < 0) ? (z - 15) >> 4 : z >> 4;
If you already have the chunk x and z's (some Api's give the coordinates rather than the chunks themselves for... reasons) if you right shift 4 bits you essentially divide by 16 right?
So if x is negative, - 15 (to account for x -1 , z-1 starting at -1,-1) , but either way, right shift 4 bits and boom, you've now got the current X and Z coords of the chunk.
As its an int calc, it always rounds down.
Boom, easy check of chunk coordinates based off location X and Z coordinates
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryCloseEvent.html
Use this event and manage somehow to check the current item (use a map, or check item in Inv, ..)
declaration: package: org.bukkit.event.inventory, class: InventoryCloseEvent
Ty
I didn't get the -15 for negatives
If you are in coordinate -1 , 0 what coordinate are you in?
for chunks
hehe
I didn't saw it that way, that's great thx for sharing
How does the Location#getChunk work?
Returns you the loaded chunk the location is part of
Didn't know it was agregation of chunk
https://paste.md-5.net/uyuvozimuy.java for some reason the playerJoin and playerChangedWorld events aren't triggered. I put them in the same paste but they're in different files actually
What would be the best way to add alot of different commands and command arguments?
Are you sure your logger works ? Try the system.out.println to be sure
it worked all previous times I debugged
Build a framework based around HashMap<String,Command> where "Command" is its own abstract class.
You can then write classes that extend that abstract, have a "perform" or "execute" method and then add all the commands to the map onEnable and, when a command is called, if the respective string is found in the arguements, boom, it performs that command via the onCommand function literally just having "commandHashMap.get(args[0]).perform()"
Ew no not a map
Wtf do you mean ew no not a map? If boi is about to deadass straight face say switch case ur about to catch these hands
do you really think I write commands like that
hell no
Using a map like that is a very low-level approach and will like
become a pain if you want to do anything remotely complex
define "complex"
for example /message <player>
I don't actually I'm really bad with commands
Why is that even close to complex?
Any recommendations?
Because with your hashmap example you'd need to input any player name etc
Acf, got it
right...
mans got the fancy uml
Chat listener for commands 💀
at work we just do this
and then it does its predictions based on whatever
I just did whatever came to mind
I tried it and nothing, I even set the load attribute in my plugin.yml to STARTUP and nothing changed at all
show me where you register the listener
the main class is in the paste too
Are you sure the plugin loads ?
playerjoin and playerchangeworld fire just fine
then post your actual code not bits and pieces you think are relevant.
like everything?
do you have it on git?
no, but I can put it there
would be easiest
yeah, wait a minute
I'm trying to create a plugin that has a prompt for players to enter their desired name for a custom tool. I want the players to be able to use hex codes when making the name for their tool but I cannot seem to get it to work. does anyone know how I can achieve this ?
if (hasEnchantedEmeraldBlock) {
ItemStack elytraCopy = new ItemStack(Material.ELYTRA);
if (elytraCopy != null) {
ItemMeta elytraMeta = elytraCopy.getItemMeta();
if (elytraMeta != null) {
for (Map.Entry<Enchantment, Integer> entry : enchantments.entrySet()) {
elytraMeta.addEnchant(entry.getKey(), entry.getValue(), true);
elytraMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', toolName));
}
elytraCopy.setItemMeta(elytraMeta);
}
}```
when i enter the code in game "&#f4d508&lʜᴏᴇ &#ffad0f&lᴏꜰ ᴘ&#ff803b&lᴏᴛᴀ&#ff4e63&lᴛᴏ ᴘ&#ff198d&lʟᴏᴡ&#ea17b6&lɪɴɢ" it just comes up as is shown here. i know it is possible because of plugins like epicrename but i just dont know how to get it to work
toolName is what I want to use hex codes on
I do not think the function tralslateAlternateColorCodes can take in hex, you'd have to parse that string yourself
isn't it ChatColor.of for hex?
Well yes, but not in the way he wants
&#rrggbb
Yes but it can parse hex tho
Which is what you initially said, picking on ur words a bit now but yea
rip, im wondering how plugins like epicrename have the functionality to do that through their /rename command though
It's quite easy with a simple regex
how do I do a delay/sleep in a BukkitRunnable? i'm trying to do a countdown and that countdown is in a bukkitrunnable
ok first comment is your config will nto work on new installs.
you have a Field set to getConfig() which causes it to load before saving the default
set teh field after you call saveDefaultConfig()
&(#[0-9aA-fF]{6,6}) would lovely work
yeah, okay
anyone?
Just don't, you'll have to use Brigadier which is a pain
Brigadier?
The Mojang command system
other than that, your code looks perfectly fine
I thought the same, but the two events just won't work for some reason
ah so bukkit doesn't have support in it?
They definitely work I use them myself.
but why do they not work for me
Although I can;t vouch for 1.8
it's still weird
hmm
Use that : https://github.com/JorelAli/CommandAPI
You don;t seem to have a ResourcePackManager in functions
if it really doesn't exist your build will fail
I forgot to remove it lol
yeah, it shouldn't be used at all
it's some useless code I tried to make and then just removed it
but forgot to remove stuff
Clean that up and I bet it works 🙂
I should probably delete unnecessary stuff instead of just leaving it there
yep
I'm not spigot or something to deprecate everything instead of deleting
for some reason, it wouldn't prompt me, but when I set it to always download it downloaded?
use a different set
one that rquires you to accept or you get kicked
you can;t force a player to accept, only kick if they don't
I don't want it to force players, I want them to be able to choose
but it doesn't even prompt
if it doesn;t prompt it thinks you already have the pack
I've seen some servers do when they open a book and you can choose but that will cost me extra time
I don't think this belongs here, but I think my player wants to shoot themselves
rip
else if (dmgCause == ENTITY_EXPLOSION) {
Entity explosionEntity = getDamager(e);
Entity exploder = getDamager(explosionEntity.getLastDamageCause());
if (exploder instanceof Player)
teamCheck(e, player, (Player) exploder);
if (exploder instanceof Projectile) {
ProjectileSource projectileShooter = ((Projectile) exploder).getShooter();
if (projectileShooter instanceof Player) {
teamCheck(e, player, (Player) projectileShooter);
}
}
}```
i'm trying to check if a player can indirectly harm team member
this works for end crystals, but not for TNT minecarts
what am i doing wrong?
the getDamager() casts the EntityDamageEvent to EntityDamageByEntityEvent and gets the damager
no java 17?
i am on java 17
why not using instanceof Player x then
the player var is the one who took the damage
why are you mixing explosions and projectiles?
i already have a seperate check for projectiles alone
else if (dmgCause == PROJECTILE) {
Entity projectile = getDamager(e);
if (projectile instanceof Projectile) {
ProjectileSource projectileShooter = ((Projectile) projectile).getShooter();
if (projectileShooter instanceof Player) {
teamCheck(e, player, (Player) projectileShooter);
}
}
}```
i'm trying to check if an explosion was caused by a projectile shot by a player
sort of like shooting snowballs on an end crystal to explode it and harm another player
Maby then send your whole code
if (event.getDamager() instanceof Projectile projectile && projectile.getShooter() instanceof Player shooter)
wait, so this was just so i don't need to cast my damager entity to (Player) again and again, but how does that solve my original issue tho?
this
I'd start by cleaning up the code. Use a switch (dmgCause)
make it easier to read and debug
switch (dmgCause) {
case ENTITY_ATTACK:
case ENTITY_SWEEP_ATTACK:
//code
break;
case ENTITY_EXPLOSION:
//code
break;
case MAGIC:
//code
break;
case PROJECTILE:
//code
break;
}```
ahh ok
you should also test the event is an instance of EntityDamageByEntityEvent before blind casting
private Entity getDamager(EntityDamageEvent e) {
if (e instanceof EntityDamageByEntityEvent entityEvent) {
return entityEvent.getDamager();
}
return null;
}```
here's my updated code: https://paste.md-5.net/iwexenutof.java
much more readable
now you can easily add debug messages to see what fires when a tnt minecart is blown up
blowing up things that early in the morning?
Entity explosionEntity = getDamager(e);
Entity exploder = getDamager(explosionEntity.getLastDamageCause());
if (exploder instanceof Player playerExploder)
teamCheck(e, victim, playerExploder);
if (exploder instanceof Projectile projectile && projectile.getShooter() instanceof Player projectileShooter) {
teamCheck(e, victim, projectileShooter);
}
break;```
the exploder returns null for some reason
when it should be Arrow
probably because it will be a VehicleDamageEvent not an EntityDamageByEntityEvent
oh
just need another instanceof check in yoru method and return the damager of the vehicle event
in getDamager()
if (e instanceof VehicleDamageEvent)
oh that works too
I actually like that getDamager wrapper. I may use it myself
cannot cast 'org.bukkit.event.entity.EntityDamageEvent' to 'org.bukkit.event.vehicle.VehicleDamageEvent'```
wait what
ide error
yeah, the pain of the Vehicle API
you may have to specifically exclude tnt minecarts and also listen to the Vehicle damage event
wait somehow Vehicle.getLastDamageCause() returns an EntityDamageEvent
i can just get it from then then no?
you can try
However I think it will be lost.
it will be off into the vehicle api
test if it's a vehicle and try
I'm pretty sure you are into the issue I found long ago.
nvm it's still null
yep, the issue is a Vehicle should override the getLastDamageCause() to return a VehicleDamageEvent
but it doesn;t, it returns an empty EntityDamageEvent
This is where teh Vehicle API breaks down
wait but then i would have to see if the tnt minecart has players within its blast radius, and then teamCheck for each player?
The issue is getting the player who triggered the minecart. that data is lost
wait how?
This is the "missing" part of the Vehicle API
wait, the VehicleDamageEvent isn't even called when shot with a flame bow
if (hs.getSpawnedType() == EntityType.PIG)``` why does the code after the of statement run even if the spawnertype is a different type?
are you using {}?
I'm not suprised. vehicles are bad
is there a way i can get a list of all events fired when i do smth?
i can test which events are fired, and listen to that
You will get an EntityDamageEvent when it's shot (probably)
There should be a VehicleDamageByEntityEvent btu there isn;t
it was wrapped into the VehicleDamageEvent
but that never gets saved as lastDamager
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/vehicle/VehicleUpdateEvent.html
what's this supposed to be?
declaration: package: org.bukkit.event.vehicle, class: VehicleUpdateEvent
You could do a workaround using the PDC
actually i might've found a fix
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityCombustByEntityEvent.html
declaration: package: org.bukkit.event.entity, class: EntityCombustByEntityEvent
didn't knew this existed
if (hs.getSpawnedType() == EntityType.PIG) {
why does the code after the of statement run even if the spawnertype is a different type? Its so annoying
There is no of in the code you posted
wdym
Ther is an ‘if’
ah
thing is even if i get the player who shot it, how will i check if the players in blast radius are in the same team or not
i know that the default spawn type is pig so idk if the server is aware of the actual type
probably or there wouldnt be a method for that 💀
they are
your damage event from explosion
are you even sure its a dif type
Sure
why am i seeing pig then
I'd suggest in the ignite event add the attacking players UUID to the entites PDC
uhh, i don't understand lol
That way in your damage event you can check for a PDC value and instantly know that Entity was attacked by a player
ohh, so assign a key to the minecart with the player name/uuid?
in teh ignite event, check if a tnt minecart. if it is and it was shot with a flaming arrow, get teh shooters UUID.toString() and put on teh tnt entity PDC
then in teh damage event under explosion you just have to check to see if there is a PDC entry, grab it, get teh entity it belongs to and you have yoru damager
@brave sparrow usless

I just lurk in here.
What prompted this ?
you could do it really simply, without modifying your code
well minorly
in your getDamager method you check for a PDC entry, grab it and return Bukkit.getEntity(UUID.fromString(pdcEntry)
then add a listener for the ignite event
in there if the entity is a TNT minecart you store the attackers uuid in its PDC
Im guessing its something todo with mineplex
Bump 🥲
Anyone know how to fix this??
@EventHandler
public void onMinecartIgnite(EntityCombustByEntityEvent e) {
if (e.getEntityType() != MINECART_TNT) return;
if (e.getCombuster() instanceof Projectile projectile && projectile.getShooter() instanceof Player projectileShooter) {
PersistentDataContainer cartData = e.getEntity().getPersistentDataContainer();
cartData.set(new NamespacedKey(main, "shooter"), PersistentDataType.STRING, projectileShooter.getUniqueId().toString());
}
}```
```java
if (explosionEntity.getType() == MINECART_TNT) {
PersistentDataContainer explosionEntityData = explosionEntity.getPersistentDataContainer();
String shooterUUID = null;
if (explosionEntityData.has(new NamespacedKey(main, "shooter"), PersistentDataType.STRING))
shooterUUID = explosionEntityData.get(new NamespacedKey(main, "shooter"), PersistentDataType.STRING);
if (shooterUUID == null) return;
Player shooterPlayer = Bukkit.getPlayer(UUID.fromString(shooterUUID));
teamCheck(e, victim, shooterPlayer);```
i did this instead, not sure how i could implement the PDC getter in getDamager()
i could always add another parameter boolean isMinecart
you have an entity in getDamager()
oh shoot my pdc wrapper only works on items
anyways https://paste.md-5.net/ewazibidon.cs I'd make something similar for entities
clean up the code a bit y'know
also create your NamespacedKey as a Field in teh class. no need to create it every time
yea i got that
but the issue is this
how would it differentiate between those
no need to change anything in there from teh original code
from this https://paste.md-5.net/iwexenutof.java
only modify the getDamager method
the explosionEntity.getLastDamageCause() does return an EntityDamageEvent.
its just not an instance of EntityDamageByEntityEvent
because Vehicle
so instead of returning null you do your PDC check on e.getEntity
returning yoru shooter
wait so when the tnt minecart is exploded, it fires an EntityDamageEvent but not an EntityDamageByEntityEvent?
event.setDroppedExp(0); event.getDrops().removeAll(event.getDrops());
the mob still drops it's natural drops
anyone know how to stop that?
Does it still drop xp?
nope
no when you getLastDamageCause() it gives you an EntityDamageEvent, justr a crap one.
one sec
private Entity getDamager(EntityDamageEvent e) {
if (e instanceof EntityDamageByEntityEvent entityEvent) {
return entityEvent.getDamager();
}
PersistentDataContainer explosionEntityData = e.getEntity().getPersistentDataContainer();
String shooterUUID = null;
if (explosionEntityData.has(shooterKey, PersistentDataType.STRING))
shooterUUID = explosionEntityData.get(shooterKey, PersistentDataType.STRING);
if (shooterUUID == null) return null;
return Bukkit.getPlayer(UUID.fromString(shooterUUID));
}```
or close
no need to null check. use getEntity() and it will be null if no match exists
[PlaceholderAPI] Failed to load expansion .... Identifier is already in use.
any idea
wouldn't UUID.fromString() throw an exception if the string is null?
yes, but there is no way the string would be null if it's present
oh yea
thats just your IDE bitching at you 🙂 Because it's stupid
to silence yoru IDE you can wrap in a Objects.requireNonNull or some crap
getOrDefault to avoid two lookups :)
you could, just have to provide a valid uuid
easier to just do two lookups 😉
I seriously hate the space bar on this new Ducky keyboard. It constantly bounces
my laptop spacebar isnt much better
I'm also thinking about a new keyboard but I'm really unsure which one
I constantly get double spaces as I type with this one
Which one is that?
IJ should delete this sht fr
@SuppressWarnings("ConstantConditions")
My current keyboard. Love it (bar teh space bar) https://www.amazon.co.uk/Ducky-Channel-Daybreak-Cherry-Keyboard/dp/B09VT69394/ref=sr_1_3?crid=2RDI5T9PJTOWE&keywords=ducky+one+3+tkl&qid=1685448501&sprefix=ducky+one+3+tkl%2Caps%2C91&sr=8-3
looks fine but i never understood why they are still two windows buttons
like who even uses the right one
I never use them except when doign tech support
telling the end user to press teh windows button makes support easier
many years ago when they were introduced we used to install programs to disable them as they kept tabbing you out of games.
brr
I believe it was Microsofts way of getting their logo on a keyboard like Apple
ok, sorry but I have to ask
What is up with you writing "teh"
age
teh and ; instead of '
As you get older your fingers move slower and don't bend as much.
so keys get switched teh yoru that;s
Do you type with 1 hand or 2?
Rly i type teh because its an easier keystroke for me
mine is unintentional
Its not sending anything in the minecraft chat either it does not send anything in the console .. I use Citizens API, but its not working, and no errors at startup. 🙂
naming conventions bruh
xd
yes
when are you registering the class?
Here
What?
when?
I was anwsering @eternal oxide question
all we need now is a latest.log from yoru server then
Is it sending the Logger message?
?paste
yes
Ok, then upload ur log like elgar said
can i control player vanilla level from database or configfile ?
I'm betting a missing command in plugin.yml
Missing command? O.o, it's the event that doesnt work??
a missing command would exit your onEnable early, thus no event registered
What??
Spigot has an enabling process
