#help-development
1 messages Β· Page 734 of 1
I was always using IntelliJ. This is going to change
you would be skipping every other item
oh now i see
i have list with size 2
this remove
end size 1
but index
not restart
i need restart index in for
hm
what exactly are you trying to do in the loop?
put the button in a free slot in the inventory and create more inv if needed until the list of buttons is empty.
Simply put, create an auto-generated inventories for the list.
Im gonna spend a day to learn this... π
please, change to dark theme
What tf is this?
Why is it underlined?
[HELP] Sending Lists Between Classes
Guys... why does eclipse show me two sources?
u can delete if u want
Okay the second one, I found it thanks
Ugh i'm still struggling here, How do I do dependency injection between 2 non main classes without creating new instances of them constantly
This is in my NON Main class
public void onEnable() {
new TaggingSystem(this.plugin, this);
}
this is in TaggingSystem.java
package me.assailent.infancyminigames.tagging;
import me.assailent.infancyminigames.InfancyMinigames;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import me.assailent.infancyminigames.tagging.TipQueue;
import javax.inject.Inject;
import java.util.List;
public class TaggingSystem implements Listener {
public TipQueue tipqueue;
public TaggingSystem(InfancyMinigames plugin, TipQueue tq) {
Bukkit.getPluginManager().registerEvents(this, plugin);
tipqueue = tq;
}
List<Player> tagList = tipqueue.getPlayerList();
public void onTag(EntityDamageByEntityEvent entityEvent) {
if (entityEvent.getDamager().getType() == EntityType.PLAYER & entityEvent.getEntity().getType() == EntityType.PLAYER) {
if (tipqueue.isTipEnabled() & tagList.contains(entityEvent.getDamager()) & tipqueue.getInPlayer() == entityEvent.getDamager()) {
tipqueue.setInPlayer((Player) entityEvent.getEntity());
}
}
}
}
shi think i got it to work lemme check tho
nope i didnt
lol
Hello, I'm encountering a blockage.. Basically I would like when a player orders /furnacegui it returns all the items cooked in their inventory, but I don't know how to proceed.. Possible to get help ?
why u pass your main instance to constructor 2 times
Wdym?
TipQueue is not my main instance
setCancelled only works with true, false
They know
They were saying that because most languages allow 0 + 1 aswell as true + false
I think you need to learn more, it seems confusing to you
My main instance is another file called InfancyMinigames.java, and also Thats what I'm trying to do π’
then it should be new TaggingSystem(this, new TipQueue(this));
strong types is one of the best things about languages that have it
Yeah, i was sarcastic ahahahaha
you can refactor by breaking a bunch of things and then fixing it again until it works
Doing new creates another instance of the class yes?
Thats what i'm trying to avoid
of what class
Whislt staying in the same instance
what class is taht onEnable function in
everytime you do "new" it will create a new instance
Its old let me update code rq
so if you dont want new instances, dont use new, but use an existing reference to an object
Thats what i'm trying to do
how do i reference an object in another class?
well you need to pass it in with teh constructor probably
idk what your structure is like
here ill upload to paste-md-5 or whatever
yeah
like idk where this public void onEnable() { new TaggingSystem(this.plugin, this); } is at
TaggingSystem.java
https://paste.md-5.net/otoworomex.java
TipQueue.java
https://paste.md-5.net/citotuleve.cs
InfancyMinigames.java [Main]
https://paste.md-5.net/wizihenume.java
like i said that is old and doesnt exist anymore i dont think
but im still trying the same thing
okay
so what sthe problem right now
you are creating a tipqueue and taggingsystem in your main class
thats fine
and then you pass in the tipqueue in the tagging system constructor
i dont think he has any problems rn, he just wants re use TipQueue instance
It returns an error in console
wat error
says that in the TaggingSystem
this.tipqueue is null
line 22 is the problem
List<Player> tagList = this.tipqueue.getPlayerList();
When the tagging system is initialised iirc
okay, well I guess its probably before the rest of the constructor is getting called
i.e. before tipqueue has been set
yes
try initializing it in the constructor instead
so you can know the order for sure
instead of guessing
and also like morice wanted to point out, use UUID instead of references to Player directly
ahh
So wait does that mean
tagList will always = tipqueue.getPlayerList();
like its live updating or no?
nvm dumb question mb
create a method ll reinit it
yeah, just do tagList = tipQueue.getPlayerList again
or dont keep a reference to tagList and just getPlayerList every time
nobody cares moment
Look --> https://ibb.co/5j233Dv
The location is always null?
It also hasn't been used for anything
Weird behaviour:
The ENTITY.GENERIC.EXPLOSION sound plays.
But the player hit doesnt take knockback or damage.
https://paste.md-5.net/owosafofaf.java
I am trying to use Fireball.class and i get the following problem:
no instance(s) of type variable(s) exist so that Fireball conforms to Projectile
how can i block the command of my plugin that are showing with the name firsti?
Example:
Normal command: /fly
Extra command: /pluginName:fly
how would i send a lightning bolt packet using NMS (mojang-remapped)?
anyone?
set the view id in the map packet
how do i make client side lightning? (only visible to one player)
packets :3
That could be a decent api addition though
π€―
You'll need to specify which type of fireball
what NMS class would i use?
Either SmallFireball or LargeFireball
i tried this
public static void strikeLightning(Player player, int x, int y, int z) {
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerGamePacketListenerImpl connection = craftPlayer.getHandle().connection;
CraftLightningStrike lightningStrike = new CraftLightningStrike(
(CraftServer) craftPlayer.getServer(),
new LightningBolt(EntityType.LIGHTNING_BOLT, craftPlayer.getHandle().getServer().overworld())
);
connection.send(new ClientboundAddEntityPacket(lightningStrike.getHandle()));
}
TIL wither skulls are technically considered "fireballs" as well for some reason lol
Yeah it's add weather or something
Donβt question Mojang
yeah but i couldn't find any packet that even contained the word lightning or bolt or anything like that
no packet with the word weather in it either
well more like no class
Actually that may have been consolidated alongside the player spawn packet in the 1.20.2 update
To the internets
i'm in 1.20.1
Oh then disregard lol
you think i didn't try that lmao
i've been googling for half an hour
found nothing useful
Anyone who knows NMS? Who can help with creating an NPC in 1.20.2.
i just did that yesterday i can help u
Yeah so apparently the "spawn weather entity" packet was removed in 1.16
and replaced by what?
someone sent me this code
public static void Confirmation (Player Player, String Message, String Command) {
TextComponent Text = new TextComponent(Common.Color("&a[β]"));
Text.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click To Confirm.").create()));
Text.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, Command));
TextComponent MessageT = new TextComponent(Message);
MessageT.addExtra(" " + Text);
Player.spigot().sendMessage(MessageT);
}
i wont forgive him for the capitals and the naming but why this is the output
TextComponent{text=[β], BaseComponent(color=, font=null, bold=null, italic=null, underline=null, strikethrough=null, obfuscated=null, insertion=null, extra=null, clickEvent=ClickEvent.(action=RUN_COMMAND, value=/event join), hoverEvent=HoverEvent(action=SHOW_TEXT, ...
i dont have access to a pc right now sooo
lol I see the problem
you aren't using the xyz
oh yeah you're right
Yeah, double checked and it does use the standard spawn packet π Nothing overrides it anymore I don't think
public Packet<PacketListenerPlayOut> getAddEntityPacket() {
return new PacketPlayOutSpawnEntity(this);
}```
but where do i even specify it?
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(world);
lightning.moveTo(loc.getX(), loc.getY(), loc.getZ());
do i just setpos?
imma try that out
didn't work
public static void strikeLightning(Player player, int x, int y, int z) {
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerGamePacketListenerImpl connection = craftPlayer.getHandle().connection;
LightningBolt lightning = EntityType.LIGHTNING_BOLT.create(craftPlayer.getHandle().getServer().overworld());
lightning.moveTo(x, y, z);
connection.send(new ClientboundAddEntityPacket(lightning));
}
There's not really any guarantee that it will actually be the overworld you want. Bear in mind that CraftBukkit sort of fucks with how worlds work
I would opt to use ((CraftWorld) theWorldYouWant).getHandle() instead if you can
i'm 99% sure it's not the problem because i have some npcs that i spawn in the same way and they show up but i will take your advice anyways
I guess if you have a CraftPlayer then ((CraftWorld) craftPlayer.getWorld()).getHandle()
I mean hey, anything is worth an attempt
didn't work π
i agree but it didn't work
Give me a minute
why use nms to create lightning?
i want only one player to see it
ah ok
I can't see anything that wouldn't be working here
I'm fairly certain it's been the add entity packet since around 1.16
That's what spigot uses
Well Spigot actually adds it to the world
Well yeah, but that eventually flows down to the addentity packet
Yeah it doesn't override the add entity packet method
ok it works sorry yall
i don't even wanna say what the problem was it was very stupid
thanks @worldly ingot @young knoll @echo basalt
I'm more concerned at the variable naming
public static Collection<Location> generateLineAB(Location a, Location b, int points) {
Vector aVec = a.toVector();
Vector bVec = b.toVector();
World world = a.getWorld();
Vector difference = bVec.clone().subtract(aVec);
double distance = difference.length();
Vector offset = difference.normalize().multiply(points / distance);
List<Location> locations = new ArrayList<>();
for(int index = 0; index < points; index++) {
locations.add(aVec.clone().add(offset.multiply(index)).toLocation(world));
}
}
This may not work as you intend. you are exponentially incrementing internalVector
you're also mutating ab
How can I prevent the player from stacking an item into an inventory. for example the inventory is full of dirt and he should not be able to stack it (add it to the stack)
If you don;t want items to stack, add a custom PDC tag to it
Hello, I am making an inventory interface and want to prevent players from taking items out, but I found that getCurrentItem().getType() method of InventoryClickEvent may throw NPE, how can I solve this?π§
check if getCurrentItem is null
Good evening guys, how could I make sure that the lore of my item is configurable via config, via a stringlist which obviously also calculates the " " spaces, I'm doing various tests but I still haven't reached the desired result, any advice?
It's pretty easy to just convert a string list directly to lore
What issues are you having
I tried to create a List, which counts the strings therefore List<String> and then initialized it with the StringList config and inserted it on item.setLore(lore);
You should just be able to do List<String> lore = config.getStringList("lore")
and then ItemMeta#setLore with that list
Yes exactly, I did just that, but he doesn't seem to like it lol
What happens with that?
Error in console, I'm not at the PC at the moment to be able to reproduce the problem
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
!hello
hi
Hi can you answer the question my friend in #help-server asked you
I'll send you the error as soon as I can
π
How could i attach a debugger to my plugin?
Intellij?
the debug button? that doesn't debug it while its in the server, I need something that would give me information there. Cause something is going on, server dont crash but an endless loop starts and idk what could be causing it.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i tried following that but I cannot edit the command arguments.
i cant delete or add anything in there.
oh i'm just terrible at reading....
@zenith gate make sure to run your server with a JDK that supports live reloading
17 should be good right?
you don't need live reloading to use the debugger lol
Well it don't matter it didn't display anything about my issue.. π
How can I cancel taking second-hand items from the GUI?
idk if this is what you mean but there is either inventoryclickevent or playerswapiteminhandevent something like that
Does anyone know off the top of their head whether ProjectileHitEvent or EntityDamageByEntityEvent gets called first
@EventHandler
public void secondHandEvent(PlayerSwapHandItemsEvent e){
if(e.getPlayer().getInventory().equals(RankUPCommand.inv)){
e.setCancelled(true);
}
}``` i tried this but its not working
dont use .equals i think that compares the entire object
you would want to use == to compare the instance of the object
could be wrong
I think either work
I would assume tho you are in a GUI so you will need the InventoryClickEvent
find which slot number the second hand is
and compare it to the clicked slot and cancel it if so
It's best to use equals to compare inventories if you're coding for 1.8.8
.equals on an inventory is better than ==
Ye
I am already canceling this event, but second hand does not prevent this
some things create a new bukkit inventory instance each time
bump, cant test it in person atm
All good Iβll wait till later π
Projectilehit is before yes
Ultimately doing this gives no lore in the item, as in non-existent
Projectile hit calls first with the block or entity it raytraced then if everything is alr, entitydamagebyentity is called
No errors, no nothing
Dependency 'me.boxxing.reviveme:reviveme:1_20_R1' not found
still getting errors
Show your code
?paste
problem solved, I had to recreate the config because it wasn't updated with the lore, everything's fine thank you very much
Are there any APIs or Libraries for creating block displays yet?
Oh really?
my plugin can't find any command/event class i created.
i didnt modified anything, and i checked the directory of all classes.
Yeah, we've had API for them since they were added
Is there a way to sort of mass produce them? Kinda like build a structure in-game and then being able to make a sort of schematic made from block displays for it?
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(PlayerRespawnEvent event) {
Player player = event.getPlayer();
event.setRespawnLocation(ArenaManager.getCurrentArena().getLobby());
...
}
this is my code
sometimes when the player is lagging
the location won't change
it is a very rare bug
but it happens
whats the best way to store aan array of itemstacks inside a config file that doesnt take 500 lines of the config file
Why are you concerned with the size of the config file?
I doubt that this i the cause. Do you get any exceptions?
No
Recompile and try again
Anyone know if Display Entities are capabale of displaying particles?
what item is at index 0 of the player's inventory including the offhand and armor? and what indexes contain the offhand and armor
uhh no?
armor is 36 - 39
offhand is 40
0-8 is hotbar
then 9 is upper left
so the full inv is 40?
If you account for the crafting grid it's 45
But just the contents themselves it's 40
bruh crafting grid is counted too?
Keep getting the good ol " uses the space-character (0x20) in its name" error but there are no spaces at all in my yml; i've even reset it to something like "temp" and it still fails to load
main: io.github.derec4.dragonforgekingdoms.DragonForgeKingdoms
version: 0.1.2
name: temp
the getContents array is different from getItem at index iirc
drop the .yml file here
name: DragonForge_Kingdoms
version: 0.1.1
main: io.github.derec4.dragonforgekingdoms.DragonForgeKingdoms
description: Framework for kingdoms server
author: Derex
api-version: 1.20
# Optional fields:
website: https://github.com/DereC4
prefix: DragonForge
This was original
right click -> open in -> file explorer
just dm me it and ill upload it here
dms malware
ez
is this index or number like does it start from 0
starts from 0
aight ty
Why
Why
Why
why
Why
36 - boots
37 - legs
38 - chestplate
39 - helmet
right?
.
Usually you should just use the EquipmentSlots instead of the raw slots.
Depending on what you are doing...
im giving the player items from an array
or the other way around
o hwait u provided an image
mb
Open your jar and check the plugin.yml there
copied it to a test plugin and changed the main part and it works fine
so it's prob a compilation issue
@short pilot
getting these errors with this code
Reload the pom
is reviveme ur plugin
naw its the api im using
link it
the api isnt published on a repo, download the jar and mvn install it
https://github.com/FavioMc19/ReviveMe-API/releases/tag/1.0.0
https://blog.jeff-media.com/manually-installing-jar-files-to-your-local-maven-repository/
Sometimes you have a certain .jar file that you need as dependency, but the author of that .jar was too lazy to properly upload it to a public repository. Thatβs bad, but not a problem. There are two ways to solve this, but only one proper way. The proper way: install the dependency The proper...
ah goofy plugin
so this?
<groupId>me.boxxing.revivemeapi</groupId>
<artifactId>revivemeapi</artifactId>
<scope>provided</scope>
<version>1_20_R1</version>
is there a way to get rid of this server-side
maybe an inv texture pack?
hey!, excuse me , does anyone know how to define arrow damage in mmoitems for bows?
beside just using power i mean
im tryna make an rpg server any plugins yall wanan suggest??
you could disable achievements
wouldn't it be recipes instead of achievements?
we can't disable achievements, they're a core part of the server
don't believe disabling the achievements in the config prevents plugins from still using it
you mean the vanilla achievements?
Its a static method which is not included in those type constraints
but I also think you can disable the recipe book thing too from popping up or you could just set it to have all recipes discovered
really only an issue for new players though
how can i download this plugin
With your browser
You really need the generics?
i downloaded it and how can i play/open it
can someone tell me why is it not passing the if statement
This very much looks like it should not be generic.
Whats the provideItemGeneric method?
Are you opped?
yes
damn
not exactly accurate. Many plugins evaluate op as having the perm
Ew
there are some plugins that don't evaluate op in that way
Print a msg and check if your if statement is true or not
wouldn't it be better to have Constant superclass instead of that generic thing
oh lol
This scales terrible...
im sure its super fun to code that
Bro thinks he's about to revolutionize the planet
Speaking from experience bro does not listen to feedback
Wdym?
public interface ItemRepresentable {
ItemStack asItemRepresentation();
}
public enum MathematicConstant implements ItemRepresentable {
PI(...);
@Override
public ItemStack asItemRepresentation() {
return null;
}
}
public static <T extends ItemRepresentable> void fillInvMap(Map<Integer, Inventory> inventoryMap, Map<T, ItemStack> genericMap, T... t) {
}
Install a spigot server, add the plugins you like, join the server.
This way you never have to extend your if-else chain with more classes.
You simply implement the interface and boom, you can pass it to your fill method.
What in the...
There are so many
It's not like you can compress them
I would just change the name to "MathematicalConstants"
does it work with the essential mod
because minecraft probably copies teh items around and whatnot
similar to how string comparisons work
== is a direct reference/object adress comparison
and .equals can be specified by the class itself
use isSimilar
== compares memory addresses, equals() compares values in objects
If you aim for the clean code, I suggest you to instead of using big if statement, use Map that contains itemstack as Key, and action as a Value ``` Map<ItemStack, Consumer<ItemStack>> onClickActions;
public void registerActions()
{
onClickActions = new HashMap<>();
onClickActions.put(new ItemStack(Material.BLUE_DYE),itemStack ->
{
Bukkit.getConsoleSender().sendMessage("Hello world");
});
}
public void onClick(ItemStack item)
{
if(!onClickActions.containsKey(item))
{
return;
}
Consumer<ItemStack> action = onClickActions.get(item);
action.accept(item);
}```
and propably Itemstack as input will be not enoght for some situations. So consider using own custom Inventory Event as Input, like @Data public class InvClickEvent { private Inventory inventory; private ItemStack button; private Player player; }
yes
@Value is java record, @Data is getters + setters
Ew
Better use slots
And register a consumer per slot to do stuff
Assumimg your inv remains in the same place
one is an instance check the other is a contents check
since you are using static to compare a dynamic object
the instance check won't pass
but the contents check will
Anyone know why I'm getting an out-of-order packet for some players?
bad packet id I'd guess
how do i slow down a BlockIteration? i'm trying to make an itemDisplay move forward but it just instantly reaches the iteration's limit
Make the duration longer? IIRC, that stuff is handled in ticks.
it doesn't have a duration
just a max distance
it only ends once it reaches that max distance or hits a solid block
How, can you give an example? I wanna see that
polymorphism :)
oh right, i thought he was refearing to something else. Thanks
Guys, can it be made so that when the player returns to the server the first slot is automatically selected?
yes
Okk
[HELP] Weird Behaviour In EntityDamageByEntityEvent if Statement
Entity#drops isn't reliable
[00:12:37 WARN]: [boxxing] Task #14 for boxxing v1.0-SNAPSHOT generated an exception
java.lang.IncompatibleClassChangeError: Method 'java.lang.Boolean net.kokoricraft.reviveme.api.ReviveMeAPI.hasDowned(org.bukkit.entity.Player)' must be Methodref constant
at me.boxxing.Boxxing.checkMatchOver(Boxxing.java:157) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing.access$300(Boxxing.java:24) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing$3.run(Boxxing.java:57) ~[boxxing-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.1.jar:git-Paper-119]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1394) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1171) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-119]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Getting this error, what would I do to fix it?
what are the chances of generating the same uuid with UUID.randomUUID()
Very very very very low you're safe to use it
it's like 0.1% of getting the same value
1e-19% chance or around 1 and 1 billion. Honestly might be lower than this
you're doing some hacky shit
There is problems with all of the gameEnd's and winningPlayer's
boolean gameEnd = false;
Player winningPlayer;
this.plugin.getServer().getScheduler().runTaskTimer(this.plugin, task -> {
gameTimer--;
for (int i = 0; playerList.size() > i; i++) {
playerList.get(i).spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(tip + gameTimer + " Seconds Left"));
if (gameTimer < 10) {
playerList.get(i).playSound(playerList.get(i), Sound.BLOCK_NOTE_BLOCK_COW_BELL, 1, 1);
}
if (gameTimer <= 0) {
if (playerList.size() > 2) {
playerList.remove(inPlayer);
newRound();
} else {
if (playerList.get(i) != inPlayer) {
gameEnd = true;
winningPlayer = playerList.get(i);
}
}
task.cancel();
}
}
if (gameEnd) {
for (int i = 0; playerList.size() > i; i++) {
playerList.get(i).sendMessage(ChatColor.AQUA + "-----------------------------------------------------");
playerList.get(i).sendMessage(tip + "Game Has Ended");
playerList.get(i).sendMessage(ChatColor.AQUA + "-----------------------------------------------------");
}
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
player.spigot().sendMessage(ChatMessageType.CHAT, new TextComponent(tip + winningPlayer.getDisplayName() + " Has Won a Game Of Tip!"));
}
}
}, 0L, 20L);
"Variable used in lambda expression should be final or effectively final"
but I want it to change when the game ends
i think im doing a stupid
Should be much lower
There are at least 121 bits that are randomized, so that's 2^121 possibilities
there's probably a better way of doing this
I'm not going to lie
definetely like 100% but idk how lol
I think I found it
public void sendMessage(String... messages) {
...
}
not just that
For games (and especially minigames) you want to like
make a common base of what a game is
And de-coupling everything from the game class in a way
You also want to split stuff into more methods for cleanability (Example below)
Alright so the way I have commands set up is switch statement between arguments based on the initial "parent" prefix (like faction create)
How do I register this? Do I need to just register the prefix command in both yml and onEnable() or do I register every individual command (e.g. "faction create "faction join")
[00:12:37 WARN]: [boxxing] Task #14 for boxxing v1.0-SNAPSHOT generated an exception
java.lang.IncompatibleClassChangeError: Method 'java.lang.Boolean net.kokoricraft.reviveme.api.ReviveMeAPI.hasDowned(org.bukkit.entity.Player)' must be Methodref constant
at me.boxxing.Boxxing.checkMatchOver(Boxxing.java:157) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing.access$300(Boxxing.java:24) ~[boxxing-1.0-SNAPSHOT.jar:?]
at me.boxxing.Boxxing$3.run(Boxxing.java:57) ~[boxxing-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.1.jar:git-Paper-119]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1480) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1394) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1171) ~[paper-1.20.1.jar:git-Paper-119]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-119]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Getting this error, what would I do to fix it?
shoo
No clue what your structure looks like but ideally you register every subcommand manually
ahh alright
Example
Shhh
Having an actual code based command api is something thatβs been talked about
It is technically a factory
coems
One question i have, how does your context work, it looks like it gives back exactly what you need
Without casting
It just returns an untyped generic and Java will automatically adapt that type to the type required to compile
Sig probably looks something like this
public <T> T getArgument(String)```
Yes you should. Private constructor, final class, static method. See how vanilla does it
vanilla code ugly
I'm not a fan of the static method but oh well
It's better than exposing a constructor and creating a dead instance with no member methods
You don't have to be a fan of it for it to be the correct approach lol
something like that
I'm still a bit confused, let me give u a bit of insight
@Override
public boolean onCommand(CommandSender source, Command command, String label, String[] args) {
if (!(source instanceof Player player)) {
source.sendMessage(ChatColor.RED + "This command can only be run by a player.");
return false;
}
if (args.length == 0) {
// Handle the /kingdom command without sub-commands
player.sendMessage("Usage: /kingdom <sub-command>");
} else {
// Handle sub-commands
String subCommand = args[0].toLowerCase();
switch (subCommand) {
case "create" -> {
case "remove" -> {
case "claim" -> {
}
}
return true;
basically a switch statement depending on arguments
but in onEnable, I'm registering like this
this.getCommand("kingdom").setExecutor(new KingdomCommandManager());
Which is erroring out when the plugin is loaded
the yml has the appropriate commands
that's fine
Does the .yml just have "kingdom" as a command
Because subcommands aren't a thing in bukkit
commands:
kingdom:
description: Kingdom parent command
usage: /kingdom <arguments>
permission: dragonforge.kingdom
kingdom create:
description: Create a kingdom
usage: /kingdom create <name>
permission: dragonforge.kingdom.create
right now just has these two
yeah remove the kingdom create part
Bukkit's really basic when it comes to commands
You just register the root itself and any subcommands are up to you
ok
What do you mean something? That's exactly what it is 
yeah something like that
anyways I opened my IDE and nearly threw up so I'm thinking about not working today
Does your code look that bad?
No just burnout
yeah. I do. I saw your ticket
thought you hung around here longer then what it says for you o.O
I left this server for a bit
ye
definitely explains that part lmao
It can get fixed soon. Testing it on 1.20.2 is going to be the wait though
the method in question got renamed to language. Or something on paper or something.
let me see if I can get it fixed quick. otherwise will be a tomorrow problem for me
Projectile hit event
ok thank you
fix deployed.
what is the float power in createExplosion?
in relation to a creeper and tnt
do you know?
I'm trying to set up a configuration file in my plugin, but when I run saveDefaultConfig like seen in articles I've found and the TntModifierPlugin repo, I get an invalid plugin type error when I try to start the server.
I have a config.yml:
foo: "bar"
and my main plugin file, TestPlugin.kt:
override fun onEnable() {
saveDefaultConfig()
registerListeners()
}
it does not generate the TestPlugin folder with my config file, and I get:
[22:38:09 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'TestPlugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
I think it has something to do with how I'm instantiating my plugin, but I'm not sure. I don't see much difference in the plugin I referenced.
wait
I think I might know what it is
nvm, don't think so
Is there way how to get block breaking speed or edit block hardness? I will probably need to calculate breaking speed manuals, but thats sounds like pain.
Oh. Was gonna say, you definite it's caused by the config?
nah I was wrong just now. If I remove the line saveDefaultConfig(), it works and loads just fine. I even removed any dependencies within the plugin's listeners on the config, and it still only errors when that's in there
if it errors on saveDefaultConfig you have no config in yoru jar
how come evokers are not moving anywhere when I do .setTarget()?
they just spawn vexes and their teeth things and not move
that's what I was kind of wondering about... I do have a config.yml inside the resources directory, so I'm not sure why it's not loading it. do I need to reference it within plugin.yml?
you are probably building using Artifacts instead of Maven so the yml never gets included
I see. how do I make sure I'm building with maven instead? I haven't reloaded it in a while
I'm also very new to IJ and kotlin
use the maven tab on the right of your screen and select package under lifecycles
i think i might have to make them pathfind towards the player manually
but idk how
did you disable AI?
no, i'm using setTarget
but the evoker isn't really moving anywhere
it's just using its vexes and snapper things
it works for all other mobs
that i am using
so long as you didn't alter/remove any of it's goals/brain it should move, unless you assigned an invalid target
possibly
since they dont have anything to attack with other than their abilities
I've never played with them
same error message
really weird
did you take yoru built jar from the new target folder?
no
ok I left it as is
just make sure it came from the folder called target
it did
Not to be condescending but can you check under "file info" that it is the newly created jar that you're using?
Like, check the created date
yeah I made sure it was created at the time I built it
rn I'm installing a zip program. new installation of ubuntu. still getting everything the way I want it
just did, and it does
the config is correct as well. currently it's a dummy config, just to get everything working
but it wasn't working with the previous config either anyway
theres no reason for it to error on saveDefaultConfig.
?stacktrace post teh full error
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
yeah it's bizarre. I'm probably missing something somewhere else
1sec
not super used to kotlin yet so the ST is a little harder for me to parse
does your main class extend JavaPlugin?
it does
I don;t use kotlin so can only help on Java bits
did you add a constructoir to your main class which takes args? (I hope not)
nop
?paste your main class
um, abstract?
wtf
try public
jfc I know that's the issue
I had to use abstract at one point and I must have put it there by accident
yep can;t instance bastract classes
Tbh I'm surprised it worked without the config function
Same, probably some kotlin fuckery
Yeah... I had to google what a main class should look like in kotlin
lmao I cannot believe I have been pulling my hair out for hours because I missed a single keyword that I put in by accident randomly
thank you so much lol
np π
Hehe it happens
been a bit since I've done a lot of dev and... damn
so far I've been able to figure everything out using java resources and seeing what pisses off my IDE but that one pervaded me
It's always just one line of code though, isn't it?
fun fact, there is no limit to the distance evokers can attack a player
and will continue attacking a player even if they switch to creative or spectator modes
@echo basalt about your cuboid class, is there any easy way to serialize it into json object in gson?
viewdistancetweaker
[HELP] getCommand(String) is null
Does anyone now if there is a method which repairs two tools with this formula: https://minecraft.fandom.com/wiki/Item_repair
get the armor slot and check what material type it is
does PlayerInventory#getContents get the armor contents and offhand too?
yes
k
BlockPistonExtendEvent#getBlocks() returns the blocks that are about to be moved, so before the piston extends. how can i get these blocks after they are moved
Get the blocks, use the extend direction to offset
can I update a resource and link the download to a papermc hangar or modrinth page? My plan is to require papermc or any fork of it, but I'm not sure if I can do that on the spigot page
If it's on SpigotMC it must work on spigot
At least afaik that's the rule
Maybe @vagrant stratus can weigh in
you can't
don't think the problem is competitor platforms, but rather the paper requirement
ok so can I write in the description of the resource that it is outdated and no longer maintained and link to a new page (e.g. modrinth or paper hanger), which then only supports paper?
u cant π
Which name would you prefer for a method that checks if a post was written by a guest - an unregistered player?
public class Post
{
boolean wasWrittenByGuest()
boolean writtenByGuest()
boolean belongsToGuest()
boolean isGuest()
boolean isAnonymous()
boolean isAuthorGuest()
}
Simply pure spigot will not support your plugin.
isAuthorGuest()
Good suggestion, I'll add it to the list
Hello, I am looking for how to prevent a player from connecting to the server if he is already connected to the server. (This is for a plugin like AuthMe)
Because currently if someone tries to connect with the same name it disconnects the person.
So if anyone knows how to prevent a player from connecting depending on whether they are connected or not I am interested.
online mode
Ig in the preLogin event you gotta see if there is a player with the same name in the server and if so, disconnect the connecting player?
I need to "disallow(AsyncPlayerPreLoginEvent.Result result, String message)" for prevent disconnect ? π€
yes
And what exactly indicates that this is a password stealer?
I'd be sus of anything that is obfuscated to all hell
Try to run the file through eset's scanner: https://www.eset.com/int/home/online-scanner/
Scan your computer for malware for free with the ESET Online Scanner. Our free online virus scanner checks for any type of virus and helps you remove it.
This is heavily obfuscated, contains hundreds of useless classes.
Everyone was talking about ectasy (minecraft force op tool). I injected a jar file with it, and this is what the file looks like, that it downloads. Totally not sus
These classes have 300-400 lines of code each
Every class looks really similar to it.
I'm not sure what's your meaning
So what? eset will do the job
I was trying to proof that this doesn't need any scan π
okay so, unlikely to actually detect Java based malware
especially spigot based anti-malware
and 2) I did actually see a malware which made use of lua
hell, I'm seeing known malicious jars on virus total being detected by less programs than 9 months ago
between 2 years one jar went from 1 detection to 2 detections
I highly double eset will do better
im gonna loose my mind
im not
someone wanna help me debug chunky sql codwe
i cant do this anymore
i dont get ANY errors
and still
theres like a million
the plugin chunky sql or actual big sql
idk what would count as big tbh
do you actually print the stacktraces
yes
or do you throw new RuntimeException
so what isnt working
i have settings
that i save in a table
but
FOR SOME REASON
settings 4 changes setting 5
setting 67 dont safe at all
and
idk anymore
its confusing
?paste the code
what code xd its like 5 classes
and what storage type
boolean
code that interacts with the db
ah
?paste
im not alloed to safe the code apperently
depends how much is on the line
just gonna use pastebun
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.
so
the class im calling is updatePlayerSettings
and it doesnt trow an error
but
it also doesnt seem to save
hellow, i'm learning to create a bukkin plugin, but my tuto say that i need to create a class with a super class name "java.plugin" on visual studio code
but i don't find how to do ?? anyone use visual studio and not eclipse ??
create a java project, create ur package, create a class eg PluginNamePlugin, then make it extend JavaPlugin and add the onEnable and onDisable
i dont remeber using either
i mean it worked just fine with the other table
doing sql/IO on the main thread will pause it
and i literally just copy pasted the code and changed the values
id use completable futures, try-with-resources and hikaricp or atm im a hibernate slag
ok thanks i try π
alr
@valid burrow heres a thing on fuatures

i forgot to dsiable the ping reply
thx
ok, i've done but visual say that "pom.xml is inexistent or invalid"
pings
1.8.8 spigot still has the full jar on maven right?
The servers are never hosted on the maven repo, but the API is, yes
And yes you can build it with BT
Nah, we'd get sued for that lol
You don't know until you try it out, those slimey lawyers claim they'll sue you but do they have the balls?
I wouldn't really wanna test to see if we'll be on the bad side of Microsoft lawyers lol
Reminder that redacted website somehow still exists that hosts all spigot craftbukkit and minrcraft jars
Which is crazy to me lol
Not insinuating we could get away with that btw
why tf does bukkit need mysql
?
buildtools downloaded mysql jdbc for the bukkit 1.8.8 jar
yes
and shaded it
It's included for devs
ah
@EventHandler
public void onEnter(EntityPortalEnterEvent e) {
Location location = ElytraFFASystem.getMain().getConfig().getLocation("portalspawn");
if (location == null) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "There's no PORTAL spawn set, please set one as soon as you read this.");
return;
}
e.getEntity().teleport(location);
}
Hey everyone, I'm having trouble fixing this, the issue is basically when it gets to the teleporting part(e.getEntity.teleport(location);) it keeps repeating itself.
it will because you are triggering the event you are in
I don't understand.
you are calling teleport inside a teleport event
Yes, teleporting will call the event again, which will teleport the person, which will call the event again, and so on
Is there a way to stop it once the entity is teleported?
First show us your code. The console output doesnt match the code you have shown us.
I removed the debugs.
Do you also hava a listener for the EntityTeleportEvent?
No.
This means the target location is also a portal block?
It isn't.
Ok but teleporting him out should not call the EnterEvent again
it will because this event is triggered at teh beginning of a teleport IF he is in contact with a portal block
Am I able to provide a video to showcase what's happening?
I don;t believe its from the interact
We know whats happening. Just trying to find the best solution.
Not sure if any forks allow async teleport
It also stops me from breaking blocks so I don't know how this is related.
when it happens your server is actually locked in a loop and will eventually run out of memory/crash
e
I dont like the boolean idea... Handling multiple teleports in one tick requires a Set then and you would need to schedule
the removal of entries.
yep it's probably going to break
else he could set a flag on the player PDC and remove after
or just meta
What are you trying to achieve? Maybe the EntityTeleportEvent is better suited.
no need for permanent
I'm making like a space FFA using elytras, and there would be portals where a player could enter and teleport to a different place.
Like a blackhole.
I guess you need to use a Set<UUID>, dont teleport the player if he is already teleported and schedule a clear of the set for next tick.
if (!player has meta) {
player set meta;
player teleport;
}
player remove meta;```
This might work without a scheduled task even.
Depending on how bad the impl for the enter event is
I've never done anything with metas before, I don't even know what they are.
I think metadata is rubbish
I would just use a Set honestly
yeah set or meta would work
What would be more "efficient".
Doesnt matter
with the set you will probably need to schedule removal due to the teleport happenign the next tick. meta/pdc you wouldn't
Probably having control over your own collections/maps
I would argue that using a Set is easier to implement
"java
probably
Hm?
If it throws an exception then its not working
it is working
You are probably casting 2 different entities and one works, the other doesnt
no
let me show u the code
WitherSkeleton boss = (WitherSkeleton) e.getEntity();```
You need to check before you cast
Alright, if this throws an exception then the method will exit right here and no other code will be executed.
it is executing bro
Aka it will not work
but it sends that error when i hit ther wither skeleton
heres the class
package me.airforce.bosses2.Events;
import com.google.common.util.concurrent.ListenableFuture;
import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
public class HealthEvent implements Listener {
@EventHandler
public void OnBossDamage(EntityDamageEvent e){
WitherSkeleton boss = (WitherSkeleton) e.getEntity();
Double dmg = e.getDamage();
if(boss.getScoreboardTags().contains("a")){
boss.setCustomName(ChatColor.BLUE + "" + ChatColor.BOLD + "Ancient Wither Skeleton" + ChatColor.WHITE + "| " + ChatColor.RED +"β€\uFE0F " +Math.round(boss.getHealth()));
}
}
and its updating
tthe health
If you dont make sure to filter out any other entitiy which is not a WitherSkeleton then this breaks.
How do you make sure this is only called for WitherSkeletons?
Set<Entity> set = new Set<>(idk what to put here);
would it look something like this π
i have a custom entity and i added a scroreboared so iam checking if it has the scoreboard tag
thats how
private final Set<UUID> alreadyTeleoprtedPlayers = new HashSet<>();
Main class ye?
u check for the scoreboard tag after blindly casting
This events gets fired when any entity takes damage.
And if you cast the entity then this throws an exception.
Check the scoreboard beforehand.
And make an instanceof check before casting blindly.
what
alr let me try
Ok so how does this work?
Am I supposed to teleport the player and then put them in the Set?
you stil cast it, just instanceof check it
Check if they are in the set
-> If yes > remove them
-> If no > add them + teleport them
but i wont get .gethealth
if (e.getEntity() instanceof WitherSkeleton witherSkele) {
// code
}
alr
π₯
if (main.getAlreadyTeleoprtedPlayers().contains(e.getEntity().getUniqueId())) {
main.getAlreadyTeleoprtedPlayers().remove(e.getEntity().getUniqueId());
return;
}
e.getEntity().teleport(location);
``` like this?
worked thx
You never add the player
Oh forgot.
if (main.getAlreadyTeleoprtedPlayers().contains(e.getEntity().getUniqueId())) {
main.getAlreadyTeleoprtedPlayers().remove(e.getEntity().getUniqueId());
return;
}
e.getEntity().teleport(location);
main.getAlreadyTeleoprtedPlayers().add(e.getEntity().getUniqueId());
like so?
add before teleport
If this works then a simple boolean will do as well now that i think about it
Also a dumb question, should the following be public or private.
public static ElytraFFASystem main;
In main class private and in the EnterEvent class public yes?
Ok it's working fine now, but this time I get teleport twice.
Private
you need to cancel the portal enter event if you are going to teleport them
But by the look of it you either want to use depenency injection a singleton pattern
I don't understand.
before the teleport, event.setCancelled(true)
There isn't a e.setCancelled
in EntityPortalEvent there is
Should I switch to it?
which event are you using?
yeah my bad, I was in wrong event
Is there any way to force object to be garbage collected?
no
not at the immediate moment but if you want to queue it basically just dereference it
you could call System.gc() but remind yourself that System.gc() is cursed as fuck and you shouldn't probably use System.gc()
why aliases not working?
aliases: rtp, randomtp, randomteleport```
[rtp, randomtp, wild] instead of this.
guys, how should i serialize PermissionAttachment
yes with foreign memory api
altho its preview still iirc
So how?
System.gc() as y2k mentioned altho its by no means forcing a gc sweep (and most jvm instances have it turned off)
well its an api
like java standard lib but the api is in preview
so :/
else
the closest u get is try with resources
Eh
i mean u have phantomreference, reference queue and cleaner if u wna listen to when the gcing is happening
technically finalize() also altho we avoid it for obvious reasons
actually idk but maybe ByteBuffer and Unsafe allow for explicit control over cleaning up
guys, how to make sit and lay commands in java?
Finalize is deprecated too i think?
?
i'm trying to move an ItemDisplay along the player's line of sight using a BlockIterator but i can't seem to figure it out and i can't find anything on the spigot forums
how do i do it?
playermovevent?
thats a very open question.
i didn't phrase that right
i'm not trying to update it when the player moves
i just wanna make it move forward slowly
well
ok, but how i can make it?
i've been trying to do it for hours but only one of 2 outcomes happen
either it goes to the BlockIterator's max distance instantly it does the same but far away from the max distance
Yeah
sit is very simple spawn something and met the player ride it
But since a lot of goofy old libs use it they wanna have it deprecated for like 10 years or so
let*
So everyone gets the chance to migrate
how? i'm too noob in java
then watch some basic spigot tutorials first
techno vision makes some good videos
Learn to code your own Spigot plugin in this complete tutorial series! In this episode, we create our plugin.yml file and setup a basic plugin.
--- Important Links ---
β Discord: https://discord.gg/m5fjByfrKP
--- Music ---
β Eddie Rohosy - Night Ride
β Phil Smiff - lake.side
β Xori - Dreamin
β Lakey- Blue Boi
β Chill Out Records - Minute Mix...
Search on google: how to register commands in spigot
i tried to use a bukkit scheduler to slow down the while loop but i've tried 4 different scheduler functions and none worked properly
how to fast project reload in intelij idea?
why would you use a while loop
dont do that
for the BlockIteration?
i'd rather just stick with the while loop
so far it's been working well but i have no idea how to make it slow down to make the itemDisplay move slowly
use gsit
its easier than rewriting the wheel
Incrementally move the display each move or with a scheduler instead of all at once
I also dont understand the block iterator. Do you need the movement increments to snap in place with blocks?
Would it be possible to create a plugin to install this api onto a server? https://github.com/LibreTranslate/LibreTranslate
Free and Open Source Machine Translation API. Self-hosted, offline capable and easy to setup. - GitHub - LibreTranslate/LibreTranslate: Free and Open Source Machine Translation API. Self-hosted, of...
sure
But this is written in python. Which means you need to run this alongside the server and use the rest endpoints in your
spigot plugin to request functionality.
Are rest endpoints essentially a way for the plugin to await information from a python script?
guys, how to fix this? [21:37:04] [Server thread/ERROR]: Could not call method 'public static org.bukkit.Location org.bukkit.Location.deserialize(java.util.Map)' of class org.bukkit.Location for deserialization java.lang.IllegalArgumentException: unknown world
code:
private FileConfiguration homesConfig;
public FluffieCraft_Commands() {
homesFile = new File("plugins/FluffieCraft/fcc_homes.yml");
homesConfig = YamlConfiguration.loadConfiguration(homesFile);
}
private void saveHomeLocation(UUID playerId, Location location) {
String playerIdString = playerId.toString();
homesConfig.set(playerIdString, location);
saveHomesConfig();
}
private Location loadHomeLocation(UUID playerId) {
String playerIdString = playerId.toString();
if (homesConfig.contains(playerIdString)) {
return (Location) homesConfig.get(playerIdString);
}
return null;
}
private void saveHomesConfig() {
try {
homesConfig.save(homesFile);
} catch (IOException e) {
e.printStackTrace();
}
}```
rest is a way of creating standards for applications to communicate between each other.
It builds on http which makes it the goto communication scheme for applications on the web.
You can use REST to let two applications speak to each other, regardless of what language each uses.
Commands where used:
Player player = (Player) sender;
UUID playerId = player.getUniqueId();
Location homeLocation = player.getLocation();
saveHomeLocation(playerId, homeLocation);
String format = "%s[%s] %s%s";
String formattedMessage = String.format(format, ChatColor.GREEN, "FluffieCraft", ChatColor.WHITE, "Home point installed successfully!");
player.sendMessage(formattedMessage);
}
if (command.getName().equalsIgnoreCase("home") && sender instanceof Player) {
Player player = (Player) sender;
UUID playerId = player.getUniqueId();
Location homeLocation = loadHomeLocation(playerId);
if (homeLocation != null) {
player.teleport(homeLocation);
String format = "%s[%s] %s%s";
String formattedMessage = String.format(format, ChatColor.GREEN, "FluffieCraft", ChatColor.WHITE, "You have been successfully teleported home!");
player.sendMessage(formattedMessage);
}
else {
String format = "%s[%s] %s%s";
String formattedMessage = String.format(format, ChatColor.RED, "FluffieCraft", ChatColor.WHITE, "You don't have a home point yet!");
player.sendMessage(formattedMessage);
}
Pretty descriptive exception right there. The world of this location is not known to the server.
How might I go about having it automatically install it/
If the server has python installed then you can just dispatch pip install libretranslate
But what do you need this for?
that's the problem
i tried that but i can't tell which scheduler i'm supposed to use
i tried using runTaskLater but according to my friend it only fires once
PS: You should refer to yml files in your plugin folder using JavaPlugin#getPluginFolder()
So
JavaPlugin yourPlugin = ...;
File someConfigFile = new File(yourPlugin.getDataFolder(), "fcc_homes.yml");
Iβm considering developing an open source plugin to translate chat messages, using this language translation api
in yourPlugin i need write plugin name?
No, its an instance of your JavaPlugin class.
runTaskTimer will start a repeated scheduled task.
Just make sure to stop it at some point.
private File homesFile;
private FileConfiguration homesConfig;
public FluffieCraft_Commands() {
homesFile = new File("plugins/FluffieCraft/fcc_homes.yml");
homesConfig = YamlConfiguration.loadConfiguration(homesFile);
}``` maybe it's a problem?
ah i see
i'll give it a try
PS: Remove any while loops
i need the while loop for the BlockIterator
that's just something i can't avoid
Then you will instantly traverse it to the end
that was my main issue
i'm simply trying to slow the loop down
You can iterate the block iterator using a scheduled task, without a loop
mb i need create def for homesFile and homesConfig in @Override for commands?
public class BlockIterationTask extends BukkitRunnable {
private final BlockIterator iterator;
public BlockIterationTask(BlockIterator iterator) {
this.iterator = iterator;
}
@Override
public void run() {
if(!this.iterator.hasNext()) {
this.cancel();
return;
}
Block nextBlock = this.iterator.next();
this.nextStep(nextBlock);
}
private void nextStep(Block block) {
// Do some stuff with the next block in your iteration
}
}
...
JavaPlugin plugin = ...;
BlockIterator iterator = ...;
int delay = 0;
int period = 5;
new BlockIterationTask(iterator).runTaskTimer(plugin, delay, period);
thank you!
Example on how to iterate via a task with 5 ticks delay between iterations
i really appreciate it
@lost matrix help pls
?learnjava moment
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Your problem is that you are refering to worlds which are not known to the server. Thats the main problem you should fix.
wtf??? i have only one world
Then make sure this world is loaded when you load a location.
Depends on what you are doing
bruh.. i need this code for save home points.
for all players
When a player joins: Load his home point
When a player quits: Save his home point
While a player is online: Keep all home points in a manager class which manages a Map<UUID, HomePoint> which maps each
online player ID to a home point
Looks like this should work. One thing i would def change is
return (Location) homesConfig.get(playerIdString);
to
return homesConfig.getLocation(playerIdString);
When does your exception occur?
mm naming stnadards
@lost matrix it worked! thank you so much
@lost matrix thanks, it's worked.. and really, how to make sit and lay without protocollib?
For sit you can spawn an invisble, temporary armorstand and mount the player on it
what the f***?
if firstrun, it's working, restarting server - this error again
rewrite this code please someone
Error while you start the server?
yes, if you first running server without config, all good, else crash with error
Use the onEnable to load your config and not the constructor of your class
oh... i forgot about this