#help-archived
1 messages ยท Page 173 of 1
in 'string', line 615, column 9: item-name: '&9? ? ? &f&lNo Grief ... ^ expected <block end>, but found '<scalar>' in 'string', line 620, column 25: - '&bIf you don't have permission to' ^
its actually telling you everything you need
The ' in don't is closing the quote of the lore.
when i remove 5 everything seems to be normal
but when I add 5 again the plugin stop working
because
the
'
in dont
closes the lore
Thanks
fixed
@tranquil edge player.setMaxHealth(20.0);
have you tried doing a higher value then 20.0?
Use the Attribute.GENERIC_MAX_HEALTH
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(100.0);
Yes. Like that. But this wont heal you player.
What do you mean by "can't register" does your ide say the method does not exist?
Are you on 1.8? -.-
No idea. its 6 years old. Maybe try what shawshark suggested. player.setMaxHealth(100.0)
Instead of default use getValue()
hello
No idea. The method setMaxHealth() is very old and doesnt exist in higher versions
i want hide please https://prnt.sc/tg7e3q
@peak glade Is this message from essentials?
yes
Then go into essentials and disable it.
?
How do I make it so players do /(servername) instead of /server (servername)
Write a command <name> that triggers another command.
So that
/<name>
runs
/server <name>
for the player
I think there are plugins out there that lets you create new commands with other commands as target
Do you know any in specific
Yeh but then I gotta do that for every server, I feel like there is a better way
https://www.spigotmc.org/resources/custom-commands.65377/
https://www.spigotmc.org/resources/commandredirect.41422/
They both look trash but you can try them
hey
They're for bungee?
@frigid ember no idea i guess not.
@peak glade No idea what you are talking about...
i need support deluxechat
where can I edit mob damage modifier?
how can you make a chest play the open animation without actually opening the chest?
is there a bukkit way to do it or is it just a pakcet
packet*
@buoyant path Only packets.
ok
@drifting lichen You can edit mob damage modifiers on a lot of places. What are you trying to achieve?
On my server
not a plugin
just either from spigot,paper or tuinity.yml
vanilla multiplier
@grim halo
Is it possible to run a function with JSON text rather than send a command?
Yes. AsyncPlayerChatEvent and check the message then parse as json.
sorry i meant when clicked
You can only:
show text, suggest a command, run a command or open a url.
What are you trying to achieve?
damn, that sucks. I can work around it
just trying to add interactive dialogue
i can just run a command for it, no worries
You can have it run commands
I used to do that to troll people via command blocks
They would see a message and then be stupid enough to click it
lmao
I forget, does the Action.RUN_COMMAND run on behalf of console or the player whom clicked?
hey, i want to make a pvp bot
a custom zombie (i think?) that attacks players like it would be a real player...well.. almost...
what would be the best way?
@tough kraken This could be a huge task depending on how realistic the bot needs to be.
Ok the best...
- Extend NMS Zombie and become an expert in AI Goals, Target selection and pathfinding.
- Collect a ton of data from fighting players and filter it so you can use it in the next step.
- Set up a neural network and analyze the data.
- Create mutations and let the mutations fight against each other. Set proper rewards and goals and only let the best mutations evolve further.
that is too big haha
i actually meant for 1v1-games. so just a bot, that attacks the player like a normal player
it doesnt really have to learn anything with the time
Then you only need to do step one and hardcode the behavior.
is there any "tutorial" for those pathfindergoals? never used them
I think by now some of the AI stuff is exposed in the API. Paper might be even further with that.
I think this is very outdated
tried it, but the spawning zombie does exactly nothing
it stands there and is walking...
should be for 1.8 if possible
tried it, but the spawning zombie does exactly nothing
@tough kraken but idk why it is'nt doing anything
Ive used this before for code so you must be doing something wrong
7smile people use 1.8 because the combat is better lol
newer combat is not very good
You can say that you like the combat system more. Cant call it objectively better.
well i like the new combat, 1.8 combat one the most servers is only cps-based, but i am only using 1.16 for my survival server
i think both has their pros and cons
I think it should be in the middle
?paste
if someone mabye wanna look at it:
and the enum:
https://paste.md-5.net/hudalejoco.java
Hmm what's an efficient method to check if a player is within bounds of two locations.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/AsyncPlayerChatEvent.html#setFormat(java.lang.String) what is the syntax for the string setting the format?
iirc "%2$s"
isn't there like a document describing it?
like how do I tell where the parameter should be substituted?
Hmm what's an efficient method to check if a player is within bounds of two locations.
@marsh hawk i would say, get minX, maxX, minZ, maxZ, and check if the players location is bigger than "min" and less than "max"
or if only one coord, just use one of them
oh yeah that would be good
what the flying fuck is that? i literally hate these PathFinderGoals
what the flying fuck is that? i literally hate these PathFinderGoals
@tough kraken is there any way around nms?
@tough kraken can you use citizens?
they have a pretty good API
I know being standalone is nice but with nms entities its really hard
nms is trash. it changes like every version lmao
i am using 1.8 normal
for example such stuff... WHY ARE THEY CHANGING WORKING STUFF
thats like bukkit... why are they renaming dye-colors?
why are mojang changing "gold_sword" to "golden_sword"? theres no cause
Is there a way to delete a world while the server is running, without using the multiverse api? (although I do have multiverse on the server)
I've tried several things, the latest attempt being:
public static void deleteWorld(){
String worldName = ResetWorld.getInstance().getConfig().getString("worldName");
if(doesWorldExist(worldName)) {
File worldFile = Bukkit.getWorld(worldName).getWorldFolder();
Bukkit.unloadWorld(worldName, false);
try {
// create a stream
Stream<Path> files = Files.walk(Paths.get(worldFile.toURI()));
// delete directory including files and sub-folders
files.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::deleteOnExit);
// close the stream
files.close();
} catch (IOException ex) {
ex.printStackTrace();
}
System.out.println("World: " + worldName + " is now gone.");
}
else {
System.out.println("No world exists with the name: " + worldName);
}
}
make sure no players are in it, unload it, and use FileUtils#deleteDirectory
but make sure it is really unloaded. or it spamms errors
public abstract class SingleListener<T extends Event> implements Listener{
@EventHandler
public void main(T e) {
execute(e);
}
public abstract void execute(T e);
}```
This should work right? my classes that extend this arent getting called, they are registered correclty
do annotations not transfer over
@tough kraken before executing my deleteWorld(); I do remove the warp from the world; teleport every player who's in it to spawn, and unload it (latter being in the deleteWorld() method) . I'm not getting errors with the current method, it just sort of reloads the world instead of getting rid of the files (and making new ones with a different method). I've tried FileUtils before, same results
fault of multiverse
multiverse is saving the worlds in the mv - worlds.yml - if there is one existing, it re-creates the same world
so I'd need to unload it from multiverse too?
would not really help
cycle through the world.yml file and take it out? ;p
if you really prefer to use multiverse on the Server, you would have to manually remove all world-related lines out of the config
i think
Context: I'm basically creating a plugin that resets a "resourceworld" every (Day/week/month depending on config) but I need it to be a different seed every time
well, just restart the server?
wait i am showing you how i am doing
Not really spigot related, but can i export my Plugin Jar with the commons lang as Referenced Library?
as my plugin is public, i have to check if the player is using bungeecord or not -
i am kicking the players, in the config i set a boolean to true, to make sure, it doesnt get resetted on normal /restart or reload,
in onEnable() i am deleting the worlds if the bool is true
then it automatically creates a new world, as no world is existing
multiverse probably would affect the reset
my reset-command:
https://hastebin.com/oxebenulej.cs
my onEnable:
https://hastebin.com/sobicowuvu.cpp
if that helps you
I'll take a look thank you very much
no problem
The onEnable basically checks if the world exists, and if it does, it sets "reset" to false in config?
is setting a class field to Bukkit.getWorld("world") once and using it over and over again the same as just using Bukkit.getWorld("world") over and over again?
yeah, to make sure, it doesnt get reset on restart or reload, as its the onEnable
and on /reset i set the boolean to true
after the reset to false
well if setting a field, probably it would be smoother, but there should be no performance difference
Hi
hello
can i make it async?
public class Map {
private MapView map = Bukkit.getServer().createMap(Bukkit.getWorlds().get(0));
@SuppressWarnings("deprecation")
public Map(Image img) {
map.setScale(Scale.FARTHEST);
for (MapRenderer r : map.getRenderers()) {
map.removeRenderer(r);
}
map.addRenderer(new Renderer(img));
data = map.getId();
}
public final short data;
public MapView getMap() {
return map;
}
private static class Renderer extends MapRenderer {
private Image img;
public Renderer(Image img) {
this.img = img;
}
@Override
public void render(MapView mapView, MapCanvas mapCanvas, Player p) {
mapCanvas.drawImage(0, 0, img.getScaledInstance(128, 128, Image.SCALE_AREA_AVERAGING));
}
}
}
uhmmm... another guy can say more xd
@tough kraken does that mean the field the world is stored to is a pointer to the object in memory? so that then, whenever the world object changes, the changes are also reflected in the field?
well in my knowledge, a field is just for accessing stuff without everytime typing it in again
specially for long methods.
like config access etc
also for keeping state though
yeah i think so
Not really spigot related, but can i export my Plugin Jar with the commons lang as Referenced Library?
Any ideas?
sadly not
aww
if i understand right, you want to add a library jar to the plugin, and export the library along inside the plugin jar?
Yeah. I've added the Commons Lang jar to the Build path and i can access it in the code with no problems but the functions i use are also using the commons lang methods and i get a ClassNotFoundException when exporting
You mean shading?
Not when exporting but when using them in Bungeecord
You mean shading?
@limpid thistle ?
Shading means putting certain depencies into the jar so you can use them at runtime
i know that in IntelliJ there is a way, for ex. to add the spigot.jar to the plugin build. but idk if thats the right what you want
Im using eclipse. You can do it that way when exporting a Runnable Jar but i don't want that
Because that won't work with spigot/bungee
well i think i am the wrong for such questions ๐ฆ
Do you use maven?
no
same
hmm thanks
I can't even find anything on the Internet they all say "jUsT eXpoRt to a RuNnaBlE JaR"
But i need some kind of configuration script
and don't wanna export the Bungeecord jar lol
yeah that would be... large files
when googling shading with eclipse it leads to some sun protection sites ๐
xD
lmao
Does anyone know what this means?
[WARNING] Error whilst handling query packet from /xx.xx.xxx.xxx:42652
java.lang.IllegalStateException: No session!
(Bungee)
lets protect from the sun guys!
which just make our lives easier
well
the ide does pretty much everything for you
ah ok
no it's not complicated, and if you plan to continue using java you'll be forced to use it someday
java.lang.IllegalStateException: No session!
at net.md_5.bungee.query.QueryHandler.handleMessage(QueryHandler.java:95)
at net.md_5.bungee.query.QueryHandler.channelRead0(QueryHandler.java:56)
at net.md_5.bungee.query.QueryHandler.channelRead0(QueryHandler.java:22)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.epoll.EpollDatagramChannel.read(EpollDatagramChannel.java:679)
at io.netty.channel.epoll.EpollDatagramChannel.access$100(EpollDatagramChannel.java:58)
at io.netty.channel.epoll.EpollDatagramChannel$EpollDatagramChannelUnsafe.epollInReady(EpollDatagramChannel.java:497)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.lang.Thread.run(Thread.java:748)
aight ok thanks
use ?paste
Who?
?paste
you...
did you realize you flooded the chat
paste it there, and post the link
?paste
just use my link
Why give something away for free that has been so buggy for years
is this a bungee internal bug?
This is a bungee problem...
if you think it is a bug, you can report it on github
I don't know why it is so hard to write a proxy server without 1000's of unexplainable errors
Then write your own one ๐
To much work
Never had an error on Bungee
then dont hate on others
Never had an error on Bungee
@sturdy oar same
expect my mistakes
so if i get it right: you are coming here, just to flood the chat, and if told to paste it on hastebin you just begin to blame others, for things that MAYBE you can handle by yourself
is that right?
Lol
Flood the chat? You're taking in help about general stuff
You're the one flooding it
Does someone ever used Factions API? Is it the same API for all forks (FactionsUUID, SavageFactions, ...) ?
if you mean asking and answering questions about maven, yeah you are right
for real, you can only be a troll
Does someone ever used Factions API? Is it the same API for all forks (FactionsUUID, SavageFactions, ...) ?
@undone narwhal i think so
I'm not a troll, I need help with an error.
then paste the error on the link that was sent, and everyone here will try to help
You should be able to paste in an error on a #help-archived chat don't you think? Or should I just do all of my messages in a pastebin lol? if my message is gonna be longer than 3 lines i'll put it in md5's pastebin.
?paste is not without cause
yeah sorry ๐
first of all, remove ip's etc from stacktraces or errors, its very unsecure,
and i will take a look at it, give me a moment
which bungeecord version are you using
@naive mountain The player's session is null
or his challengeToken somehow ended being different than his session token
means just restart the client?
git:BungeeCord-Bootstrap:1.15-SNAPSHOT:2f54c94:1500 by md_5
tried it with the newest?
wait a moment
That IP is prerouted. I suspect it's someone refreshing their serverlist?
so thats what bungeecord is doing:
if ( session == null || session.getToken() != challengeToken )
{
throw new IllegalStateException( "No session!" );
}
i already told him that
so that means you session is null, maybe restart the client, or remove that VPS if possible
It's not a big problem right
so that means you session is null, maybe restart the client, or remove that VPS if possible
@tough kraken
its probably because of that vps
Without it my players won't be able to play
is the problem only on your side, or can nobody join?
No, people can join, I can too. I just get that error message a lot and I don't know why.
then its definitely your vps, if you tried to restart your full mc-Launcher
Yeah it's happening for a while and it crashes sometimes but I'm not sure if it's related to this.
But anyone could preroute traffic to my bungee
So it shouldn't crash it
idk
okey, thanks!
I need help pls
How I can get a file that is in the resources folder?
JavaPlugin#getResource
https://i.imgur.com/dSN9IhC.png Why there is this error? Code: https://i.imgur.com/qovXsel.png
https://i.imgur.com/yn3W53w.png
JavaPlugin#getResource
@rare prairie nope
Can't do that
File file2 = new File(plugin.getResource("BridgingArea.schem"));
What are you trying to do
What are you trying to do
@naive goblet do you mean me?
What are you trying to do
@naive goblet Get a file that inside the resource folder
resource folder? You mean inside the jar?
Roader no but you could explain if you want
resource folder? You mean inside the jar?
@naive goblet yeah inside the project
Is creative inventory still heavly client sided?
https://i.imgur.com/dSN9IhC.png Why there is this error? Code: https://i.imgur.com/qovXsel.png
https://i.imgur.com/yn3W53w.png
dont do blocks.size() - 1
or make the sublist actually get the first 25 blocks
(right now it gets 26)
basically in your code if the blocks is exactly 25 the sublist would be getting a nonexistent 26th block
Okay
So I should remove -1 ?
@frigid ember
I have removed it.
But the error still comes.
code?
you didnt fix the sublist
he just told you
How do I remove blocks from a user? I accidentally let people use /acb.
right now it gets 26 blocks
hello
yes
probably looking for RaidSpawnWaveEvent
right now it gets 26 blocks
@frigid ember So change it to 24 ?
there's also Raid and RaidEvent, take a look at those
How to add PlugMan as a Maven Dependency? Cannot find it anywhere.. EDIT: https://jitpack.io
and yes @livid spruce
@peak glade https://www.spigotmc.org/threads/how-to-fix-weird-symbols-appearing-weird.442543/#post-3827400
its not work
can you show your code?
how to get class listener?
@peak glade can you take a screenshot of your code and send it?
how to get listener class in another class without class instances?
@peak glade Do you have a resourcepack installed?
@frigid ember https://www.jetbrains.com/academy/
-_-
whar resourse pack ?
@peak glade Any
@frigid ember I donโt know what youโre asking, but if youโre trying to register events you need the PluginManager.
I want to get the class instance itself listener
There is no "instance itself" unless you designed it as singleton.
that is, you need to initialize it (this)?
Do you want the class itself? Then its Listener.class
Let's start from square one. For what reason do you need an instance of your listener.
There should be nothing of importance in a class implementing Listener
functions are not visible and variables
@peak glade you need to show us your code if you want us to help
There should be nothing of importance in a class implementing Listener
Everything in a listener should be outsourced
Take my listeners for instance:
https://github.com/2008Choco/LockSecurity/tree/dev/LockSecurity-Plugin/src/main/java/wtf/choco/locksecurity/listener
I have no data held within these. Everything is pulled from other classes
@frigid ember Methods and fields in a non static scope are only "visible" if you have an instance of a class. Thats OOP 101
๐ฆ
@frigid ember Methods and fields in a non static scope are only "visible" if you have an instance of a class. Thats OOP 101
@grim halo thank you
inb4 "Well okay! I'll just make everything static"
@peak glade Minecraft doesnt escape unicode in chat. You can only do that with a String you have sent from a plugin.
send or sent here? <- pls help, fellow native english speakers ^^
thx
how do I create config files like this
this:
idk:
idk1:
idk2:
I need help, I try to do /lands for a plugin but when i wanted to find the problem it just says I issued the command
It doesnt work
contact the plugin dev
then give him the latest.log of your server?
My spigot account was stolen. I have explained to the official. But they still did not respond...
@lapis plinth wdym how do you create config files like that?
Like with parents and children idk what its called
Like it goes into the category of this, then into idk, then reads idk1
My spigot account was stolen. I have explained to the official. But they still did not respond...
You're responsible for your own account
Iโm pretty sure you just get the config and then get the string or whatever it is at โthis.idk.idk1โ
huh ok
You're responsible for your own account
๐
@lapis plinth I think you want to create ne ConfigurationSections
@lapis plinth like if it was a string at idk1 that youโre trying to get youโd type getConfig().getString(โthis.idk.idk1โ);
Is there any method to restart a server?
kk
Hello! I am looking to contribute to spigot and submitted the CLA a couple of days ago, but haven't received any response yet. Can anyone help me?
hi. im kinda new to spigot. When I start my server, I get a message saying *** Error, this build is outdated ***
*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot *** but I am using spigot 1.16.1
im using the latest version tho
You're not
If you were to do /version, I guarantee you you're a few builds out of date
yea I tried that and it said im like 40 versions behind or something
like 1.16.1
Follow that link and its instructions
Spigot releases hundreds of builds every version of Minecraft
@true raptor he doesnt mean latest mc version, he's talking about latest spigot build
@wheat summit Bukkit.shutdown() after properly configuring your start shellscript
@frigid ember ohhhh
Ok thanks
BuildTools will help you build the latest version of Spigot every time
im using this java -jar BuildTools.jar --rev 1.16.1
Yes, so run that again
ok
You should be doing this frequently. Once every few days
im still confused about configurationsections
xd
like how do i create them, and how do i read them etc
Configuration sections are dot separated
They're created automatically
config.set("Foo.Bar.Baz", 10); will result in
Foo:
Bar:
Baz: 10```
configuration.set("A.B.ValueInB", 100);
or
final ConfigurationSection sectionA = configuration.createSection("A");
final ConfigurationSection sectionB = sectionA.createSection("B");
sectionB.set("ValueInB", 100);
Its sometimes handy if you want to pass them to other objects for saving/loading
is there a Title API in spigot?
yes
Player#sendTitle()
what's the best plugin to protect chests? I've installed EssentialsX, Vault and LuckPerms so if any of those offers this...
๐ค
Version?
1.16 lol
bruh moment
this getPlayer returns a human entity
no wonder its not working lmfao
wtf
That'd do it
Does anyone know how to stop rain through a plugin and not via gamerule?
Does anyone know how to deserialize A gui From config(Custom Guis).
set up a task for setting the weather to be clear
anybody? ๐
although the gamerule saves you from doing that so i dont get why you wouldnt use it
config mean yaml file
How intensive is sendBlockChange()? I'm currently sending it to all online players every 5 ticks and loop over up to 100s of blocks to replace with Air. I'm not sure how performance would be with a large amount of players and blocks
๐ง
So I have a general question here, does Spigot not support entitydata or is there another way to do it?
I was trying to give myself the invisible item frame for 1.16. I had essentials running, so I thought that might have been the issue somehow. I tried it via command block, that didnt work either. I then went into a single player world and saved a copy to a hotbar. When I went back to my server though, it completely got rid of the nbt data of it, which I thought was weird because I had transferred other things with nbt data that way.
Any suggestions here?
Well, it's in the API for 1.16 to set them invisible/visible https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/ItemFrame.html#setVisible(boolean)
declaration: package: org.bukkit.entity, interface: ItemFrame
what's the dependencie for 1.8.8 spigot
ew
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
no i need the CompileOnly
bruh
just search up spigot gradle, its the first result
stop being stuck in the stone age
there is something wrong with my server when ever i load up my server it loads up normaly but when i try to join it it shows cant connect to server
that can be for a lot of reasons
yes
do i need this testCompile
what testCompile
just copy the code from the spigot gradle page and modify it to your needs
i don't think its .spawn
.spawn exactily
@frigid ember you need to specify a location
a yes.
@subtle blade so config.set("Foo.Bar.Baz", 10); creates "baz" as the final thing, what would I do if i wanted to create "baz2" and what'll be the method to read "baz" and "baz2"?
how would I create baz2 if i wanted it right under baz?
baz.baz2 ?
No i mean like
FileConfiguration#set
Foo
Bar
Baz
Baz2
Foo.Bar.Baz2
but then Baz2 would be inside of the baz section right?
OH
wait im dumb
ignore what i just said
Alg?
ye
Is it possible to add like /mutechat:mutechat to skript instead of /mutechat
@crimson sandal hate to tag you but I just wanted to thank you for answering earlier. Essentials was in fact the case causing the issue. I just have to use "minecraft:give" in order to obtain it. Kinda weird that the nbt data disappeared though from the hot bar. Again thanks.
@frigid ember skript?
Wth is that
Skript is designed to be a culprit
Change my mind
skript is like making a plugin in YAML
ask the plugin dev
@peak glade if youโre still trying to get emojis and symbols to work in chat Iโve already told you we canโt help unless you share your code with us so we can debug and figure out whatโs wrong
how to load missing value in default config?
Hey, I was wondering if anyone could help me with some issues im having making an inventory where you click an item and it goes into the correct slot. I have a video showcasing the glitches if anyone wants to look
i would also give my code, here's the video
wait one sec
public BucketEvents bucket = new BucketEvents(this);
public BoatEvents boat = new BoatEvents(this);
Bukkit.getPluginManager().registerEvents(new BlockBreakListener(), this);
So i have ^ in my main class, and the class im trying to register has a constructor from another class
How would I fill in the new BlockBreakListner() with whatever im suposed to put?
how would I access these classes from my Main to another class?
and pass it by the constructor thoughout your plugin where needed
the constructor has to be made in main or the class in which I need it?
whatever class you need it
the class where needed
ok ty
@halcyon elm explain further?
public DelayedItems plugin;
public BucketEvents(DelayedItems plugin) {
this.plugin = plugin;
}```
so something like this
I can't really explain, the video explains it well but I'm waiting for it to upload so i can post the link
but this will link this class w/ main right
Iโll take a look once you post it.
there ya go
its supposed to be if you click a hammer, it goes into theslot on the left, and if you click a book it goes onto the slot in the right
but it's kinda buggy
public DelayedItems plugin;
public BucketEvents(DelayedItems plugin) {
this.plugin = plugin;
}```
@tiny dagger ?
if u want the code i will dm, I don't really wanna post it here cuz it's so long
getters and setters
@halcyon elm from what I watched itโs doing that? Only issue I saw was when you clicked the book it didnโt return and said you were clicking an empty slot. That can be fixed in the InventoryClickEvent and making sure youโre event.getSlot() is the right number that corresponds with that slot.
getters and setters
@tiny dagger wdym with getters and setters exactly searched around but idk how I would do that here :/ sorry
Another issue is that if you click the hmmer when the book is already there, the hammer will go into the slot, but a duplicate hammer will appear. Same with if you click a book when the hammer's already there, a duplicate book will appear. @balmy sentinel
you know
public Map<key, val> getHashmap() {
return hashmap;
}
@frigid ember
you're probabily seeing it thoughout the bukkit api
copy my hash from the other class?
getsomething
setsomething
no don't copy
just make a get method
hashmaps don't even need a set method
in 90% of cases tho
So I only need to get it
you should be learning java tho
only the one I need it in right?
before going straight in
just the class
it has the field of the hashmap
then if you need it
classwithhashmap.getHashMap().put
whatever
@halcyon elm before a player clicks make sure that there isnโt a book already in that slot or a hammer already in that slot. If there is just send them a message saying it there is already a book/hammer in the slot or just ignore it. I think your problem is youโre not checking to see if something is already in the slot.
or if you want something like this
Would anyone know why BungeeCord gives me this error? java.lang.IllegalArgumentException: Objective Rank already exists in this scoreboard I do set a scoreboard though am not sure since there is no Objective Rank
At least I think so ^
public HashMap<Location, Long> getHashmap() {
return boatLocation;
}
so this in the class with the hash
and in the class where I need to get it from
classwithhashmap.getHashMap().
@halcyon elm without code I donโt know if I can help. Put it in a pastebin and send it here
?paste
ok
Lazinq, return the hashmap's super interface (Map) instead of the direct implementation in order to comply with the liskov substitution principle
not a fix to your problem btw
just a tip
ty
but getHashMap() still is in another file? @tiny dagger
to access it I would still have to use static right?
and than the hashmap still will be used static
https://pastebin.com/Z4UQJjYu @balmy sentinel
so I probably did something wrong :/
Also you generally dont want to pass datastructures around. Write methods in the class that maintains the map to manage its content.
If you do have to pass it around, provide an immutable copy
me?
Also @balmy sentinel feel free to alert me to any sloppy practices. I am relatively new to java
first sloppy practice, using pastebin
?
I think you'll find that most people don't like pastebin, due to it's lack of a dark theme, unintuitive design, and ads
use hastebin
?paste
Alright I will keep that in mind
or any installation of hastebin, such as the one lazinq just linked
there are a lot of those made for coding
they're all the same thing lazinq
yep
true
but
public Map<Location, Long> getHashmap() {
return boatLocation;
}```
this should be in my class with the hashmap right ๐
Also you generally dont want to pass datastructures around. Write methods in the class that maintains the map to manage its content.
@balmy sentinel I have to go, I'm very sorry. If you would like to help me further please accept the friend request I'm sending you and DM me. Thanks!
wat
Should Crate Key plugin Items be hard coded to the plugin or not? if someone's experienced with making one
ok just send me a request I guess
Should Crate Key plugin Items be hard coded to the plugin or not? if someone's experienced with making one
@simple spruce no, there's no reason for them to be
@halcyon elm I think youโll find it easier if you just switch(event.getSlot()) and then check per case. Thatโs how Iโve always done inventory click events. Iโm on my phone so it was somewhat hard to read the code but the error I believe is coming from your boolean values not be set properly.
What's the reason that they shouldn't be? @shell fog
What do you mean "check per case" @balmy sentinel ?
because it's so simple to make them not hardcoded, and extremely beneficial to have them not, as it gives you the ability to update it without having to recompile the plugin
switch(event.getSlot()) {
case 14:
//Whatever you want to do when a player click slot 14
break;
default:
}
What does PlayerInventory#getItemInOffHand return if there is no item there?
@crimson sandal hate to tag you but I just wanted to thank you for answering earlier. Essentials was in fact the case causing the issue. I just have to use "minecraft:give" in order to obtain it. Kinda weird that the nbt data disappeared though from the hot bar. Again thanks.
@lost siren Ah yeah! Essentials replaces a lot of the vanilla commands still, which from experience do more than the essentials ones do now ๐คทโโ๏ธ
i think that was the bs one
@fossil shoal check the javadocs it should tell you.
I did, it does not
it returns NotNull so its air
i remeber something was bs with that specific method
Is there a reason why spigot uses short plugin channels?
@fossil shoal
@Override
public ItemStack getItemInOffHand() {
return CraftItemStack.asCraftMirror(getInventory().extraSlots.get(0));
}```
Where getInventory() is net.minecraft.server.PlayerInventory, extraSlots is a NonNullList
So an ItemStack of type AIR
Unfortunately Bukkit is very inconsistent with where it returns air and where it returns null but it would be a breaking change to make that consistent
Or at least a change that might break plugin logic. As far as I'm concerned, ItemStacks pulled from vanilla should never be null but that's not always the case
thanks for the detailed explanation
For future reference, CraftBukkit repo on the Stash you can find implementations of any method and see what they return
Is there an event fired when a player tries to place a block where there already is a block? E.g I'm sending the player sendBlockChange() packets and replacing the block with Air, so the server won't let the player place anything there obviously, I'm just wondering if that fires any events because it doesn't seem to fire BlockPlaceEvent?
i updated my server to 1.16.1 and all players have default skins now I have no idea why
You might have turned offline mode on by accident in the config
im using bungee cord I turned it on for that
Ah, I'm not too familiar with bungeecord
Is there an event fired when a player tries to place a block where there already is a block? E.g I'm sending the player sendBlockChange() packets and replacing the block with Air, so the server won't let the player place anything there obviously, I'm just wondering if that fires any events because it doesn't seem to fire BlockPlaceEvent?
The block change is not on the server so the server can't possibly know that
Yes, there is an event if a block is placed where a block already exists, BlockPlaceEvent. It's called when a player places a block on, say, tall grass and replaces it. Though that does not get called for client-sided blocks. It can't
@peak glade we cant help if you donโt tell us whatโs wrong
that doesnโt tell us anything
If youโre talking about the symbols that were broken early Iโve already told you three times send us your code or we canโt help. Iโve also already sent you a spigot thread that goes over that issue
The block change is not on the server so the server can't possibly know that
@subtle blade So I'm replacing a sign with air and wanted to detect if the player tried to place a block in that air. How is that client sided? Surely the client sends a packet to replace the block and the server rejects it?
Because the server has no block to replace
The server responds with a packet saying "Hey, y'know there is a block here..."
When a player places a block, it isn't a demand. It's asking to place a block
Yeah that makes sense, I was just wondering if there was an event that fires when the server gets that "ask" because it would be useful.
No, there is not
There's no change on the server so plugins don't need to listen to it
Previously, when I tried to start my server, a message in cmd said that the build is outdated. After going to the spigot website and following the instructions to run build tools, I tried to change the directory of my build tools file, but cmd says "The directory name is invalid"
@subtle blade part of my plugin basically hides the sign on front of a chest and replaces it with air and an armorstand showing the most common item, I was hoping to catch the event I'm doing at the end of this ๐ https://gyazo.com/df4e01f5830bd63ea9cd19c8783ea44c
I'm just wondering how else I could achieve it
Hey everyone, I'm trying to create a custom spawn plugin for one of 16 spawns in my world. Players type /start and go through a process where eventually their spawn is set and they are teleported. When they die, though, they go back to the original world spawn set by Multiverse. Am I attempting to do this wrong?
@EventHandler
public void onSpawn(PlayerSpawnLocationEvent event) {
if (playerSpawns.containsKey(event.getPlayer().getName())) {
event.getPlayer().teleport(playerSpawns.get(event.getPlayer().getName()));
}
}
@true raptor type โcd โ and then drag the buildtools into the command prompt
@balmy sentinel thats what I did
@rotund orbit for your map of player spawns you should be using players UUID's and not their names, to start, ideally.
I use players' names for all my things o.o
And secondly, you might want to try delaying the teleport command by a tick
What about plugins that change players names etc? UUID is the only thing that is unique for every player ๐
I use players' names for all my things o.o
Players can change their name
And that too
ouch well
better fix that then haha
Got probably 7-8 custom classes that use names to find save files and such.
@balmy sentinel This is what happened after I dragged the build tools jar file into cmd
C:\Users\g6355>cd C:\Users\g6355\Desktop\BuildTools\BuildTools.jar
The directory name is invalid.
I'll try delaying the teleport, thank you.
It's not that difficult to switch everything to UUIDs most of the time luckily ๐ Just a lot of refactoring if you've already wrote a lot of code using it ๐ฆ
Yeah it'll be a lot of refactoring ๐
unless I just add a UUID field and check if its different every load
and then change the name if it is
The UUID of a player wouldn't change, it's unique and the same always
whoops sorry I meant if the name has changed but the UUID matches
That wouldn't work for plugins that change player names though, it's not that much hassle changing it anyway ๐
@true raptor because BuildTools.jar isnโt a directory. Delete that part of it so cd C:\Users\g6355\Desktop\BuildTools
The easiest way to open a Command prompt in the BuildTools directory is to open the folder windows explorer and type "cmd" enter into the address bar ๐
https://i.imgur.com/dSN9IhC.png Why there is this error? Code: https://i.imgur.com/gMVg2zP.png
https://i.imgur.com/yn3W53w.png
You can hold shift and right click in the directory as well to open a window there
case STONE:
int currentStone = customConfig.getInt("IslandMissionStorage.MissionOne.Stone");
customConfig.set("IslandMissionStorage.MissionOne.Stone", currentStone + 1);
if (currentStone + 1 == stoneOne) {
customConfig.set("IslandMissionStorage.MissionOne.StoneCompleted", true);
}
customConfig.save(customYml);
break;
So i have this
and whenh I break a stone block, it sets the stone config to one, but when i break another, its still set to 1
When using entity navigation, should the location they navigate to be the empty air space above the block or the block itself?
@lapis plinth whats inside customYml ? is that updated ?
Wdym is that updated?
is that variable a path or the contents to save ?
other than that dont see anything wrong with the code tbh
Is there a reason why spigot uses short plugin channels?
@dusk shard https://hub.spigotmc.org/jira/browse/SPIGOT-5681?focusedCommentId=36567&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-36567
He did change it from 32 to 64 chars for 1.16.1 (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/diff/src/main/java/org/bukkit/plugin/messaging/Messenger.java?until=21853d39ddb83a9f6cee99437c573182e9e3b0bc).
But it's still pretty short IMO.
I'm having issues with Entity Navigation.
Using getNavigation#a(double, double, double, double)
leads to the entity stopping a block or two early, and never reaching it's actual goal. Does anyone know why?
Other minecraft behaviour uses the same functionality with no issues.
Fabric api has issues with connecting afaik with the limit
๐คทโโ๏ธ
anyone know if it's possible to stop the text from getPromptText in Prompt (Conversation API) from printing? when I return null for getPromptText it sends me a message that says null. What im trying to do is use my own json messages instead of the conversation api ones. my messages work fine but the null/empty message is annyoing
how do i change the color of redstone particles in 1.15?
Pass DustOptions to the spawnParticle() method
I feel like I missed this somewhere but i figured I'd just ask. My account is rather new on SpigotMC and I just verified it through email. I still can't write reviews on plugins, am I missing something?
You'd have had to have downloaded the plugin first but aside from that, you should be fine
I've downloaded it a few times, no luck unfortunately
To my knowledge anyways. I don't think there's an account age minimum
2 questions:
- Is it possible to force feed something to a player? Like pushing a button and it "feeds" them bread? Not heal - specifically feed.
- Is it possible to get an item's/material's (specially food) hunger and saturation? (how much they refill if eaten)
Thx for the help!
@brisk barn File customYml = new File(path + "/" + user.islandID + ".yml");
System.out.println(user.islandID);
FileConfiguration customConfig = YamlConfiguration.loadConfiguration(customYml);
2 questions:
- Is it possible to force feed something to a player? Like pushing a button and it "feeds" them bread? Not heal - specifically feed.
- Is it possible to get an item's/material's (specially food) hunger and saturation? (how much they refill if eaten)
Thx for the help!
@mental glen 1) You could simulate this by recreating the values
- in code? You could just look it up
Whats the context, maybe I can provide better answers
I'm basically trying to implement insta-eat
The moment a player right clicks with food in their hand it gets eaten - default values
If you're making a plugin, you could work this way:
Get a file (or hardcoded?) with the food values
-> Check or rightclickevent of a food type (or w/e u want to do to get the instaeat thing)
-> remove one item of the stack
-> generate the corresponding amount of healing
-> ???
-> profit
That was my initial thought as well
But I thought there might be a "consume item" command (not event)
Instead of hardcodibg every single food value
there is like 40 foods to consider, I don't think it would be hard to create a .yml file with all the foods in it (so you could also edit it afterwards to "buff" or "nerf" a food)
if you want to, I can create the plugin tomorrow?
I'm not a seasoned coder but I think I could do it in a (few) hour(s)
Nah no need, I want to do it myself - thx though
But small problem with the hardcoding
You need to consider the effects of each food as well...
hmm let me see
Like rotten flesh poisoning, and the different effects of each stew
APPLE(4,2),
BAKED_POTATO(5,6),
BEETROOT(1,1),
BEETROOT_SOUP(6,7),
BREAD(5,6),
CARROT(3,3),
COOKED_CHICKEN(6,7),
COOKED_COD(5,6),
COOKED_MUTTON(6,9),
COOKED_PORKCHOP(8,12),
COOKED_RABBIT(5,6),
COOKED_SALMON(5,9),
COOKIE(2,0),
DRIED_KELP(1,0),
MELON_SLICE(2,1),
POTATO(1,0),
COOKED_BEEF(8,12),
SWEET_BERRIES(2,1),
PUMPKIN_PIE(8,5),
RABBIT_STEW(10,12),
ROTTEN_FLESH(4,0),
MUSHROOM_STEW(6,7),
;
;
private Integer[] value;
private Foods(Integer value,Integer saturation){
this.value= new Integer[]{value,saturation};
}
public Integer[] getValue(){
return value;
}
public Foods returnByName(String name){
return Foods.valueOf(name);
}
}```
food/saturation
for most foods..
Is that enum built-in or did you make it?
Thats not a big issue for the food poisoning, just give them a boolean "poisonchance" (or make it a double, and have it a percentage?)
^
Nice, thx
But I'm really surprised there's no "consume" function
Oh well
Time to make one!
and from that i simply use the items name Integer food[] = Foods.valueOf(item.getType().toString()).getValue();
Yeah, figured :D
yo DMan, make your plugin public if it works, I might use it in the server I'm creating :)
I'll try, pretty new with the whole plugins deal
But when I'm done I'll publish it
Will take a while with exams tho... :P
oh you want to create force eat oh boy
LooL yeah
ur gonna have alot of fun triggering the eat animation lmao
that wall hit me in the face
right clicking the food doesnt activate anything but 1 interact event,the food eating is client sided
meaning you also have to handle item locking during the eating,so he cant just switch item mid-eating
I don't think that can be too hard?
rightclick once to insta eat -> switching doesnt matter as the event would already be called
holding rightclick is the regular eat animation, ignore it in that case
thing is dont think we can acces the timer for eating
you cant know when a item was actually consumed unless ur willing to make a connection between lastclickeditem and the event
its so annoying to deal with i just didnt bother covering the animation
as i also made a instanteating plugin
I'm pretty sure that the moment you click with an item in your hand the PlayerInteractEvent is shot, so even if you change or keep the button pushed, it wouldn't matter - it'll just be consumed
more or less you can right click the food and not finish eating it
stellrow just check for the quick rightclickevent, and ignore anything else
this way a player can choose to cancel the instaeat by holding rightclick
or just use the regular animation
the guy wanted delay for some foods lol
use delayed events for that?
Occurrences found in comments, strings and non-code files (1 occurrence in 1 file)
im getting this when try putting a package in another package
not delayed events,specific delay for insta eating a food
jtx ellaborate wdym putting package in another package.. do you want to import an api?
so a steak wouldnt be instaeated but rather after 5 ticks or so
best practice wit scoreboards?
- unique objective per player
- unique scoreboard per player
Im trying to make put my api package in my other package
@unborn jewel do you use Maven framework? If so, you can add the dependency
no
Gradle? Should also work
Alright I'm not following, I'll leave it to someone else sorry
do you know what a package is
so a steak wouldnt be instaeated but rather after 5 ticks or so
For me it shouldn't matter what you eat - all food will be consumed instantly
a file directory
i want to put a package inside a package
if you're in intelIJ you can just create a new package in the package I think
not sure
i tried that and didn't work
Which ide r u using?
@mental glen in that case you shouldnt bother with the animation
Maybe its not possible, why would you need a package in a package? You can just have a folder
Intellij
just consume 1 food at right click
LooL yeah - that's the plan
Anyone know of any free maven repo hosting thatโs reliable?
For some reason hosting my repo on GitHub isnโt working
I get a 404 error
So you right click ur package > new > package
For example. If I had a package miqhtie.thing and I wanted to have miqhtie.thing.commands I would right click
miqhtie.thing > new > package > miqhtie.thing.commands.
@unborn jewel
um
Stellrow thats what I've been saying :p
doesn't work
fierceeo try JitPack to load your github repo; google JitPack
What would be the least server-intensive way to make a timer? I want to make food expire after 24 hours. I've been using the getServer().getScheduler().runTaskLater() method, but these tasks don't get saved in the sever restarts I don't think.
Can't you give the food a timestamp; and compare to the current time?
^
I was thinking of assigning the food a timestamp in its lore, but wouldn't I have to check every second for every food item that I've marked?
every second would work, but whats wrong with every minute? I doubt you care for 59 seconds too late
use the containers
That's fair, so every minute it would check...
Also if you tag your items then you wont be able to stack them anymore
@tiny dagger Containers confuse me :/
You could also check on food movement (inventory events?) or when player tries to eat it; either way, display a chat message as of why it dissapears
That's an excellent idea
If I were to use a container to assign a food item a time stamp... what would that code look like?
The docs concerning the containers are hard to wrap my mind around.
also, I do not know your context of this plugin, but i'd have it "turn into" rotten flesh or something, instead of just deleting it
I think that's a good idea yeah, turning it into rotten flesh.
Would two items with different time stamps be able to be stacked together if I used NBT tags instead of lore?
Or no matter what, do you lose the stacking ability?
probably always lose stack ability
Is doing it through the lore a viable way?
It would work yes, but if the food is created one minute (or second, depending on how oyu create the timestamp) apart from each other, it wont be stackable anymore
You could put in the lore: "this food wil expire after: (stamp)"
and then just compare current time with (stamp), on usage/movement
I'm sorry if it's not too useful
InventoryClickEvent
There are multiple. InventoryClickEvent, InventoryDragEvent.
^
Does anybody know a way to make titles for LuckPerms? Currently each respective rank has a prefix. I want players that have collected different ranks to be able to display the prefix (title) of whatever rank they have.
Hello! I was wondering if it is possible to update from 1.15 to 1.16 my bungeecord server gives the following error: > 21:16:59 [INFO] [JustDriessen] disconnected with: Could not connect to a default or fallback server, please try again later: io.netty.channel.AbstractChannel$AnnotatedConnectException
There is nog other line in the console or the logs.
Server ip seems okay.
Done this a lot of times but this time it won't work.
Yes it is possible to update from 1.15 to 1.16. Just make sure you update bungeecord and every target server.
Still won't resolve the error I have.
Normally I just swap the .jars but that doesn't do the trick for me.
21:16:59 [INFO] [JustDriessen] disconnected with: Could not connect to a default or fallback server, please try again later: io.netty.channel.AbstractChannel$AnnotatedConnectException
Still get that error.
Check your setup. This error occurs if you try to connect to a closed server.
Make sure your server is running and can be accessed manually. Then setup your bungeecord server with the correct IP.
if I do player.getVelocity(), the x and z are 0 if I'm not sprinting, is this supposed to happen?
Check your setup. This error occurs if you try to connect to a closed server.
Make sure your server is running and can be accessed manually. Then setup your bungeecord server with the correct IP.
Our bungee server and spigot (paper) server is on the latest version and the ip is correct in the bungee config and the spigot config is on bungeecord mode
spigot (paper)
Different software
same error with spigotmc, not paper
If you want paper help use Waterfall and ask on the paper discord
Is there a way to get the direction a player is walking in
player.getLocation().getDirection I think @frigid ember
That's look direction
^
Best option is to use the move event to calculate delta values
Normalize the resulting vector
okay our problem has been fixen ๐
#stupidFirewallProblems
You have getFrom() and getTo(), can work from there
In fact, Location has a subtract() method iirc
from.subtract(to).toVector(), you have your movement vector
Ehm, to.subtract(from)
Wait so I would need my location and another vector to subtract from?
PlayerMoveEvent has a Location "from" and a Location "to"
^ subtract from from to and call toVector(), you have your difference vector
Oh
Ideally you'd call this on the MONITOR priority in case any change occurs
Ty
Just dont change any event parameter when using MONITOR priority
Okay
Bukkit relocates all of NMS, yes
choco do you have any update for my issue
(my Discord username still hasn't updated automatically)
i think 7 days have passed now
Link me your account, I'll update it
๐ ๐ ๐
thanks jesus
Should be thanking Choco
Should be thanking Choco
@keen compass I just called him jesus
Are Commands run on the main server thread btw? If I make a blocking web request after a command do I need to run it in a different thread?
Yeah I know, was just wondering if commands got put on a separate thread ๐ Guess it wouldn't make sense actually since you'd want to be calling bukkit apis
yes
Yes
Packets are queued
Choco WAIT >:( im answering
๐
If you send a message from another thread to the console sender you will have the name of the thread which looks weird
like [thread.forkPool.common-worker2]: "message"
this however is not an issue with in-game chat
Yeah I get you, I've had my fair share of headaches with multi-threading, for my 3rd year physics project I had to simulate 1000s of particle interactions in Java. Everyone else's was taking 10-20 minutes to run so I ended up multi-threading and getting it down to a couple minutes ๐ ๐
Xisumavoid tweeted the Multithreading performance post from the Minecraft Jira before, I can't imagine the headache it would give you trying to multithread Minecraft now
I mean java is pretty fast on multithread
It depends
If you're creating and destroying lots of threads over and over for small tasks it can be pretty poor, the time if takes to queue them can take longer than the task itself
@karmic sable I have added permissions. But, I want them to be able to change it themselves.
Also, since getOfflinePlayer is deprecated, is there a preferred way to obtain UUID's from OfflinePlayer names from the Mojang API?
Oh and if you call getOfflinePlayer() does the server cache the player after it calls the api?
yes
Should it get cached in usercache.json?
I have 2 classes (and 1 main so 3) but I need to access a hashmap out of another class(both classes not main) without using static. So I linked both classes to main in order to get the hashmap from the other class via main?
Oh my Dev server runs in offline mode, I guess it won't be making any api calls lul
is anyone experienced with deluxetags? pls help me
create a public method that references the hashmap @frigid ember
private HashMap<String, String> something = new HashMap<>();
public HashMap<String, String> getSomething() {
return this.something;
}
@frigid ember
I have a bungee cord server and for some reason players skins will not show up on it I dont know how to fix this. my server is 1.16.1 and it started after i updated it. I tried to find fixes on reddit and other places but couldnt find much. setting the servers to online mode doesnt let players join and i thought it was an outdated plugin but that wasnt the case either


