#help-development
1 messages · Page 1581 of 1
Thank you
BufferedWriter outStream= new BufferedWriter(new FileWriter("fileName", true));
or FileWriter.append() i think
I have a command /clearinvetory <username> which opens an inventory where moderators can either completely clear player's invetory (including armor) or only clear items of the player in arg[0]. once the command has opened the first inventory, I made a different class called GUIEvent which controls the inventory. My question is, how do I get the args from the class where the command is on to the GUIEvent class so i can use them for a command perform of gui items?
well i dont have them ready but im planning to do it and this is a requirement for it
why not have the event and gui in the same class
then how can i get the argument in the event?
do i just make a public String?
you can pass the player args into the constructor of the gui class
i dont wanna use a separate class...
as you saying its better to just make the eventhandler inside the command class
i believe i cant just call the argument inside the eventhandler
i dont exactly know what your setup is so im trying to figure things out here
im assuming you want to make the command in one class, and the gui and event in another
and how do i do it?
then somewhere in the command class call the gui constructor
thats what im looking for
soo, i can get the direction of a certain euler angle ? like, when u set a headpose on the armor stand,
i know is possible transform euler angle in vectors
when you call the gui constructor in the command class with new SomeGUI(), that is when you would pass the player arg to the constructor
I made this but i just wrote what came to my mind and now there is an error can someone please point out my mistake 😄
how i can send console command with a plugin?
new Namespacekey
oh
still error
is everything else in that piece of code right?
in the whole method
Hover over it and see what the error is
ok
You don't use the get method.
..getPersistentDataContainer().get(namespacedKey, dataType)
Why can't I use EntityType in switch?
case ZOMBIE:
No need to do EntityType.ZOMBIE anymore.
Oh, didn't know. Thanks.
?
Bukkit#dispatchCommand
does the code go in onBucketEmpty() after the bucket is emptied?
since i need to stop the person from placing is certain condition is satisfied
i.e. persistant container has the value
Register the listener and put @EventHandler annotations on the method.
what do you mean by register the listener
aahh ok
?
The method will be called when the PlayerBucketEmptyEvent is called.
ohk
please help me
hi, i have to compile a finished spigot plugin. If I try it with gradle build the process says that its need a spigot compileClass.
Is there no command to download that by gradle? I dont wana setup a whole IDE for that now
Can you provide your gradle file?
Wg doesn't have a flag for that and this is the wrong channel
Gradle should download it, you'd need to debug that problem or ask the plugin developer
Uhh wait, you need that nms stuff
so gradle build should do that? Is there no another command for it? Sorry I don't programm java stuff
Iirc there should be a install option with the build tools
No, you need the nms stuff, Gradle can't do that
How would I make an entity silent
Entity MetaData
using ProtocolLib
??
It's for an entity.
Thanks but only for specific players
It can?
Though you’d be using paperweight for it
is there a way to add a player to the whitelist from the code
//check if player is on whitelist
}
player.setWhitelisted(true); //set player on whitelist
player.setWhitelisted(false); //remove player from whitelist
Bukkit.setWhitelist(true); //enable whitelist
Bukkit.setWhitelist(false); //disable whitelist
Bukkit.reloadWhitelist() //reload whitelist
ok thanks
How can i know is onDisable called by server close or /reload?
Can I change a skeleton's bow charge speed? or make it just shoot faster?
attributes i think
i remember my friend tell me a method using Thread.getAllStackTraces() then search with contains but i forget it
But server close will also call onEnable
no it wont
I want to check that in onDisable
When server start
attributes don't work
seems there is a attribute
there is no draw speed attribute
ranged attack speed mabey
if all of that aren't working then spawn a arrow earlier
ye
Why after the passage of spigot in 1.8 to 1.9 my function ** public enum ** does not work anymore
package fr.moditetboss.mytntrun;
public enum Gstate {
WATING,COUNT,STARTING,PLAYING,FINISH;
}
any exceptions?
that is fully valid java
That is unless you are using really old versions of java - but most java versions should be safe
I have a really oddly specific question, if I have a HashMap<K, V1> which I want to convert to a HashMap<K, V2> and I know that V2 extends V1 and that all the contents in V1 are actually V2 classes, is there a way to cast the whole hashmap without having to iterate through it?
.map the entry set
or maybe I just shouldn't specify V1 in the first place?
I mean sure but that's still iterative right
I was just wondering if there was a way to cast the entire thing in one go
? extends V1
.map is fine….
use generics and you shoudl be able to retrieve a V2
Unless its subject to type erasure. No clue on that
aha what about
Hello!
Does anyone know why, when you add certain dependencies, it makes other dependencies break?
is there a way to avoid this
replace HashMap<K,V1> with HashMap<K,?> then cast to V2 via (HashMap<K,V2) firstHashMap
this should work right
code everything by your self
Lmao
K, ? extends V1
I guess I can do that, does that have a material advantage?
Nope
I guess that's what elgar was saying earlier, thanks for the tip
and actually it sort of helps since the IDE already warned me that I fucked up class extensions lol
And IDE will give you a warn
thank you!
Does anyone know if there is a reason for Location not having a getNearbyEntities() method that World has?
Because Location may not contain a valid world reference
And then you would constsntly have to updated every single location makes 0 sense
public void AddUser(Player player) throws SQLException{
Connection conn;
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/***", "***", "****");
Statement st = conn.createStatement();
String check = "SELECT * FROM users WHERE UUID="+player.getUniqueId();
System.out.println(check);
ResultSet rs = st.executeQuery(check);
System.out.println(rs.next());
//String q = "INSERT INTO users VALUES('"+ player.getUniqueId().toString() +"', '"+ player.getName() +"', '"+ player.getAddress().getAddress().getHostAddress() +"')";
//st.executeUpdate(q);
//st.close();
}
Hi
console give me this error
and idk why
Is that safe?
Don't you need to use prepared statements
?
This work
but when i put ResultSet don't work
if i delete it the method work
but dont you have to use prepared statements so then you dont get sql injections
how i can fix?
¯_(ツ)_/¯
idk much about mysql
but monald
if you read the error
it says its a syntax error in the mysql
yes, but i have already tried in SQL query
¯_(ツ)_/¯
@quaint mantle This is the case:
The Command class: https://paste.gg/p/anonymous/780651dc1b944a34a4baa428197ac2fa
The Event class: https://paste.gg/p/anonymous/4c6b7dea5aa94421bef9d64b4008f044
how can i use the arg[0] from the command class in the Event class?
to perform a command
put the gui in the same class as the event, so that in the command class when you call the gui constructor you can pass the player args to the constructor.
then you can store the player as a field or something
could you give me a hint?
move all of your gui code from the command class and the event into one gui class (so you have a class with just the command, and another class with the gui code and the gui handler event)
then you can call the gui class constructor in your command class, and pass in the player to the constructor, such as new GUI(player)
Hey guys!
I am planning to make a vehicles plugin and I am a beginner in this field so can some of you pros out there tell me what are the hard parts in this process so that I can start learning those concepts right away
Thank You! 🙂
Well let's start with the obvious do you know Java
Not really sadly
beginning a plugin has always been a hard part for me
use intellij
IDE does not matter here
it does
Not at all
use intelij with minecraft plugin
Same
vehicles plugins are even worse given that they require nms and special project structure otherwise you will be quite doomed in the long run
it helps you set up the project
because i found it amazing
before this i was using eclipse
and experiences developers are used to their tools
and i had to set up everything
don't force people off what they are used to
Setting up maven/gradle is the easiest part of making a plugin
Getting a prototype to work is a lot harder
as long as you actually understand what the minecraft plugin does then it is fine
which is the part I was referring to
but you should at least have some experience doing it yourself
you were asking me abt my experience and stuff
I think you confused me with another person on here
oh
I was just saying that starting plugins is generally complicated
You have to do a lot of design work, which mostly is jsut dependent on how YOU code, otherwise you will spent the rest of your life refractoring the code - and let me tell you, it isn't fun
yup refactoring sucks
so how should i start with the vehicles?
should i make the models first?
or the movement of cars
well, first you need to understand the basics of what you are doing, doing this serverside only is quite different from serverside + clientside
no
Oh man
Spigot is limited to server side is what he means
Things like forge can do a bit of both which makes it easier to do complex stuff
It was just a suggestion since I found it useful. Sorry if I hurt anybodys emotions. 🙏
vscode or vim, every other editor I find to be extraneous
Why would I want a different editor for basically every single language and platform?
Can someone share the documention of stuff related to vehicles plugin. Since I don't know what to search on Google
Right
Having all my languages in one place is very nice
No worries about syncing themes, settings, or hotkeys
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
I have all of them different for each language. When I was doing this I thought it was a great idea but later I realized that it was not 😂😅
and I think you're confusing plugins and mods
I said I don't know what to search on Google
Does anyone happen to know how I might go about fixing some dependency breaking?
When I add a new dependency, it breaks some things for other dependencies!
I'm not sure how to fix it.
yes i think so
Umm ok
plugins are server sided, mods are server/client sided, you're talking about vehicles and custom models which would be a mod
it can be a server side plugin
just involves resource packs and optifine
plugins are server sided
i meant the custom models
Ohk
So u need to make a mod for a vehicle model
That occurs when I add this dependency: https://cdn.discordapp.com/attachments/475415047078936586/866393223987331092/unknown.png
or look into how to do resource packs for custom models ig
for some reason
do you mind explaning more?
well for a beginner, I wouldnt recommend it
do i use this instead of
FileWriter updateJSONWrite = new FileWriter(mainClass.CheckpointsCounterFile);
updateJSONWrite.write(jo.toJSONString());
updateJSONWrite.close();
yeah i agree
how would i use protocollib to change a players above-head username (intercept the packet)
But if it is in a mod then it won't work on a server right?
No, but there’s ways to do custom models with resource packs
By using write you are overwriting what ever is there, .append()
Adding a spigot dependency is breaking pieces of my code! How should I fix this?
im not sure if i can explain that in other ways
aight man ill tell you if it works! thanks!
Are you using maven?
yup
Look at the compiler and then try fix what the compiler complains about
What is the error
Does no mean it can work on servers or it can not
it can, with resource packs
Mods can’t work on spigot servers though. Resource packs can
Specifically, while I have the dependency loaded, I get the error:
java: cannot find symbol
symbol: method isGenerated()
location: variable loc of type org.bukkit.Location
For a number of different things.
If I remove the dependency, I don't have that problem, BUT.
Probs conflicting imports then but idrk
import net.minecraft.server.v1_16_R3.EntityZombie;
import net.minecraft.server.v1_16_R3.World;
public class oldredgodsandme extends EntityZombie {
public oldredgodsandme(World world) {
super(world);
}
}
So I will try to make it with resource pack then
Ok
How do I resolve conflicting imports?
Show Pom.xml
<repositories>
<repository>
<id>enginehub-maven</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<repository>
<id>destroystokyo-repo</id>
<url>https://repo.destroystokyo.com/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>lotc-release</id>
<url>https://maven.pkg.github.com/lord-of-the-craft/maven-packages</url>
</repository>
<repository>
<id>md_5-public</id>
<url>http://repo.md-5.net/content/groups/public/</url>
</repository>
<repository>
<id>papermc-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>co.lotc</groupId>
<artifactId>tythan-bukkit</artifactId>
<version>1.15.2-R0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
?paste
Hello, i have a question. I want to give every player in skyblock an item and when they right click on it, i want that it gives the skyblock GUI (execute the /is command), is that possible?
yes
how
when they join, add the item to their inv
why are you depending on spigot & the paper api?
yes but
how do i make the item work?
if i remove the spigot dependency it fixes everything else
but i want to do custom mobs
ok but why are you depending on both spigot and paper
ok so remove paper api??
on inventoryinteractevent check if the item is the right type of item, to make it easier probably make the item something unobtainable and check if its a right click
then open the gui
No
Dont make it something unobtainable
removing paper removes .getnearbyentities
Use the pdc
isn’t there like a plugin for that?
probably many
Then depend on paper not spigot and remove the paper api?
^^
no?
how can it be called
iirc it can depending on which implementation
oh
its like an extra "paper" method ya know
i mean theres still
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getNearbyEntities(org.bukkit.Location,double,double,double,java.util.function.Predicate)
declaration: package: org.bukkit, interface: World
Hello someone know how to set 0 into scoreboard?
it just disappear this line when it 0
like
kills:
0
deaths:
0
its just look like
kills:
deaths:
someone know how to fix that?
code:
sidebar.getScore(translate("&eUsername&8:")).setScore(-1);
sidebar.getScore(translate("&8➥ &7" + player.getName())).setScore(-2);
sidebar.getScore(translate("")).setScore(-3);
sidebar.getScore(translate("&cKills&8:")).setScore(-4);
sidebar.getScore(translate("&8➥ &7" + kills)).setScore(-5);
sidebar.getScore(translate("&cDeaths&8:")).setScore(-6);
sidebar.getScore(translate("&8➥ &7" + deaths)).setScore(-7);
sidebar.getScore(translate("&cKill Strikes&8:")).setScore(-8);
sidebar.getScore(translate("&8➥ &7" + strikes)).setScore(-9);
sidebar.getScore(translate("&cKDR&8:")).setScore(-10);
sidebar.getScore(translate("&8➥ &7" + kdr)).setScore(-11);
Any way to change the l4j config?
log4j?
yes
can i set the amount of an itemstack to 0?
yeah but the xml config is owned by spigot
will it remove it from the inventory?
Thought spigot loaded the plugin config if one is present which is the implementation of Plugin#getLogger
Or maybe on paper at least 
iirc only in 1.8
in higher versions just removes it
OH THANK GOD THEY FIXED IT
moin moin kann wer von euch Welt-Generatoren programmieren?
English buddy
croissant hitler
can anyone programm a world generator or has a tutorial video
Hey, I'm having a problem with one of my programs. I'm trying to make it so that when you click on an item it enchanted it, if you click on another item it enchanted it but it removes the enchantment of the other item. Basically, there would be only one enchanted item each time. Except that the enchantment stays on the item while I clicked on another item and the reason does not change. Here is the GUI and the setGlow function.
public static void setGlow(boolean glow, ItemStack itemStack) {
if(glow) {
if(ItemStackUtils.isAnArmor(itemStack)) {
itemStack.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1);
} else {
itemStack.addUnsafeEnchantment(Enchantment.PROTECTION_EXPLOSIONS, 1);
}
ItemMeta meta = itemStack.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemStack.setItemMeta(meta);
} else {
ItemMeta meta = itemStack.getItemMeta();
for(Enchantment enchantment : meta.getEnchants().keySet()) {
meta.removeEnchant(enchantment);
}
}
}
what if they use the armor for the knockback, lol
They can't
sure they can
hold armor in hand, punch
the best solution to making a glow is creating a new enchantment
the client won't be able to display the name at all but it will show the glow
How
Players cant take items in the GUI
do you know any way to hide the hotbar, heart bar and food bar ...?
OriginRealms manages to hide this as if it were spectator and survival mode... I found something about custom game mode but I'm too lost about how to do it...
I need help with this. Everytime I try to run the command, it displays that an internal error occrued, and I can't find it.
Do they have a resourcepack?
yes, but coming out of that scene you see everything normal (with your hearts and the hotbar).
Interessting
You can always setup a quick packet listener and see what the client is getting
(Using Fabric or Forge)
But here you simply use a texturepack to make everything work, no mods or clients...
did you register it in plugin.yml
Yes
We need that error though ;/
If you want, I can show you the plugin.yml file
There was no wrror on the console
Just doesn't work when I try to run it
It will never tell you that unless there is an error
Send the full server log in a paste
?paste
Ok
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Here is the error
So there was one .-.
code
yeah, I was just dumb
...
containsValue null
And put null
Also that while loop
You might just want to rewrite that entire thing
Becauee entityType can choose things like area effect cloud and then you can't kill that
?conventions
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
yeah I forget to follow conventions a lot, I'm still fairly new to java
I can tell
i know this is not spigot stuff, but can someone help me installing nms into my maven repo? afaik there is no online maven repository because it contains mc source code. However i could not figure out how to use/install nms in intellij. I even tried running Buildtools and importing that craftbukkit file manually
if im not allowed to ask it here because this is spigot pls let me know
also i could provide my current pom.xml if it helps
Anyway avoid while loops as much as you can. It's better to use a loop with a set range or you might kill the server if you're not careful
ok
In the properties section add a new property: <project.nms.path>C:/PATH/TO/SPIGOT/JAR/spigot-VER.jar</project.nms.path> (Obviously change the path to your spigot jar
Then add the dependency:
<dependency>
<groupId>net.minecraft</groupId>
<artifactId>server</artifactId>
<version>v1.VER</version>
<scope>system</scope>
<systemPath>${project.nms.path}</systemPath>
</dependency>
Don't do this. It's depricated
is the path already starting in my directory and could i do like src/main/java/resources/nms.jar? Or do i need the full path like C:\...
Wdym
also, which file? now the spigot-api.jar i got from buildtools?
That feature should not be used and might be removed in future versions of maven
Ok then explain what I should do lmao
oh okay whats the new method to do it
After running BuildTools just switch spigot-api to spigot in your POM
this one? ```xml
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
do i need to run buildtools in my project directory or just somewhere on my pc (like my desktop)
Just try it lol
If it doesn't work that answers your question
Anywhere and make sure to have maven installed on your system
Is there an easy way to tell if a user is not from the java edition?
Geyser should have an API
?paste
ok so im trying to track an item, and I have a json file which has the location the item was last seen.
When my plugin is enabled, I load this file and then I load the chunk the item was last seen in.
The problem is that after loading that chunk, there are no entities in the chunk. After logging on though, I can go to this spot and the entity is there, and in the place the json file says it should be. So why is it not in the list of entities after chunk load?
for some reason, worldguard flag deny-spawn doesnt work for slimes, whats the best way of blocking a specific mob spawn? maybe there is already a command for that? if not, any way to iterate over all entities? or all mobs entities, or something like that
Going to need the code for this one
declaration: package: org.bukkit.event.entity, class: EntitySpawnEvent
sure
thanks
System.out.println("it broke");
System.out.println("going to the spigot discord");
System.out.println("asking a million questions");
System.out.println("ok all fixed");``` ?
seems to work @chrome beacon thanks!!! ive been struggeling for a while <3
why set saturation and not set food level
oh wait
Great :)
yeaaaaa
fun load() {
val file = File(plugin.dataFolder, "locations.json")
file.createNewFile()
try {
val root = mapper.readTree(file)
for(entry in root.fields()) {
val location = Location(
plugin.server.getWorld(UUID.fromString(entry.value["world"].asText())),
entry.value["x"].asDouble(),
entry.value["y"].asDouble(),
entry.value["z"].asDouble()
)
location.chunk.load(false)
}
plugin.logger.info("Loaded $stoneLocations")
}
catch(e: IOError) {}
}
@EventHandler
fun onItemSpawn(ev: ItemSpawnEvent) {
val type = ev.entity.itemStack.infinityStoneType ?: return
stoneLocations[type] = ev.entity
save()
}
@EventHandler
fun onChunkLoad(ev: ChunkLoadEvent) {
for(entity in ev.chunk.entities) {
if(entity is Item) {
val type = entity.itemStack.infinityStoneType ?: continue
stoneLocations[type] = entity
save()
}
}
}
Im using kotlin because im a chad but hopefully you can still tell what its saying (?: means if null)
?paste
BanePig what’s the issue?
this
also even when i manually log in, both ChunkLoadEvent and ItemSpawnEvent dont end up changing stoneLocations, even though theres pretty clearly an item in the chunk
Oh sorry I am too tired for this complex problem, @chrome beacon do your stuff 
i want to say its a bug but if im wrong ill just end up feeling stupid so idk if i want to go that far
Also I am not a native kotliner so makes it quite difficult altho I use kotlin dsl for gradle sometimes
i can convert it to java
Sure lol
i mean really all that matters is the onChunkLoad event though
since I dont think its supposed to call onItemSpawn since its just loading in, and the issue occurs whether I load the chunk from code or from game
Oh no Kotlin
?paste
https://paste.md-5.net/oxeyibinej.java java code
Anyway many of spigot events fire early
Try delaying checking all entities by one tick
yeah i considered that
kinda sucks to do though :/
who knows what could happen during that tick
True but does it really matter that much
Can I not make a potion have two effects with different durations?
well its still not working but might be something i can fix
You can just not two of the same type
You can't have speed 1 for 30 and speed 2 for 5 seconds
Hey how can I detect that a player clicked on an item contained in an itemframe?
Listen to the interact at entity event and check if it's an item frame
Easiest way to get all of them
Can you only do plugins in Spigot or can you create new blocks and items too?
hello im looking for help i finnaly got a chat format to work with papichat but then when i loggen back in this morning it was the standard chat format with <name> message i have looked in all the config files but i dont know where the problem is
So it does work?
No, it doesn't work
that description lmao
See the picture
Nausea should be 30 seconds, blindness should be less than one second
Nope, already checked that
Okay
@whole stag You're making blindness only last for 1 tick, and for Nausea, a lot of potion effects break if you give them too high of a level, try something lower for Nausea
i want to do something like /do heal adeptvail for a command but i do not understand how to get the subcommand can anyone help?
I don't even think the level matters to Nausea, so 1 should be good
Use the args array that's given to you in the onCommand
args[<number>], so in your case, args[0] returns "heal" and args[1] returns "adeptvail"
Of course you should also make sure /do is not already a command on the server lol
its not lol
Honestly /heal might be more common than /do
True
I'm p sure /heal is a builtin essentials command
well im practicing the subcommands
It is
Fair enough, doesn't really matter which way you do it then
yea
so how would i make it so args[0] is heal
do i do a string
like String h = args[0] or something
Yes
and then for target i should do String t = args[1] right
Yeah that's the gist, you'll have to do length checking too.
Also would name your variables something more useful
well obviosly
String subCMD = args[0];
String target = args[1];
yea
String subCMD = args[0];
Player target = Bukkit.getPlayerExact(t);
target.setFoodLevel(20);```
ive got this so far
this is the feed one not heal
what is it used to make that kind of input sytem? it like opens a sign and lets you enter text and number
question.
Oh hey look it's what I'm doing
ProtocolLib is fun
do i need Vault to use permissions in Bukkit
i dont think you need perms to use player.hasPermission
what are you triyng to do
the exact same thing?
how are you doing it?
apply permissions to the player
NOT use any groups
but just adding perms to the player
declaration: package: org.bukkit.permissions, class: PermissionAttachment
maybe that
To open a sign for a player you need to send a BlockChange packet to change an out of sight block that is currently loaded for them to a sign, then sent an OpenSignEditor packet to open the sign editor up, then once the player clicks done (sends an UpdateSign packet) you use the input and send another BlocckChange packet to change the block back
theres no way its that complex
It is
isint there an API or smth?
There might be idk
yikes
But personally I don't want to rely on an API that might either stop being updated or go unmaintained
@sharp bough this
Only in 1.14.X for the moment
Use libraries when they stop being maintained just switch or maintain it yourself
how do i read this?
regions:
- - ==: org.bukkit.Location
world: world
x: 1.0
y: 2.0
z: 3.0
pitch: 0.0
yaw: 0.0
- ==: org.bukkit.Location
world: world
x: 6.0
y: 7.0
z: 8.0
pitch: 0.0
yaw: 0.0
- - ==: org.bukkit.Location
world: world
x: 12.0
y: 22.0
z: 32.0
pitch: 0.0
yaw: 0.0
- ==: org.bukkit.Location
world: world
x: 62.0
y: 72.0
z: 82.0
pitch: 0.0
yaw: 0.0
saveDefaultConfig();
FileConfiguration config = getConfig();
List<List<Location>> regions = config.getObject("regions", ???);
what do i have to send as the second parameter to the getObject method?
id it
regions.X. stuff
what
or getConfigSection
but i want to get the entire list
How did you store it
with config.set("regions", listObject)
getConfigurationSection("regions").getKeys(true)
i think
just to know the syntax
No
now i want to get the list of lists of locations
Use getObject("regions") then cast it
Just use getList()
Or that
it says Cannot resolve method 'getObject(java.lang.String)'
This then?
Incompatible types. Found: 'java.util.List<capture<?>>', required: 'java.util.List<java.util.List<org.bukkit.Location>>'
can i ignore the unchecked warning
what should i import for Iterator <stuff here>?
sorry ok thats weird
so im trying to see if this permission thing actually works, so im just gonna send the permissions to console (debug)
and i c ant just like, p.getPermissions();
i have to use some iterator magic stuff
@fluid cypress
It should work, you also have to hast it to List<Location> etc.
what was the class that created an area giving it 2 locations? And then i can check if a location is within that area or not, i remember using it like a year ago
its a java import, problem solved))))))))
hey sorry to ping you, permissions do work without Vault, time to redo my commands section lol -- thank you so much for encouraging me to do this lmao
declaration: package: org.bukkit.util, class: BoundingBox
Does anyone know about the changes in specifically (1.17.1) to the PacketPlayOutSetSlot class?
In 1.17 the constructor requires two integers and the itemstack--as per usual, however in 1.17.1 it has been changed to three integers and the itemstack.
I am unsure what the new integer specification is doing and there doesn't seem to be any references to this change.
oh no
Somebody tried to play with Protocollib?
thats not good
np ig lol
me
i wanna make the sign thing
but its a simple thing
cuz i dont wanna get involved with an overcomplicated feature
containerId, stateId, slot, ItemStack
I'm trying to register my thing. but i get nullpointer on this line manager.addPacketListener(new PacketAdapter(this, ListenerPriority.HIGH, PacketType.Handshake.Client.SET_PROTOCOL, PacketType.Login.Server.DISCONNECT) {
Hey guys, would it be possible to register a bunch of commands from an array for bungeecord? I'm trying to make a plugin which let's you make aliases for commands, but I want the aliases to actually show up as registered commands...
Idk if stuff was removed as i'm new to use protocollib
i have no idea what im looking
iv never used packets
F.
Send the error
Thank you!
And I assume Core line 168 is manager.addPacketListener(new PacketAdapter(this,?
yes
manager is probably null
🤔 try printing it and see what it says
did you get that from wiki.vg
Mojang Mapped
Find respective class -> Ctrl click -> it sets those vars to that
It prints null but it says to do the exact line from their own girhub "wiki"
Unsupported MC version for your ProtocolLib version maybe? Never worked with ProtocolLib but I assume getProtocolManager is dependent on the server version
Ill try another ver and get back to u
ayyy
any idea why commands arent showing up even if the uesr has the permission?
i.e;
setrank requires nectar.admin, but it does not appear if i try to tab it
#help-server? if not, show code
i dont think its a server-issue
plugin.getConfig() gives me the old config, do i need to do something to make it read the config file again?
refresh the config
JavaPlugin#reloadConfig
i already answered the question
instead of getConfig or before getConfig?
I like to saveDefaultConfig right before i reload it too in case the user deleted it
before
"refresh"
yea i do that too
thanks
is all you do grind this channel? you're like a hungry shark here
nah it's easier than working on servers, it's basically what i procrastinate with
is there any way to listen to a command without blocking or overwriting it? also, is there a way to overwrite a command? like the /gamemode command ie
if you register a spigot command it will overwrite vanilla commands
you can listen for a command with CommandPreProcessEvent
or whatever it's called
what about another plugin's command
it calls the same thing
not just your plugin related
no point
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
Player*
chill
Overwrite another plugins command?
could someone explain why this isnt working?
https://paste.md-5.net/atufimulix.java
yes
Be more descriptive any errors? Or just not working
nothing happens to the chunks
like they arent entirely set to air
yeah, i think it might depend on which enables first
(or do both run?)
never mind, no they don't
?warn @sage swift name calling/insult
That is not a registered reason!
It could be whichever is initialized last, could be off tho
calling people retards isnt being sensitive
anyways thats a warning just dont do it again
so edgy
i don't know if i can contain my power bro
ok retard
by whom, i wonder
me

@quaint mantle thanks dude
sure
🧍🏿♂️
black people
im white
don't even get me started
Done. That felt good.
lmao
based
The spigot communit never fails to amaze me
I know this is fun
I think I'd rather have someone ask for help because they can't figure out how to listen to events than having trolls like this around 😅
agreed
@EventHandler
public void eventName(BukkitEventName e){
stuff
}
it dosent worke!
oh well
also single-letter variable names outside of for loops? cmon bro
agreed
you're joking
so much cleaner
christ
oh wait
OR NUMBERED
u edited
Block b2 =
Hmmm yes
i also think outside of loop = bad
well yeah
i didnt see the edit at first
i, j, k, x, y, z is fine
but for an iterative for loop should still write out the variable
for (Block block : blocks) {
💯
mhm, come back when your plugin has more than 5 classes and you don't know what's what
come back when you aren't ready to insult people for asking for help, and/or providing answers
Pfft what a lame flex
me too, its literally terrible
Really arguing over variable names got me dead
¯_(ツ)_/¯
Could matter less
¯_(ツ)_/¯
But it doesn't matter less
im just saying that i prefer shorter variable names
I don’t but idc that you do. Do what you want idk why gecko would even care
because hes a troll lol
idk what that means
||of course you don't||
Does anyone know a tool that exposes Minecrafts gametestinf framework that was included in 1.17?
Dose anyone know how id be able to reload a players Game Profile without them re-logging? For some context I wanna change the player skin to something else and I do this through the game profile of the player. The only issue is the game profile dosent get updated and hiding and showing the player only makes there skin visible to those around but not the player. Dose anyone know a fix to updating the game profile without re-logging?
Does player.spigot().respawn() not get close ?
you could take a look at how SkinsRestorer does it
Im taking a look at that now
anyone have an open source 3x1 pickaxe
player.breakBlock(event.getBlock().getRelative(BlockFace.UP); //yes this is an api method now
player.breakBlock(event.getBlock().getRelative(BlockFace.DOWN);```
oh you can access the blocks like that?
i had this ```java
Location location = event.getBlock().getLocation();
for(int x = -1;x <= 1;x++){
for(int y = -1;y <= 1;y++){
for(int z = -1;z <= 1;z++){
Block block = location.getWorld().getBlockAt(
location.getBlockX() + x,
location.getBlockY() + y,
location.getBlockZ() + z);
if (!(block.getType() == Material.BEDROCK)) {
block.breakNaturally();
}
}
}
}
Heyo, looking for a way to ride other players, without blocking their view or interactions. Tried armor stand with isMarker already. Anybody experience?
if it doesn't block the view where would the riding player be? just higher up?
could probably make an invulnerable baby armor stand between them
Yes
i thought markers were server side
Use a small armor stand
Tried that. Blocks interactions
Hm
anything riding a player will block that player's interaction
Invisible silent size 1 slime?
Tried a bat already. I doubt this will work
¯\_(ツ)_/¯
Are you guys familiar with custom entities? How about a custom armor stand?
only way to stop the player from being unable to interact would be to do the riding server-side which wouldn't look good for the player
If you cancel the EntityDamageByEntityEvent it should prevent the items from being destroyed by an explosion
Thought about using raytrace. Can I somehow trigger a right-click on found entities?
Can't you make a custom entity without a collision box?
not on the client end
So possible with nms?
...
Is this a bad thing to ask?
thanks man it worked!
yeah, what even is the Marker tbh
i've never noticed anything with it
i dont really work with armour stands often so thats why, but what is the Marker
You’re trying to read for right clicking on custom entities right?
No. Not really. I try to avoid interacting with a passenger, when he is riding the player
You can hack into the netty pipeline and cancel certain packets.
Therefore the server won’t do shit
...
He did this to me as well xD
Don't really know what to to do with this. Any details?
That just means he doesent know the answer but tries to talk on other responses nice ego bud. And can you explain more
...
What’s doing what with another entity
This makes it sound like there’s two players involved
...
is recommend async for playsound? or send normal?
what
Normal
public static void playSound(Player player, Sound Sound, float volume, float pitch) {
new BukkitRunnable() {
@Override
public void run() {
player.playSound(player.getLocation(), Sound, volume, pitch);
}
}.runTaskAsynchronously(mainEssentials.getPlugin());
}
or player.playSound(player.getLocation(), Sound, volume, pitch);
Don’t do something async without good reasoning
wait
why not just use player.playSound
idk why you're using a void for it lol
Looks like he was trying to do it async
function for others classes
just use player#playSound then lol
A user said I was using the sound too much and should do a function.
i`m confused
Yes but you don’t need to make it async
That’s really the issue
oh ,ok
whats the point of that function
same
play sound for one player
that does play a sound for one player
.
player#playSound()
its just moving the args around and making it async
yeah lol
scheduling a bunch of async tasks to play sounds is arguably worse for the cpu
yeah
just use the bukkit one
Do I still use a function to send a sound or do I use the code directly?
function
code: player.playSound(player.getLocation(), Sound, volume, pitch);
nah, i'd personally just delete that

it literally does nothing lol
Yea it’s pointless
oh ,ok
only benefit is getting player loc
Ok.
just using global and local chat
Sounds like a plan.
?paste
The plugin would be for my server, I don't think I need permission then.
sorry
Wont learn as much unless you make it yourself
hey I have this line ```java
(player.getFacing() == BlockFace.UP || player.getFacing() == BlockFace.DOWN)
i think facing is only for the 4 sides
how do I do the up down one
i have some code for all 6 involving yaw
hmm
:)
I am getting this error in console when I send the command that I made. Let me know if you need me to send the code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
custom inventory is size 1
866493661809082418
has to be multiple of 9, just like the error says
ok okay ty
@naive fox
Is there anyway to remove this without editing the jar file or setting the players bed spawn location?
No, You'll need to edit the bytecode or compile it through compiler from source code after changes.
is this to me?
yes
oh alright, I mean I found a way to edit it with winrar but if theres no other way I guess thats the end of this case lmao
yeah, unfortunatly I don't want users to have to edit the spigot.jar in order to properly use my plugin so I just removed that part of the plugin
Theoretically couldn't you set the player's respawn point to suppress that message?
yeah I just don't want to set the players respawn point as I use that to check if the player has a respawn location while setting their home bed
It is a good idea tho
i think i found a bug when making a plugin, i have a listener for the playerTeleport event but if the cause of the teleport is by chorus fruit, then the player.teleport function won't work but it does when the cause isn't chorus fruit, like an ender pearl
which version?
i have no idea what you are talking about
send the code
error
etc
?paste
use that
declaration: package: org.bukkit.event.player, class: PlayerTeleportEvent, enum: TeleportCause
the event is called before the teleportation is completed
either cancel and do yours, or delay it by a tick
i tried cancelling it and not cancelling it but neither worked
public class PlayerTeleport implements Listener {
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
System.out.println("First");
if(event.getCause() == PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT) {
System.out.println("Second");
System.out.println(player.getLocation().getX());
if(player.getItemInUse().getItemMeta().getDisplayName().substring(0, 4).equals("warp")) {
event.setCancelled(true);
System.out.println("Third");
player.teleport(new Location(player.getWorld(), player.getLocation().getX() + 5, player.getLocation().getY(), player.getLocation().getZ() + 5));
System.out.println("Fourth");
}
}
}
}
this outputs first second third first then fourth but no teleportation happens
but it does work when the cause is an enderpearl somehow (although i don't use getItemInUse for the pearl)
which version smh
i installed the latest bukkit build tools?
and my mc version is 1.17
or.. wait version of wot?
i'm using spigot 1.17
yeah no that definitely seems like a spigot bug to me, i see nothing wrong with that code
workaround would be to do it a tick later though, as i said
i would report it on the bug tracker
where could i find the bug tracker?
also.... how do i uhhh delay something by a tick?
what
how do i execute a method a tick later*(?)
this is returning null: instance.getServer().getWorld("world"). i can assure you that world exists, maybe onEnable is too early to use this? i cant think what the problem might be
send code
?paste
Bukkit.getScheduler().runTask(JavaPlugin, Runnable) will do
#runTask means one tick later
i've never heard of schedular before, so would the runnable be player.teleport or
private static Plugin instance;
@Override
public void onEnable() {
instance = this;
stuff here...
setArea();
}
public static void setArea() {
ArrayList<BoundingBox> regions = new ArrayList<>();
World world = instance.getServer().getWorld("world");
more stuff...
I think it may not be a bug, and that it is indeed required to teleport player in a separate tick
i mean, its not much, i dont get it
just like opening an inventory on inventory close
a scheduler runs something X times, a runTaskLater runs the code 1 tick later
why instance.getServer ?
and not bukkit
Question I'm using maven modules for NMS and of course Minecraft java version has been bumped to 16 from 8 for my 1.17 nms maven module I'm using the special source maven plugin do I have to compile it in Java 16 or can I compile the module in java 8?
idk, but thanks. whats the difference between the plugin getServer method and the bukkit getServer method?
so would i do something like this?
if(event.getCause() == PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT) {
if(player.getItemInUse().getItemMeta().getDisplayName().substring(0, 4).equals("warp")) {
event.setCancelled(true);
Bukkit.getScheduler().runTaskLater((Plugin) this, () -> {
player.teleport(new Location(player.getWorld(), player.getLocation().getX() + 5, 80.00, player.getLocation().getZ() + 5)
}, 1L);
System.out.println("Fourth");
}
}
theyre the same I think
onEnable is probably too early to get a world
Yes, or you can just use runTask instead of runTaskLater
hmmmm i'm getting an error The method runTaskLater(org.bukkit.plugin.Plugin, java.lang.Runnable, long) in the type BukkitScheduler is not applicable for the arguments (org.bukkit.plugin.Plugin, java.lang.Runnable, long) but when i do a quick fix by casting argument 2 to consumer<bukkittask> i get another non quick fix-able error
since it shows an error under runTaskLater
oh wait shoot forgot a parenthesy
then you don't need to cast it
its null anyways, apparently multiverse worlds dont exist in onEnable, any ideas what to do? besides a timer or something like that
is there an event for a plugin being loaded or something?
i think the dependency waits for the other plugin to load
the hard dependency
im not sure tho
there might be a worldloadevent or sth like that in the plugin's api?
perform whatever operations you want in its listener
soft dependencies too
spigot probably creates a dependency graph of plugins to be loaded and toposort it
is it possible to do player.damage but have the damage come from another player?