#help-development
1 messages · Page 1482 of 1
@eternal oxide why were we saving in the pdc of a chunk again?
because individual blocks dont have a pdc
only chunks and tile entities do
doors are not tile entities
?paste
?paste
Verify for commands
Oh lol
and doors arent tile entities i suppose?
ow yea
Code: https://paste.md-5.net/rubaperame.cs
Error: https://paste.md-5.net/padokolodu.cs
Its supposed make you fly when you right click air with bread, that part works but the cooldown doesn't, help.
I recommend you getting Java 16
e.getItem might be null
i have to e.hasItem first then?
i am new so lmao
idk how to formulate this, any help ahah
so i am trying to like have 10 levels ok?
and starting stat is 20
and ending stat is like 800
how can i make it so that each level it increases by a right amount? idk if i explain myself
yes, or e.getItem() != null
It has better NPE message (it tells you what exactly is null) and it is required for Minecraft 1.17
i am using 1.12.2
a
as for why it doesnt really work, one issue is that you only make them fly if cooldowns.containsKey which it never will the first time
you need to revisit your logic a little
if (!(cooldowns.containsKey(p.getUniqueId().toString()))){
cooldowns.put(p.getUniqueId().toString(), System.currentTimeMillis());
}
like this?
before cooldowns.containsKey
anyone that can help???
You could do some trivial event listening (using AsyncPlayerChatEvent).
How could I start runnables per entity and stop them per entity? So entitys have their own runnables. Im trying to use hashmaps but not rly working it out
since stopping the runnables is not working as it should
and the runnables still keep going
Oh yeah Nuxoria what do you have as of now?
Okay basically i have a plugin what spawns chicken with a command
the chicken starts running towards you
when the chicken gets close enough he dissappears and the runnable stops
now every chicken should have a runnable which constantly checks for the distance
and then stops it if distance is close enough
ill send some code i hope you bother to read through it lol
Yeah
honestly it might be easier for you to just have 1 runnable that checks all chickens
Ik but I always get stuck with this stuff
per entity or player runnables
so Id just like to finally solve my problem
?paste
This is my runnable class: https://paste.md-5.net/oseraneyeh.cs
I think you get stuck on the destruction process.
the problem is you have static
the problem with static is it means you can only have one
remove all the statics and then you can do new ChickenRunnable() for eachj chicken
As md5 said you should probably work more object oriented here not using static excessively.
yeah
qall the statics?
you need to remove all the statics
yes
Okay ill try to get rid of all statics

