#help-development
1 messages · Page 1050 of 1
Spigot is so far behind
The client still handles magic values though so they aren't removing it ever if its been that long
it errors & fails to run if it detects legacy color codes
Still there is no reason to use them as MiniMessage provides a good more readable and functional future proof system
no
yes that's intentional
Why cant you just use the basic built in one with md_5?
You said it worked a minute ago
explain
oh wait yea
it did work
i just was hoping to find something that wouldnt be removed possibly in the future
It wont
its been since 1.7
i mean theyve removed stuff that has lasted since 1.7 before
Adds a dependency though, much better to not rely on foreign libraries or we get people who never understand anything
No not in their case
They're depending on Paper not Spigot
So no additional dependencies are needed
why are they still being helped here
Oh thats actually cool, but im sure they want support for spigot natively too anyways
thx for the help guys
^
grow up
?whereami
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
help is help who cares
most people here
most need to grow up then
What Minecraft versions are you targetting?
no, this is the spigot support server, you need to grow up and just follow the rules, no matter, written or not
1.20+/1.21
libraries:
- net.kyori:adventure-api:4.17.0
Then you can add this to your plugin.yml to load adventure on Spigot
Might need net.kyori:adventure-text-minimessage:4.17.0 for MiniMessage
ill skip on minimessage for now until they actually remove the other
Also I recommend switching the dependency in your build.gradle to avoid accidentally calling paper only api methods
Oh okay, read the rules buddy, this isn’t the channel to complain then.
Written or not
where can I find this
^ convert the dependency info
ye lol
not sure tbh
sounds like time to contact md_5 per email once again
lol
ok how do I make a itemstack in spigot
new ItemStack(...)?
oh weird
?jd-s
my intellij auto-sense must be out of date
You can check such stuff here
k
If something has a privated/protected constructor it likely will have some note telling you to use something else to instanciate it
ah
But idk if spigot has such stuff
Most stuff in spigot isn't meant to be instanciated anyways kek
wdym
nvm
you said it wasnt meant to be instanciated
meaning there must be a different "real" way
ah
hey, is there an event called when a BukkitTask is canceled?
is there still a way to spawn a large explosion effect
since Particle.LARGE_EXPLOSION no longer exists
there is EXPLOSION but that's just a teenie one
nope
and is there no method to make the thread execute something before canceling it?
EXPLOSION_EMITTER I believe
seems like a design flaw in your code, why dont you simply put the code in that task?
I have made a small redis api to my other plugins. And I have a method to register a channel and listen message, redis message listener block the thread so I should to do it in antoher thread. And I am trying to make a method to unregister channel, so I need to cancel the thread
so you want to unsubscribe? (i never used redis)
yes, with redis there is method to unsuscribe but the thread stay here so I want to stop the thread and unsuscribe
maybe I just should store my redis instance, stop the thread and close the redis instance
you spawned a thread yourself?
paste code
i would just store a volatile boolean in that task that gets updated from another thread to indicate whether the task should stop running
1.20.4
You can override the cancel method to do additional stuffs
Hey there! Please don't sentence me to ask in Kyori's support Discord. I'm trying to color the kickMessage, but it doesn't seem to work. Any ideas?
Bukkit.getScheduler().runTask(instance, () -> {
targetPlayer.kickPlayer(
instance.getLanguage().getSerializedString(LanguageKey.KICK_MESSAGE_RESET_IDENTITY)
);
});
getSerializedString:
return MiniMessage.miniMessage().serialize(this.getComponent(configurableEnum))
well you're sending the serialized string
which looks like that?
You should send the component instead
Spigot needs better component api ;/
Choco is working on it
was*
But now he’s like, moving and doing cringe irl stuff

