#help-development
1 messages · Page 1469 of 1
do you know how to add a repository
you've done it once for bukkit/spigot/whatever
you just need to copy it and change the values
I cant remember how to do it lmao
control-C
bruh
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
what am i copying tho
the repository
add that to my pom.xml?
yes
ite but i dont know what that did
ah right
the repositories list lists the places where the things can be found in
so its depending on jitpack?
f.e the spigot artifact is found in the spigotmc-repo, at https://hub.spigotmc.org/nexus/content/repositories/snapshots/
you are depending on BetterRTP
which can be found from jitpack.io, at https://jitpack.io
their documentation is in json?
wut
is it possible to get help ?
Thanks
that is accessed by maven
maven looks through the list and finds the jar described in dependencies
I am making an AFK plugin, and it adds them to a team called AFK, which is made by the plugin if there isn't already an existing one. After they get removed from the AFK status, I want to put back their previous team (if they had any). how would i do this? a method i haven't tried yet that i've thought of just now is putting the player in a hashmap, with their uuid as the key and the team as the object. is this method fine, or is there a more efficient one?
for example, your bukkit dependency is as such
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
first it finds the group id
which would be this
org.bukkit -> org/bukkit
then it finds the artifact itself
which is simply bukkit
which would be this
then it finds the version you described
right ok
unless I missed something you already did it
you added betterrtp in your dependencies
its still fucked
what is fucked
and what are the errors
Dependency not found
jitpack uses different values for the dependency list
see the examples
click on the maven button
Could not find artifact me.SuperRonanCraft:BetterRTP:pom:3.1.0-3 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
yes, read what i said
read the page
oh shit
wait
ok i got the groupId and artifactId
but idk abot the version and packaging
remove the packaging tag
that isn't supposed to be there and is there only because you blindly cuntpasted it from their pom.xml
looool
accidentally pressed x on the fucking maven button
how does one unfuck it
and be able to press it again
i don't know what you're talking about
nvm im jus hella retarded rn
<dependency>
<groupId>com.github.SuperRonanCraft</groupId>
<artifactId>BetterRTP</artifactId>
</dependency>```
its still fucked up
it doesnt like it
what do i put in the <version><\version>
ye ik i just saw it
tag refers to these
https://github.com/SuperRonanCraft/BetterRTP/tags
<dependency>
<groupId>com.github.SuperRonanCraft</groupId>
<artifactId>BetterRTP</artifactId>
<version>2.12.0</version>
</dependency>```
Could not find artifact com.github.SuperRonanCraft:BetterRTP:pom:2.12.0 in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
wym by that
clone or download the repository and build it with maven
f.e by importing it into your ide and then smashing the package button
if you use intellij you can import a project directly from git
file > new > project from version control > git
then cuntpaste this in it
i don't have the effort to try and wrangle you into using maven from the command line
nothing of that means anything
did you build it locally
hey i have config and messages.yml in resources/spigot folder and it saves to plugins/AuthTools/spigot but i want it to plugins/AuthTools/
my code
- getFile
use getResource and write the inputstream to disk
saveResource just dumps the file whereever
i dont know waht this means
okay
now that you're building it locally, you want to copy the dependency info from their pom.xml again
instead of using the information for jitpack
old question new problem, im trying to make the orb buffs only real PLAYER as npc dont have mana data, but, how? I tried to use world.getOnlinePlayers() or bukkit.getOnlinePlayers()
i got it working
no clue what i changed, but it seems to be ite now
how can i disable nametag visibility on scoreboard teams?
i set nametagvisibility to never
but not worked
why does the console say Disabling PluginName v1.0.0 even though it's not 1.0.0 in plugin.yml or build.gradle
What version did you declare in plugin yml then?
version: ${pluginVersion}
processResources {
expand "pluginVersion": project.version
}
What is project.version set to?
actually change both to rootProject.version
You’d have expand "pluginVersion": rootProject.version then rootProject.version '0.05'
okok
so
plugins {
id 'java'
}
group 'EE.ric'
rootProject.version '0.0.5'
and
processResources {
expand "pluginVersion": rootProject.version
}
yes?
Yeah
you could chain a task after build
Uh sure that works
and now?
But I would suggest using gradle for deployment
Ye there exist a plugin for that
I can try help you later with that, never tried it myself frankly
why is using gradle recommended tho
I mean gradle is good
Its capability of configurability is good, Idk if it’s actually significantly faster than maven but definitely faster than ant afaik. Then it’s also both imperative and declarative which can be nice. I’m not gonna go here talk why gradle is recommended because I honestly don’t know everything about it but it’s good imo.
also it's still saying
[Plugin Name] Loading PluginName v1.0.0
Did you run the clear task?
no :/
Run the clean task
should I make it run clear every time I build?
Uh if you want you could make something like
build.dependsOn clean
using the compound run in intellij
(In build.gradle)
oh this, Im not questioning gradle vs maven, I meant why do you say deploying with gradle is better than with Intellij
Because if you use gradle as your build automation tool using it to additionally deploy may be beneficial since you can directly take advantage of the api and the plugins other than using some half working intellij interop solution
and what does it have over compound task?
It’s in build.gradle, if you use gradle you most likely want to depend as much as possible on what gradle is capable of
And since this is one instance where it’s possible I advice you to declare the task dependency in gradle
plugins {
id 'java'
}
group 'EE.ric'
rootProject.version '0.0.5'
build.dependsOn clean
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
}
processResources {
expand "pluginVersion": rootProject.version
}
Yeah
It should clean before
being?
doFirst {
file("${buildDir}/resources/main").listFiles().each {
delete it
}
}```
put this in your processResources (before the expand)
Ok nice so basically it would clear eventually cached resources when generating new ones
Hmm I will ping you when I’m available
ok
Is there an event for falling blocks turning into a regular block (already tried EntityChangeBlockEvent)? (1.8)
how can i clear the Inventory of an Player?
pretty sure its something like player.getInventory().clear();
true xD thx iam dump 😉
np
what is an efficient way of checking up to 4,356 blocks which are located in at most a 3x3 chunk bounding box
I only need to know if they are passable or not
and if they are not passable, whether it is a door
this would be done rarely (once per 20 minutes per room in a loaded chunk, with offset timings)
To do it async with chunk snapshots (as you are not changing any data)
Okay, good idea. If I don't know which chunks I will need to check in advance, is that still an option?
yes
Ait so I got this in my config file:
arenaList:
- map1
- map2``` How would I go on about map voting? Maybe so it looks something like this at the end in the Minecraft chat
1. map1 (0 votes)
2. map2 (0 votes)
How would I go on about making this? I know how to get the list of course and I know I should be using arraylist / hashmaps yes?
Its not guaranteed safe but it works. If its not a time sensitive search you can always grab it sync
it is time sensitive to some extent, as every in-game morning all houses should have finished running the operation for all their rooms since the last morning
Not time sensitive as in tick accurate
so say in-game time 8AM all houses are queried on their previously calculated floor space and bed count, and each house calculates it at some point during the day depending on when it was built
yeah I guess worst case is that a house misses 20 min of productivity once and then should be fine as long as its not edited
Ill give it a go ty 🙂
I'm trying write a part of a plugin to download new plugin updates, but I keep getting an Error 503 when trying to execute.
However, if I put the URL in my browser, it goes fine.
public static boolean downloadSpigotMcPlugin(final Integer pluginId, final Integer version, final File file) throws IOException {
URL apiUrl = new URL("https://api.spiget.org/v2/resources/" + pluginId + "/versions/" + version + "/download");
try{
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
connection.setRequestProperty("User-Agent", PluginManager.getInstance().getConfig().getString("UserAgent"));
connection.setInstanceFollowRedirects(true);
connection.setDoInput(true);
if (connection.getResponseCode() != 200) {
Logger.sendConsole("Response was " + connection.getResponseCode());
return false;
}
}catch (Exception e) {
Logger.sendConsole(e.getMessage());
}
try {
BufferedInputStream bis = new BufferedInputStream(apiUrl.openStream());
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
byte[] buffer = new byte[bis.available()];
bis.read(buffer);
bos.write(buffer);
bos.close();
bis.close();
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
Google hasn't been too much help, so if anyone can give some input, I'd greatly appreciate it
Here's the User-Agent I'm using
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
is this how I do distinct on a custom class?
List<ItemStack> list = new ArrayList<>();
Set<ItemStack> uniqueValues = new HashSet<>();
for (ItemStack itemStack : itemArray) {
if (uniqueValues.add(itemStack)) {
list.add(itemStack);
}
}
ItemStack[] items = list.toArray(new ItemStack[0]);
here itemArray is the array I want to remove duplicates from
ItemStacks are comparable, just use the code from the link that was posted earlier
where
dis?
oh that's right
tf am I doing lel
Set<ItemStack> items = Arrays.stream(itemArray).collect(Collectors.toSet());
so like this?
you need the .distinct() call
but sets can't have duplicates?
ah suppose so
set is exactly what I needed, idk why I never thought of it
no sets can;t have duplicates
In that case however, just skip the stream o.O
so what do I change it to
afaik, there's Sets.newHashSet(array);
Provided by Guava I think it is, which is shaded into Bukkit
wait how do I do make it into my code?
Just use that line above lol. It creates a Set for you
oh
Instead of the Stream thing
Streams aren't super great for performance if used frequently, and given that the stream is very small and easily replaceable, definitely the better alternative imo
and it also changes itself to the correct type?
Yeah it's generic
cool
If you're using Java 9+, there's also Set.of() I think that also accepts varargs
and what would the set's name be
Guess nobody's got anything for my error 503 problem? 😅
so dis?
Set<ItemStack> ItemSet = Set.of(recipe);
I mean it's a java network thing
try StackOverflow
ArrayList<ItemStack> yourList = new ArrayList<>();
Set<ItemStack> setWithoutDuplicates = Sets.newHashSet(yourList);```
what about Set.of() tho
Its unmodifiable
You are not handling redirects
oh you are, nm then
Yeah, I was about to say
I was getting 302 earlier, but I managed to solve that
Now I'm getting 503, so I know it's following the redirects, but I can't figure out why my browser resolves the API url but my code won't
did you miss some init thing? I never worked with network, pure guessing
This is how I do it ```java
URL url = new URL("https://api.github.com/repos/ElgarL/GroupManager/releases/latest");
URLConnection conn = url.openConnection();
conn.setReadTimeout(5000);
conn.addRequestProperty("User-Agent", "GroupManager Update Check");
conn.setDoOutput(false);
// Handle redirects.
String redirect = conn.getHeaderField("Location");
if (redirect != null){
conn = new URL(redirect).openConnection();
}```
since 503 is the server is not ready or smth iirc
yep, no timeout will not wait for the redirect
ElgarL, what's the difference between the thing you sent and sets.of
did I miss an explaination
what is sets.of from?
I see no Set.of
Choco said it's available from Java 9+
and I'm not getting shouted by inte so imma suppose it's good for now
Possibly. I'm using 1.8 compat so don;t get it
yes
hi choco
java 8 compat
So pretty much does the same thing
I mean, 1.17 requires Java 16
so that's nice
I use java 11
Will be fine to use Set.of() then
It was 16 but my server was running on java 11 and 16 plugin doesn't accept 11 server :/
because 60 dropped support for 55
just, in 1.8.9 how can I get EntityEquipment from an entity?
My entity end crystals arent dealing explosion knockback and damage, but are braking blocks,
Code:
@EventHandler
public void onSnowballThrow(ProjectileHitEvent e){
if (e.getEntity() instanceof Snowball) {
Snowball projectile = (Snowball) e.getEntity();
Location loc = e.getEntity().getLocation();
loc.getWorld().spawnEntity(loc, EntityType.ENDER_CRYSTAL);
}
}``` (When you hit it it explodes but doesnt do damage and knockback)
vasically anything player related to the explosion doesnt appn
could you show error or what it writes
It's not a code error, it's a network error
btw this is my code for spiget i use
public String getDownloadURL() {
try {
URL url = new URL(SPIGET);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.addRequestProperty("User-Agent", "AuthTools");
int code = connection.getResponseCode();
if (code == 404) {
connection.disconnect();
this.result = Result.BAD_ID;
return null;
}
InputStream inputStream = connection.getInputStream();
InputStreamReader reader = new InputStreamReader(inputStream);
JsonElement element = new JsonParser().parse(reader);
try {
if (element.getAsJsonObject().get("external").getAsBoolean())
return element.getAsJsonObject().get("file").getAsJsonObject().get("externalUrl").getAsString();
else
return "https://www.spigotmc.org/" + element.getAsJsonObject().get("file").getAsJsonObject().get("url").getAsString();
} catch (NullPointerException exception) {
exception.printStackTrace();
return null;
}
} catch (IOException ex) {
ex.printStackTrace();
}
return null;
}
How does everyone else's simpler code work
the SPIGET is "https://api.spiget.org/v2/resources/" + id + "/"
idk
i literally dealt with this for 2 days bcz i didnt know how to get the file.externalUrl or smth bcz idk json and it works so nice
Well, I can get JSONs no problem
I'm actually trying to download the plugin .jar file though
try to look at the 238 line https://github.com/Stipess1/AutoUpdater/blob/master/src/main/java/com/stipess1/updater/Updater.java
Here's my "Get JSON" code
public static JsonObject getSpigotMcPluginInfo(final int pluginId) throws IOException {
URL apiUrl = new URL("https://api.spiget.org/v2/resources/" + pluginId + "/versions/latest");
HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();
connection.setRequestProperty("User-Agent", PluginManager.getInstance().getConfig().getString("UserAgent"));
if (connection.getResponseCode() != 200) {
Logger.sendConsole("Response was " + connection.getResponseCode());
return null;
}
// InputStream stream = ;
String string = CharStreams.toString(new InputStreamReader(connection.getInputStream()));
JsonObject object = new Gson().fromJson(string, JsonObject.class);
return object;
}
Player p = (Player) entity;
i want to fix this line of code, like, this command returns player including NPC, i want to avoid that
ok... I just switch my plugin test server to java 16 and it seems to be fine... Ill test on my main server later, in case it's fine, how do I upgrade my plugin project to java 16?
do you work in intellij?
cause last time I tried downgrading from 16 to 11, something seemed to still be on java 16 despite me changing the project setting
yes
he's using gradle
yes uwu
Does that still use Maven?
Shit, wrong reply
No ,wait, right reply
File -> Project Structure -> Project -> Project language level and change the sdk
dats all?
yea
ok
some guy idk theyre name told me that this is how you do it
there's no rule against "uwu" or "owo" right
I think they banned nitro emotes here
any help?
Use getClass to find where it's from
Not sure if that would even work
There isn't much of a difference between players and NPCs and that usually is intended
npc has meta "NPC"
Then check that
for (Entity entity : stand.getNearbyEntities(18, 18, 18))
{
if (!(entity instanceof Player)) continue;
if (!(entity instanceof NPC))
continue;
Player p = (Player) entity;
if (c >= 5) break;
I don't have gradle.properties
is there something like getDescription#getWebsite?
With Maven you define it in your pom. No clue how with Gradle
?jd and search getDescription
package index
Now your just checking for all NPCs
Is that what you want
My entity end crystals arent dealing explosion knockback and damage, but are braking blocks,
Code:
@EventHandler
public void onSnowballThrow(ProjectileHitEvent e){
if (e.getEntity() instanceof Snowball) {
Snowball projectile = (Snowball) e.getEntity();
Location loc = e.getEntity().getLocation();
loc.getWorld().spawnEntity(loc, EntityType.ENDER_CRYSTAL);
}
}``` (When you hit it it explodes but doesnt do damage and knockback)
i want to check for all normal players
the biggest issue is, i cant even join the game
Creeper#explode
declaration: package: org.bukkit.entity, interface: Creeper
1.8.........
ohhh
yeah
will this work?
if (!(player instanceof NPC)) {
player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + (player.getMaxHealth() * 0.025)));
PlayerStatistics statistics = PlayerUtils.STATISTICS_CACHE.get(player.getUniqueId());
PlayerUtils.boostPlayer(statistics, new PlayerBoostStatistics()
{
@Override
public String getDisplayName()
{
return null;
}
@Override
public Rarity getRarity()
{
return null;
}
@Override
public GenericItemType getType()
{
return null;
}
@Override
public double getBaseStrength()
{
return 25;
}
}, 20);
statistics.boostManaRegeneration(1.0, 20);
statistics.boostHealthRegeneration(0.05, 20);
}
Anyone know how i can override force_default_server by connecting them to another server on join?
Before it used to work to change connect value in PostLoginEvent but after a bungeecord update it stopped working them being connected to the server but being forced towards lobby
https://helpch.at/docs/1.8/ if you wanted 1.8 javadocs
yeah I have that...
I guess.. I found it.. nice
do you think I have to send packets to the players about the creeper... or....
yo is there something wrong with this? It never fires, all the other events in this class do.
@EventHandler
public void onBlockDropItem(BlockDropItemEvent e) {
Bukkit.broadcastMessage("start cancelled: " + e.isCancelled());
cancelCustomBlockEvent(getCustomBlockFromLocation(e.getBlockState().getLocation()), e);
Bukkit.broadcastMessage("location: " + e.getBlockState().getLocation() + " // block: " + e.getBlockState().getType() + " // cancelled: " + e.isCancelled());
}
I have a question but I dont know where to find an answer so I figured I would ask here. if I do a command like /command player how can I make it so it sends the refrenced player a message?
get the first argument with args[0]
then just use Bukkit.getPlayer(args[0])
it may be null...
uhh... maybe it's the wrong event?
if you say others in that class work...
Isn't Bukkit.getPlayer() very inefficient?
it says it would should fire whenever a block drops an item, including torch on top of a block being broken etc. I break a block with a torch on top (in survival), the torch drops but the event is not fired
Well there's no other way to do it but I'm just asking in general
exactly 😂
unless you get offline player...
but then you will have to check if the player is online and convert into a player object.
Well the main way I do it right now is have a reference map based on uuid so I can just do core.getPlayerReference(uuid) to retrieve the player object
oh it may be a mohist thing...
Nah getting an offline player is more resource heavy then getPlayer
seems to work on normal spigot
mohist?
it's a server implementation..
allows forge + spigot. I want to make a vanilla-client compatible server with terraforged for worldgen
For future note
We don't support forks of Spigot
yup thought it was a problem in normal spigot but turns out nope
I'll file a bug report on mohist if its not fixed in the newest version (I'm a couple days behind)
though a thing worth noting, it doesnt seem to work as advertised in the docs
why even have a fork which combines spigot and forge..
(this is on normal spigot now) I get the event for the broken block but not the torch or banner or whatever on top of it
This event will also be called if the player breaks a multi block structure, for example a torch on top of a stone. Both items will have an event call.
for my use case, allows me to use forge-exclusive server-side mods (worldgen) with spigot plugins, instead of having to port one to the other individually
Is there a way of initialising an empty audience (in adventure api) that can then have players added to it
I'm trying to keep track of the players listening to a boss bar for an entity
but there isn't necessary an initial player there
Paper not Spigot
Hey, Could anyone tell me how i change the gamerule with the command?
How can i override force_default_server? it used to be possible before but stopped worked after a update long time ago
probably in world
is it p.getWorld().setGameRuleValue(String, boolean); ?
Oh Thanks
Can you show me an example
no cause i dont know how to instantiate or get GameRule
but if you were to take a look at the class, you'd see how to use it.
is it like this p.getWorld().setGameRuleValue(doMobSpawning, false);
im kinda new to this stuff tho
again, look at the class
okay
why a duplicate forEach inside the lambda?
its so i can check both player and online
eh? that makes no sense
You are only getting Online Players. There will be no offline
thats not what i mean
You are looping over every online player for every online player.,
for every player, for every player, for every player, for every player
down the rabbit hole we go.
for(Player p1 : Bukkti.getOnlinePlayers()) for(Player p2 : Bukkit.getOnlinePlayers())
xd
It would probably be easier if you explained what you are attempting to do.
i think its because im using the server jar, not the api
where do i get the spigot api?
what IDE specifically are you using?
makes no difference. server jar just has the API and implementation
intelijj
didn't you install Minecraft development plugin?
but i get this
if you are using pom then just use spigot-api instead of spigot
unless you are using nsm
is there a 1.7.10 api?
go away
lmao
just send them a new one
Is there a possibility to license a purchase individually in the sourcecode of a plugin? To prevent multipeople use of a purchased plugin?
how often are you sending it?
pretty sure packets take care of that
sorry for late response, but there is.....
It shoudl not flicker if used correctly
but I'm a dumbo and decided to go extra stupid and I'm mapping 1.16 to 1.5
for specific reasons, if you get it 🙂
How often are you calling sendTitle?
just put the fade in to 0?
You don;t know how often you are calling the method
where?
?paste
thanks
Hello everyone, I have a question: If I have two plugins that have shaded the same libraries but they have different versions, will the bukkit class loader only load the first it finds or does it prioritize the one I have shaded
Is there a way to access getForcedHosts in bungeecord? the info in ListenerInfo
public void sendTitleToPlayer(Player player, Integer fadeIn, Integer stay, Integer fadeOut, String title, String subtitle) {
PlayerConnection con = ((CraftPlayer) player).getHandle().playerConnection;
con.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, null, fadeIn, stay, fadeOut));
if (subtitle != null) {
con.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + subtitle + "\"}")));
}
if (title != null) {
con.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + title + "\"}")));
}
}```
reload maven
Yeah he's basically just killing his server
same thing after reload
then I have actually... no idea...
Is it possible to add velocity to a player without having them pause in place as when i add velocity its not smooth
put the fade in fade out and title in every single on of the titles you send...
this is my code..... probably a lil bit not understandable, but still hope it is.
why are you using 1.7.10
//core == instance of main class
//20 == ticks == 1 second
core.getServer().getScheduler().runTaskLater(core, () -> {
//do stuff here
}, 20);```
(it probably doesn't, let's be honest)
I don't actually use that code
It's just something google came up with when I googled spigot packet title
for hcf
I use reflection
for cross compatibility with versions
basically you just have to send a times(fade in, stay, fade out) packet every title you send...
afaik the packet one already solves all that shit for you anyway
There isn't a spigot 1.7.10 repository, but I think there's a craftbukkit one
think i got it working thanks
one sec, I'm writing a tst
Does spigot allow premium resources to download dependencies from jitpack/github/maven repository and put them into a lib folder?
I was reading a thread about that, just a sec
emm what
when I try yo build, it just shows this error
Unknown command-line option '-v'.
so something is setting the enviroment for gradle to contain something -v
but i can't find any file with that
https://spigotmc.org/threads/java-16-dynamic-libraries-for-plugins.508083/ Apparently there's a built-in function for that on spigot, as said by md_5
nvm I was being dumb
Thanks, although I remember reading somewhere that premium resources cannot access the internet. Maybe they changed the rules?
Idk, better check the premium resource guidelines
why's that
but if it's a built-in function I'm pretty sure it's allowed
Why are premium plugins not allowed to access the internet
I'm not saying thats the case, I just remember something like that being posted.
join palmergames.com:1 on 1.16
what does that have to do with internet access
it just means the plugin must be able to run without accessing a specific server
I'll show you it not flickering and show you the code
But if the plugin requires dependencies to be downloaded beforehand, doesn't that break the rules?
yep it brakes them
I mean and that rule is a bit weird that force devs to make plugins to work
in offline
?paste
Okay then, how are plugins that use large external libraries such as JDA supposed to both follow the 4mb max upload size and not download from a website?
featherboard guy does it in seperated jar
so he by passes
that
at least I think
So then having a free resource download the dependencies would be allowed?
Also regarding the premium guidelines, I've talked with the developer of this plugin (https://www.spigotmc.org/resources/discordminecraft-1-8-1-16-x-linking-custom-commands-more.58934/) and it also downloads JDA on startup, but it's premium.
Yeah, its just I'd rather not be banned for misunderstanding the rules 😂
Really wish they were more specific
just make an alt
Pretty sure thats not allowed
😂
So if i had an alt that got banned, my main would technically become another alt and I'd be punishment evading.
Yeah how about no
To test stuff?
hardly ever need alts to test stuff
but anyway
if luckperms can get away with it, you're probably not going to get banned for it either
downloading dependencies at runtime isn't drm
if someone complains about it, tell splögget to up their artifact size limit
Okay I have an idea
or just bake the dependencies in and serve them from a third party without a ridiculously low artifact size limit
like github
maybe have the user change a value like Download dependencies at startup from false to true
But if its premium then theres no point in selling if its available on github
😂
plenty of premium projects are open source anyway
but it wont work without internet
and it breaks rules if that was premmium plugin
that's for drm
Just add the plugin to your Dependencies and if the user has that plugin dependency missing, spigot would tell them that
Wait what libraried
idk, JDA was thrown as an example
The just shade it in
spigot
Wait what
is it ok to use normal data structures (e.g. LinkedList for a Queue) in a method that will be called asynchronously? I only use the data structure internally and don't return it etc
define "use in a method"
I once accidentally shaded in bungee chat api and spigot itself and the plugin was 40mb but it loaded just fine?
I have a method calculateRoom which will take chunk snapshots and check if a space is enclosed and if so, how much floor area there is, the amount of beds and positions for possible connected rooms (behind doors).
is this linkedlist passed in as an argument
I plan to run this asynchronously as it could be scanning (not modifying) up to ~4.5k blocks
nope
it is completely contained within the function
the thing with the "asynchronous" word that you need to remember is that it's always relative
it is "not synchronous with x"
so, it should be safe right
in bukkit development, it's generally used as a substitute for "not synchronous with the main server thread"
since relatively speaking it is synchronised with everything it interacts with
every thread is "asynchronous"
there is zero difference between code running on thread A and thread B
makes sense
whether something is synchronous or asynchronous only comes into play when thread A and thread B interact
Oh also NNY, what was the method to do something on another thread again?
then an interaction would be getting a chunk snapshot
You told me but I forgot
the chunk snapshot is grabbed on the main thread
and then passed to your thread for processing
this would be asynchronous
👏
your processing of the chunk snapshot however is not asynchronous
It was bukkit.something iirc
nor is it synchronous
it is alone
there is nothing to be synchronized with or not be synchronized with
it simply happens
you can say that it is "concurrent with the main thread", that is, it happens at the same time as the main thread does stuff
so say I do not know which chunks I need before I begin my algorithm. Is it safe to request a chunk snapshot within my calculateRoom function, which is asynchronous with the main thread?
but since your code doesn't do anything with the main thread, that is entirely irrelevant
no, chunk snapshots must be obtained on the main thread
the method isn't thread safe
there are various ways you could go about it
the rooms would worst case occupy 3x3 chunks
a queue, pool of futures, just blocking on an asynchronous method
hmm
simplest would be to create a method in your algorithm class that returns a CompletableFuture<ChunkSnapshot>
and then joining that future to the thread that runs the algorithm
the method would schedule a bukkit task to obtain the chunk and compute the chunk snapshot, and then compute the future with it
and then return the future
which you then .join or .get
this will make your algorithm stop whenever it runs into a new chunk snapshot
it will then wait until the main thread gets around to obtaining it, completing the future
the thread then resumes and does whatever you tell it to
okay thats the behaviour I want. I'll do a DFS floodfill (since that should fail faster than a BFS when it needs to) and build up my cache of chunk snapshots as I discover them
if it's a public plugin and there's a chance the chunks may be unloaded, remember to use paper(lib)
as in if the chunks that I want to snapshot are unloaded?
if that is a possibility, yes
as the 60% of people that run on paper will throw your plugin in the shit bucket if they see it loading chunks synchronously
so what is the proper way to load those chunks
60% of 35% is not a lot
60% as in the total people on modern versions in the bukkit ecosystem that use paper
Ignore the grumpy old man thats NNYa and write it using Spigot as you would. See how it performs.
maybe I should write it without async to see if it even needs optimisation in the first place
the proper way is to call getChunkAtAsync
which will not blow up the chunk loading queue on paper servers
If using Paper
the library does it for you
if the environment is spigot, it'll just call the regular spigot sync loads
how much of an issue is the chunk loading queue if the method is called infrequently?
un noticable mostly
an arbitrary estimate would be that it'd take around 7ms to get the chunk
which is very noticeable if you do it frequently
he said infrequently
yes, well, i'm giving him information
Your just being a bitchy fan of paper
i'm being a bitchy fan of not lagging to shit
i've spent my due time hunting down sync chunk loads on my server
infrequent, possible chunk loads. Doesn;t sound laggy to me.
certainly not
which is why I said if you do it frequently
occasional 7ms here and there is fine if it only happens on startup
doesn't mean that he shouldn't get some practice with working with futures for when he actually needs to make something performant, however
I agree Futures are a great thing to learn
its mostly down to how many rooms there will be which is hard to predict
64.73% on 1.16 btw
it would be ~63ms (9 chunks) worst case per room, each room would need to be verified every 20 minutes.
at offset intervals
if you're doing it repeatedly, you'd definitely want to do it asynchronously, even if the time impact isn't high
I'm seeing 37.9 straight paper on 1.16
as the people looking at their timings reports will actually throw it in the shit bucket for seeing the repeating number
all forks is 51.2 Spigot, the rest forks.
pretty sure this pulls the stats from bstats
this is from bStats, but its only a single plugin representation.
though, all the rooms in a house will be calculated with the same offset so if I want to not get lag spikes with large apartment blocks I should do it async yea
46% across all versions
64% on 1.16
< 30% on 1.12
strangely enough 1.12.1 is almost 50% while 1.12.2 is like 30% 🤔
are you looking at the stats of groupmanager?
i was going to compare the spread of luckperms but I can only find luckpermsgui on bstats
yeah i'm not surprised by that, gm is pretty old school
I've also not put it anywhere but on Spigot/Github
most of them probably don't even know paper exists lmao
still living in the craftbukkit age
Okay, so I'm trying to create a map vote system.. this is how I've tried to make it select 5 random maps from the arenaList in the config file. It gets the list fine and all I guess? This is the code I use for that part: https://paste.md-5.net/ojavumoguv.php, and to get the list and send it in chat, I tried doing this: https://paste.md-5.net/sotaqetawu.php but I can't seem to make it work the way I am trying to. I'm trying to make it return a list in chat like this
- map1 (0 votes)
- map2 (0 votes)
- map3 (0 votes) yeah? but I can't seem to do this right and I'm not sure what to do.
huh?
I assume you only want each player to be able to vote once
in which case you should be storing it as Map<String, Set<UUID>>
or more properly, a set or a map of Arena objects or something
nesting several maps/collections is kind of iffy
stuff like HashMap<List<String>, Integer> is 🤡
I also want it to select 5 random maps from the config string list when the server starts so players can only vote for some maps, like I mentioned with
- map1 (0 votes)
- map2 (0 votes)
- map3 (0 votes)
You could String, Integer and have a Set external to that to track who has voted
Yeah, we are not writing it for you. We can advise and help with errors, but the writing is up to you
my ass hairs are itching in a way that speaks "this needs to be oop'fied"
He can;t select 5, not sure oop is going to be easy for him
myeah
He woudl do better to start now though
Wasn't saying that
never even mentioned that
basically, there's a .txt of words that it'd much up and then print in chat
and the first one who writes the word in chat wins some prize
there were a handful of issues, though
Yeah, I've seen some streamers play that game
most pressingly, it loaded the entire .txt fresh from disk every time it wanted to print a word
one of those party pack games
which, for a file with several thousands of words in it, could tak like 4 seconds
ah
https://paste.md-5.net/ojavumoguv.php this one as linked above shows how I tried to make it select only 5 maps on startup but it doesnt work, I wanted to find out why and what I maybe could do about it
so the whole server just froze for a few seconds just before it
the second issue was that even though the file had like 2000 words, the plugin exploded somewhere on the way and could only print one of the first 100 or 200
which made the whole game predictable and boring
i haven't been able to find a decent replacement for it since throwing it in the shit bucket
Just loop 5 times, selct a random arena and add to your map. Then remove it from teh available arenas to select from
ait
not the most performant solution but should be fine unless you have hundreds of maps
he's only doing it at startup
that should be fine
My KFC dinners late 😦 Driver still at teh restaurant
that's cultural appropriation
um, I do fancy some water melon too
lmao
hey is this somehow how i would implement my repository through jitpack? https://github.com/pavlyi1/AuthTools/
<dependency>
<groupId>com.github.pavlyi1</groupId>
<artifactId>AuthTools</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
you need to use a tag or a commit hash as the version
this tag right?
oh nice thank you
for some reason my code is again not working, can someone maybe take a look at it? I really dont know what's wrong, It's supposed to lock a container but even "Locked!" isnt shown in chat
https://paste.md-5.net/oqibosiyol.cs
You are using || instead of && on line 10
he shoudl be using ||
the || is fine
there is nothing wrong in that code. You broke it elsewhere
he wants to return if the block isn't a tile or if the block isn't lockable
Hmm
oh sec I see your mistake
.contains(p.getUniqueId()) See something wrong there?
are you storing UUID's or strings?
if UUIDs then ignore my ramblings
well, what I'd recommend here is instead of throwing all of the logic in the if clauses and having it all become unreadable, is precompute some booleans for us
and then sit down and think up of the possible outcomes for our action
and then figure out the relations of the computed booleans, our input, and the outcome, our output
f.e we have effectively 3 input variables for this logical operation
is the chest locked?
is the player trying to lock something?
does the player have the key for this chest?
we also have 4 possible outcomes
you can't lock this
you can lock this
you can't open this
you can open this
now, construct a logical map of these inputs and these outputs
and then write it down with ||'s and &&'s
in our particular case, the 4 possible outcomes can be represented as a truth table of two properties; whether we can open the chest, and whether we can lock the chest
that said this approach sucks anyway and you'll need to split locking into its own separate listener on MONITOR priority
but you should do it anyway since it's a decent logical excercise
the chest isnt locked and when i try to lock something and rightclick the block it does nothing not even an error on the console
i can open it and cant lock
and you've read literally nothing of what i've said
yeah, throw around some booleans or whatever
You either broke your command or the map you hold the players wanting a lock in
If the player is never added to the list then your code falls straight out the bottom.
Would it be considered bad practice if I replaced my Player interface with a json object orientated one?
Like instead of the usual java class IPlayer{ int kills; public int getKills() { return kills; } public void setKills(int a) { this.kills = a; } }
i'd instead use something like
class IIPlayer{
JsonObject json;
public int getKills(){
return json.get("kills").getAsInt();
}
public void setKills(int kills){
json.addProperty("kills", kills);
}
}
This would make stuff like storing data externally so much easier
Correct
it imples shit tier performance but I suppose other than that there is nothing blatantly wrong about it
really though, just write a serializer and a deserializer
it's about the same amount of work
But using this technique I could simply add methods on the fly & not have to worry about saving those new items.
Currently when I add new properties to the IPlayer I'd also have to map those new items to the class that saves/loads their stats
pretty sure you can rig up gson or whatever to automatically serialize complex objects anyway
Well i'm already just dumping a jsonobject into the database for each player
Can't gson serialize pojo without anything extra
🙈
you should have a column for each property
Using proper relational database methods
You really think I can be fucked to do that
Then just store the json as files
instead of a {kills=20,name=yourmom}, you should have 2 columns named kills and name
dump it in as a blob and forget about it. Be sure to show it to NNYa regularly
My IPlayer has about 150 properties, i really don't want to create a table with 150 elements
just use the bukkit config api if you insist on doing everything wrong
That's a fair point.
Don't some SQL implementations actually allow querying json
Yeah
Though I don't really understand why simply dumping the json string itself into it
I mean it kind of defeats the entire point of relational databases
like, other than using a brick as a hammer
It works just fine
so does the brick
Get a better brick
you also look like a monkey using improvised tools
idk i've just not really seen any arguments showing why it's bad
that's because sql is black magic and nobody understands why or how it works
people just recite the same inane shit they read up somewhere without knowing the reasons behind it
👌
offtopic but why?
Is it a premium resource?
no free
maybe it got marked for manual review 🤷♂️
rip
everybody needs to keep up appearances, after all
wdym
they need to at least pretend to moderate the free resources section
xd
they do moderate it against malicious plugins. They do not moderate against bad ccoding practices however as that would require an immense amount of manpower
there's a ton of malware plugins out there in the free section
they do probably moderate it a bit on their own but they mostly rely on reports
well yeah... ofcourse
idk if this is the right place to ask, but my buildtools continuously says it is outdated when trying to build a spigot version even if i download the latest buildtools from jenkins, anyone got some advice?
what does it say exactly
Your BuildTools is out of date and will not build the requested version. Please grab a new copy from https://www.spigotmc.org/go/buildtools-dl
are you trying to build something mega ancient
dunno then
java version updated?
can you try removing everything in the folder where is the BuildTools.jar?
java is updated to latest, and i have tried deleting everything in the folder with buildtools and it still didn't work
show screen of the cmd
how do you run it
? wdym?
java -jar BuildTools.jar --rev latest
weird
ig try removing the BuildTools folder on Desktop and then redownload the buildtools again from here
?bt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thats so weird
what're you trying to do? get a serbur to run or install nms to the local maven repo?
ngl half of that i don't truly understand
why are you running buildtools
literally i'm just trying to build spigot 1.16.5
i've done it before for 1.16.4 but idk why it's not working for 1.16.5
i'm asking because depending on what you want to achieve there may be an alternative solution
apparently there is a website to download spigot builds from or something? i might use that in the meanwhile my buildtools is broken lol
wait
if you need nms in your local maven repo, that won't work
if you just need the jar, yeah that's fine
i just need jar so i guess the website will work
hmmm
generally ill advised to download random jars from random people
yeah i just downloaded that from the website it seems to work, but thank you anyway haha
@grand swan sorry for ping but spigot jar distributed above
wait what....
Not you
confusion
the other jar
gee
the spigot-1.16.5.jar
then how does spigot exist...
that's the whole reason why everybody needs to deal with buildtools
they don't distribute the jar
cool
they distribute a script that builds the jar
likewise, paper distributes a jar that builds the jar
except that unlike buildtools, it works as a server jar
it builds the actual jar on the fly when the serbur starts
It's a legal reason
its not dumb if it saves them a lawsuit
it's dumb that they need to do that to not get sued
thats mojangs decision
whose decision it was isn't relevent, it still remains dumb
well the option to sue would come from mojang
you're perpetually confused about everything
yes
does anyone know which packet it sent to the server when an entity Interacts with a BLOCK.
not an entity.
the EntityInteractEvent gets fired not sure what you mean with thepackage however. If an entity does something, it will be server sided?
packet
Packet is a lil information that the player can represent o nthe map
to inform the server or the player..
every time you send a message in chat, a packet is sent, etc. etc. etc.
I want the packet that corresponds to when an entity / player RIGHT CLICKS or ATTACKS a block.
basically the "interact event"
Entities don't attack blocks
I'm talking about players.
entities don't send packets either
PacketPlayInInteract off the top of my head, idk
you know that it was formerly named "PlayerInteractEvent" which changed to "EntityInteractEvent"
and PlayerInteractEvent is deprecated.
what about right click...
i'm sure you can ctrl-f the page yourself
https://wiki.vg/Protocol#Interact_Entity I know what packets are lol
but entities are server sided. The player is the only entity that can send clientbound packets
serverbound*
hmmm
I sometimes look at the amount of packets and think about how outdated bukkit is in some situations
iirc the hand animation packets are also used for the interact event
just gives me anxiety to start coding with them
generally it's kind of fucked
itemStack.addEnchantment(value, level); is throwing me an Illegalaccessexception because the level is 10
how fix how fix
how do I register my listener into bungee plugin channel?
wdym?
Plugin Messages?
yes
Spigot side or server?
I found this link https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/#the-bungeecord-plugin-channel but it only teaches how to register Spigot server
Bungee side
in bungeecord use getProxy().registerChannel("<channel>");
at spigot use getServer().getPluginManager().registerOutgoing/IncomingChannel("channel");
Can I name the channel whatever I want?
I think yes....
I believe it requires a : in it
but look for viaversion because it has the idea of cancelling Plugin messages where the names are capitalized..
Guys, CompletableFuture<Inventory> future = CompletableFuture.supplyAsync(()->abstractInv.build());
future.join(); will stops main spigot thread until the inventory terminate?
if you run it inside the main thread, yes
if run like that:
no , alright?
Incredibly "future.thenAccept(<consumer>);" works.
no u won't get bukkit yelling it's not main thread.
Oh yeah
i forgot that
WAIT
runTaskAsynchronously, if I'm not mistaken still runs in the main thread, just not synced with minecraft ticks, use andThen (or whatever the operator is called)
this is a bruh moment, just noticed who you are.
no
it will throw exceptions....
I tested myself...
please read what I wrote
It's not synced with minecraft ticks, but still, it's the main thread
run in the main thread but not synced with minecraft ticks , alright
hm