#help-development
1 messages ยท Page 1244 of 1
what am I witnessing
you're on the right track but it's a bit lopsided
you're constructing a ToggleCommand object, so the variable type it goes into must also be ToggleCommand
vcs2 teaching how to use variables and di
so we'd have
ToggleCommand listener = new ToggleCommand(uhmmmm);
also, the name listener isn't a very good name for this variable, is it? it's a command, not a listener
so let's change it to
ToggleCommand command = new ToggleCommand(uhmmmm);
let's get this straight
- Every time you call
newyou're creating an object - You want to pass the same object both to setExecutor and your listener's constructor.. but why?
In order to call a method from your ToggleCommand class you need to have access to an instance of it. The way we do this is by holding it in a variable, and passing the value of that variable in the listener's constructor. That way, any method fired on the listener class will always have context to what value we're passing
Just let vcs handle this
sure
More people will just cause confusion
just let them both help me
place that line in your main plugin class and let's see what you have
i think we might want to remove the uhmmm part
sure
@Override
public void onEnable() {
// Plugin startup logic
ToggleCommand command = new ToggleCommand();
getServer().getPluginManager().registerEvents(new BlockBreakEventListener(), this);
getCommand("togglealert").setExecutor(new ToggleCommand());
}```
How many instances of ToggleCommand are you creating there?
right; now, remember that we want to pass the command to the setExecutor and the BlockBreakEventListener constructor
and we don't want to do that by calling new each time, but by passing the variable we just created
how'd we go about this?
getServer().getPluginManager().registerEvents(new BlockBreakEventListener(command), this);```
uhmmm
how many times does new ToggleCommand() appear in your code in total?
2, one in the variable and the other in setExecutor
once, ever
you must not call it twice or else you have two commands and that's not what we want
then we can pass command inside setExecutor?
so remove that second constructor call and instead pass it the one we constructed earlier
yes, that's right
let's see the end result
package me.egitto.griefnotifier;
import me.egitto.griefnotifier.listeners.BlockBreakEventListener;
import org.bukkit.plugin.java.JavaPlugin;
public final class GriefNotifier extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
ToggleCommand command = new ToggleCommand();
getServer().getPluginManager().registerEvents(new BlockBreakEventListener(command), this);
getCommand("togglealert").setExecutor(command);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
this is correct
now, something of a tangent, but why do you think we don't want two commands?
in other words, why is it important that we call new ToggleCommand exactly once?
bc then we have 2 seperate sets
that's right
we would have one set that's updated by the command
and another set used by the listener -- but it'd always be empty, because it's never updated by the command
now you can access the ToggleCommand, its methods and fields, in the listener class
next, you would want to create a method on ToggleCommand to determine whether a player is in the toggled list, and then call that method from the listener
let's see the two classes once you've done this
a public method that takes a Player, or a player name maybe, up to you, and returns a boolean; if the player is in the toggled list, true, otherwise false
and like all methods, it should be named something descriptive, for example isToggled
public boolean isToggled(String playerName) {
return toggledPlayers.contains(player.getName);
}```
right
then, in the listener class, call that method and use the boolean it returns to determine whether to send a message or not
if (command.isToggled(player.getName())) {
player.sendMessage("You are toggled!");
return true;
} else {
player.sendMessage("You are not toggled.");
return false;
}```
let's see the two classes
this method would go in that class
which
togglecommand
yea its already in there
i don't see it in this paste though
it is
look im sleepy
like it was said like almost an hour ago, you should go and learn java first 
its 11;30 pm
method declarations go directly under class definitions
yu try to find the hair on an egg to send me learn java
ive already learned it
public class ToggleCommand implements CommandExecutor {
Set<UUID> toggled = new HashSet<>();
@Override
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
onCommand here is a method definition; your new method should look the same
that is, it should be indented 4 spaces, and it should be within the curly brackets of the class -- not inside another method
You have not. This entire conversation would not be needed if you had
for example
public class ToggleCommand implements CommandExecutor {
Set<UUID> toggled = new HashSet<>();
@Override
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
//method body
}
public boolean myNewMethod(String myParameter) {
//method body
}
}
i already resolved it
and yes these are the absolute java basics you definitely should know these
hey, on player async chat event, no matter what i set the message to, it will always default to <PlayerName> : {my custom stuf.... . . .. }
<Sp3eex> {i can edit this}
but not anything before
either way let's see your command class once you've put the method definition where it should go
package me.egitto.griefnotifier;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.*;
public class ToggleCommand implements CommandExecutor {
Set<UUID> toggled = new HashSet<>();
public boolean isToggled(String playerName) {
return toggled.contains(playerName);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
if (cmd.getName().equalsIgnoreCase("togglealert")) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "You Must Be In Game To Run This Command");
return false;
}
Player player = (Player) sender;
if (toggled.contains(player.getName())) {
player.sendMessage(ChatColor.RED + "Toggled Off");
toggled.remove(player.getName());
return true;
}
player.sendMessage(ChatColor.GREEN + "Toggled On");
toggled.add(player.getName());
}
return false;
}
}
much better
now, go into the listener class and call that isToggled method from there
?whereami
btw does the TOTAL_WORLD_TIME statistic record ticks or milliseconds or seconds
ticks
right
are you sure thats what you want if you only want to send it for toggled people
now, do we still remember what we were trying to do from the start?
we want to broadcast the alert message only to op's who are toggled
yes
so... rather than sending them "you are toggled", what should we send them?
player.sendMessage(message)
that's right; and we only want to do that if what?
if (toggled.contains(player.getName())```
we're not in the command class, remember; we're in the listener class, and here we have to call the method you just created
so that'd be if (listener.isToggled(player.getName()))
and putting this and that together, what do we get?
yes
if (listener.isToggled(player.getName())) {
player.sendMessage(message);
} else {
player.sendMessage("Toggled Off");
}```
if (toggled.contains(player.getName())) {
player.sendMessage(ChatColor.RED + "Toggled Off");
toggled.remove(player.getName());
return true;
}
player.sendMessage(ChatColor.GREEN + "Toggled On");
toggled.add(player.getUniqueId());
}
return false;
}
}```
xhould i remove this from command class
let's hear why you think it should be removed
i'll probably forget about this by tomorrow, be sure to resend the classes and a description of your problem
why there is no EntityDamageByEntityEvent#isCritical method ? im using spigot-api 1.21.4-R0.1-SNAPSHOT
Because no one has added it to the Spigot API
uh
There a way to get the recipe/output of an autocrafter?
I have so many plugins but my server says i have zero
i have 30 plugins in the file but my server says 0
Found it
have you restarted your server?
i suggest PlugmanX for testing
declaration: package: org.bukkit.event.block, class: CrafterCraftEvent
I saw that md_5, ty
how does they display text in the left center screen ? how is it done ?
probably shaders
most likely that new hologram display thing and its riding you
yeah
if this is the case then it may just get borked if you turn into perspective mode, so you could check with that
my guess is that it is a title with a bunch of negative spacing
Could you theoretically get the attack damage of the item held and multiply it by 1.5. And maybe also add a check for strength or something idk
Nvm thats quite dumb and easy to work around
How is this happening? I trying to keep the auto supply filled but its only working on block place.
BlockListeners.java: https://paste.md-5.net/ronusahefe.java
ItemListeners.java: https://paste.md-5.net/onufinikeb.java
what is this supposed to do
I get the auto-supplying in block place, but what would you be supplying in the pickup event
wana know the type? Secret
Don't worry about it, I got it fixed. I trying to fix another issue, something strange is happening with the PC. I have multiple servers running on the PC and one server, not related to spigot is binding to this virtual IP which is my NordVPN. So annoying
What is this for?
I mean, I'd hate to look at it but it doesn't seem to be doing anything particularly harmful
if you feel like refactoring, go for it
its a way to retrieve data from custom yaml files
Yes, there is a way. I have that on my plugins but you can search how or maybe someone can help you
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
Olives i made only one get() function because i find it cleaner XD
i could have made getString, getInt, blahblahblah, but get() seemed cool to me
set() and get() and delete() and save() is what I have, i think its nice... maybe ill have to refactor,.. meh
โ ๐ฌ
show us the message
Autoboxing has left the building apparently
do i have to download maven or is it somewhere already?
can i run the command within the project command line?
Sure? As long as u can refernece the maven binary
Go look up how to mvn-install jar files
Then u can use the file as if it were in ur local maven repo
yeah found something
i have to install https://maven.apache.org/plugins/maven-install-plugin/ into my project?
man in Eclipse this was much simpler, i could just add a jar as a dependency in like 5 seconds and here it takes 5 hours
yeah it's one command but mvn isn't recognized as a command in my project command line
I mean you can still use jar dependencies in IntelliJ
Don't use system path though
But you shouldnโt
so what, download maven? and do some stuff there?
how else am i gonna use my api jar that i made myself
Intellij didn't add maven to you path environmental variable
You need to do so yourself or run it fron Intellij
Or just use the file path of the maven executable directly
Wait if it's your api
Then you don't need the jar
Run maven install in the api project
And then depend on it like normal
yea i still need to add environmental variable
where is maven installed by default? with intellij?
ok
Hello can someone explain or help me why my PlayerInteractEvent Listener gets called multiple times with one rightclick?
I get the outprints "test" and "test2" 3 times?
https://paste.md-5.net/emucevokiv.java
I would appreciate any help! i cant manage to fix it somehow
They do check the hand
Oh
Anyways that appears to be the Paper API
Oh dang nevermind i forget my listeners are getting registered with reflections too so i just had it registered multiple times
my bad
I made a new project, added my server.jar as external jar to my project, but when i try to do 'extends JavaPlugin' it does not recognize JavaPlugin aka I can't import it
What am I doing wrong?
what spigot version?
1.24
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
to everyone dm me and tell your problem at website you get 110% accurate and fast reply
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Does eclipse work perfectly fine or should I use intellij?
Eclipse works fine if you want to
I use Eclipse
Eclipse Ftw
Aighttt
but Intellij can generate a plugin project for you with the McDev plugin
All those tutorials use IntelliJ as well thats why i was asking
don't see a lot of eclipse tutos
Bcs ive never worked with a pom.xml before so i'm doing some searching
just create a new Maven project in Eclipse
Yeah but first I gotta setup that pom xml for that
oh?
then edit the pom
oh damn
thats crazy
LMFAO
ur him
ty
What do I select as Archetype from the list?
none skip it
I can't click next without selecting one
I'll have to open my ide to look
but I know you can choose none
ah, first screen,
tick the top box, no archetype
Oh I see indeed, thanks
Sorry for all the questions, kinda new to me
And IntelliJ tutorials dont rlly help since they just use the mcdev plugin
Could you maybe send your pom.xml as an example ?
Because I have this rn:
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.vuxaer</groupId>
<artifactId>WarpsPlugin</artifactId>
<version>1.0</version>
<name>Warps</name>
<description>A plugin that handle warps</description>
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
but I think I'm missing a build section
not really needed
damn it's been a while since I did the T... reifiedType hack
this one :)
public <T> Whatever<T> createWhatever(Params here, T... hacky) {
Class<T> type = (Class<T>) hacky.getClass().componentType();
return WhateverWrapper.wrap(type, ...);
}
you need a plugin.yml
elgar talking with ghosts
I can hear them ๐
Hahaha
I have a plugin.yml but I think I found my mistake
Restarting my server rn
NVM UGH
name: Warps
version: 1.0
description: A plugin handling warps.
author: Vuxaer
main: me.vuxaer.main.Main
commands:
warps:
description: Teleport to the current warps location
permission: warps.tp
setwarps:
description: Set a new warps location to your current location
permission: warps.setwarps
permissions:
warps.*:
description: Gives access to all Warps commands
children:
warps.tp: true
warps.setwarps: true
warps.tp:
description: Allows you to tp to the current set warps location
default: true
warps.setwarps:
description: Allows you to set a new warp location
default: false
Doesn't this look right?
?main
the error you posted said it had no plugin.yml
likely you put it in the wrong place
it shoudl be in a src/main/resources
It is in there tho
probably main/resources
as there is already a src directory defined
but try whichever works
and how do you run ur project when u already have a build section defined in ur pom?
same way. maven build
your run configuration should save if you give it a name
in Eclipse
Im still having this stupid yml error
ugh
I can't send images in here unfortunately
?paste your pom. Then show an image of your project structure
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
!verify PowerVlogs
Usage: !verify <forums username>
!verify PowerVlogs
A private message has been sent to your SpigotMC.org account for verification!
dont mind this old childish name XD
idk why it's displayed like that btw rlly weird
but should still be right
what version of spigot are you wanting to build for?
server is 1.24
but I think that plugin only uses features that should work in 1.16 as well
then you need to change the source/target for the correct java version, 21 I think
ok
open the built jar in your target folder with any archive program
check if the plugin.yml is in there
well that's not a version that exists :D
It does now
I assumed he ment .4 so latest
we're on 1.21.4 ...
Its not in there wthhh
try src/main/resources main/resources and just resources
See which works for you
one of them will
it indented automatically but ill try
Hi guys, I want to know if there is a way to change the pathfinders of an entity after it has been created? I leave the initpathfinders empty, and when I want to add them after that through the goal selector, they stay in place, as if I hadn't added anything. And if there is, how can I clear the existing pathfinders? My version is 1.16.5
Its finally working omg
Ty for all the help bro <3
np
IDEA does not recognize yaml property declaration usages in project how fix it?
and why yAml if config is yml
yml is just the short form of yaml
yaml is the name of the format and .yml is the extension
you can use .yaml as well if you want
How make a pvp force enable in a pvp arena using pvp manger plugin and world gaurd
If you mean the fact your packages aren't nested, make sure this setting is enabled
It defaults to flat for some reason
I have it hierarchical actually
My other projects arent like that
But this one is
idk
choco when are you gonna leak hypixel's project structure
does hypixel use master!?
It's already been leaked https://hypixel.net/threads/hypixel-systems-and-plugins-in-general.5557514/
Hello! If you are looking for Hypixel plugins, then you must read this post.
First of all, Hypixel uses ONLY CUSTOM plugins! There is NO PUBLIC plugins on the Server!
So, let me explain everything to you!
Hypixel use dynamic servers and multi-proxy system.
Hypixel plugins for 12.15.23:
1...
Btw, for sync Hypixel use proxy and databases.
Checks out
We do, in fact, use proxy and databases
They also say Citizens isn't public which is pretty funny
wtf is a citizen
I steal
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (p.hasPermission("warps.setwarps")) {
warpLoc = p.getLocation();
}
}
return true;
}
How do I save this warpLoc somewhere so it doesn't reset when restarting the server?
plagiarism at its finest
some kind of config or database
kek
any good tutorials on configs?
i prefer tutos that r not yt videos

FRICK
gottem
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
smh
I've added all the methods to create the config, but do I also need to create the config manually in my file structure, or will they do that automatically?
Need to have it in your file structure so that it can be created (if necessary) with the #saveResource() method.
It'll go in your resources folder.
ty!
use the default config
and first line in onEnable do saveDefaultConfig();
every time your server starts your plugin will creatre a new config, IF one doesn;t already exist
I mean, if it's the only thing they are putting in the config, sure.
But if they want to add anything else, then the default config is just gonna get crowded.
its his first plugin so best to keep it simple
and its a warp plugin so it's not going ot be super complex
Maybe, but if they make a lot of warps, that's a lot of config data.
makes no difference, its going in a file wether its a custom config or the default
its still just a Map/file
I work at Hypixel and suddenly you're afraid to ping me?
He's scared because you are a big bully
your recently revealed split personality just has me frightend
I see
(and again, missing husky updates, but I am having my finance guy work on the invoice)
what is that
error
did not assign a file to the build artifact
where is [Help 1]
What command did you run
Are you running like install:install
Run install
Lifecycle -> Install
^^
ok thanks xD now that ive installed it
i can use it in other projects
as dependency?
Yes
^
yeah
the install plugin thing only runs the install bit, but it would first need to package, compile etc
the install lifecycle does all of that
so this <dependency>
<groupId>dev.spexx</groupId>
<artifactId>permissions</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
what about the repository
Install puts it in your local .m2
"dev.spexx:permissions๐ซ1.0 was not found in https://jitpack.io during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of jitpack.io has elapsed or updates are forced
Try to run Maven import with -U flag (force update snapshots)
"
do i invalidate caches?
or what XD
no
Then that would be the problem
why is it trying to find my dependency in jitpack.io repository
my dependency is installed locally
it is i just installed it locally
at least nothing with that dep info is
Make sure your groupId and artifactId matches the project pom that you are installing.
ohh now it worked i think
if i make any changes in powerpermissions plugin, is it auto synced here? in other project, where im using it?
No, you have to run install every time you make changes.
i love reinventing luckperms
assembly
luckperms to me is like buying a car with 250hp, ... im happy with 100, i dont need more and dont want more
the most famous thing is not always the best for everyone
Worth!
Imagine actually caring about megabytes
Except that 250hp car is free
and the 100hp needs a lot of maintenance to get working
or just straight up needs to be build from parts
I can use getConfig().getString(...) to pull properties from the config, but is there also a way to add new properties using commands?
for example /addwarp name, which adds a new warp w/ the location to the config
getConfig().set(...
that should be filled in for you
I think it got deleted when I replaced my pom with your example not sure tho
https://maven.apache.org/xsd/maven-4.0.0.xsd
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>```
I'd try just F5 on teh pom first
Yea not gettin errors anymore now
I replace my project tag with urs (even though it was the same) but that seemed to fix it
a hidden typo probably
What's the method to do the opposite? (remove a warp from the config)
set(path, null);
I suppose the property itsself stays in the config then
Just without any data inside of it
no
if you are using the api to remove data from a yaml file, setting it null removes both the property and the tag
I saw it got removed indeed, amazing :)
the only reason the tag stays is because there was more then one property
Ty for the explanation!
hey everyone
So i had this plugin, called tpto plugin, it lets u tp to another world
but if i do /setmap <nameMap> it tell me this error on line 27 at SetMapCommand
?nocodew
hey guys in recent spigot versions 1.21 how do you set target goals or even make them for custom entities?
any examples? would appreciate it
?nocode
Itโs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
I know my boy, be patient
but on line 27 there isnt any code?
Take a look at how Mojang does it
That would be your best examples
so int i = 0?
correct
sounds like somebody didn't recompile
is that paper
no
because after your teleport you fall through instead of returning true
i never understood the return thing
you are also going to get multiple Does not exist messages the more maps you have
do not for loop over the section
if (section.equals(mapname)) {
player.teleport(map);
sender.sendMessage(ChatColor.GREEN + "You Have Been Teleported To " + mapname);
return true;
} ```
like that
yes
i know how to fix that
this should work hopefully
it doesnt
Learn to read stack trace
there is no maps config section
how is PDC tied to a block? if I push it with a piston, will it still have the data? what if enderman takes it and drops it on the ground?
PDC isn't tied to blocks that can be moved
PDC doesn't exist on blocks, it exists on block entities
e.g. Chest
The grass block does not have an attached block entity
so it cannot have a PDC
no
that is NOT a block
I know i did it in the past for limited creative but i cant find the project anywhere
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
I somehow saved pdc into a block
There are projects that use the chunk PDC to store block information yea
you did not store IN a Block
and then on break event i retrieved pdc from it
It stores it in the chunk using the blocks location as a key
they handle "moving" by angry event tracking
A lot of screaming
I see
Anyone know if there is an easy way to run commands through a locally running spigot server's console then read the output in real time? I dont want to stop the server, get the log, then read it, then open the server again to get the log file, that takes too long, I need it to be in real time beyond just like praying there's a python library I can use.
thinking of using subprocess but if there is a more direct way that spigot has that would be way better
rcon?
do you not have a console?
whats that
I need a way to access the output from console using code
rcon seems to be what I need ill look into it
seems like rcon is very unsecure
just dont make the port reachable from outside
obviously its insecure because it allows connections to execute commands
is there a way to expose like a secure rest endpoint with authentication then
you can write a plugin for it
from there you can run the commands over rcon via loopback or pass a custom commandsender to Server::dispatchCommand and forward the command feedback it gets as the response
if it is your own server, you can add a log filter with a plugin to redirect all output, as for input, you can just use the plugin for that ig
for output you can use your own commandsender
when a command is run with a commandsender, that commandsender receives the command feedback
implement it and pass it to dispatchCommand and have the feedback get piped to the rest api response
well command feedback is hard to define
not all commands return the result directly
some send it as a chat message
you cannot implement custom CommandSender
if it's feedback it gets sent to the command sender
if its a global broadcast to all players it's not feedback
i have
the dispatchCommand call will blow up not knowing how to turn your custom impl into something it can take a CommandSourceStack from
maybe it has been changed since but it worked fine in 1.17
after a quick look into nms source it looks fine
that doesn't get used for plugin commands however
sure, then only some commands work, while a whole other category of commands don't
I'd say just use tmux & ssh tunnel, no need for half assed custom solutions
explains why it worked for me though; i used it to run plugin commands, typically moderation, from a local llm and then feed the model the command feedback from the command sender
i remember originally grabbing or spoofing a command block as the command sender, though i don't remember how i got the feedback from it
how can i access the motd of a server and the playerlist? (this wouldnt be a plugin just a general app to update info about my server :D)
u would have to send a ping to the server methinks
idk what the way to do that is tho, consult protocol wiki
protocol wiki?
it was wiki.vg, might be https://minecraft.wiki now
ty ill look into it
https://mcapi.us/ or this it looks like
?protocol
hey, curious to know what everyone else uses when it comes to versioning. I've been trying to get a semver system going on my repo along w a changelog flow. I've been looking at commitzen, but it involves using python, it formats and bumps the version based on the commit message.
hey guys in recent spigot versions 1.21 how do you set target goals or even make them for custom entities?
any examples? would appreciate it
im not sure how to find how mojang does it
You can look at the decompiled source in the work/ folder to see how Mojang does it
Is there a way to disable structure generation in a World? I'm dynamically creating worlds on command but I would like them to be flat with no structure generation
Thanks
WorldCreator.generateStructures(false)
is it possible to use protocolib make fake blocks
i think u can make fake blocks with the spigot api
i think it was complex so protocollib was used
Yes it is but using just packets can cause desync and flight issues
can you send docs for that
Exactly
sendBlockChange will send a fake block change packet to the client while the server will remain unchanged
Does the server handle the flying issue ? so it does not kick you if you stand on a fake block.
No
If you stood on that block you could be kicked
Because the actual block can be a non solid block thus causing the server to think a player is flying
but i need it for my pixel art
I mean make the actual block a barrier block or smth
is it true that updating real block is slower and laggier then sending fake packets for pixel art or playing animation and stuff
Depends on what you are trying to do. Simply setting the block state to grass block on the server won't affect performance.
i am making a animation on a 100 by 100 platform i am confused weather to change blocks entirelyy or just the packets
setting real block = physics and light updates, send packets
sending a packet = just build the packet
setting thousands of blocks can generate lag
I raally dont know ...
Sorry
Sorry...
For large animations if they will be frequently changed that will affect performance a lot.
its like 10fps
Depends on each pc.
so using packets is always better right as it will only needed client side while changing blocks will also put load on server
I agree on that...
Not always better
wouldn't say "always" but in your case it may be better
thats true
You can always benchmark it :D
As I said it depends on a lot of factors. If you will have this animations all around the world then yes, it could.
you are right no problem ๐
thanks a lot guys
no problem if you need more help ill be right here....
there is api for sending fake blocks that don't affect the world and is essentially the same as sending packets without sending packets manually
the advantage of going packet route vs using the api is mainly entity and nbt data. Since the server ticks entities(now possible to have non-ticking entities) and has additional data the server likes to fill it, it is advantagous that you might now want the server to handle that stuff and not be aware about it.
however, these days there is a lot in the api where going packet route isn't really necessary as much ๐
Thanks, IDK how I missed that when looking at the javadoc
can you tell about the api ?
declaration: package: org.bukkit.entity, interface: Player
is there any resouce pack that only contains 256 colors and teh blocks are retextured to 256 colors , i need it for detailed pixel art and i tries to edit resource pack with python but there are lot of non cube blocks or multi texture blocks which gets reuined , so if there is such resouce pack that already did it pls tell me
i will check it out and see if its faster
thanks a lot
Well you could use mushroom blocks or noteblocks
those have hundreds of states
Noteblocks have over 1000
You can also do a trick with horse armor and display entities to have full RGB โblocksโ
Well you can, but I don't think you should for 10k blocks ๐ฌ
Why does Bukkit.getWorld(); return null even if the world exists?
if it returns null the world is not loaded
Should I use WorldCreator to load the world in?
that depends. is it a custom world?
Yeah it's a superflat world I create in my plugin
because you will break the default load order and may break some other plugins
Thanks
Not all plugins get worlds by name. Some use teh load order, so [0] is always the main world
break them
Make them suffer
How do you add suggestions when typing?
I would like to add all the available warps here
Implements TabCompleter?
in tabComplete return a List<String> of your warp names
does that work for brigadier suggestions
No clue
I think you got to use a command framework for this if it doesn't, as Spigot doesn't expose brigadier by default
Is there like a ? spigot page for that as well?
well, rather, you're better off using a command framework rather than trying to use brigadier natively
implement TabExecutor instead of CommandExecutor on your command class
oh ok and then add unimplemented methods
i see ty
what is a common used package name for this?
or
Will I still be able to define the command itsself in the same class
Yours would likely be WarpCommand
i was confused after reading "instead of"
Implement CommandExecutor and TabCompletor in the same class
WarpCommand implements TabExecutor
So you can implement the command and the tab completion in the same class
TabExecutor is just a convenience interface that implements both CommandExecutor and TabCompleter
2 fast 4 u
i missed TabExecutor i read TabCompleter like before, im stupid
Yeah that make sense
Its early and I've not had my Wheatabix
Its early and im sitting in a damn meeting since 2 hours
meetings ๐คฉ
So,
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
return new ArrayList<>(plugin.getConfig().getConfigurationSection("warps").getKeys(false));
}
should do the job?
everyone's dream activity in any field
yes
alrighty
you may use List.of instead of new ArrayList, it's just a bit clearer
I missed the meeting 2 days ago, THEY BOUGHT EVERYONE PIZZA
;:C
does anyone know how I can add items from a plugin onto a shop?
For example add the sellwands from axsellwands to economyshopgui free version so players can buy them.
also you may want to check whether the configuration section exists before, just in case the user messes up the config
Then I get: Type mismatch: cannot convert from List<Set<String>> to List<String>
They bought Pizza because you were not there. It was intentional
they were celebrating your absent
oh getKeys returns a Set, well, what you did is fine then
alr ty!
:C Sad
You all so mean sniff Jokes a side, they wonderful
i see i am gonna check it out
omg thats so better , do we even need mods lol plugins and resources does the dream work
ok i know we need mods i just said it as a joke
man, I had a message ready and everything
you can still send it always better to learn new things
so i can add around 800 custom blocks with note blocks alone noice
it's very much easier when you have client mods at your disposition
people usually limit themselves when it comes to plugins as it may produce performance issues however you don't have to worry about that with mods, as you can optimize those in a much tighter way
yah if we only need features in most efficient way mods are better , as plugins can add a lot but are inefficient
Is there a way to code a instant teleport when entering a nether portal without having the screen to like get drunk or whatever it is xp
yes, you just have to teleport them as soon as the PlayerPortalEvent is triggered
yes but if the player lags he will still has that animation
Very smart of you
The time to teleport also depends if its in the same world or another
yes, but if the plugin is meant to be run on survival server you'd be breaking noteblocks.
My solution to this was "tuning fork" to investigate how the noteblock is tuned and quickly change it
And only ever show the base state to the clients.
I suppose you cannot disable a loading screen between two worlds
Not disable, no
Yeah makes sense
uh you may actually have to listen to the PlayerMoveEvent and check if they're inside a portal actually, not too sure when exactly the PlayerPortalEvent triggers
but cant you send fake packets of that noteblock in that specific state so the resouce packs show it in desired texture while the real note block is not effected
if you're on latest, there's a gamerule for this I'm sure
I thought maybe theres like a way to preload the world when the player joins the server to be able to skip the loading screen
Imma check it out ty!
You can use this and see if it is a player and the portal you want to teleport from https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalEnterEvent.html
That fires when ANY Entity contacts a portal block
ah that was the event I was looking for
nothing popped up in the javadocs as I searched PlayerPortal... so I thought I was tweaking lol
What are common named classes for this sort of things? I suppose something like PortalListener?
"APlayerHasEnteredTheNetherPortalBlockSoWeCanSendThemToTheNetherRightAway.java"
perfect ๐
yep
bettt
I would just register this listener in-line tbh, it'd be very small
that's nice
This might be a dumb question, but is there a way to update the plugin without needing to restart the server each time?
Since I can't replace the .jar file when the server is enabled, I need to stop the server to be able to replace it and then start the server again to run it
Alrighty
you can use an update folder
the server will pull new jars from teh update folder upon a restart
why cant u just put the plugins in the plugins folder
why a seperate update folder?
file locks
oh, i have never experienced that tho
when on Windows file locks are common
oh windows ๐
it'll also behave weirdly when the plugin tries to load a class/resource it hasn't loaded before
also, if you just replace the jar (when able) you are likely to get left over classes in memory upon a reload
never reload
Oh yeah reloading is weird ๐
i made a freeze state for a mob and after reload it was still frozen but restarting fixed it
Is it possible to detect when a player in creative duplicates an item with the middle click?
I ask at the moment because I am in the hospital and I have nowhere to develop
yes/no good luck with creative
maybe InventoryCreativeEvent? outside of that creative mode is an absolute wildcard
Yeah, you can detect a slot change but understanding if it was a middle click is going to be near impossible
the cursor itself might not be server sided at all
possibly not. Much of Creative is purely client side
whatever the client says the server accepts
( can people abuse this in building servers ? )
for sure
๐ง
in creative mode the client is the one that tells the server "these are the items i have in my inventory", when you put an item on your cursor it just tells the server there is now air in that slot, and when you put it down it tells it to "spawn this ItemStack i'm giving you"
with the InventoryCreativeEvent you can control what the itemstack becomes on the server but that's about it
the safe way of doing building servers is to not use true creative mode, but a faux one in survival with fly/god etc with an extra inventory to pick items from and such, think Hypixel Housing
wait so the issue with items being deleted in creative mode is usually because of this?
makes sense
like this one
this is due to client or server?
no clue, that might be any kind of desync, I know nowadays both client and server have item drop throttling, it is possible that the client's throttler disagrees with the server's and desyncs, the server's throttler might disallow the dropping, but in creative mode it is the client that mandates what is in the inventory, it gets the final say on that
but that's just a theory
The found tag instance (ListTag) cannot store List
am I tripping or is there something weird going on
stacktrace? that's been fixed since 1.20.4 afaik
watch me get yelled at for using paper
?whereami

hehe
@eternal night thoughts?
any event / listener tuto's on the spigot pages?
from John PDC himself
idk the commands
and yes the list stores both types the same
this has always worked in 1.21.3, not sure if it's because I updated to 1.21.4 or what
it's a weird edge-case on empty lists, I know that much
empty list.. hm
lynx will know better, he invented this api all by himself
when he wasn't doing the thesis
it might be empty yes
(not like he is anyway)
i know it's "fixed" on normal PDC, but apparently not on PDCView?
bukkit event api is cool
i hate it when there isn't a good way to make it cancellable tho
๐ญ
is it a .4 moment
I do have a getOrDefault I might just not save a list if it's empty
good enough let's pray this doesn't blow up
i managed to make 256 custom states of noteblock but i am having problem as when placed it changes it state due to block placed below it , any way to summon them with locked state
I believe you need to listen to the BlockPhysicsEvent and check
Can you not set the block state with the force boolean ?
Yeah but it will update as soon as something around it does
Is there a way to get the displayname from a block in the BlockPlaceEvent?
Well ye, but assuming all they are doing is some animated pixel art in an enclosed space, the force would be all they need
You can get the translation string and use a translate chat component for things
You can't really get the display name of a block because player may have different language set
You can detect which I believe but the server has only EN lang file
ohh yea
Can't i like make an ItemStack variable from the block that has been placed
And then get the meta from this itemstack
The thing is, I'm making a parkour plugin where a player needs to place a start and end pressure plate, and I want to check when a player places this specific pressure plate
are you requesting a list that contains something your list type doesN#t support
Attach a PDC tag to it
sometimes it's empty
I always store strings on it
Yea it do be rather weird
It's basically just a wrapper for NBT tags
Tho that error is higher up
is it a custom pdc type?
do you have replication steps, some code I can look at
hm yeah idk i can't reproduce it with just empty lists so, good luck
no
how's the thesis going? is it going?
there's like a lot of wrappers on wrappers going on
if you're willing to sit through it I can send detailed code but in general it's kinda whatever
have you attached a debugger
You should be able to see everything you need with just a debugger at the utils.pdc.PDCContainer.getOrDefault call

hiss
๐
Yea I mean, the code is fine
I just need the state at that point in time
prior to the error
ug
go ahead on that
he will backdoor your server

I'm not running this locally idc

backdoor my ass we have backups anyways

he will send all the envvars and sysprops to paper's internal servers
all the plugin configs
I can't wait for it to blow up my logs with all the pdc spam
It will 
tps drops to a solid 4 when the error fires up
Ah but isn't logging async?
tps drops because of all the context switching
lmax disruptor ๐
that does NOT look like lmax disruptor ๐
๐
finally ๐ข , thanks a lot @smoky anchor for sticking with me and others too
venturechat doing weird things I need to update my fork
what a beauty <3
lynx can you make it only dump when there's an actual error pl0x
i made that with minecraft blocks , cant wait to do that with these news rgb blocks
thanks in advance
I did xD

ItemStack#getPersistentDataContainer
it is
https://pastes.dev/TUulIseK6N is the patch, if you care for the diff.
that is the jar
well shit my pdccontainer is both read and write
time to abstract this into views
getting you logs in a sec
i love the stray adapter.isInstance(type, tag);
it isn't
I'm assuming it's there to throw errors
it doesn't throw errors
it yields a bool
.isInstance calls the matchListTag down the line
yeah it's still blowing up, got logs now
isInstance compare for ListTag for adapter List
isInstanceCompare for ListPersistentDataTypeImpl and pdt instance org.bukkit.persistence.ListPersistentDataTypeProvider$ListPersistentDataTypeImpl@57ebabbe
Matching list type byte. Expected 8; Found 10
do you have the offending item?
can you write to it and then /paper dumpItem while holding it
gotta put the item aside it blows up tps when I hold it