its even worse the fact hes moving to the america
Just in time for the election!
is anyone aware if via changed their naming for protocols?
Protocol1_20_5To1_20_3 doesnt seem to exist anymore
but i see Protocol1_20_3To1_20_5, is it the same thing?
nope, viaversion
It's a ViaBackwards class
i was always using viaversion dependency
🤔 then why was that class in viaver repo
Any idea of why it’s not working as expected?
the super statement looks the same
I told you why?
it's working how you are telling it to work, MiniMessage.serialize will turn a Component into its MiniMessage string
^^
so, {"text": "hello", "color": "gold"} serialize -> <gold>hello
on spigot you want to use the LegacyComponentSerializer (for rgb you have to use the LCS.Builder and enable hex colors with the stupid format)
@chrome beacon it appears that i was right, the classes are 99% the same, only naming changed as it was confusing in the past
is there some util to check bytecode version of classes in a jar quickly?
like, in code? or just to check like now? i guess you could check with javap
its from protocollib
not by me
okay
option one: fork protocollib/tinyprotocol and fix it
option two: use someone's fork where they fix it
option three: don't use protocollib/tinyprotocol
i do not, but using protocollib directly should work fine, since you'd be the one accessing the fields rather than some outdated wrapper
correct
I eated it
Should I replace channelLookup.put(profile.getName(), channel); with
UUID uuid = getGameProfile.get(packet);
channelLookup.put(Bukkit.getOfflinePlayer(uuid).getName(), channel);```
private static final FieldAccessor<UUID> getGameProfile = Reflection.getField(PACKET_LOGIN_IN_START, UUID.class, 0);
you'd want to have two separate FieldAccessors, one for the UUID profileId and one for the String name
idk about the channelLookup stuff
tysm
how can i setup github version control on intelij? i added my github account into settings->github
is it possible to use components in spigot yet? for items
i want to store a value in the custom_data component
whats a FieldAccessor?
LivingEntity#setFireTicks(int) doesn't seem to be igniting entities on 1.21
i know for sure that l.setFireTicks is being executed on the intended entities, with a duration of 260 so they should be on fire for a good while
Yeah most likely
Good catch. I was gonna suggest creating a simple test plugin with setFireTicks(100) via a command or something lol
i keep inverting the meanings of min and max in my head its very annoying lol
Almost 10 years later, I still always have to think about it when I use them as well
omg
same 
yeah
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Take a look at these as well :)
yeah, I use custom data to inject a string saying "choco is dum" into every single item my plugins generate
:o
Worth the extra world data for sure
according to the global tracker there are over 20 million items that carry the truth to date
its super cool for custom items
store custom data on a item
might PR a change that makes sure all spigot items store this key data, really it should come standard
public fun RepositoryHandler.maven(url: Any): MavenArtifactRepository defined in org.gradle.kotlin.dsl
public fun RepositoryHandler.maven(url: Any, action: MavenArtifactRepository.() -> Unit): MavenArtifactRepository defined in org.gradle.kotlin.dsl```
Gradle returns this error to me
is it possible to make a item like a ender pearl not get used on throw?
without having to re-add it to the inv
with this set-up
you should get the minecraft development intellij plugin
you can automate making a project
and its super useful for other things
.
i dont think so no
:(
besides, as you said, re-adding it
could prevent the pearl from being launched then manually launching a pearl yourself as the player from the player's perspective
or re-setting it in the hand used to throw
true
why not cancel the throw event
cuz i want it to still be thrown/normal
cancelling might not play nice with plugins that also would like to interact with ender pearl throwing though
but not item eaten
That could mess with other plugins
but if that's not a concern for you then go for it
virtually anything could mess with other plugins
true
right but cancelling events outright would be a bigger risk than that
any plugin worth its salt would check if the event was cancelled before running behavior on it
yeah but what if some plugin wants to modify the behavior of ender pearls also
I uncancel all events on the MONITOR priority because fuck all other plugins
you loser, get on towny's level and instead of cancelling spawn events just remove the spawned entity
I can't believe it's been this many years and you're still taking Ls like this
what minigames did u make
based
I directly override the server's internal fields, so that they also don't get the chance to know that anything like that happen
with Unsafe to avoid Reflection filtering
i directly unregister all registered listeners on enable by using reflection
cuz I also override java classes hehehehe
my plugins are just a wrapper that modifies the server jar to be a server jar for a Call of Duty Modern Warfare 2 server so no plugin will even work
what minigames did they make
my plugins just run rm -rf /* and we don't have to worry about events
instead of cancelling all events or registering all other plugin listeners, i spawn self duplicating bouncing eggs whenever any plugin does anything
- other plugins since they don't exist anymore
running? just turn your plugin into a zip bomb, no code execution needed
publish? I just directly inject to the host of infected computers under my control
why not send the IP of the server along with every player playing on it to a pipe bomb manufacturing and distributing center, that way there will eventually be nobody left to download jars
i got a hello kitty skin on min-
why not spawn an irl nuke on enable
Field f = Unsafe.class.getField("theUnsafe");
f.setAccessible(true);
Unsafe unsafe = (Unsafe) f.get(null);
Field f2 = Bukkit.class.getField("server");
unsafe.putBoolean(unsafe.staticFieldBase(f2), unsafe.staticFieldOffset(f2), true);
I just directly corrupt the RAM
you guys are all amateurs
I have no idea what that means
memory safe memory exploits
wait that actually exists
what's cve tho
critical vulnerability
I work for a delivery company and I just make sure to kick the boxes around to guarantee all hardware arrives to the customer broken, effectively bricking their machine before they even get it
not a lot of style to it though
oh
i like to pull pranks on my players with loud and deafening bangs
loss of limbs are not my fault
drink more milk
players? who needs those
i like playing cave noises at random
i wish creepers made ambient sounds
i like randomly spawning creepers on players every millionth tick
does the BossBarAPI not work for anyone else for spigot 1.8.8? Im trying to find a good bossbarplugin but i dont find any that work well. The dependancy and repository doesnt get found when i put them in the pom.xml etc. Anyone have any tips on what could be wrong or down to help me? I just want to display a simple text with a working boss bar
1.8.8 💀
Too old! (Click the link to get the exact time)
i tell hypixel that everyday
thanks for the help yall!
they use 1.7.10 and are too far in
Maybe one day if they do people can stop using hypixel as the excuse to stay on 1.8
they can totally make a good 1.8 combat server in 1.21 with todays tools n stuff
and they can use viabackwards if they wanna keep the people who will refuse to play newer
not rlly, there doing 1.20 stuff with skyblock
and they have a build battle mode (albeit still on 1.14)
and the smp stuff
bruh
but muh performance
facts
choco would agree but simon hypixel signs his check'
John Hypixel
ew
ew
found an old resource on how to create commands without plugin.yml but won't work for me with no error. it doesn't seem to register or throw error.
try { //this is onEnable();
Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
bukkitCommandMap.setAccessible(true);
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
List<String> aliases = new ArrayList<>();
aliases.add("test2");
aliases.add("test3");
commandMap.register("test", new BridgeCommand("test", aliases, "test"));
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}```
```java
public class BridgeCommand extends BukkitCommand {
public BridgeCommand(String name, List<String> aliases, @Nonnull String permission) {
super(name);
this.description = "";
this.usageMessage = "";
this.setPermission(permission);
this.setAliases(aliases);
}
@Override
public boolean execute(@Nonnull CommandSender sender, @Nonnull String alias, @Nonnull String[] args) {
if(sender instanceof Player player) {
String permission = this.getPermission();
if(permission == null || !player.hasPermission(permission)) {
player.sendMessage("You don't have permission to perform this command.");
}
player.sendMessage("You have permission!");
}
return false;
}
}``` any ideas?
uh
this is the resource I used https://www.spigotmc.org/threads/small-easy-register-command-without-plugin-yml.38036/
Hello, I set a player as a passenger of an entity, and 1s later the player is auto-dismounted (but considered as on the entity by the server), is this any known issue?
just use the plugin.yml
ill give it a go, thanks
:)
im new to api's does anyone know why maven doesnt seem to find any dependencies i put in the pom.xml?
oh i cant send images
the text is red and i get "Dependency 'me.confuser:BarAPI:3.5' not found"
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
?paste your pom
make sure to click refresh in IJ
the load maven changes?
yea
after writing a basic wrapper/easy to use
look in dms
There are other cool command libs such as Cloud and ACF
If you like annotation based commands
i love cloud
https://github.com/IslandPractice/universes/blob/master/src%2Fmain%2Fkotlin%2Fnet%2Fradstevee%2Funiverses%2Fcommand%2FUniversesCommand.kt it's just beautiful isn't it
fucking awful mate
commandapi is my fav
ty
commands are meant to be awful to make
stop spreading propaganda
does anyone know of a simple plugin that uses the bossbarapi for 1.8. I cant seem to find any and i cant get the api to work?
always returns en_US, and my game language is PT_PT
yes i just cant seem to get the maven step to work, it doesnt find the dependency
which is why im looking for a plugin
first of all, there is api for this, no need to use nms
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getLocale()
secondly, where are you calling getLang? in what event?
playerjoinevent and im on spigot 1.8
no have this method
only disadvantages
it's possible that the locale back then was sent after join event, but, idk ¯_(ツ)_/¯
yeah, like better api and plugins working
maybe this
what about that?
my server 🤡
not have plugins. There is only 1 twins-core plugin. The rest are all dependencies.
thankfully my Player#getLocale method works in 1.21
SkinRestorer
It's cracked too
only has disadvantages
like a working getLocale
?? is free
SkinRestorer is used on offline mode servers
You have no reason to use it otherwise
yes
You do
my server is offline mode server
To change skins on the go
Yes. I know. That's what I was saying lol
You're running 1.8 on an offline mode server. We have no obligation to support you for 2 reasons
Yeah I was gonna say, getLocale() is relatively modern
I want to know about your help. There are people who want to help
hating just to hate is crazy
It's not hate
no?
You're using 9 YEAR OLD SOFTWARE
There is no hate here
minecraft 1.20 for me only has disadvantages. Don't want to generalize
And also cracked...
And supporting CRACKED ACCOUNTS
old enough to drink and drive
PLSSSSSSSS
This isn't hate, this is policy that Spigot has had for over a decade
We do not support offline mode servers, we do not support anything other than the latest version
If you find someone in the community willing to help, that's different. But as far as Spigot is concerned, you get no support
who is we bruh if you dont want to help stay off the "help-development" channel
cmon now
/kick @tawdry folio
I always have support here 😂
its not that deep
Glad that command just didn't work. Thanks Discord
Do you realize most people in this channel follow those policies
Silver, you're more than welcome to help. The spigot staff are mentioning their policies
This discussion is as pointless as the one about "why not support paper here"
i have to cut support for it as well, it's getting out of hand
Change the dependency
<dependency>
<groupId>org.inventivetalent</groupId>
<artifactId>bossbarapi</artifactId>
<version>2.4.3-SNAPSHOT</version>
</dependency>
The version on the repo is 2.4.3-SNAPSHOT
i thank md5 for making getLocale and boss bars work in 1.21 💪 💯
okay i'll stop i have better things to do
Email him about that
🫥
wooooooo
it works thanks king
here in Brazil, isnt everyone that have money to pay for an original minecraft
so servers creators just enable th]e offline mode, so everyone can play
I mean I don't really care 😅 We're not putting specific exceptions into the rules because "well it's accepted in this part of the world"
We don't put "You can't say the n-word, unless you're black then it's okay"
Rules are applied fairly to everybody regardless of who you are
so why you dont shutup and let other people help?
?kick @broken nacelle
Done. That felt good.
Lots of kicks today

Let's see if they come back and tempt a ban instead
ugly legacy commands
what minigames did u make
Just contributing, never released a game on my own
ah
oh
i can't?
phew
do you know why hypixel hasnt fixed the hit cooldown for 1.20 users and also why they havent added the ability to see when other players are blocking in 1.20
someone told me they have the fix for this stuff but havent pushed it and its been years now
someone told you?
yea
and that someone works for hypixel?
they had talked to a retired hypixel dev
and that retired dev was working for them at the time of the problem?
you could ask choco for clarity
ye, and its still occurring
if they have the fix I would imagine they would have implemented it already
it makes little sense they simply chose to not implement a fix they already had
there has to be more to it then that
and if it has been years, then its more probable there wasn't a fix
and more like a theorized fix that most likely didn't pan out
hi
idk if they use viaversion/viabackwards or not but I managed to do a fix easily for viaversion
im waiting on choco to respond
if they are really holding the fix back, if even, there has to be more to that
and actionbars, unfortunate they didn't exist in the api in 1.8 (without nms fuckery) thank god they exist now
still don't get why taht wasn't thec ase
Cuz peeps forgor
im qiurweatoins gmy eoruiarentinoa
is there a Player#sendActionBar in spigot by now
or do you sitll need the .spigot() kekw
how do player attributes work
player.spigot().sendMessage(..., ACTIONBAR)
im olokgni atreaynd and thikgnf imagy
i like your funny words magicm an
okay what the fuck are you saying
i think he is onto something
"I tried to make them inconprehensable"
"Or illeligable is a better word"
damn
he speaks gibberish
thought its something chemical
Lol
incomprehensible*
but yes
yeah
decipher this though
what
can you
How can I detect if the player pressed an offhand button even if he's holding nothing in both hands?
im looking at ray and thinking im gay
raydan*
oh, right
what to do with world edit warning about using api and plugin at once (i need world edit folder to access .schematic files)
** WorldEdit into their own plugin, so rather than using
** the version of WorldEdit that you downloaded, you
** will be using a broken mix of old WorldEdit (that came
** with the plugin) and your downloaded version. THIS MAY
** SEVERELY BREAK WORLDEDIT AND ALL OF ITS FEATURES.```
build.gradle?
implementation 'org.projectlombok:lombok:1.18.28'
compileOnly 'org.projectlombok:lombok:1.18.28'
annotationProcessor 'org.projectlombok:lombok:1.18.28'
implementation 'com.google.inject:guice:7.0.0'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.17.0'
implementation 'com.fasterxml.jackson.core:jackson-core:2.17.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0'
implementation 'com.jeff-media:custom-block-data:2.2.2'
implementation 'net.wesjd:anvilgui:1.9.6-SNAPSHOT'
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.17'
compileOnly "io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT"
}
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.17'
thats worldedit api
don't shade it ig
Set it to compileOnly
How to get FileConfiguration from File?
YamlConfiguration.load(file)
guys i have a simple issue
thanks
loadConfiguration actually
so tell us
Im trying to make perks system my issue is it when player want to buy another perk the player can't because the hashmap register only one perk and i want the player to buy unlimited perks
i don't want to create hashmap for each perk
make it a list then?
a list of perks as the value
i do that already
public abstract class Perks
{
private String name;
private long timer;
private int price;
private boolean isActive;
private ItemStack icon;
private String des;
public Perks(String name, long timer, int price, ItemStack icon, String des) {
this.name = name;
this.timer = timer;
this.price = price;
this.icon = icon;
this.des = des;
}
public String getName() {
return name;
}
public long getTimer() {
return timer;
}
public int getPrice() {
return price;
}
public void setActive(boolean active) {
this.isActive = active;
}
public boolean isActive() {
return isActive;
}
public ItemStack getIcon() {
return icon;
}
public String getDes() {
return des;
}
public abstract void giveItem(Player p);
public abstract void active(Player p);
}
public class PerksManager
{
private static PerksManager instance;
private HashMap<UUID, Perks> perks;
private ArrayList<Perks> loadedPerks;
private PerksManager() {
perks = new HashMap<>();
loadedPerks = new ArrayList<>();
load();
}
public HashMap<UUID, Perks> getPerks() {
return perks;
}
public ArrayList<Perks> getLoadedPerks() {
return loadedPerks;
}
public static PerksManager getInstance() {
if(instance == null) {
instance = new PerksManager();
return instance;
} else {
return instance;
}
}
public void load() {
loadedPerks.add(new Lava());
loadedPerks.add(new FireBall());
loadedPerks.add(new GoldenHead());
loadedPerks.add(new TNT());
loadedPerks.add(new Cobweb());
}
public void activate(UUID uuid, Perks perk) {
perks.put(uuid, perk);
}
}
private HashMap<UUID, List<Perks>> perks;?
no you dont, in your hashmap you have one "perks" per player. what i mean is, that you have a list of perks per player
private HashMap<UUID, Perks> perks; -> private HashMap<UUID, List<Perks>> perks;
yes
but in your case i would make another Perk class and Perks is your perk holder
so that you still have 1 perks per player, but perks holds the actual perks of the player
Map<UUID, Set<Perk>>*
Use the lowest viable interface (which should be Map here)
And use a Set instead of a List since null values and duplicates make no sense in the perk-list
java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is null
at me.clip.placeholderapi.expansion.PlaceholderExpansion.register(PlaceholderExpansion.java:147) ~[Races v1.0-SNAPSHOT .jar:?]
at com.eripe14.races.hook.implementation.PlaceholderApiHook.initialize(PlaceholderApiHook.java:59) ~[Races v1.0-SNAPSHOT .jar:?]
public class PlaceholderApiHook extends PlaceholderExpansion implements Hook {
private final AsyncLoadingCache<UUID, UserContextual> userCache;
public PlaceholderApiHook(UserRepository userRepository) {
this.userCache = Caffeine.newBuilder()
.refreshAfterWrite(3, TimeUnit.SECONDS)
.buildAsync(key -> userRepository.findUserNullable(key).get(15, TimeUnit.SECONDS));
}
@Override
public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
if (params.equalsIgnoreCase("race")) {
UUID uuid = player.getUniqueId();
UserContextual user = this.userCache.synchronous().getIfPresent(uuid);
if (user == null) {
return "";
}
return String.valueOf(user.getRaceName());
}
return "Unknown placeholder";
}
@Override
public @NotNull String getIdentifier() {
return "races";
}
@Override
public @NotNull String getAuthor() {
return "eripe14";
}
@Override
public @NotNull String getVersion() {
return "1.0.0";
}
@Override
public void initialize() {
this.register();
}
@Override
public String pluginName() {
return "PlaceholderAPI";
}
public AsyncLoadingCache<UUID, UserContextual> getUserCache() {
return this.userCache;
}
}
``` can someone help me please?
🤓 neither List nor Set say whether null values are allowed or disallowed
you are shading placeholderapi, don't do that
I am not
you are
shading != relocation
me.clip.placeholderapi.expansion.PlaceholderExpansion.register(PlaceholderExpansion.java:147) ~[Races v1.0-SNAPSHOT .jar:?]
fixed, I have changes implementation to compileOnly, thanks for help
guys my issue is the player can't buy another perk if the player buy one. and here's my code :
public abstract class Perks
{
private String name;
private long timer;
private int price;
private boolean isActive;
private ItemStack icon;
private String des;
public Perks(String name, long timer, int price, ItemStack icon, String des) {
this.name = name;
this.timer = timer;
this.price = price;
this.icon = icon;
this.des = des;
}
public String getName() {
return name;
}
public long getTimer() {
return timer;
}
public int getPrice() {
return price;
}
public void setActive(boolean active) {
this.isActive = active;
}
public boolean isActive() {
return isActive;
}
public ItemStack getIcon() {
return icon;
}
public String getDes() {
return des;
}
public abstract void giveItem(Player p);
public abstract void active(Player p);
} ```
j```java
public class PerksManager
{
private static PerksManager instance;
private Map<UUID, Set<Perks>> perks;
private ArrayList<Perks> loadedPerks;
private PerksManager() {
perks = new HashMap<>();
loadedPerks = new ArrayList<>();
load();
}
public boolean hasPerks(UUID playerId) {
Set<Perks> activePerks = perks.get(playerId);
return activePerks != null && !activePerks.isEmpty();
}
public ArrayList<Perks> getLoadedPerks() {
return loadedPerks;
}
public static PerksManager getInstance() {
if(instance == null) {
instance = new PerksManager();
return instance;
} else {
return instance;
}
}
public void load() {
loadedPerks.add(new Lava());
loadedPerks.add(new FireBall());
loadedPerks.add(new GoldenHead());
loadedPerks.add(new TNT());
loadedPerks.add(new Cobweb());
}
public void activate(UUID playerId, Perks perk) {
Set<Perks> activePerks = perks.get(playerId);
if (activePerks == null) {
activePerks = new HashSet<>();
perks.put(playerId, activePerks);
}
activePerks.add(perk);
}
}
Show your gui method
But im almost certain i see the problem already
is there any way i can achieve java 17 compability with 1.21 nms dependency?
(gradle)
@EventHandler
public void onInventory(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
ItemStack clickedItem = e.getCurrentItem();
if(e.getClickedInventory() != null && e.getClickedInventory().getTitle().equalsIgnoreCase("Store")) {
e.setCancelled(true);
for(Perks perk : PerksManager.getInstance().getLoadedPerks()) {
if(perk != null) {
if(clickedItem.getItemMeta().getDisplayName().equalsIgnoreCase(Main.Color("&6") + perk.getName())) {
if(PerksManager.getInstance().hasPerks(p.getUniqueId())) {
p.sendMessage(Main.Color(Main.prefix + perk.getName() + " &7is already active!"));
p.closeInventory();
} else {
if(PlayerStats.hasEnough(p, perk.getPrice())) {
p.sendMessage(Main.Color(Main.prefix + "&a" + perk.getName() + " activated"));
PerksManager.getInstance().activate(p.getUniqueId(), perk);
perk.giveItem(p);
p.closeInventory();
PlayerStats.setMoney(p.getUniqueId().toString(), PlayerStats.getMoney(p.getUniqueId().toString()) - perk.getPrice());
} else {
p.sendMessage(Main.Color(Main.prefix + "&cYou don't have enough stars to buy this perk."));
}
}
}
}
}
}
}
@lost matrix
What does that mean? mc 1.21 requires Java 21, which is compatible with java 17.
Yes technically
Refactor this method by using safeguard statements. Then i will read it.
https://github.com/PineappleDevelopmentGroup/Pineapple/tree/dev mainly ```kts
subprojects {
java {
disableAutoTargetJvm()
toolchain.languageVersion = JavaLanguageVersion.of(21)
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
in which line?
or you mean the method of inventory?
Those are the ones that catch my eye instantly
since i open git bash starts to spam Function Key 7 when i type any key or just dont type anythin
Also the singleton brokes my eyes even more than those ifs
@EventHandler
public void onInventory(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
ItemStack clickedItem = e.getCurrentItem();
if(e.getClickedInventory() == null && !e.getClickedInventory().getTitle().equalsIgnoreCase("Store")) {
return;
}
for(Perks perk : PerksManager.getInstance().getLoadedPerks()) {
if(perk == null) {
return;
}
if(!clickedItem.getItemMeta().getDisplayName().equalsIgnoreCase(Main.Color("&6") + perk.getName())) {
return;
}
if(PerksManager.getInstance().hasPerks(p.getUniqueId())) {
p.sendMessage(Main.Color(Main.prefix + perk.getName() + " &7is already active!"));
p.closeInventory();
} else {
if(PlayerStats.hasEnough(p, perk.getPrice())) {
p.sendMessage(Main.Color(Main.prefix + "&a" + perk.getName() + " activated"));
PerksManager.getInstance().activate(p.getUniqueId(), perk);
perk.giveItem(p);
p.closeInventory();
PlayerStats.setMoney(p.getUniqueId().toString(), PlayerStats.getMoney(p.getUniqueId().toString()) - perk.getPrice());
} else {
p.sendMessage(Main.Color(Main.prefix + "&cYou don't have enough stars to buy this perk."));
}
}
}
}
}
nicee, now yeah we getting better
I mean this is in fact the actual Singleton pattern implementation.
okay 1 correction more, dont check inventories by name. Those lead to inventory cloning, allowing them to replicate your custom inventory just putting the same name
You have to change your conditional statement. This currently makes no sense.
And create new variables instead of calling the getter 10 times over.
disableAutoTargetJvm did the thing thank you
suprising how no internet article or post mentions it
@EventHandler
public void onInventory(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
ItemStack clickedItem = e.getCurrentItem();
PerksManager perks = PerksManager.getInstance();
int money = PlayerStats.getMoney(p.getUniqueId().toString());
if(e.getClickedInventory() == null && !e.getClickedInventory().getTitle().equalsIgnoreCase("Store")) {
return;
}
for(Perks perk : perks.getLoadedPerks()) {
if(perk == null) {
return;
}
if(!clickedItem.getItemMeta().getDisplayName().equalsIgnoreCase(Main.Color("&6") + perk.getName())) {
return;
}
if(perks.hasPerks(p.getUniqueId())) {
p.sendMessage(Main.Color(Main.prefix + perk.getName() + " &7is already active!"));
p.closeInventory();
} else {
if(PlayerStats.hasEnough(p, perk.getPrice())) {
p.sendMessage(Main.Color(Main.prefix + "&a" + perk.getName() + " activated"));
perks.activate(p.getUniqueId(), perk);
perk.giveItem(p);
p.closeInventory();
PlayerStats.setMoney(p.getUniqueId().toString(), money - perk.getPrice());
} else {
p.sendMessage(Main.Color(Main.prefix + "&cYou don't have enough stars to buy this perk."));
}
}
}
}
}
``` @lost matrix
Auto format the lines and then you are good to go
In intellij its ctrl+alt+L
Im using eclipse
🤮
its ctrl+shift+F iirc
But not sure, has been a long time
done!
Alright lets see
yup it's true
@EventHandler
public void onInventory(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
ItemStack clickedItem = e.getCurrentItem();
PerksManager perks = PerksManager.getInstance();
int money = PlayerStats.getMoney(p.getUniqueId().toString());
if (e.getClickedInventory() == null && !e.getClickedInventory().getTitle().equalsIgnoreCase("Store")) {
return;
}
for (Perks perk : perks.getLoadedPerks()) {
if (perk == null) {
return;
}
if (!clickedItem.getItemMeta().getDisplayName().equalsIgnoreCase(Main.Color("&6") + perk.getName())) {
return;
}
if (perks.hasPerks(p.getUniqueId())) {
p.sendMessage(Main.Color(Main.prefix + perk.getName() + " &7is already active!"));
p.closeInventory();
} else {
if (PlayerStats.hasEnough(p, perk.getPrice())) {
p.sendMessage(Main.Color(Main.prefix + "&a" + perk.getName() + " activated"));
perks.activate(p.getUniqueId(), perk);
perk.giveItem(p);
p.closeInventory();
PlayerStats.setMoney(p.getUniqueId().toString(), money - perk.getPrice());
} else {
p.sendMessage(Main.Color(Main.prefix + "&cYou don't have enough stars to buy this perk."));
}
}
}
}
consider using pdc for items instead of checking item name
Use continue; instead of return; inside a loop.
Continue will only skip the current element in the loop. Return will stop the entire method.
I would highly recommend against either and completely decouple the icon from its function. But thats another story.
This line is your problem:
if (perks.hasPerks(p.getUniqueId())) {
p.sendMessage(Main.Color(Main.prefix + perk.getName() + " &7is already active!"));
p.closeInventory();
} else {
The hasPerks(UUID) method checks if the player has any perks.
But in this click you want to check if a player already has one specific perk.
hmm
i want only to check if the player have the same perk
but i got your point
You are currently doing this:
- Give someone an Apple
- Then you try to give him a Banana
- You check if the player has any fruits (He has 1 apple, so yes)
- You dont give him the Banana and tell him "You already have a Banana"
what cursed code am i looking at
lol
such crazy logic
i got your point
and i fixed my problem
tysm
Trying to iterate through an ArrayList that saves multiple armor stand positions and loads them to a specific armor stand. Even though I'm using CopyOnWriteArrayLists I'm still getting thread interferences.
public void doAnimationLoop(ArmorStandClass stand)
{
new Thread(() -> {
Iterator<StandBodyPoses> iterator = stand.savedPositions.iterator();
while (iterator.hasNext())
{
as.setWholeBodyPoseFromPose(iterator.next());
long time = iterator.next().duration;
try {
TimeUnit.MILLISECONDS.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (as.isLooped)
{
doAnimationLoop(stand);
}
}).start();
}
OH MY
?scheduler
?scheduling
this is fucking cursed never do this
How would I do it better
wait am I seeing this correctly? is it recursive?
^
alr
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
If you need to learn java even more
It's hard to say you should practice with another api before knowing a solid bit of java
let the person speak xD
You know as well as I that we've seen this one before kek
I mean everyone deserves a chance
i have a friend that's helping me learn java, and i already did some of html and java
sure, what's your issue?
I think ?ask fitted more
Prolly, but the new to java got me
ive never met someone younger than 40 who wasnt new to java
what
suck java
im trying to make an plugin that shows how many blocks you have travelled, basic, just for testing, but i got stuck here and don't know what to do now.
1 sec
?paste
(for your code)
ok
that's the class that i used for listening
if you need the main tell me
iv'e searched a bit but din't find in the javadocs something that shows how to show steps count
Well from that class, I can surely say that it will just do nothing but send a message on player join
So the issue lies within the playerMove method?
yes
and save the player to a variable when they move
Well ok but that's not really anything kek
the message on player join is fine
You gotta do something with it haha
lmao
Check if they moved to another block, and add 1 to some sort of counter (something like PDC or Map)
so you can keep track of the player and compare the move event's from and to see how much the moved and add it to their total
exactly
so which part are you unsure about
how to get the steps count and how to broadcast it to the player
thats all parts
first of all, you dont take steps in the game, you just move a certain distance
the move event has the position they player has moved from and where they moved to
The game already keeps track of how far you’ve walked
i don't want it to be useful, just to learn
I remember something like that but I can't find the statistic
well i dont think there is a certain one for general distance
its usually like distance walked or distance flown or something like that
or distance walked underwater
i think that in-game it is blocks traveled or smth
PlayerMoveEvent has the methods #getFrom and #getTo which you can use to compare player movements, ie: detect when they move a block. Use those two methods to determine when and how far a player moves
yeah there is no blocks traveled
I suppose youll have to add all distance by x statistics
to get the true distance traveled overall
but its not very customizable
You could also reinvent the wheel and store that data to a yml or something
like you wouldnt be able to know if it was vertical or horizontal movement or something
so it wouldn't count if i traveled in Y, but if i added to count Y and X it would count the blocks twice?
event#getFrom#getBlockY for vertical movement no?
It's too inefficient for a 2TB world and there is no good way to load chunks manually I think
i just want horizontal
well im saying that statistics count all movement, on all axes
so you have to use the move event pretty sure
and then ignore the y
yeah I was saying its impossible with statistics
event#getFrom#getblockX/Z and event#getTo#getBlockX/Z to calculate how far they've moved then
Ah gotcha ok
Sure, a lot of the time we like to pass around a "try it and see" so just play around with that for a little bit and see if you can get it working
?tas
how should i create a connection to my database? should i create a plugin that will handle all communication between every other plugin and the database
My friend needs help with BukkitRunnable, he can't figure out what the null(placeholder cause he can't figure it out where it says change this, we tried to put "this" but the runnable isn't in the main class its in its own class called playAnimation
public void doAnimationLoop(ArmorStandClass stand)
{
new Thread(() -> {
new BukkitRunnable()
{
@Override
public void run()
{
Iterator<StandBodyPoses> iterator = stand.savedPositions.iterator();
while (iterator.hasNext())
{
as.setWholeBodyPoseFromPose(iterator.next());
long time = iterator.next().duration;
}
}.runTaskLater(null /*<-- change this */, 20L * 30L );
if (as.isLooped)
{
doAnimationLoop(stand);
}
}).start();
}
The plugin iirc
Have you tried di for the main class?
are there good ways to make an item stack harder to dupe?
your friend? i thought it was you
also why are you STILL doiing threads
Lmao didn't notice that
?scheduling please just read this and re-think what you are doing
That's some awful code
and yes null should be replaced with the instance of your main plugin
.
nono Im trying to help my friend, they said they're using threads cause without itll override the server
what
????
your dear friend has no idea what they are saying
wtf
if you allocate a thread, then either way allocate a bukkit runnable that runs synchronously, you're only making your code MUCH worse, less maintainable, heck, maybe even much slower and use more resources.
Why don't they join themselves
and i bet my life that the friend in question is you
Ill invite them
It's still ran on the main thread aint it?
yep
this code just speaks "hey, run this task in a thread, the task is you're going to tell the bukkit scheduler to execute this SYNCHRONOUSLY after (20 * 30) ticks"
hi im the loser that has no idea what he's doing with this
yep
you are using an actual iterator to iterate
is this decompiled code or are you an npc
also you are calling next() twice in here is this intentional
for(StandBodyPoses pose : stand.savedPositions) lol
yeah..
Are you sure
ive done C# for 1-2 years
c# != java
and I've been doing this for over a month now
c# has some abhorrent naming conventions too lol
I do not wanna see more code of yours lol
you know.. you can apply custom settings to an iterator.. sometimes to do that, you need to use the iterator directly.
like in my libraries
yikes you sound offended fr
I'm offended by that atrocious code, yes
is this a bad way of doing this?
cancelTaskForPlayer(player);
Inventory inventory = player.getInventory();
BukkitRunnable task = new BukkitRunnable() {
@Override
public void run() {
for (int i = 0; i < inventory.getSize(); i++) {
ItemStack item = inventory.getItem(i);
if (item != null && item.getType() == Material.ECHO_SHARD && item.hasItemMeta()) {
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains("§aʀᴇʟɪᴄ ᴏꜰ §3§lᴛʀᴀᴠᴇʟ")) {
tickTravelTask(player, getRLevel(item));
}
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains("§aʀᴇʟɪᴄ ᴏꜰ §c§lᴇᴍʙᴇʀ")) {
tickEmberTask(player, getRLevel(item));
}
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains("§aʀᴇʟɪᴄ ᴏꜰ §6§lᴛʀᴇᴀsᴜʀᴇ")) {
tickTreasureTask(player, getRLevel(item));
}
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains("§aʀᴇʟɪᴄ ᴏꜰ §1§lᴍᴀss")) {
tickMassTask(player, getRLevel(item));
}
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains("§aʀᴇʟɪᴄ ᴏꜰ §4§lᴄᴏᴍʙᴀᴛ")) {
tickCombatTask(player, getRLevel(item));
}
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getDisplayName().contains("§aʀᴇʟɪᴄ ᴏꜰ §2§lᴛʀᴀᴅᴇ")) {
tickTradeTask(player, getRLevel(item));
}
if (item.getItemMeta().hasDisplayName() && item.getItemMeta().getCustomModelData() == 10) {
item.setAmount(0);
}
}
}
}
};
playerTasks.put(player, task);
task.runTaskTimer(WardenRelics.getInstance(), 0L, 5L); // Repeat every second (20 ticks)
}```
what settings ?
yes
?pdc
if (x == y || !(x == y)){
System.out.println("You lost!");
}```
I saw something like this the other day kek
How could i improve?
use this
wtf
and use a switch statement
pdc and map
isn't that if(true)
yeah or just a map
Yes lol
also
what are those
are there good ways to make an item stack harder to dupe?
that's my og question
I had to resend it :P
lol
what makes them easy to dupe now
I mean they are dupable
when have they not been
huh?????????
Couldn't tell you
yes.. is there like.. ways to make it harder for it to be dupable?
friend came to me for some syntax help and thats basically what he sent me lol
like how could a pdc improve it?
you dont have to check for display names
i wonder if there is a pair of values such that x == y || x != y is false
maybe Double.NaN
I can rename your item in an anvil and the code would break
probably in java script
yeah
Reminds me of a really cool quote
so could that be lagging the server out as i tested it with 8 ppl and its realy laggy
"javascript is as similar to java as a carpet is to a car"
that might be because of the tasks, but hard to say
You don't have carpet in your car?
LMAO
Poor
nvm im dumb
no fcking way
the whole code is just about those tasks
I do, but a carpet is not similar to a car
i put && instad of ||
Ohhhh
and depends on what the ticking methods do
yaeh that wouldn't work bc this returns true
I know I was just being goofy
I already thought you're shchewpid
?paste
its rly bad code ive been told this is my first plugin
https://paste.md-5.net/ininarahor.cs
you've been told?
or have you been told that this is your first plugin?
Readability = 0
no ive been told its bad code
- extract this into its own function since it's common (used 4 times)
alright
I don't :>
they sometimes get duped
- all your code is inside the
if (player != null)so to improve readability just invert the statement (if (player == null) return;) and then put all the code outside of the if
- this is bad as you've been told bc you should use pdc and not names for custom items
if(player.isSneaking()) {
Location loc = player.getLocation();
growCrop(loc);
}
This gets repeated in every case, just put it before the switch condition.
not in every case
like this?
sorry I wasnt talking to you
Make a new boolean method that returns true/false based on the sneaking then you can just do if(isSneaking(player)) or something
why
it can be made a static method
to improve DRY
yes i've mentioned that
So you get to practice readability and expandability
Better to just make everything an object I mean
changing player.isSneaking() to isSneaking(player) is not improvement..?
no.
am i the only one here thinking you should just be using a record for everything
it's worse than improvement
It's already a method yes it makes no sense to I'm just saying in the sense of understanding OOP principals
you shouldn't use a record for everything
there is literally no need for that
some things need to be mutable
I already said so yes
.isSneaking() is perfectly fine
kk
why is this red?
why is this whole part not outside the case?
non static method from static context
what case does it not get repeated in
you are accessing a non-static method from a static method
look at default
it breaks immediately
are there more levels than 1 through 5?
I just mentioned because it's good practice to think in the way of "everything is an object"
yes.. that's what java is
the switch is probably complete but just has default for no reason
everything IS an object
if you have level 0 you shouldnt be in this function period
That's the point I'm trying to make D:
so just remove default?
ok this code is making me dizzy idek what is happening here imma go work on my stuff instead
why not just have a record for the custom item, with a BiConsumer<Player, ItemStack>, a method to validate the PDC and whether the player has to be sneaking or something
???????????????????????????????????????????????????
no
exactly
Yes we need another dev log 😛
so default is not needed if this covers all your cases
okay maybe not a record but you get the point
but that has nothing to do with static
if they are.. you know, in the inventory, they cant sneak
also why do you need this functionality in the first place
i don't know the whole context here
use the pdc
any reason for using Integer not int
theres and error when i use int
so show the error
I mean better I guess, if you do the same thing in all switch cases, does it really need to be in the switch?
nvm im stupid capital letters
but yeah anyways, unless you change the display name check I can easily get myself a level 4 item with just an anvil
well and color codes idk if thats possible
but thats besides the point
I hate that the isSimilar method in spigot compares durability as well
i think i do a check for custom model data somewhere
what white line
the character guide?
okay, custom model data is not the same as pdc though, so be careful still
public static boolean isSimilar(ItemStack heldItem, ItemStack customItem){
if (heldItem == null && !heldItem.hasItemMeta()) {
System.out.println("held item is null || held item has no meta");
return false;
}
ItemMeta meta1 = heldItem.getItemMeta();
ItemMeta meta2 = customItem.getItemMeta();
if (meta1 == null || meta2 == null) {
System.out.println("held item meta is null || custom item meta is null");
return false;
}
if (!meta1.getDisplayName().equals(meta2.getDisplayName())) {
System.out.println("held item name is not the same as custom item name");
return false;
}
if (!meta1.getLore().equals(meta2.getLore())) {
System.out.println("held item lore is not the same as custom item lore");
return false;
}
PersistentDataContainer data1 = meta1.getPersistentDataContainer();
PersistentDataContainer data2 = meta2.getPersistentDataContainer();
return data1.has(customItemEffects.getRegisteredKey("CustomItem"), PersistentDataType.STRING) &&
data2.has(customItemEffects.getRegisteredKey("CustomItem"), PersistentDataType.STRING) &&
data1.get(customItemEffects.getRegisteredKey("CustomItem"), PersistentDataType.STRING)
.equals(data2.get(customItemEffects.getRegisteredKey("CustomItem"), PersistentDataType.STRING));
}```
This is what I did for itemstack comparisons kek
you can improve this code like 3 times more probably if you had an int of the level on the item
settings > editor > code style > visual guides
as well as the item type itself
ew display name comparison
lemme try thanks
but... also pdc?
why turn off the line, its the "you fucked up" line
tf
wow minecraft is making me have fun
type + pdc is all thats needed imo
bro can NOT disconnect
Gotta make sure it's EXACTLY the same item
yea
anything beyond that is means you messed up
yea its for reformatting which i don't like
this happens when i JOIN
kekw
Cannot have any discrepancies
i mean you could also just use a registry or something
What do you think I did shortly after writing that shit?
deleted that shit
All of the above kek
its optional
so how should i disable it
??
this is not isSimilar this is isEqualDownToTheBone
I know
if I want to keep track of players then I should use UUID right?
what the fuck does that mean
no fucking clue
I was just pissed that spigot compares durability
But then I thought "Oh why not just fcking cache my items duh"
needed to infer the fucking type
problem is that I need the player instance at some later point for sending packets
The type only matters to me when it's deciding weapon abilities ie: level one Widows blade is a wood sword, level two is stone, etc etc
But then I redesign and switch to registry and compare pdc
oh right bc you are returning an object : UIFont and kotlin is like "wtf is that??? this is only known locally in this function"
should I just live with calling Bukkit.getPlayer?
So long as the player is on server yeah I'd think
i love having the type ???
like bro i'm just confused as you are
yeah I would need to remove the player on leaving the server from the set anyways
lmao
Sounds like #getPlayer works fine then
object : UIFont is simply a local class and kotlin cannot infer that you mean buildMap<Double, UIFont>
I am depending on spigot 1.21 and for some reason the Attribute class is not being recognised in my IDE, any ideas what I might be doing wrong?
Update IJ
update it
Ahh gotcha, was just making sure there wasn't some surprise refactoring or something aha
Should just need an update
This might take a while, turns out this laptop is still on IJ 2023.1 💀
I just reinstalled IJ kek
I use toolbox so it auto updates 
Same
toolbox >>>
how should i create a connection to my database? should i create a plugin that will handle all communication between every other plugin and the database?
rather have a webservice or smth
How does a server detect which plugin to replace when it is updating all plugins under the /plugins/update folder?
how to properly add testing to a plugin? In this case its a plugin library for other plugins to use
to test what
Depends on what it is, mockbukkit is a testing tool for plugins
well and it uses packets
name in plugin.yml?
It’s just the jar name
okay ty
There’s a pr to use the plugin.yml name but I don’t think it’s merged
you must do Runnable {}
kinda sucks you cant use last parameter as lambda, just write an extension method id say
thanks
i got my ```kt
runTask(1200) {
removeInvoice(invoice.uuid)
}
i personally would use Durations
yeah fair
We still can't figure this out, it overloads the server, we don't need criticism we just need help like everyone else here does. We are trying to play armor stand animations
public void doAnimationLoop(ArmorStandClass stand)
{
new Thread(() -> {
Iterator<StandBodyPoses> iterator = stand.savedPositions.iterator();
while (iterator.hasNext())
{
//long time = iterator.next().duration;
new BukkitRunnable()
{
@Override
public void run()
{
as.setWholeBodyPoseFromPose(iterator.next());
}
}.runTaskLater(Plugin.getInstance() /*<- add thing*/, 10L * 2L );
}
Whats another way to do it
there is literally zero point to that thread
So just get rid of it in general
yeah probably
bruh just dont spawn a new thread and more tasks inside
like what on earth are you trying to do?
just remove that thread and use BukkitScheduler::runtaskRepeating or whatever its called ig
so, its a armorstand animation plugin, this is the play command so when you do
/armor play name itll play that animatronic through a array list
im looking through my IJ warnings and I get "suspicious call to List.contains"
what does that mean?
context?
BingoParticipant player = teamManager.getPlayerAsParticipant(event.getPlayer());
if (!enabledPlayers.contains(player)) return;```
more context
enabledPlayers is a list of subclasses of bingo participant
enabledPlayers a set?
any useful quick fixes?
no, just Inpsection of "sussy warning"
hmm
Reports method calls on parameterized collections, where the actual argument type does not correspond to the collection's elements type.
so typeof enabledPlayers is List<BingoParticipant>?
thats what it says
contains takes Object, thats probably the issue
well you have a list of subclasses and youre seeing if it contains a base type??
right?
@EventHandler
public void onPlayerSendMessage(final AsyncChatEvent event)
{
BingoSession session = getSession(event.getPlayer());
if (session == null)
return;
TeamManager teamManager = session.teamManager;
BingoParticipant player = teamManager.getPlayerAsParticipant(event.getPlayer());
if (!enabledPlayers.contains(player)) return;
BingoTeam team = player.getTeam();
if (team == null) return;
sendMessage(team, event.getPlayer(), event.message());
event.setCancelled(true);
}```
not really
its just a List of BingoPlayer
BingoPlayer implements BingoParticipant
so BingoPlayer is a subclass of BingoParticipant?
yeah
ah
well just what i said
youre storing subtypes and checking contains with a basetype
that basetype might not be a subtype when casted
well
a l aList<Integer>.contains(Number)
then it wont be contained in the list
so whats the problem
its like really pedantic
equals impl doesnt take care of comparison with basetypes
okay I just added this if (!(player instanceof BingoPlayer) || !enabledPlayers.contains(player)) return;
now it stops crying
makes sense