#help-development
1 messages · Page 696 of 1
When doing asm shinanigans
I now hold you responsible
For me making this mixin asm abomination
now what did u just say?
Come find me
You have two weeks
Till it's too late
And I try to unleash that monstrosity
Hello i want to teleport the player to the spawn when he died so i use PlayerrespawnEvent but i didin' work
delay it by 1 tick or so
how?
with scheduler
ok i try
doesn't the player respawn event have a method to set the repsawn location
setRespawnLocation

if i remove api-version from my 1.20.1 plugin will it be backawards compatible to most versions or just the close ones like 1.19?
I mean, if you want to maintain backwards compatibility, develop against the lowest version you want to support
if you want to support 1.8.8 (for whatever fucked up reason, maybe you hate yourself) develop against 1.8.8 spigot api
ok thanksss
thx you
it work now
how can we delete the resource on spigot
report it and ask to delete
How can I parse a team entry to a Player/OfflinePlayer instance? Is it okay to use the deprecated getOfflinePlayer(String) method in this case?
whats the event i should be listening to to detect arrow hit a block?
ProjectileHitEvent I believe
thanks ❤️
I dont think you can load 1.8 plugins on newer versions
i think 1.13 is the lowest you can go which works on all newer versions
you can certainly still load 1.8 plugins
the server has to enable the legacy compat layer
which is annoying
okay whats that
but that is like, the one upside to spigots backwards compatibility love
well, the largest break was the material flattening in 1.13
which broke some stuff. So the server has to rewrite the bytecode of some of those old plugins in regards to their usage of the material enum.
wait it does what
it modifies the plugin itself so it can run ?
That's hilarious lol
Yea, the classes loaded are ran through commodore (spigots utility class to transform their bytecode)
compatibility only exists due to wrapper around Minecraft api
lol
which is kinda stupid as Minecraft api has very useful shit
will my plugin made on 1.20.1 api work on older versions? do i need to remove plugin-api from plugin.yml?
well it didnt on 1.16.4 so i may just have my answer but i wanted to make sure
does it run on 1.19?
i've made an documented API
how can I make intellij use the documented jar instead of decompiling it?
can it be done automatically by just using the dependency?
or it needs to be set manually everytime?
idk, couldnt it ever figure out
so just manually set the source file
or find out how to make gradle to use the source file from the maven repo ig
what is the event that transfom farmlands into dirt
lmfao
that's for pressure plates
hm interesting
unless you mean natural change from being dry
that would be different event
ass-pressure
yeah~
some guy is working on fixing the docs :D
I'd volunteer to clean up the Commodore class because it's ass
but I'm not signing no CLA
Is there a way to increase performance with a plugin when it comes to crazy high worlds? (512, 1024, ...) How do you do this? Spigot 1.20+
You mean build height uhh
Aye
Well it's the same as all other performance improvement guides
break your world into multiple worlds
Might have to look up that shit since I don't know about it
Also, how would I be able to identify the performance issues?
Do you mean "create a plugin that will increase performance for server with big build limit" ?
Or "optimize a plugin to work with big build limit"
In a perfect world it doesn't have to
I just want something that eases the user and server load when they are on the server
I would guess chunk loading
It's not as simple as high limit = bad
Since each chunk is times 4
I know
I'm just a man with a plan and i don't know where to start 😄
multithreading?
you can't just randomly say multithreading lol
Yeah, there is a mod for that
Cubic chunks
I checked with them is they had some kind of plugin, but no luck
ok so im using acf-bukkit and I am registering my command everything but when I use it in-game, it gives me the "unknown command" message
I have op so i believe i have the permissions required to use the command
No but like when there is no water near like how to make the farmalands always hydrated even if there is no water
that would be the physics event I think?
does the command even contain anything that can run then
like default command
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockPhysicsEvent.html
Just be sure to do the easiest checks first
yeah it opens an inventory
show the code
yep just copying
@CommandAlias("punish|p")
public class PunishCommand extends BaseCommand {
@Default
@CommandPermission("sentry.admin.punish.menu")
@Syntax("<player>")
@Description("Open the punishment menu for punishing a player")
public void onOpenPunishMenu(Player cmd_user, @Values("@AllPlayers") OfflinePlayer target) {
Inventory menu = getPunishmentMenu(cmd_user, target);
informPlayer(cmd_user, "&aOpened punishment menu for &c" + target.getName());
cmd_user.openInventory(menu);
}
}
nothing in console
I have been trying to troubleshoot for an hour i have no idea whats wrong here
@EventHandler
public void onBlockPhysics(BlockPhysicsEvent event) {
if (event.getBlock().getType() == Material.FARMLAND && event.getChangedType() == Material.DIRT) {
event.setCancelled(true);
}
}```
im mvn installing my project
the project has its dependencies
when I use the project as dependency in other projects, those dependencies are missing
how can I install the project with those dependencies?
Its not working
did you register the listener
yes
oh figured it out
just had to change the scope to compile :dumb:
more brackets in the if please
make it print something in console and see if it prints when the farmland hydrates
I think you need to use getSourceBlock
But try to create a void world and print everything you can from that event in case that doesn't work
.
dont rlly see anything wrong with that hmm
public void registerCommands() {
BukkitCommandManager commandManager = new BukkitCommandManager(this);
commandManager.registerCommand(new PunishCommand());
// --- all players ever "@AllPlayers"
commandManager.getCommandCompletions().registerCompletion("AllPlayers", context -> {
List<String> nameList = new ArrayList<>();
for (OfflinePlayer player: Bukkit.getOfflinePlayers()) {
nameList.add(player.getName());
}
return nameList;
});
}
No clue how to solve your problem, just little suggestions
don't use §c, use ChatColor or better yet components
cmd_user in java you don't use snake_case
we use lowerCamelCase
yes yes I know about the case issue, its just easier to not have to hold Shift every 2 seconds but dont worry this was just a test I do infact normally use lowerCamelCase
the §c is very placeholder
and i found the issue
I removed @Values("@AllPlayers") and now it works, wonder whats wrong with that
wait ru using multiple BukkitCommandManagers?
Don't make excuses.
Camel is a great smazijg and sensicle rule of thumb nomenclature.
But still a rule of thumb. Uve got nothing to apologise for
no just one
well i hate it but i use it because other humans exist
and they like to look at your code
even when i dojava @EventHandler(priority = EventPriority.HIGH) public void onBlockPhysics(BlockPhysicsEvent event) { event.setCancelled(true); } its not working
Fair
Have you checked if it is actually getting called for farmland ?
I have no idea what this event gets called for
i didnt checked
ok it seems to be BlockFadeEvent
ah yes, the issue was
I was using @Values("@AllPlayers") but not @CommandCompletion("@AllPlayers")
thanks acf
fixed now
so bro didnt check if the event actually ran when that happened
but used the event
and then complained
public void onBlockFade(BlockFadeEvent event) {
if (event.getBlock().getType() == Material.FARMLAND && event.getNewState().getType() == Material.DIRT) {
event.setCancelled(true);
}
}```
nice code
what about it
hello, I'm trying to make a plugin, this doesn't work. Don't put blocks in the HashMap
public void storeOriginalBlocks() {
SkyWarsLocation skyWarsLocation = new SkyWarsLocation(skyWars);
World world = skyWarsLocation.getPos(1).getWorld();
Location minLocation = skyWarsLocation.getPos(1);
Location maxLocation = skyWarsLocation.getPos(2);
for (int x = minLocation.getBlockX(); x <= maxLocation.getBlockX(); x++) {
for (int y = minLocation.getBlockY(); y <= maxLocation.getBlockY(); y++) {
for (int z = minLocation.getBlockZ(); z <= maxLocation.getBlockZ(); z++) {
Location location = new Location(world, x, y, z);
Block block = location.getBlock();
// Controlla se il blocco non è aria prima di memorizzarlo
if (block.getType() != Material.AIR) {
originalBlocks.put(location, block.getType());
}
}
}
}
}
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
how are you getting the min/max location
bet this will break for stairs (for example) btw
or any directional for that matter
anything with state really
what do you guys think of such a system
looks solid
Location minLocation = skyWarsLocation.getPos(1);
Location maxLocation = skyWarsLocation.getPos(2);
?paste
pretend there is no "implement Listener"
im also gonna pretend the BlockPlaced list does not have a different name scheme from originalBlocks
can we see SkyWarsLocation.java ?
My only guess is that pos1 is bigger than pos2
hi how i can get the ids of old minecraft items?
for example item 68 in version 1.6.4 what is it?
But they are so useful to the coordinates I don't think cerntri.
This page contains links to our lists of Minecraft IDs sorted by their type/category.
will that give me the version specfic item?
there's a website for that
no way to get it via code
you'd have to do that yourself

