#development
1 messages ยท Page 59 of 1
yeah let me just load every single class until i find the one that extends placeholderexpansion
kinda lol
i removed my standalone plugin subproject now, now it only creates an actual PAPI extension
you know what's funny
// If the last char was an escape, check if the current char is a backtick or an escape
if (lastWasEscape) {
// Two escapes in a row are actually two escapes in a row!
if (current == Parser.ESCAPE) {
lastWasEscape = false;
builder.append(Parser.ESCAPE);
continue;
} else if (current == Parser.BACKTICK) {
lastWasEscape = false;
builder.append(Parser.BACKTICK);
continue;
} else if (current == Parser.UNDERSCORE) {
if(!inBackticks) {
builder.append(Parser.ESCAPE);
// Don't continue! I mean, do continue...
}
} else {
lastWasEscape = false;
builder.append(Parser.ESCAPE);
builder.append(current);
continue;
}
}
Not calling continue means it continues with the code lol
Least horrific imperative parser
oh damn I thought I totally fucked up. Making it able to parse \ in unescaped strings without double escaping the \ char broke 4 tests. Adding a single ! to a condition in the parser fixed it lol. I will never touch this again
I think it's working fine now. If anybody is bored, I'd love it if someone could find a flaw in my parser by coming up with a test that breaks it https://github.com/mfnalex/PAPI-Replace/blob/master/core/src/test/java/com/jeff_media/papistringreplace/TestReplacer.java
Which GUI api would you guys recommend? I remember someone in here that developed one but cant find it
triumph gui or @leaden sinew's
i used it once, didnt like it more than triumph
RedLibs is also really good
this is my debugger:
[01:21:25 INFO]: [Marry] [STDOUT] Divorce method called for player: OhLqvely
[01:21:25 INFO]: [Marry] [STDOUT] OhLqvely is married.
[01:21:25 INFO]: [Marry] [STDOUT] Partner for OhLqvely: null
[01:21:25 INFO]: [Marry] [STDOUT] Error: Partner is null.
https://paste.helpch.at/pibekuhono.typescript
private static Player getPartner(Player player) {
String partnerName = getMarriagePartner(player);
if (partnerName != null) {
}
return null;
}
```you always return null
Ideally you should be storing UUIDs, not player names, because if the player changes their username, the other person's going to end up being married with a non existent partner ๐
but if you want to use names, you can use Bukkit.getOfflinePlayer() (although not recommended)
I'm so dumb
you are right
;s
UUID are always better then playernnames
and I forgot it
I changed it into UUIDs but It still gives me null
marriage plugin????
i dabbled in making a marriage plugin a lil while ago
and?
idk just excited it's a meme in my friend group
you can browse my project for inspiration https://github.com/Ivan8or/MessyMarriage
i took a novel approach where instead of only tracking marriage player pairs, i have a stat called amiability; any two players that are nearby each other have an 'amiability' with each other that changes depending on how they interact
I can't get it to work to read my partners to divorce
I think my plugin does't like people divorcing
Do you have a spigot page on it
no it's not a public plugin
at least not one with a spigot page
the code is open source tho
that's one form of interaction
it's very broad
for me i tracked stuff like if they slept in adjacent beds, ate food at the same time, damaged / killed each other
etc
Yeah I want to work with a point system if they are near each other if they do the same stuff etc
yeah my project does that
i think for you tho the foremost thing you should consider is using something like this to track player pairs
static UUID generatePairID(UUID a, UUID b) {
// upper halves of each uuid
long ah = a.getMostSignificantBits();
long bh = b.getMostSignificantBits();
// lower halves of each uuid
long al = a.getLeastSignificantBits();
long bl = b.getLeastSignificantBits();
// long multiplication conveniently overflows so as to fit perfectly into the result UUID
return new UUID(al*bl, ah*bh);
}
basically this is a communative way to associate two player ids with a marriage/pair id
aka it doesn't care if you mix up the order of players, you still get the same marriage id as a result
very powerful because now you won't have to worry about tracking the same data twice or having to use if statements weirdly
how would you "decode" it tho?
if you don't have either pair
i find there is rarely a need to, but if you want you can just have a map that goes from marriage ID to the pair of players
wait wdym either pair
without either player
so like you only have the marriage id?
yea
then yeah you need to call a method that looks it up in a map or something
but you'd have to do that anyways
that kind of defeats the purpose
this just makes the direction of player1, player2 -> marriage better
with basically no downside
Map<UUID, Marriage> with entry for both players xD
eepy
big reason for doing it the way i have described is if a player can have multiple relations at once
which is unavoidable if there's going to be something like amiability between people
tbh its almost at that level
and the moment other people's amiabilities get involved it will be at that level
man maybe i should start work on this again
Does anybody know how to disable DamageTicks?
Im trying but im getting nowhere and I just wanna disable it entirely since im using custom plugin guns.
package com.koboyashi.disableiframes.events;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public class Disablediframesevents implements Listener {
@EventHandler
public static void hitByProjectile(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof LivingEntity) {
LivingEntity damagedEntity = (LivingEntity) e.getEntity();
//set damage
damagedEntity.setNoDamageTicks(0);
damagedEntity.setLastDamage(Integer.MAX_VALUE);
}
}
}
Could just use EntityDamageEvent so it's all the damage events rather then specific.
replacing hitByProjectile ye?
Yes
Ill try that and see if it works
still not working, I can combo by hitting with my shotgun and then shoot but not all of the pellets get registered, only 1.
im not sure but I think its not telling the server to disable the iframes.
package com.koboyashi.disableiframes;
import com.koboyashi.disableiframes.events.Disablediframesevents;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
public class Disablediframes extends JavaPlugin {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new Disablediframesevents(), this);
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "No IFRAMES is enabled.");
}
@Override
public void onDisable() {
getServer().getConsoleSender().sendMessage(ChatColor.RED + "No IFRAMES is disabled");
}
}
Maybe I miss read your initial question. I thought you wanted to disable all damage except your custom damage.
Could you explain what exactly you're trying to do?
Im trying to disable iframes entirely
so custom dmg (like my shotgun for example) can land all of the pellets
instead of just 1 pellet.
Because im making an Zombie Survival Server as i've been researching all the ways to get other items if i disable skeletons, creepers, enderman, phantoms.
If I could send it, I would send a demostration of what the shotgun does rn.
You can use Imgur
i had to do a double take, for a moment i thought you were recommending imgur to fix the iframe issue
Could you explain?
For the demonstration
Lol
oh lol, yeah sure ill post it
but its gonna take a while im busy
What do you mean iframes?
What you can do is add data to the pellets (arrows, snowballs etc...) and on the entity damage only cancel if it's not the pellets you saved.
Invincibility Frames, making all the damage register instead of 1 source.
Oh I think I get what you're saying now. So not all of the pellets are running the event?
isnt there a way to set the invincibility duration within the damage event
or am i misremembering
@leaden sinew
have you tried setMaxiumNoDamageTicks(int)?
would you explain im not in best of state atm
well you seem to only use setNoDamageTicks, when setMaximumNoDamageTicks also exists
so if its set to 0, iframes will be removed?
i would assume so, would mean that the internal counter wouldnt beable to tick up
Maybe try -1?
tho if that doesnt work, you could calcuate how many projectiles actually hit the entity and just times the damage by the quanity of successfully hit bullets
tho id try different values then just 0 like yapperyapps said
also else fails the method i suggested moght work well enough
This worked.
but I dont know why people just hadn't made this as an plugin?
What do you mean?
Well the reason why i did this is because I couldn't find a plugin at all, only leftover code, about disabling iFrames
going back to like 2008 and 2011
yeah sorry, but ill post it here
so everyone can use it, So i can put it to rest FOREVER.
Im going to rest, I need the mental health recharge.
https://www.spigotmc.org/resources/disable-iframes.112341/
just call them invulnerability frames ๐ซก
iframes is a pretty common term
what is this
does it actually work aswell?
apple?
if so glad i pointed you in the right direction
Yeah it actually works, lemme show you
no
what do you mean no
one singular problem rises, lava is now just insta killing
set invincibility ticks differently for stuff that isnt your bullets
makes sense
since you removed the iframes, you will have to add them back for all other instances
nah im just gonna add fire-resistance totem that makes you able to walk in lava and fire
modern problems require modern solutions
nah slime its just fun
Wot
what's wrong slime
Uh
lmao
term of endearment
Is there a way to only apply CSS styling if the element has specific classes and only those?
Like in my case would I like to only apply some formatting if the classes of the element are foo and bar but not f.e. foo, bar and foo-bar
.foo.bar { ... }
that'll also apply if theres .whatgoesafterbar, wouldn't it?
It does
oh yeah I misread
try this
idk how to combine it with two classes but
ยฏ_(ใ)_/ยฏ
wait
yeah
.foo.bar:only-of-type
right?
Nope. doesn't work
Did you find a working solution?
Yeah. It's what I mentioned here
Weird question, (avoiding invisible entities + teams) is it possible to show the item frame floating text (when looking at a named item inside an item frame) but like... when not looking at an item frame
For example (https://prnt.sc/9ZRIrdZi4CHw), I'd like to be able to look at the sign above, and see the floating text, but only when looking at the sign. I don't want to have the item frame below.
I've tried placing an invisible item frame behind the sign, but its not triggered for the player because the sign is in the way.
I know I could spawn a named invisble armor stand, or zombie or whatever whenever a player looks at a sign, and if I only want the player to see the text i could put the player and named entity in the same team and hide other nametags, but I'm trying to avoid this as im using teams for a seperate function.
Trying to learn how to use abstract classes better, is this correct usage? https://paste.helpch.at/avonavicob.java
no it's not
doing this stuff in the child class seems redundant
this.main = main;
this.fileName = "kits";
this.path = path;
setup();
since you're already calling super() which would already do it for you
Just not sure how else to access those variables in the child class then
Ohhh it needs protected access right?
the variables you have declared in the abstract class carry over to the child class, so even though you don't explicitly redefine them you can still access them
Yeah the issue was that they were private lol
that would do it yeah
- The access modifiers inside the base class should be
protected, notprivate. You inherit the properties of the main class, so you want to be able to access them. - You should avoid using the same variable names for the parent and the child class.
- You should not override the static fields.
public abstract class ConfigFile {
protected static final Logger LOGGER = LoggerFactory.getLogger(ConfigFile.class);
protected final JavaPlugin main;
protected FileConfiguration config;
protected File file;
protected String path;
protected String fileName;
public ConfigFile(JavaPlugin main, String path, String fileName) {
this.path = path;
this.fileName = fileName;
this.main = main;
setup();
}
}
public class KitsConfig extends ConfigFile {
private final Map<String, Kit> kits = new HashMap<>();
public KitsConfig(JavaPlugin main, String path) {
super(main, path, "kits");
}
}
The FileConfiguration shouldn't be static then I assume?
protected logger ๐คจ
Also yeah how should the logger be setup?
apart from the field order, the loggers were fine
well I'm not sure what's the point of the custom logger, just use Bukkit.getLogger()
first step would probably be not using the bukkit config stuff
noooooooo
use the plugin logger
not bukkit's logger
isnt that the same
no
What then?
idk never cared enough
Also I'm just using it to learn rn mostly
wait what's the difference
the loggers are fine though
I prefer understanding how it works before using a potential API for the configs
it doesnt rly matter if u use a per class logger or ur plugins logger
just dont be misleading by logging to someone elses logger
jackson, configurate, whatever
logging to ur own logger has a prefix
Would that also be true when using an abstract class logger? Or how should it then be setup?
and then you model your config in code, not weird inheritance things mixed with static state and low level impl details
yeah, thats why i said it was fine and shouldnt be abstract.
sure
honestly i think it's fine, for now at least. they said they're still learning stuff and i'd say that bukkit's configuration api, while not great, is definitely simpler than other ones like the ones you listed that use "fancy" things like reflection and annotations
What do you mean?
well that's just an unnecessary method
Is it automatically using the super method?
Ig it is
So this would be a decent setup?
Abstract class: https://paste.helpch.at/wixazexoti.typescript
Child class: https://paste.helpch.at/uvijapuhef.typescript
are you sure you want the child class methods to be static
Oh not the config actually, but the logger yeah I think so
Wait yeah it should be static no?
Im not sure lol
no i meant your getKits() and isKitEnabled(String kit) methods
Ohhh
like i guess you could make them being static work but it seems a bit scuffed
I don't see any reason why not honestly
imagine you try to call those methods before the constructor is ever called
since they're static that would be allowed, but the member variables are still undefined
if they weren't static you wouldn't be able to find yourself in that situation
Ahhh yeah that's true, thank you
Changing it now
I should have a config manager that gives the instances of the config classes though right?
Instead of using dependency injection whenever I need one config class
if you want you can have probably have one class that holds all the individual config classes yeah
idk your exact situation but that seems fine
you'd still want to use dependency injection for the manager class tho
just because good practice
the setup method should be private
Preferably I want this config "util" to work in other projects as well, so I can just copy it over there without much configuration
True, ty
Yeye ofc
though loading files in a ctor generally isn't best practice I guess
"just because good practice" doesn't help much
ctor?
constructor
I mean, you generally want to separate file loading logic from config data
because data should just be data
And a constructor should just load data?
a constructor's responsibility should always be only to initialize the fields and prepare the class to be used (that doesnt mean using any setup/init methods), it should never to any complex operations or loading any data on initialization
no, a constructor should be as simple as possible, basically
so you rather have a separate class that handles the file loading logic and then creates a simple data object
woah is that a factory reference
But this can't really be extracted from the abstract class?
public void setup() {
InputStream stream = this.getClass().getClassLoader().getResourceAsStream(fileName + ".yml");
if(stream == null) {
return;
}
file = new File(main.getDataFolder(), fileName + ".yml");
main.saveResource(fileName + ".yml", false);
config = YamlConfiguration.loadConfiguration(file);
}
Changed it to public because it's removed from constructor
I mean I'd generally just not use abstract classes whenever possible
How come?
inheritance often brings more problems than it solves, composition can often be used instead. You might need to rethink things this way, but often the result is more clear than inheritance
might I ask why are you using InputStream stream = this.getClass().getClassLoader().getResourceAsStream(fileName + ".yml");?
Got it from someone yesterday, in his config class. Not entirely sure why honestly... But the config is loaded now at least
I see, what's composition though?
ngl i do that too
that way it works whether it's in the IDE or a jar
in the ide?
yeah if i'm running my code from within the IDE
so in the cwd?
Ohhh I'm not doing that but I'll just keep it if I'll do it in the future
getResourceAsStream only works on the class loaders resources
which in most cases is the files inside the jar
it just means a class that uses other objects
so rather than KitsConfig being a ConfigFile, it would use a ConfigFile
for example, you might define ConfigFile as a concrete class with methods similar to FileConfiguration, and then define KitsConfig to take in a ConfigFile and uses it:
class KitsConfig {
private final ConfigFile config;
public KitsConfig(ConfigFile config) { this.config = config; }
Map<String, Kit> getKits() {
// TODO: use the config in some way
}
}
this way, if we want, we can swap out the ConfigFile for some other version, like a test double or something else
Hmm I see, but I think I still prefer using abstract. Easier to troubleshoot I think but not sure
Thanks for explaining it btw, makes sense now
even if you don't end up doing that, at the very least i'd recommend sorting out that KitsConfig class
the way youre using static is just asking for the class to be misused
it's also kind of weird that you're loading the config field by instantiating a class
you might wanna look into the basics of oop before diving into some more intermediate things like abstract classes because it doesnt seem like its there
I feel like I do know the basics of oop, this is what I currently have
Abstract class: https://paste.helpch.at/pilexedoju.typescript
Child class: https://paste.helpch.at/uraqijijaw.typescript
looks like you just copy pasted the ConfigFile from M0dii and quick fixed the errors ij gave you
Well yeah, it is, but can't see how else it would be
yes
because you don't know the basics of oop
kits is still static. if you understood oop, you would've changed that as well
Didn't notice that... I know it shouldn't be static now
Where would you recommend I learn oop then? I thought I did but yeah
sure, there are online courses and what not, though it's not nearly the same as having an entire education course for it
๐
Education Course is not necessary
I never said it is neccessary
fair
but from personal experience, my work colleague never went to a college or university and instead went the 'online course' route and now he's struggling with basic concepts
online learning will only get you so far, though usually depends how much effort you put in (of course that applies to education too)
ngl my friends who went through uni with me also struggled with basic concepts up until the very end
imo biggest factor is just sincerity
One last question and I'll leave you be. If I have a manager class to dispute the config instances, how should that be done? I guess this would be bad lol
private static final Map<String, ConfigFile> configFiles = new HashMap<>();
public static ConfigFile getConfig(String configName) {
if(instance == null) {
LOGGER.error("Method cannot be called before class is initialized");
return null;
}
return configFiles.get(configName);
}
The null check to make sure the manager is actually instantiated
yeah, I know some people too that went to uni with me that didn't do good in programming
and that's usually because the person is not, let's say, 'meant' for it
Ig idk
i think this is a decent opportunity to use enums
true
(can't add reaccs) 
Dont make it static your good
why not
Like call it a ConfigRegistry or more valueable name and youre done
well, it's a getter, so there shouldn't be any more logic to it, but you could instead create a method, idk, getOrCreate, where instead of returning null you could instantiate it instead
though it really depends on your overall implementation
Then I risk it getting instantiated twice though
Wait no I wouldn't, thanks
honestly just learn SOLID. it forces you to right somewhat object oriented code and on top of that, once youve learnt it, youll be able to right pretty descent code

I've looked at the model many times, and mostly understood it I just forget it, or probably dont understand it well enough lol
Any recommended guides for it?
a lot can be recommended
You gotta understand the benenfits it gives you
Also is this alright then?
private static final Map<ConfigRegistry, ConfigFile> configFiles = new HashMap<>();
public static ConfigFile getConfig(String configName) {
if(instance == null) {
LOGGER.error("Method cannot be called before class is initialized");
return null;
}
return configFiles.get(ConfigRegistry.valueOf(configName));
}
public enum ConfigRegistry {
KITS
}
Wait
Adding this
nah thats not what I meant
I can recommend you an one page article that gave me the general idea of it and that was enough for me, but maybe you'd need way more than that
just google and see what works for you
if you really wanna learn SOLID and have it stick, unit test as well. it directly shows you why what youre doing is beneficial
How would it be unit tested though?
consider changing getConfig to directly accept an enum as the argument
Ah yeah, good idea
Before you guys told me to seperate data and logic from constructor, but I don't see how that would be possible without making things worse here.
private ConfigManager() {
main = BossEvents.getInstance();
config = main.getConfig();
instantiate();
}
private void instantiate() {
setupConfig();
new BukkitRunnable() {
@Override
public void run() {
saveConfig();
}
}.runTaskTimerAsynchronously(main, getInt("config-save-interval") * 20L * 60L, getInt("config-save-interval") * 20L * 60L);
}
public static ConfigManager getInstance() {
if(instance == null) {
instance = new ConfigManager();
}
return instance;
}
I setup the instance in the main class like this configManager = ConfigManager.getInstance();
This way only getInstance() has to be static
public enum ConfigType {
MAIN("config.yml"),
KITS("kits.yml");
// + Getter
private String fileName;
ConfigType(String name) {
this.fileName = name;
}
}
public class ConfigManager {
private static final Map<ConfigType, ConfigFile> configFiles = new HashMap<>();
public static ConfigFile getConfig(ConfigType cfg) {
if(instance == null) {
// This shouldn't happen and there's an issue with the code. Though not sure why you need to check if the instance is null here. Consider only checking the return of the method, because the instance can be not null but the returned ConfigFile can be null too.
return null;
}
return configFiles.get(cfg);
}
}
consider this.
of course this is just a rough idea what you can do, it really depends on your whole implementation.
look into https://www.baeldung.com/junit-5
Thank you. Regarding the instance null check, wouldn't it give an error if I tried running configFiles.get(configType); before the class has been instantiated?
static access has nothing to do with class being instantiated
Oh yeah because the map is static anyway, mb
if all your public methods in the manager are static, you will only access it by class name ConfigManager.blah()
Guys it me or on runTaskTimerAsync is creating another thread at each executions ? ๐ง
It should
I mean wouldn't it be better if it just kept one thread and execute things on it ?
Like a single async thread
In terms of minecraft, yes. In terms of optimization, no
i figured it'd be using a thread pool of some sort
Pretty sure it does
Because let me explain my situation, I got a plugin that needs to "tick" things that are a lot in the server and to tick those "things" I use one async timer per world
yeah in that case it's not like every execution makes its own thread
is that logic or is there some better way ?
but also no guarantees that only one specific async thread will forever be used
uh oh but running things async isn't automatically safe to do
I know but in my case it is
If it's async and everything is "async safe" you could make your own thread and handler.
Ok thank you, so you say if I use plain java it's ok right ?
If the scheduler isn't working how you want atleast.
Yeah. Just like I said make sure it's "async safe"
how do you know if you apparently don't know much about multithreading?
No I know about multi-threading, I just don't know about the async on bukkit
Np. I have a simple task handler if you want to get an idea of the use case...
I'm an experience developer don't worry
that's the basics
Basics of bukkit ๐
Let me repeat once more, I don't know about how the bukkit async work
I thought it would keep one thread per async timer
(What seemed logic to me)
there are docs which tell you what you can rely on, everything that isn't written down, you can't rely on
hey there i achieved to run this in IDE but not working outside it 
fun onEachResource(path: String, action: (File) -> Unit) {
fun resourceToFile(path: String): File {
val resource = object {}.javaClass.getResource(path)
return File(checkNotNull(resource) { "Path not found: '$path'" }.file)
}
with(resourceToFile(path)) {
this.walk().forEach { file -> action(file) }
}
}
onEachResource("templates/paper") // folder is in my main/resources folder
one thread per async timer would be a huge waste of resources
That's what I'm asking and it seems that at each "execution" it creates a new thread
At least that's why the answers I got told me
You might also check this, not very well documented that's the first place I went to
resources in a jar are not Files on the regular file system
Nvm thanks for your help
so is there a way to load files from resources
don't use the File api is a good start
i need to loop through folders and files i couldnt figure out streams in this situation
Pretty sure getResource() is an InputStream right?
Ah
getResource returns URL
there is getResourceAsStream
but as i said couldnt figured out looping files with it
if you want to loop through files, you should open the the jar as a zipfs
resources of classloaders are more general and not limited to local file systems
whats zipfs
Treat it like a zip file
fs=filesystem
FileSystems.newFileSystem(resource.toURI(), emptyMap<String, String>()).use { fs ->
Files.walk(fs.getPath(path))
.forEach { file -> println(file.toUri().toString()) }
}
i have tried something like this
is this the right direction
yeah
Files.walk(pathInJar)
.filter { Files.isRegularFile(it) }
.forEach { path ->
println("File in JAR: ${path.fileName}")
action(path.toFile())
}
paths are seems to be correct
but toFile not working obviously so how am i going to read, copy these files
make sure to .use the steam returned by Files.walk
Files.readAllBytes, newInputStream etc whatever floats your boat
nio my beloved
hey
i tried adding papi as a expansion but the placeholders dont work
i did everything like shown in the wiki
can someone help me if so dm me
or write here
if you did everything right then it should work
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class MyExpansion extends PlaceholderExpansion {
private final SwordFFA plugin;
public MyExpansion (SwordFFA plugin) {
this.plugin = plugin;
}
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public boolean persist() {
return true; // This is required or else PlaceholderAPI will unregister the Expansion on reload
}
@Override
public String onRequest(OfflinePlayer player, String params) {
if(params.equalsIgnoreCase("placeholder1")){
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
}
if(params.equalsIgnoreCase("placeholder2")) {
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
}
return null; // Placeholder is unknown by the Expansion
}
}
public void onEnable() {
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new MyExpansion(this).register();
}
}
Not Even this works
?codeblocks
Use codeblocks for formatting code or configuration files:
```<language name>
<your code here>
```
For example:
```yaml
test:
- โhiโ
- โthereโ
```
Produces:
test:
- โhiโ
- โthereโ```
please help:
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class MyExpansion extends PlaceholderExpansion {
private final SwordFFA plugin;
public MyExpansion (SwordFFA plugin) {
this.plugin = plugin;
}
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public boolean persist() {
return true; // This is required or else PlaceholderAPI will unregister the Expansion on reload
}
@Override
public String onRequest(OfflinePlayer player, String params) {
if(params.equalsIgnoreCase("placeholder1")){
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
}
if(params.equalsIgnoreCase("placeholder2")) {
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
}
return null; // Placeholder is unknown by the Expansion
}
}
public void onEnable() {
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new MyExpansion(this).register();
}
}
Not Even this works
does getPlugin("PlaceholderAPI") maybe return null? which placeholder did you try exactly? did you try with /papi parse? Does your expansion show up in /papi list?
Does your expansion show up in /papi list?
nope
did you add PlaceholderAPI as depend or softdepend in plugin.yml?
yes
then add some System.out.println("registered") or something into the if block in onEnable
check if it actually registers it
alright
are you sure you didn't get any console errors?
is it an expansion or is it inside another plugin
its for my plugin
did you register it
i think so
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new MyExpansion(this).register();
} you mean this?
does getPlugin("PlaceholderAPI") maybe return null?
add some System.out.println("registered") or something into the if block in onEnable
are you sure you didn't get any console errors?
like this?
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new MyExpansion(this).register();
}else{
getLogger().info("null");
}
yes
no errors yes
also did you maybe accidentally shade PlaceholderAPI into your plugin?
show your pom.xml / build.gradle(.kts)
FERDI long time no see
```java
put code here like this so that it looks better
```
System.out.println("tada");
also if you're wondering yes we have never met before
id 'java'
}
group = 'org.srino'
version = '1.19.4'
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
dependencies {
compileOnly "io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT"
compileOnly 'me.clip:placeholderapi:2.11.3'
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
i did it exactly like in the wiki
So what did this print?
Also add a System.out in case the plugin is not null
also double check the logs (go right to the start) to make sure there are zero errors
it might be that something didnt load properly
right at the start
Yeah does your plugin even show up in /plugins ?
yup
^
You shall print sth out in both the if and the else part
Why are you checking if 17 > 10? That build file is cursed lol
idk i didnt do anything there lol
ok i added the second loger if its not null
but its not printing anythin
that's why I asked you three times already to add more debug outputs
@Override
public void onEnable() {
getLogger().info("Trying to hook into PAPI...");
if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
getLogger().info("PAPI is installed, registering expansions...");
new MyExpansion(this).register();
} else {
getLogger().warning("PAPI is not installed, not registering expansions.");
}
}
if this still doesn't print anything, you simply are not using the correct .jar in your plugins folder
this MUST print something
What was the issue?
i was dumb lol
i was using a jar from another folder that was simply called the same
๐ฌ
Yeah thats what i figured lol
im so sorry for wasting your time
No problem lol
xDD
Happened to everyone once
it will never hapenn again xD
Which plugin dependencies does voteparty need? help please
nuVotifier or smth i think
Must be the classic copying and pasting blindly without knowing what it does
๐ฅฒ
Ah its IntelliJ mcdev plugin that adds this weird stuff
I wonder why it doesnโt just always set a toolchain
@dawn viper related to #general-plugins message I can't seem to find getNMS
I did find asNMSCopy tho
or asBukkitCopy
yeah those
the first one turns Bukkit's ItemStack into a NMS one, and asBukkitCopy does the other way around
ahhhh
seems like I have to use asBukkitCopy actually
hmm, would this work? java List<ItemStack> stacks = new ArrayList<>(); classImplementation.createInventory(stacks); stacks.stream().map(CraftItemStack::asBukkitCopy).forEach(stack -> { player.getInventory().clear(); player.getInventory().addItem(stack); });
I love the 'would/will this work?' questions
how about you try and find out? ยฏ_(ใ)_/ยฏ
I know I need to test it ๐
but it's a lot of work just to build it and then put it on my server and then start it ๐
what's the point of clearing the inventory on each iteration and then adding the item
it's for a sorta kit command, it replaces your inventory with spesific items
so if there's 10 items in the list, you:
- clear the inventory
- add first item
- clear the inventory
- add second item
... - clear the inventory
- add tenth item
?
Would this be slower than using the Bukkit API to deserialize an ItemStack to yaml? https://paste.helpch.at/ipidomuyod.java
maybe not slower but definitely worse
there are a lot of meta quirks for all the different items which require a lot of effort to fully cover
But if I don't use those, will it not then be faster?
i really dont think it's going to make any noticeable difference
even if it does, premature optimisation is bad
premature micro-optimisation is even worse
^^
hmm that is true
this should be better java List<ItemStack> stacks = new ArrayList<>(); classImplementation.createInventory(stacks); player.getInventory().clear(); stacks.stream().map(CraftItemStack::asBukkitCopy).forEach(stack -> { player.getInventory().addItem(stack); });
right?
looks better yea
if you're gonna use the :: stuff i bet you can do something like
stacks.stream().map(CraftItemStack::asBukkitCopy).forEach(player.getInventory()::addItem);
and really smoosh it into a one liner
ye, ended up doing that
this was originally from one of the things suggested for beginners
but I'm just expanding upon it just for fun
how do you people call your unused lambda params? I've seen __, TypeName, sometimes "unused", etc
public NamespacedKey getKey(final String key) {
return keys.computeIfAbsent(key, String -> new NamespacedKey(plugin, key));
}
__ works
or of course you make a full lambda util class with curry & const functions to write it in a point-free style
i dont think theres a formal name but yeah
usually people call it
$__unused
or just ignore it by keeping the default name
linters dont like $ usually
true that
a book I read suggests to use the class names, e.g.
(String, Integer) -> ...
but that looks horrible lol
yeah thats not nice
does that even work in java?
that doesn't seem like it would be valid code but i guess i've never tried it or looked into it
oh wow it totally works
yes sure, you can also do String String = "this var's name is cursed";
speciรคlรymbรถls are also valid
I've seen people use russian or turkish variable and method names ๐
prob cause they r russian or turkish ๐
var String = "Hello World"
would be weird if they weren't, yes lol
is the dev-general channel gone or however it was called
damn i just always assumed that class names were reserved i guess
this is kinda mind blowing to me
only primitives are
Theyโre reserved in real languages
does anyone know why PlayerEditBookEvent#getSlot() is deprecated?
"books may be signed from off hand"
What is the general naming convention for yaml files?
yeah its typically snake
Also for the file names?
yeah
I thought that was just the variable names but ig it makes sense
well as BM said there rly isnt one but ppl just use snake
Gotcha, thanks
noted that though i already used an external path rather then resources folder
thanks for the help
it also says that it returns -1 for offhand, so I dont see any issue
anyone knows why this happens? I cannot click on this message or anything. my checkstyle.xml looks fine to me https://paste.helpch.at/sabinoputa.xml
Folks, I am trying to find an API that allows you to input lon and lat and then returns the region. For example:
If I inputted: 48.8584ยฐ N, 2.2945ยฐ E it would return Europe
https://developers.google.com/maps/documentation/geocoding/requests-reverse-geocoding#reverse-example
Might be able to use this
Great find, but paid after some limits I believe.
OSM
aka openstreetmap, it has an api, totally free of use
Open source geocoding with OpenStreetMap data
well it outputs a country, not the continent
but it doesnt require any online stuff, so maybe it'd be worth it if you'd just create a map for country<>continent
Ah, I can get the country already using a diff API, I needed the continent more than anything.
100ms sounds like surprisingly long when you think about what it's doing
Like
Really really long
Prolly a hardcoded list of countries and their borders
https://paste.gg/p/anonymous/40456cd0c50246208ffc0ef1ed6f3cdc
I'm having some trouble getting this relational placeholder to work. I'm putting %rel_infiltration_color% as the placeholder
edit: nvm oops sorry for ping
edit #2: what are you using to test? (I have never used relational placeholders before but the code looks fine by looking at the wiki)
Is it possible to get which config file a placeholder was called? Or the configurationsection
I've got a kit / class setup where one class has one config file. And I want to check if a player has access using a placeholder. The expansion is setup for this, but I'm unsure how to get the kit / class name (just the file name or a string in the file)
@Override
public String onRequest(OfflinePlayer player, String params) {
if(params.equalsIgnoreCase("unlocked")){
return KitManager.getBePlayer(player.getPlayer()).ownsKit();
}
return null; // Placeholder is unknown by the Expansion
}
not sure what that means
So in this lore
lore:
- A kit made for testing purposes
- "&bThis kit will be removed"
- ""
- "%player_unlocked%"
The placeholder should show either "UNLOCKED" or "LOCKED", based on if the player has the kit unlocked or not
I hope that explains it better
everything is possible
it's not rocket science
you just have to have sufficient knowledge how to do it ๐
Yeahh lol but where does the placeholder get the file or section it has been used in?
Oh is it just this.getConfigSection("");?
It's apparently a thing in the expansion
onRequest will never know where it was called from, more specifically how do you thinl it will know that it exists in a file that is exactly in your filesystem
everything is loaded into memory, from that point there's no trace that placeholderapi parsed the placeholder that is in your config file
You said it was possible though?
didn't read into question enough, but why would you even need to do that
sounds like your structure is insufficient to solve your problem
I know I can change the placeholder for every kit but that seems a bit weird
Might be the best solution though
Nvm found a better solution
huh yeah that sounds very long
let me spin up JMH and test whether it's true lol
It loads an image each time, so not really surprising
in my tests, it took 12ms on average
does it not keep the image loaded or sth lol
weird
too lazy, I believe you that it is like you say lol
%rel_infiltration_color%
No I mean what command r u using to test
Or code
Of what the placeholder outputs
Im putting it into a luckperms rank right now. I've tested and its worked with non relational placeholders
Can you try /papi parserel?
Hah, I thought the same thing. Looks pretty dope, may use it for another project
Anyone can help me?
code?
and what's current and expected behavior (specifically, not just "does not see brewing stand")
I can't provide a screen
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
โข HelpChat Paste - How To Use
brewing1:
material: BREWING_STAND
slot: 31
display_name: 'ยง6ยงlะกะฃะะะ ยง6ยงlะะะะฌะะะะ ะะ'
lore:
there are no errors in the console
wtf
Wrong channel, for deluxe menus go to #general-plugins or #1007620980627230730
.
only brewing stand? if so, what spigot version are you using?
1.12.2
yes
only brewing stand
try brewing_stand_item in caps
ยป Give the helpers some details
ยป Ask suitable questions
ยป Be polite
ยป Wait
We helped the most we were able to - without code, errors, etc we can't help more
If this is DeluxeMenus help, this is not the right channel @still cosmos
As Matt mentioned above
But contradicted in #minecraft
#coding-help ๐
i work on an region system and i want to hear some opinions on my optimization ill write quick code so u get the way it works
@eventhandler
public void BPE(BlockPlaceEvent event){
Chunk chunk = new Chunk.getFromLocation(event.getLocation);
if (this.plugin.RegionManager.chunks.contains(chunk) {
//todo if chunk exists in the memory chunks are only stored in the map only if some modifcation was done to it
}
maybe ill get chunk in string value and check if it exists in the map as a string
instead of getting the object
yeah I wouldn't use the object itself
but besides that it's just an if statement so idk how else you'd optimize it
ยฏ_(ใ)_/ยฏ
chunk is basically x y z w in different value like 100 = 1 and everything shorter so if there region from 33-10 in x crossing it it will return true
i mean instead of everytime looping thru all effected blocks and etc
because regions can be in different shapes and from A-B
chunks are only x and z
i dont use game chunks...
oh
public static HashMap<String,List<Region>> Chunks = new HashMap<>();
public static String getChunkIDFromLocation(int X,int Z,int Y) {
int x = X / 100;
int z = Z / 100;
int y = Y / 100;
return ("CHUNK{" + x + "," + z + "," + y + "}");
}
here changed it to string
i dont think i need an object
maybe ill make it into a smaller number
like 20 or so
so when adding new region it will register the chunk to system so later it will load into server memory for quick accses instead of expensive disk operations often
how ever if i stick to regions it will be heavy shit why? because regions dont have an spesfic shape it can be in a shape of a cat or a unicorn for example not just an sphere or cube
the process of breaking down large amounts of data into smaller, more manageable pieces?
instead of having to browse everytime all existing regions i try to achieve just browsing thru regions that exist in the chunk to make it more efficent
can u think of something better?
I created a custom Unicode that is pretty big to make a custom GUI, its not in the right spot tho. Its like 3-4 pixels to the left. I googled how to fix this, and couldnt find much. I found this post that explains they did it with a width of -10, but I dont understand what they changed to make that happen. Could anyone Help? https://www.spigotmc.org/threads/advanced-resourcepack-mechanics-how-to-create-custom-items-blocks-guis-and-more.520187/
https://cdn.discordapp.com/attachments/1143588884341588091/1146520851131408586/2023-08-30_15.04.20.png
well I wouldn't overload names with different meanings
eh im weird ik ;c
also not sure why you're using strings there
and also not sure why you're having static mutable state there
that's not how DI works
and also not sure why you'd choose fixed size that isn't a power of 2
wdym?
there is a reason why chunks are 16 blocks wide
never really digged into it its not meant to be minecraft chunks
i just did it to split things up
first thing came to my head on how to call it lol
division by something that isn't a power of 2 always requires more cpu resources
ohh so thats why mc uses 16 wide chunks
2 4 8 16 32 64 etc
oh
fuck
then imma change math formula
so it always return numbers by 2
hold my beer
but the performance different is extreeeeeeemely small (compared to the rest of the program) so its not a big thing
public static String getChunkIDFromLocation(int X, int Z, int Y) {
int x = X / 100;
int z = Z / 100;
int y = Y / 100;
x = thepowerof2(x);
z = thepowerof2(z);
y = thepowerof2(y);
return ("CHUNK{" + x + "," + z + "," + y + "}");
}
public static int thepowerof2(int two) {
if (two % 2 != 0) {
two--;
}
return two;
}
i think it should work
it always will be diviison of 2 now
or it must be x2 each time?
then it makes the whole concept pretty useless of that chunk system
uhhhhhhhhhhhhh
Here are some guild wide stats for your eyeballs. :eyes:

32,421,670
34,460
undefined
191,441
118,198
89,980
5,861,574+
15,765
Mar 29 2016
can you see my code?
please delete ur messages its related to general plugins its the devolopers chat and what error said show me again
ill tell u whats wrong show me error stacktrace from console
power of 2 != divisible by 2, e.g. 6 is divisible by 2 but not a power of 2
so its 2 4 8 16
powers of 2 have exactly one bit set in their binary representation
that's why it works nice with bitwise instructions like shifting, and, or, xor, not
i see
make sense
nah not gonna loop over it
stupid idea
hm ill think
on how to sort it better
you can also consider using a data structure like PRtrees or whatever, not sure if that helps you
not familiar with PRtrees
its just what of i thinked would work good
lemme see PRtrees
not sure how it works but simillar concept of splitting into many groups in groups
nah Duck i think im way too dumb at the moment to be able to understand the concept of PRtrees but thanks alot for the advice
you can simply use https://github.com/EngineHub/PRTree
or build a quadtree/octtree yourself, that's pretty simple
https://paste.helpch.at/ejatopecef.java
https://paste.helpch.at/uqozudesox.yaml
The code works I can marry someone and it will store in the config BUT I can't get it to work to divorce I really can't i also tried with you @dusky harness even with the line of code you used I now added UUID'S because with the playernames it also doesn't work so I transfered to UUID'S I really don't know how to get it to work I tried everything please help me.
did you debug your code?
I had a debugger on the code and it probably will return my partners to null
so then which part of your code is not working?
why does this only remove one of the two players' marriage entries
private static void removeMarriage(UUID player1UUID, UUID player2UUID) {
ConfigurationSection marriagesSection = marriageDataConfig.getConfigurationSection("marriages");
if (marriagesSection != null) {
marriagesSection.set(player1UUID.toString(), null);
saveMarriageConfig();
}
}
shouldn't you be setting both player 1 and player 2 to null if your config looks like this?
marriages:
9ee31426-8ec8-4f4e-969f-2c8c6c0350cc: efe046ed-15a6-420a-b503-8506c58955ef
efe046ed-15a6-420a-b503-8506c58955ef: 9ee31426-8ec8-4f4e-969f-2c8c6c0350cc
Yes probably yes
ConfigurationSection marriagesSection = marriageDataConfig.getConfigurationSection("marriages");
if (marriagesSection != null) {
marriagesSection.set(player1UUID.toString(), null);
marriagesSection.set(player2UUID.toString(), null);
saveMarriageConfig();
}
}```
?
```
put your code in a block like this
```
I did
you can also specify what language you are using like so
```java
code code code
```
I can't send screenshots
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
what are you sending screenshots for
like @fading stag says you should try debugging your code to try to sniff out exactly where it goes wrong
I will it will say what I said it wait a second ok
[21:05:01 INFO]: [Marry] [STDOUT] Divorce: Starting divorce process for player OhLqvely (9ee31426-8ec8-4f4e-969f-2c8c6c0350cc)
[21:05:01 WARN]: Nag author(s): '[Ohlqvely]' of 'Marry v1.1' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[21:05:01 INFO]: [Marry] [STDOUT] Divorce: Player OhLqvely (9ee31426-8ec8-4f4e-969f-2c8c6c0350cc) is not married.
@torpid raft
doesn't really tell you much
what do you want to know
It just doesn't know who I'm married too
How I will fix that It knows I'm married to a person so it can divorce because It doesn't seem to know I'm married
this is going to be a common occurence, you should try to internalize what the process is for cases like this
i'd recommend adding a ton of print statements to see exactly what your flow of execution is
as well as why it is happening at every junction
that way you can see exactly where things go wrong and why
public static void divorce(Player player) {
UUID playerUUID = player.getUniqueId();
System.out.println("Divorce: Starting divorce process for player " + player.getName() + " (" + playerUUID + ")");
if (isMarried(playerUUID)) {
System.out.println("Divorce: Player " + player.getName() + " (" + playerUUID + ") is married.");
String partnerUUID = getMarriagePartner(playerUUID);
if (partnerUUID != null && !partnerUUID.isEmpty()) {
System.out.println("Divorce: Player " + player.getName() + " (" + playerUUID + ") has partner UUID " + partnerUUID);
UUID partnerPlayerUUID = UUID.fromString(partnerUUID);
removeMarriage(playerUUID, partnerPlayerUUID);
player.sendMessage("You have divorced your partner.");
System.out.println("Divorce: Player " + player.getName() + " (" + playerUUID + ") has successfully divorced partner " +
Bukkit.getOfflinePlayer(partnerPlayerUUID).getName() + " (" + partnerPlayerUUID + ")");
} else {
player.sendMessage("An error occurred while processing the divorce (No partner UUID).");
System.out.println("Divorce: An error occurred while processing the divorce for player " + player.getName() + " (" + playerUUID + ")");
}
} else {
player.sendMessage("You are not married.");
System.out.println("Divorce: Player " + player.getName() + " (" + playerUUID + ") is not married.");
}
}````
ok
do you see anything that could be wrong
because I canโt find a fix i know what the problem is
what gets printed when you run the code
[21:05:01 WARN]: Nag author(s): '[Ohlqvely]' of 'Marry v1.1' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[21:05:01 INFO]: [Marry] [STDOUT] Divorce: Player OhLqvely (9ee31426-8ec8-4f4e-969f-2c8c6c0350cc) is not married. ```
it doesnโt recognise that iโm married
okay so what can you tell about your flow of execution from that output
where does everything go wrong, which if statement
else
else doesn't run any logic
so it will never be else's fault
what is the if statement that returns false for the else to be run
if (partnerUUID != null && !partnerUUID.isEmpty()) {
no
that if statement is actually never even reached
if it was, you would see the print statement System.out.println("Divorce: Player " + player.getName() + " (" + playerUUID + ") is married."); in the console
but do you already know the solution
vaguely
so what do you think
i think you gotta figure at least this much out on your own ๐ญ๐ญ๐ญ
you were so close with this
which if statement is the lead to that else block
Bukkit.getOfflinePlayer(partnerPlayerUUID).getName() + " (" + partnerPlayerUUID + ")");
or is it the first 1
the first 1: if (isMarried(playerUUID)) {
it's this one
this is the first (and only) if statement that you can clearly see not giving you what you want
so dig deeper and figure out why
because probably my ismarried is broken
but how can i retrieve that from the config
repeat your process
add a bunch of print statements to the isMarried method
and see whereverything goes wrong
tbh iโm not on my pc anymore.
gotta sleep i have work in the morning
but i will use this advice tomorrow
so probably my ismarried is broken and i will have to fix that
ye
thank you
ofc anytime
okay, now add support for polygamy 
Does anyone have experience with minecraft server development i am making a upcoming server and need people to configure plugins and maybe make a custom one i may be able to provide a custom role or opportunity to become admin if you help
think of this channel as #coding-help btw
although unless you have a specific question, you might want to request in #1135819518111907900 or #1135819519303098429
if you do have a question, then a better channel to ask would prob be like #minecraft, #general-plugins / #1007620980627230730 , etc
oh i didnt see those channels i didnt have related roles
yeah thanks
Hey I'm trying to set the player as glowing through packets using protcol lib, and I'm getting this error with this code.
private fun setTeamGlowForPlayer(player: Player) {
val packet = protocol.createPacket(PacketType.Play.Server.ENTITY_METADATA)
packet.integers.write(0, player.entityId)
val watcher = WrappedDataWatcher()
val serializer = Registry.get(java.lang.Byte::class.java)
watcher.entity = player
watcher.setObject(0, serializer, 0x40.toByte())
packet.watchableCollectionModifier.write(0, watcher.watchableObjects)
protocol.sendServerPacket(player, packet)
}
Is it recommend to use a TypeAdapter over just a Data class that's parsed in the constructor on initialization? Where the data class would override hashCode() to save the data
the data class would override hashCode() to save the data
what does that mean
Like this class https://paste.helpch.at/tazurekahu.typescript to make it serializable
hashCode has nothing to do with being serializable
Oh, forgot what I used it for then
Well, hashing
could use glowapi
https://github.com/MrGraycat/eGlow/wiki/Developer-API https://www.spigotmc.org/resources/eglow-glow-cosmetic-respects-eula-mysql.63295/
Yeah, it would just be nice to do this with packets though as its such a minor feature of my plugin
could look how they do it
Yeah, not a bad idea
they dont use protocol lib :/
I'm sure I could do it with nms, but I need to use protocol lib
protocollib is known to be horribly optimized i thought
I've never used it before ๐คท, the project im working on uses it, and adds the paper api as a dependency so no nms
this is my first time on the forums so if i'm in the wrong forum then feel free to move this thread
i wanted to add a fake player to the player list, although that requires me to use packets
i thought setting up nms for paper would be the same as spigot and apparently that wasn't the case
i am...
The lead developer of the project told me to use protcol lib, ik how to add nms with paper
usually I would use paperweight
maven ๐ ๐คก
nothing wrong with maven
well
https://github.com/SkytAsul/GlowingEntities
Simple library
need help optimizing code for my library.
what can i do?
when i use pasteSchematic() then it blocks the main server thread if the region is big, in this case i'm using this for big regions (testing it)
run it async? 
completablefuture and bukkit scheduler wont work on FAWE
@river solstice ?
also i'm not even talking only about async, overall the server freezes entirely for like 1 second or more.
then hardware diff
wdym "hardware diff"
btw only when i use the api its laggy, but when i try to do it manually its not laggy (by using //copy and //paste -a, or //schem save <name> and //schem load <name>
anyone knows a decent api for file hosting except dropbox and gdrive apis
What do you mean?
sorry im getting help already and i was wrong
Me again ๐
Still didn't fix the divorce but I have gotton further
Now the error is:"
Caused by: java.lang.IllegalArgumentException: Invalid UUID string: CaptainMiner_Z
So can someone please help me find out why this isn't working
If you can help me please just @me โค๏ธ
send me ur code
CaptainMiner_Z isn't a UUID. it needs to use player.getUniqueID not player.getName()
I will I am just adding a quick command to see if it can retrieve marriage and partners so i'm 100% sure that is not the problem
bro? it literally says "Invalid UUID string: CaptainMiner_Z"
You have to fix the error so the command actually works???
And you can easily convert a playerName to a uuid at any time
I never did this wrong
Can anyone help me because he didn't react anymore
Never did that wrong
Someone give me a colour to put this text:
Main colours of the site are:
#252525
#539d65
#262626
...
huh
groovy moment
I prefer groovy over kotlin because ij always gets a stroke when I use buildSrc scripts in kotlin
ij always has a stroke over anything in groovy
why yes I would like to cast String to String
thank you
I currently got a tiny project setup that consists of many tiny sub-projects, how can I now publish them all to maven local at once?
My "parent" build.gradle looks like this:
plugins {
id("maven-publish")
}
allprojects {
tasks.withType(PublishToMavenRepository).configureEach {
dependsOn("build")
}
}
but when I run gradle publishToMavenLocal, it doesn't even try to build the "child projects"
20:33:19: Executing 'publishToMavenLocal'...
> Task :buildSrc:extractPluginRequests UP-TO-DATE
> Task :buildSrc:generatePluginAdapters UP-TO-DATE
> Task :buildSrc:compileJava UP-TO-DATE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:compileGroovyPlugins UP-TO-DATE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :publishToMavenLocal UP-TO-DATE
BUILD SUCCESSFUL in 267ms
oh wait I don't have the plugin declared in allprojects
Ur not implementing subprojects
In dependencies
I'm pretty sure it needs that, at least for gradle build
when I run gradle build, then it builds all submodules
here's my structure, if that helps (currently I only got papi-replacer and yaml-commands as children, the currently opened file is the main build.gradle)
it seems like it simply doesn't apply the maven-publish plugin to my sub projects
https://github.com/knightzmc/pdm/blob/95d25ce3221075326fc163747a4220621c167b52/build.gradle#L57 i just did this but it's dumb and silly
idk if theres a better way
probably is
Why are there two different projects in the same project tho
the issue is that my subprojects don't have any publish tasks
And apply(plugin = "...")
well that's what I'm trying. but neither allprojects { } nor subprojects { } allow to declare plugins { }
Tadaa
oh yeah, apply seems to do the trick, thanks
hmm it still doesn't publish anything, when I run publishToMavenLocal on a subprojects, it only always claims that task is UP-TO-DATE
probably I have to configure which artifacts to publish
Wait what is up to date
It doesn't have to build fully every time if it's built already
it just says "publishToMavenLocal" is up to date and doesn't do anything
I fixed it by simply adding the maven-publish plugin and the publishing section to my java-conventions buildsrc script
plugins {
id("java-library")
id("maven-publish")
}
group = "..."
version = "..."
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
hm unfortunately now the pom it generates doesn't include any dependencies
how can I make it so that the published pom correctly lists the dependencies?
why do you want to publish those plugins all in one artifact?
assuming that's what you're trying to do?
since otherwise you wouldn't have the maven publish plugin in the base module
I don't want them to be all in one artifact, they should all be published as separate artifact
then do something like this
act like they're all separate
there might be a way to do it how you're doing it, but idk since I only do 1 module, so I'm suggesting that instead since that's what bm suggested
I can publish them just fine, the issue is that the generated pom is completely empty
it's missing all the dependencies, it doesn't even mention <packaging>jar</packaging>
what file and directory is that? and send the build script
that's my .m2/repository/com/jeff-media/cesspool/yaml-commands/1.0-SNAPSHOT/yaml-commands-1.0-SNAPSHOT.pom
here's the full project https://github.com/mfnalex/cesspool
(also make sure to not commit .idea)
this seems normal
but that pom is useless
it does not even mention there's a .jar file
it doesn't mention all the dependencies
idk if thats even required
its not supposed to
i think
only if its transitive
as I didn't shade anything, the dependencies are required to be in the pom
oh ok, let me try that
same with api for implementation
but you should only make some dependencies transitive
thx, that worked. the pom is still missing the packaging part, which means maven won't be able to find this dependency
are you sure?
well that has to be defined manually, at least in my setup
hmmm
in maven all I gotta do is mvn install without configuring anything ๐ฅฒ
lmao
yes, lol
thanks
usually IntelliJ auto completes the dependencies, this time it didn't so I had to type it manually
it also takes 10 billion years to run
ok next question ๐
if I use compileOnlyApi, then the generated pom uses <scope>compile for those dependencies - what do I have to use for dependencies that should up as <scope>provided in the generated pom?
depends if you want them to be exposed as transitive or not
but like is it possible to do compileOnly but still be in the pom
so that things like exclude would work
well
not compile only
maybe implementation
assuming it doesn't already
yh i believe implementation will include
but... not transitive iirc
if you want transitive i think it's just api
there wouldn't really be a need
if you really want it ig you could make a maven publication, assuming gradle allows you to edit the dependencies in there?
using api(...), it still lists them as "compile"
api is implementation + transitive
here's my generated pom. I'm using "api(...)" for jetbrains annotations, and compileOnlyApi(...) for my papi-replacer dependency. Both show up as "compile", which leads to jetbrains annotations getting shaded if one simply uses my project as dependency in maven now
why are you shading annotations
?
bro
my question is how to avoid that
bro
but also, read my above messages
I know that. That is why I'm currently asking how I can avoid shading them
compileOnly
then this
why do you want it?
it'd be nice but imo it isn't really something that is needed
idk why gradle excludes it
yes but they CLEARLY know that and already said they want to AVOID shading it
oh ok
It's just that I already said what api does and replied to their question, and didn't suggest using api in it