#help-development
1 messages · Page 2278 of 1
ye it separates sub builders
They’re probably using a staged builder :0
But yes I agree with Lynx, no need to have that
Also
Just having a single builder is good enough? Over engineering the type system seems rather superfluous
There’s a lib called cloud which has that
For a single server this would handle very decently
And fairly justifiable also :3
but in that case a builder would have about 700 lines of code, so IMO it would be better to divide that code to smaller section like CmdEvents, CmdArguments, CmdProperties, CmdSubCommands
Sounds like you should split your components up a bit more
Also focus on getting 100 players before upgrading lol
Chances are you wont have that many starting out
100 concurrent is a lot
This staged/step builder is a bit well…. Often can be addressed better
I'm just coding for sake of coding
Sounds rather compulsive
nah
why is you spekin shakspear elgnish
Am I?
Hey
Hey 👋
Y:\Development\IntelliJ\OTroll\src\at\orange\otroll\OTroll.java:120:49
java: cannot access com.mojang.brigadier.context.CommandContextBuilder
class file for com.mojang.brigadier.context.CommandContextBuilder not found
How could I fix that?
That error does not come from the line you have highlighted
?paste teh full error
This is the full error
ah an IDE error
I'll assume you are trying to access a private field in the ServerPlayer object (as you are using obfuscated names its hard to tell). b should be the connection
Btw, is there some easy way to run task at the end of the tick? (in 1.17.1 btw)
tasks run next tick at the earliest
Run the task at the start of the next tick
it is also possible that there is a method with the name that returns or requires CommandContextBuilder, but that class is not on the build classpath
Though I have only seen the eclipse compiler complain about that issue
Paper has a ServerTickEndEvent
I am trying to get low delay for this, because I am using it for replicating light updates to client and the one tick delay is quite visible.
Oh, thanks, I was importing spigt api, so I didn't see it
Yeah but how to fix it
One tick delay is 50ms (max)
Thats the average ping of a player. Not sure if i would call that "quite noticeable"
well two ticks plus the ping would make it quite noticable
just increase the tick rate :)
I just looked it up and .b.a(packet) is correct
Just use minestom
The build classpath is incomplete, somehow - thus the IDE produces the error - somehow
I haven't used IJ for long enough to be absolutely sure about it however
Why am I getting null from e.getPlayer here?
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent e){
Player p = e.getPlayer();
//If the player is AFK, disable AFK
if(main.afkManager.isAFK(p.getUniqueId()))
main.afkManager.disableAFK(p,System.currentTimeMillis());
}
Yeah, I don;t see how he is even getting that warnign on that line for a non obfuscated path when he's not using any mappings
are you sure?
You dont
player is not null normall
I don't think you are
what are your dependencies?
Fringe plugin possibly
either you misidentified the thing that NPEs (it's probably main.afkManager that is null) or some plugin is not honoring the nullability specs
Ah, I notice now that it only happens when the player is afk I will look into that
depend on the bootstrap jar not the snapshot
Yep, I misinterpreted the error, this was the real reason: 13.07 18:31:35 [Server] INFO Caused by: java.lang.IllegalStateException: EntityPotionEffectEvent cannot be triggered asynchronously from another thread.
Wdym?
in the folder where you found the 1.19 SNAPSHOT jar there is one marked SNAPSHOT-bootstrap
How the hell can one think that this is null? Whatever
ikr
Or just depend on https://github.com/Mojang/brigadier directly
So is there now way I can remove a potion effect from that event?
I tried but it doesn't work
Javac moment
Weirdly I just checked the spigot jars and it is missing a bunch of the brigadier classes. It only has the tree package
well, and the CommandDispatcher
I mean, in 1.18 and 1.19 those should be their own jars
Yeah, in 1.19 it only has the minimal Brigadier
So is there any way to fix it?
how did you try depending on teh GitHab Brigadier?
its only released as sourcecode and you are not using any build tool
the jar
Nope
But would the people have to download the Github brigadier too?
Well, you said you tried it but clearly you have not
oh they dont publish release jars
as there is no jar to download for it. you have to build it yourself
However, your IDE error makes no sense at all. Its complaining about a dependency you are not using
its literally bitching about Brigadier when you call ServerPlayer#connection.send(packet) (yours is obfuscated).
https://pastebin.com/kG4e1Z4t anyone know why this would be lagging my server? its supose to load a schematic using FAWE over a period of time so its kind of in rows which it does fine on a small scale but i have a relatively small schematic (20x20x40) ish and it crashes my server ;p im loading it over 1000 ticks so its not like its all being set at once
First thing i notice: IO
Using Files or Databases on the main thread is bound to cause lag at some point
If you know that they are offline and will continue to be offline you can use Trees - this would keep them stored for a long(-er) time at virtually no cost
I tried the spigot one
but thats the only way i can get the schematic file
there is no spigot one
There is
try the jar geol linked
Load them async and then use them sync.
also it works fine with small schematics like 5x5x5 but not medium ones
wdym
Well then you would need to keep tree and a list/map (or just update the tree on logout/login)
Also this looks to me like you are pasting the schematic every tick for several ticks.
Then your IDE is fubar. Theres no reason for that error
Oh the problem was:
It wasn't used
It was added as an library but not as an dependency
im getting each row of the schematic then loading it over a period of time (atleast thats the intention)
lol
Why dont you just paste it using the fawe api and let it handle the workload distribution?
because i need it to paste row by row to make it look smooth with fawe its just the entire thing at once but im trying to make it customizable so each row is pasted at a time its a bit hard to explain
but it should be pasting 1 row every ~40 ticks so its not every tick
I have no idea why you are iterating over the whole schematic there. This just looks messy.
FAWE has no way to get a schematic by row so i dont have any other choice
TreeSet<OfflinePlayerEntry> offlinePlayers = new TreeSet<>();
Map<UUID, Integer> onlinePlayers = new HashMap<>(); // This one would need to be sorted every time and merged with the offlinePlayers tree when needed
class OfflinePlayerEntry implements Comparable<OfflinePlayerEntry> {
private final UUID offlinePlayer;
private final int playtimeHours; // MUST BE FINAL
// Don't forget the constructor, hashcode and equals method
public void compareTo(OfflinePlayerEntry other) {
return Integer.compare(playtimeHours, other.playertimeHours);
}
}
// On logon remove player from the offlinePlayers list (you must need to have the EXACT same playtimeHours variable)
// On logoff you can add it back again
Something like that
Yes you do. Instead of iterating it every tick you could just iterate it once.
Or even better: You use editSession.setBlock for a whole row. Go from xMin to xMax and zMin to zMax for a fixed y
The big issue is that there is no way to easily sort something by it's value if the value can change
alright ill try the setblock thing thanks but how is it iterating every tick?
Hence we NEED to make the "value" final
Yeah - hence we only represent offline players in the tree
For the online players you can represent it however you want
how can i rotate an Object[][][] array?
rotation matrix
?
Yes this is for a rotation in an euclidean space
List<Map.Entry<UUID, Long>> /* uuid, ticksPlayed */ online = new ArrayList<>();
// Populate the online list
List<Map.Entry<UUID, Long>> bestPlayers = new ArrayList<>();
Iterator<OfflinePlayerEntry> itOff = offlinePlayers.iterator();
Iterator<Map.Entry<UUID, Long>> itOn = online.iterator();
Map.Entry<UUID, Long> bestOnline = null;
while (itOff.hasNext()) {
OfflinePlayerEntry e = itOff.next();
while (true) {
if (bestOnline == null) {
if (itOn.hasNext()) {
bestOnline = itON.next();
} else {
bestPlayers.add(Map.entry(e.offlinePlayer, e.playtimeTicks));
break;
}
}
if (e.playtimeTicks <= bestOnline.getValue()) {
bestPlayers.add(Map.entry(e.offlinePlayer, e.playtimeTicks));
break;
}
bestPlayers.add(bestOnline);
bestOnline = null;
}
}
if (bestOnline != null) {
bestPlayers.add(bestOnline);
}
while (itOn.hasNext()) {
bestPlayers.add(itOn.next());
}
@last temple
Or do you want to rotate the matrix in memory?
wdym
Well the code that I suggested would, if implemented correctly have 0 latency
It would be more buggy however
But they can be ironed out
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
Clockwise rotation
[7, 4, 1]
[8, 5, 2]
[9, 6, 3]
And you want this for an 3D array?
- Why?
- Is it a cube?
- yes
This makes it a bit easier. But you still need to decide around which axis you want to rotate and in which direction.
that is not a problem
LootGenerateEvent or edit the loot tables directly
I find the first one less tedious.
I can only think of algorithms that would scale poorly memory and time wise. But its pretty much just a nested loop over
2 dimensions that need to be flipped.
send them
public void rotate(Object[][][] cube) {
int sideLength = cube.length;
Object[][][] temp = new Object[sideLength][sideLength][sideLength];
System.arraycopy(cube, 0, temp, 0, sideLength);
for(int x = 0; x < sideLength; x++) {
for(int y = 0; y < sideLength; y++) {
System.arraycopy(temp[y][x], 0, cube[x][y], 0, sideLength);
}
}
}
No idea
Clockwise around the z axis would be my guess
Again: Why do you need to do this?
I cant imagine a scenario where this would be useful.
Well to rotate you just have to multiply your matrix by the rotation matrix you want
Its not an euclidean rotation he wants.
my server keeps loosing like 50% of the chunks every time I restart the server. I have world edit installed and my plugins folder is connected to a github repo. Could it have anything to do with the plugins?
How does a server lose 50% of the chunks? As in deleted? reset? What version? lol
1.19 as in deleted no nothing just void
yup
world edit
custom plugin
self made
although
I dont see how my plugin should affect it
Try without them
How are you stopping the server
Using spigot or a fork?
restarting the systemd service
oh
lol
thats prob the problem
cause it needs to run some stuff before instantly killing it right?
You're killing the server ;/
Let it stop normally
That is just like pulling the power cable
how would I let it stop?
Stop command
Ctrl + C or the stop command
/stop?
yea
can I use it ingame?
Yeah, but also via the console
thanks ppl
Hoi, i'm making a plugin where i need to damage a player's armor, and this works fine, now my problem is having the armor break when reaching 0. of course i could just remove it but what i'm looking for is to let the player know that his armor piece broke
if left - amount <= 0:
tellPlayer()
?
i mean by having the breaking animation display
like, when you take damage at 0 durability, you hear a sound and see the armor's particles
just like you would by taking regular damage
i suppose so
cancel every entutyDamageByEntityEvent if both the damager and entity are players
is there a /restart command so I dont have to stop and start all the time?
?
it causes some problems for some plugins but isnt it just fine for most?
sucks for dev tho
i use reload for development purposes all dah time no cap cuz on the blood on the gang cuz
i would need to restart almost every minute when debugging
depends on whats on your server
add multiverse and this 9 seconds already become smth like 20
ew multiverse
try running bungee on an AMD fx with 7g of ram ddr3 x)
yeah at like 16 tps
right
if i can run 4 1.8 - 1.18 servers with a few ide tabs open, with chrome tabs open to high hells you can make bungeecord run
Running multiple servers on one server isnt how things are meant to be
bungeecord for this reason
cant run 1.18 and 1.19 at more than 15tps with only a single dimension
oracle free vps
i only have one server though
So I made my own plugin and in there I check if a player has a permission using if (player.hasPermission("warpplugin.command.list")) { But somehow it doesnt work. Even though I did add those permissions by using Powerranks webeditor
Use vault to check permissions
i have this bug sometimes
And how do I do that? 😅
permission checking straight up wouldnt work, used vault to check perms and never had issues again
sec
Add debug statements to see what is happening
Don;t use vault to checkperms. Use Player'hasPermission
So what Im already doing, but that isnt working
then you didn;t give the permission
Why not?
I mean new so how do I do that? 😅
Then you are not giving the player the permission or something else is not working
Vault hooks directly to each permission plugin so its not needed. Effective permissions are on the actual player
If you give yourself op and it still doesnt work then the permission is not the problem. Do that.
When Im op it works just fine
Vault would be teh correct choice, if you want to check a permission in a world they player is not in
Well there you have it. You didnt give yourself the permission properly.
I think so yes
ServerPlayer
Powerranks says it did though
Yeah Player is just an abstraction
So using player is the correct way?
You need to specify your startup script in the spigot.yml
or bukkit cant remember
ooh, like the command?
or bash file?
should InventoryInteractEvent detect moving items around in the inventory ?
i dont just make a cow flip simulator
Does someone know how to use cronjobs on sh skript to automatically restart the server at certain time every day? I tried and it didn't work
hey ! so i have this code.
the goal is to create a private chat between the roles "Zabuza" and "Haku".
when either of them send a message in chat with a "!" before that message, the other one and the player receives that message.
the problem is the folowing :
when the player is "Zabuza" it works perfectly fine
when he is "haku" it doesnt.
anyone knows why?
@EventHandler
public void onMessageSend(PlayerChatEvent event){
Player player = event.getPlayer();
User user = getUser(player.getUniqueId());
String message = event.getMessage();
if(hasStarted){
if(user.getRole() == Role.Zabuza){
if(String.valueOf(message.charAt(0)).equals("!")){
for(Player player1 : Bukkit.getOnlinePlayers()){
if(getUser(player1.getUniqueId()).getRole() == Role.Haku && users.contains(getUser(player1.getUniqueId()))){
player1.sendMessage(BLUE + "Zabuza : " + GOLD + message.substring(1));
player.sendMessage(BLUE + "Zabuza : " + GOLD + message.substring(1));
}
}
}
}else{
if (user.getRole() == Role.Haku) {
if (String.valueOf(message.charAt(0)).equals("!")) {
for (Player player1 : Bukkit.getOnlinePlayers()) {
if (getUser(player1.getUniqueId()).getRole() == Role.Zabuza && users.contains(getUser(player1.getUniqueId()))) {
player1.sendMessage(BLUE + "Haku : " + GOLD + message.substring(1));
player.sendMessage(BLUE + "Haku : " + GOLD + message.substring(1));
}
}
}
}
}
event.setCancelled(true);
}
}
Isnt there a skript discord?
You are always cancelling the event if the user is not Zabusa
I'm talking about sh skript not skript for plugins
where ? the "event.setCancelled(true);" is outside the if else isnt it?
Yes shell
Right i misread that
Wdym?
its shell script not shell skript. Thats why i instantly thought of skript.
You have a lot of common code in here. This violates DRY
How can I detect when a player uses a command?
Yes shell script. My bad. Do u know how to do it tho?
Do you use screen?
wdym?
Well either way you need to schedule the job outside of the window and let it tap in and then execute /restart
i get it
For example this:
if (String.valueOf(message.charAt(0)).equals("!"))
Whenever you have copy pasted code then you are doing something wrong
One moment ill give you an example
private static final Set<Role> CHAT_ROLES = Set.of(Role.Zabusa, Role.Haku);
@EventHandler
public void onMessageSend(PlayerChatEvent event) {
Player player = event.getPlayer();
User user = getUser(player.getUniqueId());
String message = event.getMessage();
if (!hasStarted) {
return;
}
event.setCancelled(true);
Role userRole = user.getRole();
if (!CHAT_ROLES.contains(userRole)) {
return;
}
if (!message.startsWith("!")) {
return;
}
Role oppositeRole = userRole == Role.Zabusa ? Role.Haku : Role.Zabusa;
for (Player receiver : Bukkit.getOnlinePlayers()) {
if (getUser(receiver.getUniqueId()).getRole() == oppositeRole) {
receiver.sendMessage(BLUE + userRole + " : " + GOLD + message.substring(1));
player.sendMessage(BLUE + userRole + " : " + GOLD + message.substring(1));
}
}
}
This does pretty much the same with the common code extracted.
Go ask on the skript discord
oh i seee
thx
Actually this might be a bit cleaner
private static final Map<Role, Role> CHAT_ROLES = Map.of(
Role.Zabusa, Role.Haku,
Role.Haku, Role.Zabusa
);
@EventHandler
public void onMessageSend(PlayerChatEvent event) {
Player player = event.getPlayer();
User user = getUser(player.getUniqueId());
String message = event.getMessage();
if (!hasStarted) {
return;
}
event.setCancelled(true);
Role userRole = user.getRole();
Role oppositeRole = CHAT_ROLES.get(userRole);
if(oppositeRole == null || !message.startsWith("!")) {
return;
}
for (Player receiver : Bukkit.getOnlinePlayers()) {
if (getUser(receiver.getUniqueId()).getRole() == oppositeRole) {
receiver.sendMessage(BLUE + userRole + " : " + GOLD + message.substring(1));
player.sendMessage(BLUE + userRole + " : " + GOLD + message.substring(1));
}
}
}
Its expandable for more roles.
Did you learn about functional interfaces? Consumer, Supplier, Function, BiConsumer, BiFunction etc
duh
ages ago
CompletableFutures?
yes
functional interfaces are the best ongod
pair a functional interface to a future and ohmygod
Streams
yes
Reflections
yes
Orchestration with Semaphores and Locks?
yes
definitely
synchronized keyword, locks, semaphores, executors etc
70% of that
locks and synchronized key word and executors yes
idk what the heck is a semaphore
we in high school?
Well then its time for some frameworks.
I would highly suggest Redisson.
redis framework?
Yes
Redis is the most powerful tool for multi instance networks
Another thing you can try is communication through sockets.
Its a type of lock with multiple permits
whats the command doing
Unplayable. Almost crashing the server.
the amount of stress you caused to your server made it produce extremely high amounts of temperature that had the FBI and CIA and the russian government concerned and prepared for wide range nuclear explosions, you caused a catastrophe!
Is there any tools or way, to where i can clone a github repo, and have it be built on a linux machine?
jenkins
But money
shit, where do I hide?
i should of mentioned free
jenkins is free
oh
i think i need to plug my own server in
orchestration
gonna be like 4 different server instances
cant believe i spelled it right
Orchestra?
Its managing threads and generally resources in a performant way.
Orchestration
i mean thats pretty vague
Yes it is. Go for other topics.
Bytecode injection with ASM would be another topic
Serialisation with Gson. This one is really hard to master.
Im at the point where i dont have to manually write any serializer anymore
because my uber Gson instance can serialize everything from records to interfaces
gh actions?
Then you are using it wrong
i heard its complicated
but
i also heard jenkins is a bitch to setup
not really that hard
I would love to just be able to build on my local pc, and when it builds it pushed the jar to my linux server
i use it for posting my python package to pip when i make a new release
idk if i rly need something like jenkins for that or not
Dont know how any automation stuff rly works
See but thats so easy cause its done through clis and you never need to compile or touch anything
same with nodejs
i could create my own auto deployment with nodejs but with java idk how lmao
I need to spawn cages for a minigame. Any way to use a schematic or something to have the same build spawn at multiple places without using too much resources?
what is lru
How i can get a List of a value in a MySQL table?
like my table has name and uuid
how i can create a List of uuid?
I mean SELECT uuid FROM table and then iterate over the result set ?
i need a List<String>
💀
List of uuid 👀
You shouldnt store a uuid as varchar in your DB
caching algo
this conversation is making me lose brain cells
Least Recently Used
well duh but what is it
so what
saying the first 2 words u see in google isnt that much of an explanation yk but thanks
Every db supports uuids natively and its infinitely faster than varchar
i didnt google it lul
thanks anyway but main question/problem is something else
may you explain how it works
can someone help me with thius erorr log
Create a select query and iterate over the ResultSet
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
send the error do not just ask
lol its like tryitandsee
so we can't help you without any logs
Current Thread: Server Thread
[21:37:41] [ERROR]: [tchdog Thread] PID: 52 | Suspended: false | Native: true | State: RUNNABLE
[21:37:41] [ERROR]: [tchdog Thread] Stack:
[21:37:41] [ERROR]: [tchdog Thread] java.net.SocketInputStream.socketRead0(Native Method)
[21:37:41] [ERROR]: [tchdog Thread] java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
[21:37:41] [ERROR]: [tchdog Thread] java.net.SocketInputStream.read(SocketInputStream.java:171)
[21:37:41] [ERROR]: [tchdog Thread] java.net.SocketInputStream.read(SocketInputStream.java:141)
[21:37:41] [ERROR]: [tchdog Thread] java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
[21:37:41] [ERROR]: [tchdog Thread] java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
[21:37:41] [ERROR]: [tchdog Thread] java.io.BufferedInputStream.read(BufferedInputStream.java:345)
[21:37:41] [ERROR]: [tchdog Thread] sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
[21:37:41] [ERROR]: [tchdog Thread] sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
[21:37:41] [ERROR]: [tchdog Thread] sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1590)
[21:37:41] [ERROR]: [tchdog Thread] sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1495)
[21:37:41] [ERROR]: [tchdog Thread] java.net.URL.openStream(URL.java:1093)
thats a shortened version
?paste
Need all of it
it works on our test server but not in our production server
^
Sure - It keeps track of the age of each thing it is caching. When it is full it discards the thing that is the "Least Recently Used"
to make space
Well, age as in when it was added
o
so the oldest thing added
PaperSpigot 
is just kicked
ic
thats pretty dumb if u ask me
had to use "dumb" cuz "This message can’t be posted because it contains content blocked by this community. The message may also be viewed by the community owners."
r word is blocked 💀
You're doing network things on the main thread causing the server to freeze and shutdown
oh
owo
How do i not run it on the main thread
also on a minecraft version that is old enough to go to kindergarden
either use a completable future on its fork join thread pool or the bukkit scheduler provides async run methods
?scheduling
^
imma use futures
because my future so bright
that i always gotta be
looking in the future
can a method of the eventlistener class be non static?
they should all be non static
oh
Lol what
public void <methodName>(<EventType> eventVarName)
Doesnt matter if its static or not
Its just normal to keep it non-static
people dont like static
if you instantiate a listener, the listener methods should be available to that instance
ig
declaration: package: org.bukkit, interface: Chunk
idk the dimensions
declaration: package: org.bukkit, interface: World
if you wanna check below that block for more air is up to you
Why does InventoryOpenEvent doesn't fire?
does anyone have any commandapi?
like command framework ?
do you have its github?
https://github.com/Incendo/cloud would be one
update i found a way to make my own auto deployment
i made a script that clones the repo and then builds with gradle and shoves the gradle file to the server directory 
?paste
ignore
replacing a plugin jar file while it is open might not play too well
i didnt
windows supports that
you still have to /rl or /restart tho
How do i cancel a command 🤔
twitter works well
A custom command or vanilla?
?
Did you make the command?
Is there a way to detect player movement that was only done by the player?
but that would send the usage messages
No return true with your own error message
hi im probably dumb
but
public static boolean checkNicked(UUID uuid) {
AtomicReference<Boolean> nicked = new AtomicReference<>(false);
try {
Runnable runnable1 = () -> {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new URL("http://45.151.135.0:3005/checkNick?uuid=" + uuid.toString() + "&token=e
").openStream()));
nicked.set(Boolean.parseBoolean((((JsonObject) new JsonParser().parse(in)).get("nicked")).toString()));
in.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
};
} catch (Exception e) {
System.out.println(e);
System.out.println("checkNicked error");
nicked.set(false);
}
return nicked.get();
}
why isnt that working
final int chunkXInRealWorld = chunk.getX() << 4;
final int chunkZInRealWorld = chunk.getZ() << 4;
world.getHighestBlockAt(chunkXInRealWorld + 8, chunkZInRealWorld + 8);
would do it no ?
15 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c45 minutes&7!" Enter
30 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c30 minutes&7!" Enter
45 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c15 minutes&7!" Enter
50 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c10 minutes&7!" Enter
55 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c5 minutes&7!" Enter
56 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c4 minutes&7!" Enter
57 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c3 minutes&7!" Enter
58 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c2 minutes&7!" Enter
59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c1 minute&7!" Enter
15 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c45 seconds&7!" Enter
30 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c30 seconds&7!" Enter
45 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c15 seconds&7!" Enter
50 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c10 seconds&7!" Enter
55 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c5 seconds&7!" Enter
56 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c4 seconds&7!" Enter
57 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c3 seconds&7!" Enter
58 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c2 seconds&7!" Enter
59 59 2 * * * tmux send-keys -t ${SERVER} "broadcast Server is restarting in &c1 second&7!" Enter
0 3 * * * tmux send-keys -t ${SERVER} "broadcast &4Server is restarting&c..." Enter
0 3 * * * tmux send-keys -t ${SERVER} "stop" Enter```
@steel swan btw
u shouldnt do
"if (String.valueOf(message.charAt(0)).equals("!"))"
u can just
if (mssage.charAt(0) == '!')
no need to wrap a string
I'm having issues with implementing the spigot 1.19 jar into my old plugin that I haven't messed with since 1.17; it tells me all the bukkit imports and such can't be resolved, i.e. import org.bukkit.Bukkit can't be resolved
Look if you have added correctly spigot as project dependency
I am not entirely sure how to do that whoops
this gives me a NullPointerException for PreparedStatement line
Connection is probably null
Print connection
Suppose I want to find the coordinate that a player clicked at on an map (that is inside an item frame). Not sure how to approach this at first, but could I first assume the map as a plane axis and get the player clicked direction as a vector, and find the intersection point between a vector and plane in 3d space? Im not sure what the proper way would be.
yes it seems its null but why?
because if its null why plugin is still running
maybe because connect just doesn't properly set it
doesn't the entity interact event have a vector of exact click ?
created the tables i want
to it is fine?
?paste
public void connect() throws SQLException {
if (!isConnected()) connection = DriverManager.getConnection("jdbc:mysql://" +
host + ":" + port + "/" + database + "?useSSL=" + ssl, username, password);
}
public void createTables() {
PreparedStatement preparedStatement;
try {
preparedStatement = connection.prepareStatement(
"CREATE TABLE IF NOT EXISTS " + playersTable + "(uuid VARCHAR(255), name VARCHAR(16), PRIMARY KEY (uuid))");
preparedStatement.executeUpdate();
preparedStatement = connection.prepareStatement(
"CREATE TABLE IF NOT EXISTS " + experienceTable + "(uuid VARCHAR(255), xp INTEGER, PRIMARY KEY (uuid))");
preparedStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
uwu
is MySQL a field name ??
its class name
how are you calling a non static method then
Yeah it does. Should I find the intersection between that vector and the map (which can act as a plane) to find the map coord?
hmm right lemme test
I’ll research some stuff
iirc the map's location should be its centre ?
I don't see you actually assigning the connection field anywhere here
it was not static
that was the problem
static was the problem
sorry, too late for spelling xD
getRow is not how you do that
resultSet.getInt(resultSet.getRow())?
no
read through a tutorial
specifically this part
on how to grab results from a result set
fixed thanks
i don't know how to get top 10 players from a database has 2 tables
table 1 is Player UUID and XP
table 2 is Player username and UUID
how i can store top 10 players in a hashmap? (Username and XP)
tbh i need a spoon feed help because its ~4:30 AM and i want finish this part before going to bed
I cba to type the query out
SELECT username, xp
FROM players
JOIN xp x on players.uuid = x.uuid
ORDER BY xp DESC
LIMIT 10
Are static variables like Inventories safe or it's better to store them inside something?
would yield you the top 10 players in regards to xp by name and xp
Well, meh, concerning inventories are not real constants and are mutable idk if static is the best
I have gui inventory method which returns inventory then i want to access it in two other classes
Wouldn't you want that inventory in a Map<UUID, Inventory> anyway tho ?
else how would your plugin handle two players using the inventory at the same time
So Map okay
this will gives me 10 top players? from highest xp to lowest?
and i don't know what is x and players.uuid = x.uuid
Table 1 (name: players) is Player UUID (name: uuid) (key) and XP (name: xp)
Table 2 (name: experience) is Player UUID (name: uuid) (key) and Username (name: name)
can you gimme another example with this information? thanks
x is the name to refrence the xp table
ow
i think this works
SELECT uuid, xp FROM experience JOIN xp x on players.uuid = x.uuid ORDER BY xp DESC LIMIT 10
i've to change player yes?
JOIN xp x
makes no sense
if your table is named experience
also if you start from experience, you'd join player
can you see this and gimme another example?
my brain is not working correct
sorry
SELECT username, xp
FROM players
JOIN experience on players.uuid = experience.uuid
ORDER BY xp DESC
LIMIT 10
for example
thanks
note, we can drop the table identifier here
sleep
as we don't have a name collision
i've to finish this
lol
exactly
i don't have anything named username
You can get name from uuid
so name
But it’s a bit sketchy
instead of username
I mean, no need for a mojang auth request if you have it in your DB
if this will not work i delete IntelliJ IDEA
"SELECT name, xp FROM " + playersTable + " JOIN " + experienceTable + " on " + playersTable + ".uuid = " + experienceTable + ".uuid ORDER BY xp DESC LIMIT 10;"
Space before first Join
After players table
playersTableJOIN
experienceTableuuid
Ofc it won't work
?
like playersJOIN ?
no
playersTable + " ...
U need a space before join
lol np
Rotating my phone showed me the space
np
Mb
It should be sorted by the experience column
Hey I have a question is anyone available
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
but it is not
public static HashMap<String, Integer> getTopPlayers() throws SQLException {
String playersTable = Utils.getConfig("database.players_table"), experienceTable = Utils.getConfig("database.experience_table");
HashMap<String, Integer> players = new HashMap<>();
PreparedStatement preparedStatement = MySQL.getConnection().prepareStatement(
"SELECT name, xp FROM " + playersTable + " JOIN " + experienceTable +
" on " + playersTable + ".uuid = " + experienceTable + ".uuid ORDER BY xp ASC LIMIT 10;");
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
players.put(resultSet.getString("name"), resultSet.getInt("xp"));
}
return players;
}
try {
Utils.getTopPlayers().forEach((String username, Integer xp) -> {
player.sendMessage(username + " " + xp);
});
} catch (SQLException e) {
throw new RuntimeException(e);
}
Erm so I was looking through the website and was wondering if there was any good /vanish plugins you could recommend
Use LinkedHashMap
imajin predicting the future
🙂
69
:D
@eternal night i think if i sleep rn, i will wake up 3 or 4 more days
lmao xD
gn xD glad you figured it out 🙂
Does anyone know of any good web panels that let me create and manage VM/VPSs? Preferably one I can install on my own server node
Not like VirtualBox, I want something a little more and ptero doesn't really cut the needs cause I want root access to the VMs not just have a docker instance
I want a tool like some VPS hosting companies have, being able to look through a web panel and view statistics about the overall dedi and vms, create VMS, view databases, and manage other things about the server (Like cPanel/sPanel has) I would use one of those two but I don't wanna spend money on just something ill have locally for a while and not gonna be deployed remotely as of now
I think i know one
Let me find the name
I would recommend using prepare statements and parameterized requests. For example:
public ResultSet find(UUID uuid) {
String sql = "SELECT * FROM users WHERE uuid=?";
PreparedStatement st = this.connection.preparedStatement(sql);
st.setString(0, uuid);
return st.executeQuery()
}
So im making a plugin that runs a command through console, and i want people to be able to change the message it sends but I don't really understand how to do it. I got the config to generate but I don't know how to get it to run the commands like I want
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import world.pokeorigins.mc.pokeclear.PokeClear;
public class Broadcast extends BukkitRunnable{
PokeClear plugin;
public Broadcast(PokeClear plugin) {
this.plugin = plugin;
}
@Override
public void run() {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "broadcast §bPokemon have been cleared");
}
}```
it pretty much every hour runs the command broadcast
but I want to be able to change the message in the config after the word broadcast
You can get the config from YourMainClass#getConfig()
Hi i find the name of the panel its called webmin
how do i check if a block is a door
By checking the material
yeah but there isnt a built in way to check if its one of the 5 kinds of doors
whatev I did this
public static final EnumSet<Material> MATERIALS = EnumSet.noneOf(Material.class);
static {
for (Material material : Material.values()) {
if (material.toString().contains("DOOR")) {
MATERIALS.add(material);
}
}
}
?di
instanceof
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Ok
isTagged what a friendly name!
hop on rocket league
😂
Playing Minecraft with my girlfriend
Couple goals
Oh how old are u?
If i can know
22
22
Slow
haha
i suppouse she is the one on the photo
Yes
tyty
I thought you where 17-18
doesnt really look very appealing to the eye haha
ill look into it
gotta wait for this dedi to deploy time for a coffee
Burch a friend told me
I just send it to you ==> <==
☝️
You can also have others alternatives like cPanel
yes but cpanel costs money
i would use sPanel if it was open source
gonna try ispconfig and see what thats like
Hi, is a dumb question but im thinking about it. But the runnable is not running
send code
Thanks
Sorry for time but pastemd5 wasnt loading
I think the issue is caused by the TImeUnit because it was working before
Burch?
I think it's because you're passing milliseconds for the period.
is that config long epoch milli?
if so you can pass it to Instant/Date instead of doing that wonky transform
in reguards to it not working
it should work uhm
im not sure never overrided BukkitRunnables before
Allrgiht
Strange because before addig TimeUnit was working
Also on git how can ignore every target directory from the modules?
in git ignore add target/*
add .idea/ too to ignore idea files
that TimeUnit conversion is giving you 1000 milliseconds for every second
and since period is in ticks it's treating that like 1000 ticks
oh thanks
But wait
ill ignore modules target?
Because i have modules. menu and file which contains a target directory
Will them ignored?
hmmm
for that you may need to ignore in the module directory
ive never git ignored like that before
i would assume
target/* ignores every folder named target
while target/ ignores just the target folder in the base directory (hence why .idea/ doesnt have a * at the end)
** is also another thing
ok
thanks and sorry for being annoying
nono its fine gitignore is annoying
i was doing soething a few months back, it was different i think iwas trying to gitignore a private key file inside the code and it didnt wanna work lol
wait its possible to ignore keywords form being upload to git?
Lmao i would love to know that
.idea/
.gradle/
**/build/``` my gitignore
So that will ignore every directory called build right? no matter if its inside a sub directory?
Any idea why maven can't resolve spigot 1.19? Unresolved dependency: 'org.spigotmc:spigot:jar:1.19-R0.1-SNAPSHOT'
what is this dependency even? :jar:
Did you run buildtools?
Do you need nms or only the api?
Forgot to, that helped thanks!
So I've just started with spigot & java - and have been making a few simple plugins to learn.
I'm trying to get all the blocks of a certain type in X chunk.
Is there any already existing methods that I would use, or do I scan through every block in the chunk I need
and compare it's type?
That's obviously exceedingly inefficient and resource intensive, but not sure if there's a better way to do it.
is it possible to play the hand animation from the server side
as in, for example a player right clicks some bricks with a stick
i want the animation of the player swinging their hand to be there
okay1203, i dont think because i know that the server only displays the player itself in the server to all the players
But im NOT really sure
alright
#help-development is for development support or questions
If need server support go to #help-server
ok sorry
Someone help me please i try to make plugin with 1.19 bukkit but it can't import using buildpath can someone share totorial how to import bukkit file using maven pls
i just installed a new skript addon and now my server wont run
and it says spooky things like "hecked ur serevr"
Server?
no i ask here
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Is this work for eclipse?
u absolute troll
sorry im high and watching a show
bri
shes
fucking insane
did he booby trap the car
@quaint mantle
Nop
Whut
how can i set log type to birch in 1.8?
1.8 🥲
Set the Data Byte to the Magic value corresponding to birch logs
* Gets the metadata for this block
*
* @return block specific metadata
* @deprecated Magic value
*/
@Deprecated
byte getData();```
Deprecated
Deprecated as in "this method doesn't make Sense, yet it exists"
It is Safe to use in 1.8
In 1.13 and above you should never use it however
thanks working
This is the Main reason I despise 1.8 - 1.12
I'm pretty much new to Spigot and Paper, please don't judge how messy this is.
Anyway, this works. But however, when I try to craft the item named "Reroll Item" it gives me the first recipe, which was an Enchanted Golden Apple instead. Can anyone help? Thanks 😄
When you initialize SR1 you use Item, Not item1
Also, avoid using the mc namespace when it makes No sense
ohh
i was looking everywhere ty
?jd-s
hmm
what kind of executor is best suited for database operations? im intending to provide it to the completablefuture instead of the common pool
basically do some db queries once in a while
What type of db is it, is the tasks cpu bound or io bound?
Altho in general I personally prefer a work stealing pool in scenarios like these with async mode enabled that is
its an embedded h2 database so running locally
but what do you mean if the tasks are cpu or io bound?
Depending on that you might wanna adjust the parallelism of the pool
If some tasks are cpu bound the usually there’s no point in going over the amount of processors when choosing the parallelism
well its mostly loading playerdata stuff and saving things so im not sure
i think mostly io as its a database? ¯_(ツ)_/¯
Yeah h2 is mostly io bound
In that case you could go with a higher parallelism than the amount of available processors
dont really know what parallelism is
the amount of tasks it can run at the same time?
It’s the amount active workers the pool will try to maintain
The amount of threads can still be more tho
ah
The biggest advantage of fjp provided you use it in async mode is that you get a queue per worker
And a worker can basically steal another worker’s tasks on their queue
A normal thread pool executor only has a single queue for the tasks before they get executed
and what the advantage of having a queue per worker then? faster?
hmm
Else a fixed thread pool where you configure M:N (core pool size:max pool size) is fine
But yeah you should probably read about littles law and what the notion of a blocking coefficient means, that might help you a bit to configure the values of whatever pool you’re gonna use
hmmm
if im understanding it correctly, the blocking coefficient is the percent of the time that a task is blocking and waiting for input or something?
not sure about the blocked part
how would I create a new task that runs 30 times with 1 second between each time and then schedule it?
?scheduling
L signifies its a long
yes
so it waits so many ticks before doing the task?
gameStartCountDown.runTaskTimer(this.plugin, 20L, 30L); will this run the Runnable 1 time per second for 30 seconds?
in 30 ticks it will start the task and run it every second forever
or the other way around
I forget which is delay and which is interval
interval, is second one, so starts in 20 ticks and runs every 30 ticks from them on
the first is the delay
yes
you keep a count inside the task and cancel it when you reach 30
how do I cancel from within the run function?
but
nvm
BukkitRunnable gameStartCountDown = new BukkitRunnable() {
private int count = 30;
private final Mgames plugin;
public BukkitRunnable(Mgames plugin) {
this.plugin = plugin;
}
@Override
public void run() {
if (count == 0) {
this.cancel();
}
Bukkit.broadcastMessage("Seconds: "+count);
count--;
}
};
gameStartCountDown.runTaskTimer(this, 0L, 20L);
``` How do I access the main plugin from within the BukkitRunnable I realized this would not work
YourClassName.this
That a thing?
Can you get already initialized objects by class. This
Will it return the initialized objects of that class?
dont you need to do a return after the cancel() too?
hi
oi
I'm late back to the discussions but, learn Dependency Injection to get the Plugin instance. However my favourite at the moment is java JavaPlugin.getProvidingPlugin(this.getClass())
Well this wont work in his case.
Unless he calls it with PluginName.class
He can just do
YourPlugin plguin = YourPlugin.this;
If the runnable is an anonymous class inside his JavaPlugin
this is for scheduling so it shoudl work. its taking the current class
its getProvidingPlugin not getPlugin
I thought he wanted an instance inside of his runnable
I know dependency injection
Sorry to barge in with some random bullshit but maybe someone knows something about this
Does anyone know how to allow lets encrypt to use a secondary IP to create a SSL record against?
I have a subdomain that points to a secondary IP my server has (Yes it points to the server, i can use both ips to ssh in the server so im not sure why lets encrypt says this to me)
I did
then I'm wrong
is that FQDN pointing to your server?
Yeah its an A record pointing to the secondary IP assigned to the server
It says (154.53.58.245) is teh resolved IP for panel.civ-server.cloud
I don’t think so?
oh are you specifying the other IP when setting up?
I mean he creates an anonymous subordinate/subclass
Say I have a config file
test:
item1: 1
item2: 409358
item3: -2304230
How can I remove just one of these items from here?
Yeah i wanted to run NGINX off the secondary IP and run my ptero daemon off the other
itll work with the main ip im sure of that
but for some reason it doesnt like the secondary one
I did just change my name servers to my providing IP so maybe that will help sec
config.set("test.item2", null) and dont forget to save
Thanks
I thought that would just set it like item2: null
Admittedly I didn't test though
nulls can;t exist in a config outside of an enclosing object like a List
Actually they can, Just in another way iirc
pog i bricked the server by changing name servers 
yay!?
didnt know that was a thing but alright
Not a spigot problem, but I have started a local webserver using java and when trying to use a script.js in a html file it doesn't use the content of the file
does anyone have any idea on why it's like that? :))
I don't see you using the script anywhere
i don't need to, it's "loaded" in the head
if i just open root.html in my browser, it works as expected, logs to the console "Test!"
Use Firefox, it has a Mode to intercept all Network Traffic coming from the browser
If it does not GET your Script, then you have a serious issue
i think i know that the problem is
If the GET is sent, but the Server responds with 404, then the Script is Not there