You should send the relevant config
https://paste.md-5.net/ewixulujeh.makefile Each skywars has its own configuration, this is the test one
Yep just as I thought, your y and z in pos1 are both larger than pos2.
Therefore it's never iterating over them, you're only saving blocks on the x axis
And if they're all air, your map will be empty.
Should be using Math.max(pos1.getX(), pos2.getX()) and Math.min(pos1.getX(), pos2.getX()) etc
Do I have to swap configuration from pos1 to pos2?
No, just use Math.max and Math.min on each coordinate
i try
i test it:
public void storeOriginalBlocks() {
SkyWarsLocation skyWarsLocation = new SkyWarsLocation(skyWars);
World world = skyWarsLocation.getPos(1).getWorld();
Location minLocation = new Location(world,
Math.min(skyWarsLocation.getPos(1).getBlockX(), skyWarsLocation.getPos(2).getBlockX()),
Math.min(skyWarsLocation.getPos(1).getBlockY(), skyWarsLocation.getPos(2).getBlockY()),
Math.min(skyWarsLocation.getPos(1).getBlockZ(), skyWarsLocation.getPos(2).getBlockZ())
);
Location maxLocation = new Location(world,
Math.max(skyWarsLocation.getPos(1).getBlockX(), skyWarsLocation.getPos(2).getBlockX()),
Math.max(skyWarsLocation.getPos(1).getBlockY(), skyWarsLocation.getPos(2).getBlockY()),
Math.max(skyWarsLocation.getPos(1).getBlockZ(), skyWarsLocation.getPos(2).getBlockZ())
);
for (int x = minLocation.getBlockX(); x <= maxLocation.getBlockX(); x++) {
for (int y = minLocation.getBlockY(); y <= maxLocation.getBlockY(); y++) {
for (int z = minLocation.getBlockZ(); z <= maxLocation.getBlockZ(); z++) {
Location location = new Location(world, x, y, z);
Block block = location.getBlock();
// Controlla se il blocco non è aria prima di memorizzarlo
if (block.getType() != Material.AIR) {
originalBlocks.put(location, block.getType());
}
}
}
}
}
try
that... certainly is one way to do it
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... IT GO
@hasty prawn tanks