you meant the constructor class specifically? Where im first putting data into the hashmap?
So i might be rlly stupid but can anyone explain to me why this returns 4 empty lines?
if (block.getState() instanceof Sign) {
Sign sign = (Sign) block.getState();
String lines[] = sign.getLines();
The sign is filled with stuff, and this ^^ is called on SignChangeEvent.
What am I doing wrong?
(version= 1.16.5)
but like the getter methods
Ahh okay tysm
this but static
I know this isnt exactly on topic, but is there a specific reason you're doing Bukkit.getWorld(ent.getWorld().getName()).spawnParticle instead of just ent.getWorld().spawnParticle?
That’s a point
ent.getworld.spawnparticle imo is spawning it only for the ent
so others cant see it
no it isnt
it isnt?
I once had a problem
with that
where particle spawned for ent
only
not sure what method i used then
that would be Player.spawnParticle
Still looking for an experienced developer, willing to pay your worth. Get in contact with me.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I can't post there unfortunately
Easiest way would be to listen for player move event and then check if a past position is the same as a current one, if that’s the case then start a runnable to take the time.
Well breaking the rules here doesn't make us want to work for you
I'm sure that being paid is nicer than a little rule broken on the server in pursuit of hiring someone!
I'll take someone who is good with Java/MC devt. and doesn't mind too much that I asked here
You should still do it on the right place aka what olivo linked you, this channel is made for assisting development, not for recruiting developers or anything.
To be honest right, the requirement on the forums is making 20 posts, before I can ask to hire someone. I don't really have a reason to talk to anyone on the Spigot forums, other than hiring.
So I've either got to make 20 spammy non-contributory posts on spigot
Or just quickly try my luck here, yknow
Can we just not go over this
I've already messaged a spigot mod to see if they will make an exception on the 20 posts rule for me to no avail unfortunately
Sure!
You were just engaging with me, that's all
I have some other discords which have request services channels if you’re interested. This is still not the right place bud
will respond to your PM thanks
you said to store a hashmap of players uuids against location keys. but how can i get the location of the block? is that
Block b = event.getClickedBlock() . something to get location?
What are you even doing? This was all working as you wanted days ago.
uh i'm trying to storing it inside a hashmap and check for the lock that way
you are scrapping the PDC and saving the data yourself?
You are if you are changing to a hashmap
You are literally asking the exact same questions for days.
im trying to make it more simple
um, the code I showed you is as simple as it could get. Using the PDC does everything for you, no database, no saving/loading. It seriously can;t get any simpler
well at least i can change the system.out.println to something better
Im having issues with importing Votifier...
pom.xml:
||```xml
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vexsoftware</groupId>
<artifactId>nuvotifier-universal</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
||
Usage:
||```java
@EventHandler
public void onVotifierEvent(final VotifierEvent e) {
Vote vote = e.getVote();
System.out.println(vote.getUsername() + " has voted on " + vote.getServiceName());
}
```||
Error:
||```diff
-The POM for com.vexsoftware:nuvotifier-universal:jar:2.6.0 is missing, no dependency information available
```||
Yes, that was fully working sample code, but you need to do the messaging how you want
?paste
gg on helper
Thanks (:
Read how to properly use jitpack.io https://jitpack.io/
strange that elgar doesn't have the helper role
u had to apply
oh
I'm too grumpy in my old age to put a target on my back.
interesting that the helper role has perms to kick/ban and delete messages
Wait really?
that's basically a mod at that point
@ivory sleet changing my methods to private and using parameters fixed almot everything! Im just getting this error for some reason:
https://paste.md-5.net/uceduzisin.rb
at this block of code:
for (UUID uuid : ChickenMap.runnablePerChicken.keySet()) {
if (uuid == chicken.getUniqueId()) {
ChickenMap.runnablePerChicken.get(chicken.getUniqueId()).stop();
ChickenMap.runnablePerChicken.remove(chicken.getUniqueId());
}
}
yeah
the error appears on the for loop line
don't modify a collection while iterating over it
ConcurrentModificationException
then use an iterator
get the entry set and use an iterator
modifications to the entry set are reflected in the map
So i have a .jar file that i need to use as a library.
it is in the lib folder however i need to work out how to load it. The second issue is that it is written in kotlin, not java
Kotlin is interoperable with java
Kotlin does create a lot of junk at the bytecode layer though
But idk, method descriptors should be fine
Yea
it doesn't have a maven repo?
yeah it does, but it is too large to feesibly shade
Just treat it as a normal library I guess, if you use maven (don't recommend it for that type of stuff) use the system scope
if it had a maven, Spigot now supports downloading depends at runtime
I however recommend gradle's solution since that allows using your artifact without warnings
ohhh, how?
ive worked with iterators like once so yea I might just did a dumb mistake but this code block gives illegalstatexecption at it.remove();
Iterator it = ChickenMap.runnablePerChicken.entrySet().iterator();
while (it.hasNext()) {
ChickenMap.runnablePerChicken.get(chicken.getUniqueId()).stop();
it.remove();
}
does it download to lib or something?
or just cache it
it creats a new libraires folder
awesome, ill give it a shot
libraries:
- com.github.pemistahl:lingua:1.1.0
this just leaves me with a class not found error, is there anything else i have to do?
I've no idea what repos it checks in
did you get an error in console?
I know it checks maven central
sec and I'll check
yeah it is there
I'll add it to my test plugin and see if it works
👍
yep, it worked perfectly
im stupid
my spigot is too old
8/may
ill run bt rq
its defo downloading something
yep it works
it even got the kotlin depends
is there a way to prettyify this
Yep, much better than injecting into ClassLoaders or pacakaging huge jars
as in make a custom output
Can;t read, SS is too small for me
I'd not bother trying. its only going to be in teh log once.
That will always be there. It may change in the future as this is a preview feature
how do use this cool code box on discord?
```java
followed by ```
you mean those ' ?
` is not equal to '
of the keyboard for me
wait german keyboard
ohhh idk
Top right, next to backspace
just copy the stuff in the pastebin
ok got it
Else you could write some code then select it and right click it where you can change it
because i get this Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2 at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_291] at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_291] at de.mondgnu.lobbyvillager.villager.VillagerTradeWindowHandler.getWorldWithMostPlayer(VillagerTradeWindowHandler.java:49) ~[?:?] at de.mondgnu.lobbyvillager.villager.VillagerTradeWindowHandler.onTradeOpen(VillagerTradeWindowHandler.java:33) ~[?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_291] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_291] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_291] at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:3092-Spigot-9fb885e-ebe18b9] Error with this```public World getWorldWithMostPlayer(List<World> worldList)
{
World worldListItem = worldList.get(0);
for(int i = 1;i <= worldList.size();i++) {
if (worldListItem.getPlayers().size() < worldList.get(i).getPlayers().size()) {
worldListItem = worldList.get(i);
}
}
return worldListItem;
}```Code
Oh yeah
size 2 = index of 0 and 1
change i <= worldList.size() to i < worldList.size() probably
how do you spawn a new thread?
and then start with int i = 0
Thread t = new Thread(() -> {
});
t.start();
¯_(ツ)_/¯
i love to code bukkit plugins its so fun when something works
Are you sure you want a new Thread? and not just an async runnable?
that could work
i need to run some code that takes a little while onEnable thats all
How can i make PlayerList plugin without ProtocolLib?
Hmm I don't recall whether BukkitScheduler#runTaskAsynchronously pauses execution until server is finished enabling.
asynchronous tasks are started at the beginning of a tick
It doesn;t run till the next tick
and the server doesn't tick until it has enabled
wait no that is fine
But as he's talking about Threads he clearly doesn't need to wait for the result.
Oh okay then either you create a new Thread then or use something like a CompletableFuture if you want it to run async while enabling.
that may not be good
i have another question i get this ErrorError occurred while enabling MapHandler v1.0-SNAPSHOT (Is it up to date?) java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_291] at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_291] at de.mondgnu.maphandler.MapHandler.onEnable(MapHandler.java:20) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot.jar:3092-Spigot-9fb885e-ebe18b9] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot.jar:3092-Spigot-9fb885e-ebe18b9] with this Code```public final class MapHandler extends JavaPlugin {
@Override
public void onEnable() {
List<String> worlds = findFoldersInDirectory("C:/Minecraft server/Main1.16.5/ClassicBWMaps");
if(worlds.size() != 0)
{
for(int i = 0;i <= worlds.size();i++)
{
WorldCreator world = new WorldCreator("ClassicBWMaps/" + worlds.get(i) + "/Legacy");
world.createWorld();
}
}
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
public List<String> findFoldersInDirectory(String directoryPath) {
File directory = new File(directoryPath);
FileFilter directoryFileFilter = new FileFilter() {
public boolean accept(File file) {
return file.isDirectory();
}
};
File[] directoryListAsFile = directory.listFiles(directoryFileFilter);
List<String> foldersInDirectory = new ArrayList<String>(directoryListAsFile.length);
for (File directoryAsFile : directoryListAsFile) {
foldersInDirectory.add(directoryAsFile.getName());
}
return foldersInDirectory;
}
}```
the general contract of onEnable is that once it returns, your plugin is enabled and functional
Who taught him code blocks and not paste 😦
?paste
lmao
you do not want to offload heavy work to an asynchronous thread and have your plugin in a weird not-quite-enabled state even after onEnable returns
Me too. I'm guilty
what are you offloading to this new thread
i need to initialise the language detection service
yeah, onEnable should wait for that
so it just loads the models to mem
your plugin probably doesn't function entirely without that
Im trying to use the votifier API but it wont work
public class VoteEvent implements VoteListener, Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onVote(VotifierEvent event) {
Vote vote = event.getVote();
Bukkit.broadcastMessage("VOTE! CHECK CONSOLE");
System.out.println(vote.getUsername() + " has voted on " + vote.getServiceName());
}
public void voteMade(Vote vote) {
System.out.println("Received: " + vote);
}
}
Error when compiling:
-package com.vexsoftware.votifier.model does not exist
which means that it's not enabled without it
i mean, yes probs not
which means that onEnable shouldn't return before it's done
yeah i get it lmao
onEnable taking a while is fine; it is only done once at startup
did you fix your pom?
i just hate the [11:43:11] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 8792ms or 175 ticks behind
🤷
What do you mean "fix"?
Is your language detection for typed messages or for language in files/data?
are you sure this is because of your onEnable at startup
and not something happening after your onEnable
they are in the depend jar
afaik it is
Yes, but are you detecting teh language of data or player typed messages?
it doesn't sound like it's in the startup
or are you using like plugman or something to reload the plugin
but i didn't type nothing
in that case you can just fire it off async as no players will be online for a while.
xd
just set a boolean for enabled so yoru plugin doesn;t try to do anythign untill yoru async task set it to true
fuck off
I mean if you do want to load in parallel I guess you could start loading it in onLoad and then join the async task in the end of onEnable.
And just hope you never get me on your server. With my typing ti will never work out my language.
i mean i was just gonna set a boolean status
saving 8 seconds of startup time is not worth breaking the contract of onEnable
eehh fair enough
and yeah, you can do your startup in parallel
but onEnable must wait until your startup is done
doing it in parallel might save you half a second or something
You could begin your init in onLoad
also doable
Just don;t use anything Bukkit in there
👍
beat me to it.
i <= worlds.size() you probably want i < worlds.size() instead.
You are not pink, I don;t see your messages anymore.
lol
you should ban someone for shits and giggles
unlimited power
thank you i try in a bit
You were a helper here?
and mute and move users in voice channels
oh thank you for letting me know nny lol
and use external emoticons as well
interesting how they gave you all these perms but didn't tell you anything about them
conclure didn't read the message telling us what permissions we have, he just went straight into doing his daily tribute to helping people in the help chats
lol
Oh yeah they did tell us about the mod perms guess I just missed it
@Override
public void onLoad() {
CompletableFuture.runAsync( () -> {
this.detector = LanguageDetectorBuilder.fromAllSpokenLanguages().build();
this.detector.detectLanguageOf("Starting the Language Service");
});
}
This doesn't allow it to return b4 it is done, how do i do that
join or get the future in onEnable
that'll make onEnable block until the future is complete
CompletionStage<Void> future;
void load() {
future = CompletableFuture.runAsync(...);
}
void enable() {
//other stuff
future.join();
}```
iirc
does runAsync block for the result? i don't remember but I don't think it does
CompletionStage carries join()
seems rather silly for it to block
I mean it blocks on the thread its executed on right?
yeah
then you don't want that
But ofc if u'd use smtng like Executor e = r -> Bukkit.getScheduler().runTask(plugin,r); then it would still run sync
yup
also CompletionStage doesn't seem to have the join
and it won't enable until onenable returns
and onenable won't return before this stops blocking
Oh yeah use CompletableFuture then
🤷🏿♀️ complete a completable future manually from a new Thread I suppose
can't use bukkit's scheduler for this so you need to create and spin a thread yourself
and you only need one so you don't need to set up thread pools or anything
just a raw thread will do
yeah although CompletableFuture::runAsync uses the common pool by default so just using it without providing an executor should execute in concurrent
how do i do that
but that apparently blocks until the future is complete?
Hmm I think it would only block the worker that got delegated the task, not the server thread unless get or join is called explicitly.
can I make it so it doesn't do the moved too quickly thing in when I p.teleport?
that'd make more sense yes
yeah do that if you want to
since that probably isn't ideal
and if I were to do that is there a way to disable it?
or can I only set it to huge values
InitLangDetector initLangDetector;
@Override
public void onLoad() {
this.initLangDetector = new InitLangDetector(this);
this.initLangDetector.start();
}
@Override
public void onEnable() {
try {
this.initLangDetector.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
would this work?
InitLangDetector extends thread
Uh sure
Oh I just didn't expect the usage of a Thread but that looks fine
player.perfomCommand or player.chat (a bungee command) would work?
Nope
on a spigot plugin
You can do the opposite iirc but doing that would require a bungee plugin also
You mean perfoming minecraft command using a bungee plugin?
Yep
Elaborate, I mean ChatColor#translateAlternateColorCodes exists or you probably mean something else.
like to the console
sorry i should have clarified
cause some methods produce the colour codes
I think chatcolor works on console
yes
Yeah I think it does
but it depends on how you use it
cause using the logger with chatcolour doesnt work afaik
oh
the "symbol" would work?
Like lot of plugins log with a colored text
I mean using the coloredconsolesender should work fine?
🤔
oh idk
If something needs to be logged then color shouldn't matter?
OH nvm it's just called ConsoleCommandSender
adding colour to a console message makes the logs a nightmare to read
I dont color my logs
[0;32;1mStarting the Language Service[m
I can see why that is a pain
🥴
Colour in game but in logs theres no point
What if everyone coloured every message
You can use hex colors
ChatColor.translateAlternateColorCode('&',"&x&F&F&A&5&0&0") or smtng
little verbose but yeah
Can we send title message without using nms
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this); // this line causes error
Error occurred while enabling Lobby v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: This registration already exists
more context is prolly necessary but i'm not sure why this error would be occurring out of nowhere, even after having no issues for weeks. tried restarting, reloading and rebuilding.
using the console command sender is cancer
as that won't respect the end user's logging configuration
and can't be attributed to your plugin properly
Aren't you suppose to have all lowecase on BungeeCord
title?
why would that be
yea
No like using spigot itself
yeah,
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i thought it was baked into spigot
I am unsure but that might be invalid then yanlol
declaration: package: org.bukkit.entity, interface: Player
i added another plugin
also can you send the entire stacktrace
Oh Thanks
found my easy fix, comment out the registration line, build, reload, uncomment, build reload. back to normal, but it'll just break again as it's already happened several times in the past day
probably unable to get help either because its honestly weird asf
Also btw what are you using the incoming channel for
reading playercounts from another server
so that i can have a 'total network online players'
Yeah I will add it
what's the uh
method
unregisterincoming and unregisteroutgoing?
@Override
public void onDisable() {
getServer().getMessenger().unregisterOutgoingPluginChannel(this, "BungeeCord");
getServer().getMessenger().unregisterIncomingPluginChannel(this, "BungeeCord");
}
Uh I think the way you're doing it is the ideal way
"Could not set generator for default world 'world': Plugin 'SpaceTravel v1.0-SNAPSHOT' is not enabled yet (is it load:STARTUP?)"
``` How can I fix this?
Maybe wanna set the load to STARTUP in plugin.yml
In the plugin yml you want to set load: STARTUP so it loads before worlds.
oh alr thanks
Hello, I'm working on editing(forking) a spigot jar. I was originally using paper jar, but I realized that spigot jar has a lot of lag. How did the paper make this spigot not lag? My question is how to fork a spigot jar without a lag.
Wym has a lot of lag
hmm
for example, when I kill boss, 1 tps downs
Paper never goes down tps with this
Ideally you should probably head over to the paper discord and ask the same question there.
okay thanks!
But in short Toto, there isn’t just one how, they have optimized it for some years now so optimizing it as paper might now be as trivial as you think.
oh
Although you’re free to go through all of their patches
Yup
Ok thanks
Hi, someone know how to remove npc from tab without remove this skin ? I don't want to use Citizen. Sorry for my english, i'm french.
Why not 😂
?
Because I have already done the code for the other features and I don't want to start over
Citizens is basically doing everything for you by abstracting away packets and nms, why not use it @ancient tusk ?
yeh
It doesn't hide the ping
ah f
It would be just blank?
Yes but I want there to be no line
Probably nms
How would i tie information for a bossbar, per player. Using a hashmap with the key of player yes. But what would i use for the value
I have already tried
whats the question about?
remove npc from tab without remove this skin
Well finally I may be using Citizen. Anyhow, thanks for your help
id recommend citizens
Do you just want their name removed? Do you care about the connection info?
No, I will use Citizen, it will be easier
you can hide the name just by setting the PlayerListName to a space
or using protocolLib https://www.spigotmc.org/threads/remove-player-from-tablist.55175/page-2
Yes but it doesn't hide the ping
Thats why I asked you if you cared about the connection info
using ProtocolLib will remove it completely
okay, thanks i will try
Will PlayerListName work If you have tab plugin
No clue
:/
@EventHandler
public void customStoneGen(BlockFormEvent e) {
//System.out.println(e.getBlock().getType());
// Standard Custom Stone Gen
if (e.getNewState().getType() == Material.COBBLESTONE) {
Material underCobble = e.getBlock().getRelative(BlockFace.DOWN).getType();
//System.out.println(underCobble);
for (Material m : validBlocks) {
//System.out.println(m);
if (underCobble == m) {
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> {
System.out.println("IF " + m);
e.getBlock().setType((Material) underCobble);
//Code That Runs After Timer
}, 1);
break;
}
}
}
}```Code works fine without the runTaskLater, but with it I get ``Could not pass event BlockFormEvent to VanillaPlus v1.0-SNAPSHOT``
anyone have an idea?
is your event listener in your plugins main class?
No, it's in "public class CustomStoneGen implements Listener"
Then you can;t blindly cast this to Plugin
You need an instance of your plugins main class
Hey if I have a Villager and I dont want him to move around or make noises but still face nearby players, what do I do
You can set the movement speed attribute to 0
Whats the method to do that
didn't the paper discord already supply you with the answer ? xD
villager.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0);
thanks
Information:
<random player UUID> --- how would i get this as i don't know what it would be
<value attached to that> --- and get this too
random text is very random
?
It doesn't really need it, im trying to get the stringlist of players UUIDs and the values attached to them. When i don't know their uuids
You are still making very little sense
The only thing I've managed to make out is you want to get a value thats somehow attached to a UUID that you don;t know.
Ok let me explain it the way i did before...
I'm trying to get a list of player UUIDs from a YML file. And i have the UUIDs stored in a stringlist called Information I'm trying to get the list of player uuids and the values attached to them to store them into a hashmap, Keep in mind i don't know what the UUIDs will be so how would i go around getting them via .getStringList
if you are attaching values to them you don;t store them as a StringList
You store it as a Map/ConfigurationSection
Forget it
I can tell you how to do it, but ok
Hey I have a problem with my custom book, I want the title to be underlined at the top of the page but it carries on throughout the entire page
How would I stop the underline?
there is a reset color code
What is it?
&r is the code
cheers, sorry just having a shit day
i found out how
@vestal dome So you know how I was trying to get a command to run when a message is clicked in the book, well I found some code online that actually makes it work
hm
using json?
nice..
Yeah that has always been possible ?
sounds abit right
Hm is json hard?
not too hard
I mean not if you understand the syntax of it
Is it part of spigot or????
Json itself isnt
is it json json
No json is JavaScript object annotation for short iirc
But we have bungee chat api for instance which wraps around json with objects
Show the code
turn your player and see which changes the most (probably the second)
Is there a way to serialize bungee's hover and click event to a Json string so I can save it into the config?
???
The bungee chat api?
Pitch and yaw, pitch is head movement up/down, Yaw is turngin around
Yes
Thanks <33
I think Component#toString should be enough
Really? I saw a class named "TextComponentSerializer" can't I put that into a Gson?
Oh yeah you can ?
Ok
It implements a JsonDeserializer
p.getInventory().getItemInMainHand().getItemMeta() == BedrockPiece.getCustomItem().getItemMeta()
``` i have an if condition like this, BedrockPiece is a custom item btw.
p is the player entity. not sure why this doesnt work
No errors
Use .equals
Oh
private final static Gson textComponentSerializer = new GsonBuilder().registerTypeAdapter(net.md_5.bungee.api.chat.TextComponent.class, new TextComponentSerializer()).create();
@Override
public Map<String, ?> serialize()
{
Map<String, Object> values = new LinkedHashMap<>();
values.put("json", textComponentSerializer.toJson(toChatText()));
values.put("center", centered);
return values;
}
@Override
public Object deserialize(Map<String, ?> values)
{
if(values.containsKey("json"))
{
TextComponent bungee = textComponentSerializer.fromJson((String) values.get("json"), TextComponent.class);
JsonChatComponent chatComponent = new JsonChatComponent(bungee.getText());
chatComponent.clickEvent = bungee.getClickEvent();
chatComponent.hoverEvent = bungee.getHoverEvent();
if(values.containsKey("center"))
chatComponent.centered = (boolean) values.get("center");
return chatComponent;
}
return null;
}```
Smth like this?
can someone recommend a tutorial for gtting started with plugins
send throught dm
Ok
Yeah tvhee that should work
im already pretty good with coding
but how do plugins work
Swirl yeah it’s highly recommended to get some basic java skills before hoping to spigot api.
Oh
There exists some wiki pages for it
ok
Good that you are pretty good, you know the most important things from Java?
I recommend a yt channel called Technovision
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thanks
I would recommend reading source code also
Anyone know why my maven is showing this for my vaultAPI
Did you declare the repository?
https://github.com/MilkBowl/VaultAPI anyways you can find it here
yeha
ik thats hwere i got the maven stuff from
So how can i detect when i put fire on a block
Hmm then it should work fine
.
PlayerInteractEvent maybe
It still aint working
is there a jar file i need to download?
?paste your pom.xml
If hes' placing Fire, you need BlockPlace Event, if he's igniting https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockIgniteEvent.html
Elgar will help you as he is a god at this yeahyeah (I use gradle)
ok
Theres nothing wrong with your pom. InteliJ or Eclipse?
Intellij
Cleared cache?
yeah
Is there a refresh button at the top right of your pom.xml
Yes
then restart your IDE
How do I reinstall the Spigot libraries on IntelliJ, I seem to have deleted them
Using Maven?
Yes
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Run BuildTools
Check if the files already exist, if they do, repeat as above, Invalidate cache and restart IDE
the entire repository is gone
just run BuildTools
How can i make make the block break a little? you know there is a texture change when you are breaking blocks
I believe you can send a block break update to a player
i am using 1.12.2
😬
i thought he meant for the server
guys wat is proper way 2 convert block coords to region coords? :I is it just divide by 512?
Wouldn’t you have to get the offset of the region from origin and then subtract that from the block coordinate?
region?
wat ._.
oh no
i mean like which region a block is in
by region, do you mean chunk?
what is a region?
mca file
https://dinnerbone.com/minecraft/tools/coordinates/
^ like this here he does it but dosent show his math lol
looks liek hes dividing by 512 but idk ive been jebated by block math b4
woudl it not be >> 9
:I
hmmmm
it could be :I
i need 2 find out 4 sure somehow 🤣 or ima delete ppls houses
yes 512 is 9
handles negative properly rite?
yes
kk ;3 tysm ima try taht
java dll? what are you running this command in?
hey why is java class not an option in intelliJ
?paste
?
lol
error: https://paste.md-5.net/usugemagot.cs
code: https://paste.md-5.net/ezevemasef.java
its my first time with packets
its supposed break bedrock when ignited
any help?
lol im just starting plugins
i wsh someone would help me too
:/ i feel that
.
hey guys is there anyway to build a spigot with latest rc1 of 1.17 to start testing the plugins and java 16 on it?
so when the day comes can have an idea of what plugins to implement
A few questions, why are you using packets to fake the breaking of blocks?
Two line 19, NEVER sleep the main thread
Lastly what is playerInteract.java:172 ?
oh one more poitn this section of code !(l.getBlockY() <= 0) is equivalent to l.getBlockY() > 0
This question makes no sense. Re-word it?
All done but It doesn't give me the files I was missing in the first place
Did you make a module yet?
Oh it means you are not in a valid package
lemme dm you a photo
read the link I just posted
Location l = b.getLocation();
then b is null
its not a block igniting a block, its an entity, so you use getIgnitingEntity
Oh
and you always test for null if it can be null
i want to get the ignited block
silly question, but, can world names have spaces?
so i have to .getBlock
no
to enes or to me ?
I don't think so
ok
alright thanks 🙂
You getBlock() to get the block that was set alight
They used to be able to, but its not a good idea
It can break so many things
dang, i guess i have to support it then :/
Had a command with an arg that can have spaces & world would be a second one
just force them to wrap the world with "" if it has a space
I coundn;t honestly tell you if they can or can;t these days
actually once se
I just tried to create a world and it generated with a name with spaces
what should i do else
but on chunk load it appeared sorrounded by []
elgar, the command args will still split it right?
Yes spaces can still be used in world names
its just to be able to parse it after joining the parts?
you surround a "world test" in " it will be passed as a single arg
Thread.sleep(1000);?
No you never ever use any Sleep or wait.
sleep and wait are literally freezing the server for that amount of time.
To delay execution of code use teh Scheduler
if you want them spaced 1 second apart the first one would be 20L, the second would be 40L etc
Hi. Why this code doesnt work?
@EventHandler
public void onDziadek(PlayerMoveEvent e){
if(e.getPlayer().getInventory().getHelmet().getItemMeta().getDisplayName().equals("§7Helm Dziadka")){
e.getPlayer().sendMessage("test");
e.getPlayer().setWalkSpeed(0f);
}
}
}
The test shows up but im still able to move
any errors?
try -1
I think it adds the value rather then setting it. I could be wrong. Doesn't hurt to try.
That’s a question you should ask in the paper discord
I would estimate within a couple of days.
If you don't want a player to move, you should cancel the event, unless you wan't it so they cannot permanently move.
How can I create a command that, for example, I put /claim code and fetch https://server.es/api/itmCode.php?code=[CODE]
Usually teleporting them back to a certain location is better
It's most likely due to the string check
you shouldnt be comparing the helmet itemstack display name with some string
cause its not safe
and also did you register the event
Also the PME is limited to 20 tps
instead of using display name, use persistent data container
store the item as some sorta identifier as a string
does anyone know if it's possible to send and receive bungeecord plugin messages for any given channel when there are no players on?
No it needs a PluginMessageRecipient to send a message which is as of now only players are
I am unsure but I believe receiving doesn’t require any player
well one's redundant without the other
i'm trying to have a staff chat-like system, and basically if no one's on a given server and plugin messages are being sent to that server, when a player joins they basically just all start flooding chat
No but for instance only server A would need a player contained to send, server B doesn’t need a player contained to receive
well wb a solution to this
I believe that would never happen where it queues a lot of messages due to this
i leave and join server a (lobby) 10x times, which should be sending to all opped players on the network "yan left lobby", however no one is on the duels server, so when a opped player joins the dueled server, they're also greeted with a bunch of spam that should've been sent from the past
so i'm unsure how that's true
but there's gotta be some sort of solution for this
at least something
Oh maybe I am wrong then
One way would be to go use redis instead, I don’t know if someone tried this yet but to implement your custom PluginMessageRecipient
never worked with redis
would it work if i implemented a check for playercount?
yea should
Yeah technically you could get far with that
@eternal oxide it doesn't work, idk whats wrong.
can someone help me so i am making a punishment system called "IdkPunishment" and it is saying unable to connect to database which means it can't connect to my database.
code here
code that prints out the error
You don’t print the stacktrace?
no
It would help significantly if you would print it
https://paste.md-5.net/domutenulu.java
This is supposed to crack bedrock and give it to the players inventory when its ignited
idk whats wrong
no errors
.
doesn't work bc i realized the plugin is only received after a player is on the server, so i'm never gonna be able to get the server at 0
anyone at my case?
a shabby fix seems to be getting the player count from 5 seconds ago? using a scheduler ig
idk, do you have any better ideas
no one?
Hmm maybe you could add the player count or time stamp when sending the message and when you receive it you check the included data
Ok so you have two options
you can use reflection and NMS to use the recentTPS
or you can make your own class
to track the current TPS
wdym, so include the timestamp in the forwarded message and compare it on when it's received to see if it's the same as rn?
depends on if bungeecord messages are received immediately or not
hey i noticed in some plugins they save data when plugin is turned on and off. Simple example - a command that changes the boolean value to the opposite each time it is used and writes the value to the hashmap for each player. After restarting the plugin, the hashmap has been remembered and each player has the value set before the restart. Can it be done somehow without using the database and writing to the file?
hmmph
Technically you could use players pdc to do that
Enes have you tried debugging that ?
is this a response to me?
To tuso
o
Yeah or lazy validate the message
is this true tho
Class<?> craftServer = Class.forName ( "org.bukkit.craftbukkit." + getServerVersion() + ".CraftServer" );
Method getServer = craftServer.getMethod ("getServer");
Object nmsServer = getServer.invoke ( Bukkit.getServer ( ) );¨
double[] recentTps = (double[]) nmsServer.getField("recentTps");
double average = (recentTps[0] + recentTps[1] + recentTps[2]) / 3;
public static String getServerVersion () {
return Bukkit.getServer().getClass().getPackage().getName().substring(23);
}
maybe try this
Doesn’t have to be the time stamp, was just an example
because i wanna use System.currentTimeMillis()
I found it on the forums and it uses reflection to get the tps
timestamp seems the most efficient tho
I use Instant.now but both works
i think its with the if condition
it doesnt print "is bedrock"
if (!(l.getBlockY() == 0) && b.getType() == Material.BEDROCK){
System.out.println("is bedrock");
use != instead of !(condition)
is there anything else wrong?
But uh yeah block y is basically at the bottom
At least what you’re checking
Or nvm
Heh the opposite
conclure
is there any reason why messages r only processed after i leave and join the same server
e.g. they'll be sent from another server but i'll only receive them (using a bukkit.broadcastmessage to debug this) after i leave and rejoin that same server
it still doesnt work
i just need to fix this
Not sure about the implementation details so no sorry but I can look into it when I arrive home
Send the entire snippet
This is what I was looking at https://www.spigotmc.org/threads/resource-bookutil-1-8-1-9.131549/
It does look like it is using json
Maybe use b.getY() instead of b.getLocation().getBlockY()
Lol. The client would probably disconnect but the server would either have some sort of error just treat it as a timeout. It would be interesting to see what would happen though.
I'm having a problem with using my arenaConfig file (https://paste.md-5.net/qesiyiweti.cs). I've done so it's not much static in it but more constructors but I can't seem to be able to actually get the config or anything.
not working
Hmm Enes this is only when a player is igniting a block right ?
Yes
BlockPlaceEvent might be more suitable
Yeah uh sure
declaration: package: org.bukkit, interface: BanEntry
then, you can check if it was a ban using the QuitEvent, and checking if the user is banned
Ok it works, but the PacketPlayOutBlockBreakAnimation is not
did you get this workign while I was gone?
Oh xD
ah okies, I had to go t-cut my bonnet
yeah but as i said, but the PacketPlayOutBlockBreakAnimation is not working
?
@quaint mantle https://github.com/aikar/commands
You can see the group id and artifact id there
.
You might be sending it erroneously
wym
Does the sound play?
yep
Hey elgar, i just tried, sorrrounding part of a command with " & it is still taking each word as a different arg
odd
For example:
/setcustomblock "gold ore with overlay"
to both
yeah?
oh man I don't know where to start
as the sdound plays I see no reason for the packet to not play
Is a water bottle the only thing a player can consume or interact with related to water
it does but its on the last stage
its stuck there
ah ok, set teh entity Id to a random number
your packets are overwriting eachother
Anyone know if there is a way to indicate that multiple words in a command should be part of the same argument string?
I can do it manually if necessairy but i'd rather not reinvent the wheel
Do you get any break animation at all?
if i throw a snowball and it has a pdc and in it it has a namespaced key bob. If i throw the item/snowball does it keep it pdc even as an entity
pdc on ItemStack does not transfer
Yeah the last stage
it there a way i can keep it?
always
You never see any of the other break stages, but you do get their sounds?
Yep
how do u make maven repos lol
you use some repo hosting thing like artifactory
something like that
host it yourself
then you can upload artifacts on there
is there a way around so my entity still have the pdc from itemstack?
are you spawning it or launching manually?
launching manually
like i throw a snowball
and that thrown snowball still has it data from itemstack
it does?
@paper viper in cmd?
does lauching it manually mean like throwing it
Yes
Ok
yes
so yes
Yes
like you are inside your project direcotry
Ok good
you need to set the path for maven
Yes
I have not installed maven i am using a intellj plugin called minecraft development
which creates a maven installation in the project
bassacliy a maven enviroment
i dont have maven installed on my pc
It doesn't create a maven installation
^
IntelliJ ships an inbuilt maven version
you still have to install maven
That is uses to compile things
Your plugin merely configures it
(through the pom.xml)
I'd heavily advise for installing maven fully on your system
this is why i tell people to learn the thing before they get a gizmo to do the thing
get maven
on my pc
But how i am i using maven with intellj
intellij bundles its own maven binaries
read up
boolean meterMoved = (beforeLocation.distance(afterLocation) >= 1) ? meterMoved = true : meterMoved = false;
I don't use ternery operators at all is this correct or completely wrong as im trying to see if 2 locations are greater than 1 but im getting this error
Variable expected
List<String> pages = new ArrayList<>();
TextComponent page0 = new TextComponent();
page0.addExtra("\n");
page0.addExtra("Yea");
page0.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "google.ca"));
page0.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("k cool").create()));
pages.add(ComponentSerializer.toString(page0));
openBook((Player) sender, pages);
``` so I have this but im trying to add normal text without any click events or hover events. How could I do this?
yeah no
that isnt correct ternary
don't use = true
you cant assign
just do true
during ternary
ahhhh
boolean meterMoved = (beforeLocation.distance(afterLocation) >= 1) ? true : false;
thank you
which is literally boolean meterMoved = (beforeLocation.distance(afterLocation) >= 1);
oh yeah -_-
also
Sorry ive been at this for 6+ hours my brain is melt
use distancesquared
distance is kinda intensive if you're going to do this action a lot
distancesquared gets rid of the calculations stuff you need to do for square roots
Best way of checking if a player has moved a block as i will be using this alot later on
boolean meterMoved = (beforeLocation.distanceSquared(afterLocation) >= 1);
better?
Still aint working