I couldn't find anything about it on the boosted yaml wiki, so how would i do it? java YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
as i said, i am using boosted yaml
No idea what boosted yaml is but that's how you'd do it in just regular ol spigot
boosted yaml is an yaml library for java, but anyway, i only know how you would do it in yamlconfiguration
and that's what i wrote
Well, you're asking in the wrong spot then.
But, I found this on their GitHub:
YamlDocument config = YamlDocument.create(new File("config.yml"), getResource("config.yml"));
I'm guessing that's what you're looking for.
oh, i didn't know that it created the file (the one with yamlconfiguration)
Well
what If i drop 1 emerald
then 2 breads
what will u do?
will u just say "invalid argument" then scam me out of my items?
Looks like it does, yes. Basically you'll be using YamlDocument instead of YamlConfiguration from now on.
u need a way to retrieve the items thrown
no it wont do anything
the items will just stay stored in the cauldron
itll just scam u out of ur items?
oh
but i saw they disappear
when u throw them
lol
you can get em out with shift-clicking
i see
or breaking/moving
Is there an event for a player joining or leaving a team or a way to hook into /team command (which is a vanilla command)?
It says this should not be used for logic
yea for this example
but shouldnt be used for logic of one specific command
only for logic that applies to all commands
Who says that?
it just says command logic
yes and all of the examples can be specified under "command logic" but thats obviously not the definition theyre talking about
What i believe they mean (taking into account the examples) is that this event should be used for logic thats executed for every command the same
i mean i cant find any other command event
so unless you're registering every 10 letter combination as a command use this one
I mean you can always replace the command, or/and wrap it and delegate
I mean yeah thats one way
theres another?
This
Or you just go with the event callback
Myea sure
I have a 1920x1080 guim and I want it to appear when I type /shopgui but I can't find it, can you help me?
.minecraft\resourcepacks***\assets\minecraft\textures\guis\shopgui\Shop_GUI.png
i doubt you can use a fullscreen gui with shopgui
how can i prevent Flying is not enabled on the server without changing it into the server.propreties
you would need a custom plugin that can workout where the player is looking using coreshaders
Isn't there like an event for when a player gets kicked?
yes right
hmm thx
public void onPlayerKick(PlayerKickEvent e) {
if (e.getReason().equalsIgnoreCase("Flying is not enabled on this server")) {
e.setCancelled(true);
}
}```
i feel like reason is an enum
oh it is a string
sysout the reason before the if and check if it has different punctuation
It does sound like just disabling it in the server properties is easier
can you edit server.prop from within spigot api?
it requires a server restart from what I know, so probably not
but for world settings etc you can I guess
I mean you can change the setting and then just disable the plugin until they restart
is auto updating plugin against spigot tos?
you can check for updates, but auto updating (in many countries) would be illegal.
It would likely break servers too.
a command eg /pluginname update would be allowed probably, as well as a full changelog and confirmation with confirmation it shouldnt break anything
ChatGPT says otherwise (i know you can't always trust chatGPT, but still)
config: This is a variable of type YamlConfiguration that you're declaring. It will hold the loaded configuration data from the YAML file.
YamlConfiguration.loadConfiguration(file): This is a static method call on the YamlConfiguration class. It takes a File object (denoted by the file variable) as a parameter. This method reads the contents of the specified YAML file and parses it into a YamlConfiguration object.```- ChatGBT
It says that it doesn't create the file
maybe i'm just dumb tho
GiBiTi
lol, that isn't even remotely useful
most notably because they aren't using bukkit's yamlconfiguration system
YamlConfiguration doesn't make the file, but you said you were using Boosted YAML which does make it for you.
Atleast according to their docs.
Oh, so YamlDocument.loadConfiguration(file);?
Why are you using boosted?
Got it recommended and they explain it like it has advantages 🤷🏻
Its pointless to use it over teh provided SnakeYAML unless it has somethgin you specifically want to use
it is stupid that spigot doesnt ship with dfu
especially as you don;t know how to use it
What do you guys think about using reactive streams in a plugin?
reactive stream?
like the asynchronous stream?
i mean it just depends on how you plan to structure the rest of your plugin
if you are using something like lettuce alongside d4j, then sure lol
what the hell is this https://github.com/reactive-streams/reactive-streams-jvm
i aint reading all that
well, unless it is on the main thread it doesn't count
that is where all the cool people do ALL of the IO
real
it just depends on how you structure the rest of your plugin really
there is no black and white answer
since everybody is dead in general can we sell plugins in spigot with ways other than paypal?
come to #general to answer
hey, can I check somehow if an player has an minimum amount of an item anywhere in the inventory?
if i save this as a file where will it be stored? will it be in same directory as config.yml?
no
then where should it be stored?
working directory yse
or some security exception
the root of your pc
Player#getInventory has the method you need though i dont recall the name
btw can serial uid be completely random?
depends how its generated
no isnt it the dir at which the program was launched?
yeah it'll be relative to the working directory
alright
jvm serialization is kinda monkaS
yes but you should change it when the class structure changes
anyways, how do i make store the file where the config file is?
i dont want to be laying on random spot
if that's the case it's kinda cool
:)
Is there a way to wait until the latest.log is written so I can read it? (Required for some debug stuff)
its being written until the server is closed
I can now set the resolution I want very easily
how do i change the log level?
you cant read it iirc since it would be used by other program, thread will be terminated if you close the server
like this?
no
log level of what
custom log4j config iirc
you clearly never have used Logger#log(Level, String)
elaborate?
you need a log4j.xml or something like that
i used log4j2 almost in every of my projects, but mostly just log.info, warn and error
but bukkit doesnt use log4j2 right?
bukkit uses java api logger
log4j2.xml
spigots looks like ```xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="com.mojang.util">
<Appenders>
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
</Console>
<Queue name="ServerGuiConsole">
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
</Queue>
<Queue name="TerminalConsole">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
</Queue>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="1000"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="SysOut" level="info"/>
<AppenderRef ref="File"/>
<AppenderRef ref="ServerGuiConsole" level="info"/>
<AppenderRef ref="TerminalConsole" level="info"/>
</Root>
</Loggers>
</Configuration>
i dont think i can just rebuild the server lol
all probably
lright lemme test this
nope
[18:16:42] [Server thread/INFO]: Moterius joined the game
[18:16:42] [Server thread/INFO]: Moterius[/127.0.0.1:59536] logged in with entity id 286 at ([world]-90.0105074814872, 78.0, -42.8679230480403)
[18:16:47] [Server thread/INFO]: Moterius issued server command: /test
[18:16:47] [Server thread/INFO]: Test method for library build being recognized
>
io.github.moterius.VectorParticleLib.Echo.printHello(); //-> 'Library build' message
Echo.logger.log(Level.FINEST,"Logging FINEST log message");
return true;
its not in latest.log either
id you change line 23 too
if it still doesnt work look on spigot/paper forums and see if theres anything
already did
i changed all 'info' to 'finest'
maybe the file aint getting loaded?
ah
it should do, check online for a better wiki
you need to provide an argumet for the run script so its getting recognized
its indeed not reading the edited config
but apparantly that breaks other stuff
might not need the entire config from spigot too
does ServerBound mean the packet is heading to the server?
yes
why that is null
so um
it reads the config now
show more code
@EventHandler
public void playerJoin(PlayerJoinEvent event){
lastMove.put(event.getPlayer(), 0);
playerTimer.put(event.getPlayer(), new AfkLogic(event.getPlayer(), 0, plugin));
notMovingTimer(event.getPlayer());
}
``` thats all
ooooh it logs skin strings
ewogICJ0aW1lc3RhbXAiIDogMTY5MzI0MDE5OTg1OSwKICAicHJvZmlsZUlkIiA6ICJiYTA5MWI1MWEyMWM0NzEwYTRkNTc5OWYyNDBjY2Q2YSIsCiAgInByb2ZpbGVOYW1lIiA6ICJNb3Rlcml1cyIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80MzcyMGZiOWI5YmE1NDY1MjIxMDFjMTdiOTQwOGU2ZDA2ODk3NDczNjZmYmUxYTM0NmNmMDQzYTAxZGIyZmQiCiAgICB9CiAgfQp9
lol
no it isnt, where do you define lastMove
why is it static and public
is this the problem?
Due to memory leaks and GC shenanigans I'd suggest not using stuff like players as keys
this class is screaming that you dont know java
maps dont need to be static, the events and command should be in their own class and uuid should be used not player instance
the issue isnt even with the join event
its with the location isSimilar
why then when saving the location, the world is zero?
either the world isnt loaded yet and it doesnt have a world or the location is broke
if(cond) return
else if(cond) { ... return}
``` or ```
if(cond) return
if(cond) { ... return }
``` and why?
1st case: do this if, else do that if.
2nd case: do this if, do that if.
debug the method calls
I'm not sure what youre trying to say here
aside from 'use variation 2'
anyone knows how to use NexEngine?
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!
what if that is the question? 🤔
Then I gave them the answer
true
just return false if its null
thanks, problem is solved
I dunno how to use the library
where's the doc?
double mx = Math.cos(Math.toRadians((yaw + 90.0F)));
double mz = Math.sin(Math.toRadians((yaw + 90.0F)));
mc.thePlayer.motionX = forward * moveSpeed * mx + strafe * moveSpeed * mz;
mc.thePlayer.motionZ = forward * moveSpeed * mz + strafe * moveSpeed * mx;
can someone help me understand a bit why the motionX and motionZ are calculated this way? It's a code from a function which makes the player move when he presses WASD, mx and mz just represent the direction he is moving to.
Ik that mx and mz are important because they are either negative and positive and that is very important since that determines in which direction you move the player.
thanks
Why the same tropical fish in inventory and when i'm trying to get it's color+pattern has different names?
Gray flopper & Black Tang
But the other fish has the same name but only one color...
You have a resourcepack, maybe that one changes it ?
Nope
(or are you editing the lore with a resourcepack)
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
if(!(commandSender instanceof Player)){
return true;
}
Player player = (Player) commandSender;
AfkLogic afkLogic = playerTimer.get(player.getUniqueId());
player.sendMessage(player.getUniqueId() + "");
if(afkLogic.isStarted()){
afkLogic.disableTimer();
}
else{
afkLogic.startTimer();
}
return false;
}``` why if I use a command, then AfkLogic is null.
as I understand it, it does not work only while using the command
what is playertimer and where is it coming from
thats probably whats happening
I'm damageing an entity, and the lastDamageCause and EntityDamageEvent is crucial to be updated correctly. Do i have to set the last damage cause first, or deal the damage first?
i tried everything ._.
System.out.println(tropicalFish.getName());
System.out.println(tropicalFish.getBodyColor());
System.out.println(tropicalFish.getPatternColor());
System.out.println(tropicalFish.getPattern());
but even color isn't the same
it does seem like you are using the same instance thats odd.
ur not getting an error in onJoin?
I don't know how I didn't think of this before
just saying. ur doing some pretty bad practises there as well
like morice said
and you are creating a task for every joined player
which is sub optimal
especially since that task runs every tick
Is it better to create one for everyone?
for every single player
i would defo yea
could even be async as far as i can see
ok, i'll do that
what does minecraft ascent height do, I know that it is max 256x256, for example, I put 256x256, I will put this gui in the bottom right corner, how many ascent and how many height it should be...? or is there anyone who can throw me the ascent and height wiki?
I think the height can be any, and the ascent can be any, but less than the height
ascent only works vertically. if you want to move horizontally, then you need to use negative spaces, you can search the Internet about them
why square?
you don't really wanna do sqrt
You should use distanceSquared unless you need to display the distance
In which case you kind of need the actual distance
hi , iam stuck at something weird iam on 1.20.1 , and iam trying to get getOppositeFace of a sign
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.
a thx
pixel
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
tasked.forEach(player -> {
AfkLogic afkLogic = playerTimer.get(player);
if(!afkLogic.isStarted()) {
if (lastMove.get(player) >= 20 * 5) {
afkLogic.startTimer();
}
else {
if (Bukkit.getPlayer(player).getLocation().distanceSquared(lastLocation.get(player).clone()) <= 0.05){
lastMove.replace(player, lastMove.get(player) + 1);
} else {
lastMove.replace(player, 0);
}
}
}
else{
if(Bukkit.getPlayer(player).getLocation().distanceSquared(afkLogic.getLocation()) >= 8) {
afkLogic.disableTimer();
lastMove.replace(player, 0);
}
}
lastLocation.replace(player, Bukkit.getPlayer(player).getLocation());
});
}, 1, 1);``` so this code will be more optimizated?
checking every tick is serious overkill
but how to do otherwise?
I can put 2 ticks), I think there is no replacement for this method
you usually use the playermoveevent to track movement
and a timer, 5 minutes or so, to check if he is afk or not
you could do a much simpler check. set a long on teh player for a timestamp of the last player move packet received
hmm, but then it will take into account pitch and yaw
Hi , anyone know how to get sign from behind?
Then as God said, check every 15-30 seconds to check the time since they last moved
using :
sign = (Sign) b.getRelative(event.getBlockFace().getOppositeFace()).getState();
b is the clicked block which is the iron_door :p
blockface 🤔
if you get ANY move packets for the player they either moved or moved their mouse, so not afk
hello how do I save a byte array to a yamlconfiguration properly? for example I save [2,3,3,2,3], but when I save it it outputs
!!binary |-
AgMDAgM=
yeah using it but its notseems to be working anyway goona go check it..
do I need to use protocollib for packages? I just don't understand that at all.
move event
I got this error https://paste.md-5.net/uyumalirof.md can any1 help
ohhh, okay
if you receive a move event for a player they can;t be afk, or they are being pushed by water
so just store the time the move event fired for them
if you want to set them afk after 2 minutes you check (in a task) every 15 seconds or so (no need to be super accurate), do teh math to see when their last move was
if current time > last move + 2 minutes
ok, I'll try to do that.
use the api
wich?
player.spigot().sendMessage
is it ServerboundChatPacket?
stop using packets for things which are in the API
lolno
lies
i want to all by client sided
sendMessage only sends a packet, nothing else
yeah sendMessage doesn't affect the server
there is ZERO point iun using packets for anything you are asking about
all you are doing is making your life more difficult
Exhibit A:
✨ overoptimization ✨
Player#spigot().sendMessage(ACTIONBAR, "message");Works on every modern version
Ik how to use it with spigot
you are setting up NMS, remapping (except you are not doing this part correctly) and being version restricted
literally making your life hell over using a single line of code
crazy right
I just thuoght of a good abstract for sending a message with a packet
crazy?
what if we like have this CommandSender class
i was crazy once
and you can send messages to it
and that sends the packet
don't forget about nms calls though ofc ofc
woah woah woah, did anyone lock you in a room ?
A rubber room with rats
and rats make me crazy
crazy ? I was crazy once-
tho I'd still be crazy if I used NMS to send chat messages

that explains it..
id be crazy if i tried to async everything and packet everything
surely nothing can go wrong
honestly the api is kind of bad anyways lets just remove it
yea i mean
if only there was a competently designed NMS mappings viewer
then I could just, code it all up in nms 😭
now to make a safe API around nms to work across versions
My main complain with the current viewers is on interfaces you can't view where its implemented which is kind of annoying
oh wait a minute
paper-mojangapi
okay lets call it Bukkit
lynxper
lynxper 
but i want to craftbukkit
craftlynxper
higgs boson?
🤣
well then at least use the proper class name
there is no 1_20_R1 anywhere in NMS class names since a looong time
like 2+ years
pretty sure this is wrong, in my experience even when not moving the client periodically sends move packets
I've never seen it happen
ill test
what would be in the move packet thoug
if it does, just check if to and from are the same
the client must send a position packet every 20 ticks
Are you troll?
So I made a plugin that creates advancements through creating json files in a datapack using gson but is there a way to constaly have it update soon as something is new in it besides /reload and /datapack enable/disable
How do you listen for people leaving or joining a team?
What is the best way for inventories? Comparing themself against ==, equals or via InventoryHolder ?
yeah thats what i thought
Hello i want to recup the count value
how i can do it?
code:
on_first_join:
items:
- material: STONE
count: 1
messages:
- Welcome {{ player }}, on this server!```
pls yes
You want to persist the things? Like saving how many blocks they broken
please paste that properly
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
i don't now how to make ...
with ```yaml
oh
or ?paste
bot is down
?paste
nop
oh weird
hi guys, using playerinteractevent how do i check if a cartography table is right clicked
Maybe my proxing is causing problems inside discord apis thenbefore some bots dont respond
check if action is RIGHT_CLICK_BLOCK and then check if getClickedBLock().getType() == Material.CARTOGRAPHER_TABLE
and also only check one hand, playerinteract event is called once per hand
?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
}
?comparing inventories
pls help 😅
Hey, do some of you know how could I make a Nametag plugin that people can apply below the player nickname?
like
<playername>
<tag>
(I just need a start idea)
Well its pretty simple the logic
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous usernames, global display names, and server...
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
that's not valid yaml
You mean replacing the variables or what?
[15:00:38 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:38 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:39 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:39 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:40 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:40 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:41 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:41 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:42 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:42 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:43 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:43 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:44 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:44 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
[15:00:45 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] Move packet recieved.
[15:00:45 INFO]: [STDOUT] [net.minecraft.server.network.PlayerConnection] X: -0.5 Y: 67.0 Z: 22.5
all without moving (took me a bit forgot to test)
how to get all the ? commands?
== can’t be applied to Block and Material
Only admins can if im not wrong
i wrote a wiki article about it https://www.spigotmc.org/wiki/discord-commands/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
nice
that's why I told you to use getType() on the block
Thats why he did getType()
?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!
do ?cc list in #bot-commands
i get {material=STONE, count=1} but after i can't do it
and epic thats what it sends it just sends the same coordinates repeatedly
since you asked ig
the what
this
And for inventories? What we can use? equals, == or InventoryHolder which is better
equals inventory view
oh
weird
No I mean something like that;
https://imgur.com/a/lJMGUk9
it updates every second even without movement
thats minecraft
int count = (int) getConfig().getMapList("on_first_join.items").get(0).get("count");
guess you just add an if from equals to
me? or who you answered
equals() doesn't really do anything on inventories besides ==
so what bette? Because also ivnentory holder is a thing too
I have a nightmare because they musnt be matched via title because of obviuously reason
if in doubt, use equals
This is CraftInventory equals()
but the underlying inventory doesnt override equals
is Amazon CodeWhisperer good with minecraft?
hence it all comes down to it using == anyway
thx you and i'm sorry to be so dumb...
why can’t BlockState be casted to TileState???
So better use inventoryA ==inventoryB ? Thanks and sorry for pinging
it can ??? if it is
it can - if it is a tilestate
you cannot cast a grass blockstate to tilestate
is cartography table not a tilestate
no
but it doesnt store anything
it's just a block that opens a stateless gui
you cannot store any items there or anything
so how do i create a block pdc with a cartography table
a crafting table is not a block entity, for example
please don’t say you can’t
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
hm dependancy
yeah but a tiny one, and it's on maven central
im down as long as it works
ofc it works, but only in 1.16.3+
ur joking irght
no, why would I
im running a 1.16.2 server
why
1.16.3 is the version since when Chunk implements PersistentDataHolder
flashbacks to PDC implementation on chunks
blame lynx for not having added it earlier
how do i add custom blocks with pdc?
im blaming lynx for not adding pdc in 1.8
TRUE
all those 1.8 servers
custom blocks? you don't. you use ItemDisplays with CustomModelData
yeah gg lynx for having waited until after 1.13
No but like blocks that drop custom loot
all those 1.8 suckers now have to live without it
oh in that case, just apply a custom tag, and in blockbreakevent, check the block's pdc
and then drop your custom loot
Thx
do you think postgress is on choco
What
@EventHandler
public void onInteractEvent(PlayerInteractEvent event) {
if (event.getHand() == EquipmentSlot.HAND &&
event.getAction() == Action.RIGHT_CLICK_BLOCK &&
event.getClickedBlock().getType() == Material.CARTOGRAPHY_TABLE) {
Block block = event.getClickedBlock();
PersistentDataContainer pdc = new CustomBlockData(block, NationAddons.getInstance());
if (pdc.has(new NamespacedKey(NationAddons.getInstance(), "printing-press"), PersistentDataType.STRING)) {
event.setCancelled(true);
printingPress(event.getPlayer());
}
}
}
would that work
what is a good way to disable first person view?
A mod
do you think postgres is on chocolatey
totally
yes
alright last question
wait block PDC exists?
tell your players they'll get to see cute anime girls if they don't use first person mode
in BlockPlaceEvent is there anyway to check the display name of the itemstack when its placed, so for example check if a dirt block named "test" is placed
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
Arrays, Maps, Collections, etc as PersistentDataTypes :3
it could even store a Map<Material,TreeSet<List<String>>>
but I hate treesets
don't use them
anyone know?
@tender shard you literally made a library for EVERYTHING
you should rather use PDC tags
how do i do that
anyway you can get the item that is used to place using getItemInHand()
nah im interested in the tags
ItemMeta meta = ...;
meta.getPersistentDataContainer().set(someNamespacedKey, PersistentDataType.STRING, "my custom item lol");
or: Why you should NEVER use NBT tags again! Spigot 1.14.1 added the biggest improvement that (in my opinion) ever made it into the Bukkit API: The Persistent Data Container (PDC). It can be used to store custom data on Entities, TileEntities, and ItemStacks. Using a bit of math, it can also be used to...
thats fire
theyre way better like a player cant just rename the item to test and use that custom block
is it possible to make a foreach like this or no?
for (int i : getConfig().getList("on_first_join.items").size())
How to do pdc for blocks?
because it dfon't work
So in conclusion which is the best way for inventories i didnt really get a conclusion??
cant you just do e.getItemInHand().getItemMeta()....
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
I dont think, because you have to set them again the meta to the item. If im not wrong otherwise override the data
List<Map<String,Object>> items = getCOnfig().getMapList("on_first_join.items"));
for(Map<String,Object> entry : items) {
String itemName = (String) entry.get("name");
int count = (int) entry.get("count");
}
so like this
yes sure
COnfig
itemMeta.getPersistentDataContainer().set(new NamespacedKey(NationAddons.getInstance(), "printing-press"), PersistentDataType.STRING, "custom");
if (event.getItemInHand().getItemMeta().getPersistentDataContainer().has(new NamespacedKey(NationAddons.getInstance(), "printing-press"), PersistentDataType.STRING))
would that be g
yes
fire
private final NamespacedKey itemIdKey = new NamespacedKey(myPlugin, "item-id");
//
@EventHandler
public void onEvent(...) {
// use the key now
just store the NamespacedKey in a field
oh yeah sounds good
that also avoids typos if you need it in more than one place lol
I usually have a class that only stores all my NamespacedKeys
or have them all as public final field on the main class
public class MyPlugin extends JavaPlugin {
public final NamespacedKey whateverKey = new NamespacedKey(this, "whatever");
// ...
NamespacedKey.fromString("pluginname:item-id") be like
sure that also works if you dont have an instance
We love fromString
isnt the constructor deprecate
who uses old versions
heeeeeeeeeeeeeeee
i didnt know that
i used new NamespacedKey(PluginMain.getPlugin(PluginMain.class), "key") everytime
yeah that's ofc the best way
well using getPlugin isn't exactly
but it's fine, I mean it only runs once
anyone got that plugin that outputs the artifact into any directory
maven or gradle
maven
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
it would be preeetty sad if it couldnt do that
on a non related topic to this. is it possible to choose what discord embeds from a custom website? like say i make a website and i want to choose what it would embed there do u know?
the profiles thing i meant
Somethign more powerful, with IJ you can configure to it. To when you start your mc server thru Intellij, first make it run mvn clean package and then start the server. If you want help i can explain you how to set it up
i aint doin allat
it uses "open graph" / "og" meta tags
<meta property="og:title" content="This is the embed's title">
? what is spigot english
facebook, twitter etc uses the same
ah i see so you can choose what it embedded. ive always wondered about that
just google "html open graph meta"
i see, thanks so much
np
a spigot is this: 
the thing where water comes out
yeah but what is spigot english
like u have american english, british english
but spigot english?
spigot english is like this:
help guys my plugin not workings?? I using intellij but error when startup help plz
Hiya! is anyone able to make it happen to create an API to make sure that specific cases happens, such as setting block, opening the crate for the user and so on 😄 ?
Please @ me if u know how Or if you know a plugin which already does this ^^
that API is called Spigot API??
just dont type loose code and dont swallow exceptions
Does this allow another plugin to set their block and run a action 🙂 ?
in wordpress one can also easily change this per post etc with Yoast or other plugins
ah i see, ive never used wordpress before. but good to know.
what is a smart way to load a config? I have a huge config and i need parts of it in many different classes what would be the smartest way to load all of it
by loading all of it
yh but like do i create a different class for it? or do i do it in the main? like im not sure if theres like a general way
cause i couldnt find anything about it online
but just loading it onEnable seemed kind of stupid me
Loading it in onenable is usually the way to go
well first of all i need to pass in like 50 things in the get command if i want to use multible things of thew config
wich gets really confusing
well thats the whole reason actually yh
Then turn your config into a data class
alright ill see what i can do
on my config.yml : test: test:16 how i get the test and the 16?
getString("test").split(":")
How to check if Color is set? Because if player doesn't have color i got error```java
@EventHandler
public void onProjectileHit(ProjectileHitEvent e) {
Entity hitEntity = e.getHitEntity();
if (!(hitEntity instanceof Player)) {
return;
}
if (e.getEntity() instanceof Arrow) {
Arrow arrow = (Arrow) e.getEntity();
Color color = arrow.getColor();
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
String hex = String.format("#%02x%02x%02x", red, green, blue);
switch (hex) {
case "#7ebff1":
Bukkit.broadcastMessage("Freeze Arrow");
break;
default:
Bukkit.broadcastMessage("Normal Arrow");
}
}
}
are you actually identifying your custom arrow by its color 🥲
you should use PDC tags instead
also why do you need the color as string?
why not metadata? is arrows metadataeable?
sure, that'd work too
Agree but colors is also fine
i compare via material
how i can overide a minecraft command
create a command with the same name
different topic, does anyone know why a zombie spawning in and starting to attack a player does not trigger the EntityTargetEvent?
Is there a way to prevent pirating premium Plugins effectively?
obsfucate it
you cant
Yea but that does not prevent pirating
you would need some type of kernel driver to check if someone's pirating your game
so you simply dont, just deal with it
And manual verification is forbidden right? Like the Plugins works only half until you verify yourself
verification servers are kinda bullshit
you can always create your own verification server on localhost anyways
Minecraft accounts works becuz you need to use them to get into servers
and most people use them anyways
they were never your customer to begin with
don't put effort into them, they will find one or another way to pirate ur product
usually kids with no money that run their little servers :>
you can always make foss plugin and add donations site and beg people to donate lol
:,)
which can work
something like, per month pay
never make one time pay donations
becuz if you do, you wont get money from people who forgot to unsubscribe from your donation thing
never mind i idiot forgot to register the event
and just add another $ into the name for every nested lambda
if you already know the type why give it name lol
effecitvely? make your plugin total shit so nobody wants to use it
other than that? no
alternative is to make it open source, SOME of those illegal websites take down open source plugins on request
not all of them, some even sell them
Spigot api is someone else’s work
but it doesn't have a price tag
But nobody sells it
(this is in config.yml)
getConfig().getConfigurationSection(„kits“).getKeys(false)
yes i alredy know that but how i can get it in a variable
like it is a list?
or string?
List<String> kits = …;
Its a configurationsection, getKeys gets a list of… well… the keys inside it lol
Is this a map list or config section?
try .getStringList
Because a configurationSection is not a list
getKeys(false)
getConfigurationSection(…).getKeys(false)
dont work
Thats a List of strings
config section
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
right thanks, i was dougthing ahha
?paste
Or screenshot
oh right, it returns a Set<String>, not a List<String>
if you want to have it as list, do this
List<String> kits = new ArrayList<>(getConfig().getConfigurationSection("kits").getKeys(false));
otherwise, just do Set<String> kits = getConfig().getConfigurationSection("kits").getKeys(false);
you can see that it's a Set in the javadocs https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/configuration/ConfigurationSection.html#getKeys(boolean)
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
thx you that work know 😄
np
Most people use stuff like proguard (I think fr33 does that), and some (I mean some really important plugins like intave), as far as I asked & not being sure (not knowing the exact thing they do), they use ZKM as main obfuscator and load classes through secured class loader, downloaded everytime on boot.
proguard is common with android sdk
And it has a gradle plugin (I think)
pls dont
why nottt
https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
Except for variables, all instance, class, and class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed.
i’m gonna make a spring boot plug-in
but thats not a variable name, that an argument!
thats a lambda paramater variable
var var = new var()
its used for minifying the package
not for any "protection"
main purpose of proguard is optimization
it shrinks bytecode, removes unused methods etc
those have automated deobfuscators
no point of using that
heya, im trying to get a function from worldguard on to simple score, i want to be able to see what worldguard region im in. But i cant get it to work. Anyone know how to do it?
Im not even sure im at the right place to ask for help, if anyone know anything, or just knows where i should ask instead id really appreciate it :)
worldguard uses its own player object as well just fyi
so you will need to use its method to convert a player to a WorldGuard Player
also, worldguard uses vectors as well
the link I gave contains this info as well, just have to browse around
Great, Thank you very much :D
also Worldguard has events you can listen to
which if I recall there is one for entering regions
ok nvm, just has a single region event which isn't all that helpful
I mean, they have flags both for entering and leaving. But i dont think i can use that in what im trying to rn
you can, just have to implement a hook for it is all. For some reason I thought WG had some other events that were helpful that it itself ran
but the current API docs state there is only a single event and that is for pvp XD
but good news you now have the docs to look at stuff which should be more helpful 😛
also they have a discord as well
Yeah, im gonna read through em and hope i find what i need. Thanks for the tips :9
Yeah, i tried asking there as well, its not very active i think
But thanks again :D
what
Hello. Why does my placeholder doesn't parse color?
Did you run it though translate alt codes
what?
ChatColor.translateAlternateColorCodes
It's a simple js script to translate placeholder on russian and add text of error
&b is not color code minecraft can understand
You need to use §
💀
Also what in the JavaScript are you doing
i wrote this crap in 2021 and it has worked since
i didn't know java then
thanks
Is there a way to automatically update a datapack after something has changed instead of doing /reload or /datapack enable/disable. I made a plugin where it generates json files in a datapack for a custom advancement to count ride counts
why don't you just load the advancement directly, without that datapack?
I can do that? First time working with anything with advancements
if you got the json, you can use Bukkit.getUnsafe().loadAdvancement(...)
