#help-development
1 messages · Page 346 of 1
I would suggest
I found this
is it true? is data really fast to store in a json file? is sqlite better?
CommandSender not Commandsender
Because it's really important when You need for asking for help because they Will explain You really technnical the things and You wont understand
But learn the básics
okay
yeah but im still having the problem with public class CommandKit....
Json is fastest when you’re talking about storing data as a text file that’s human readable yes
But not compared to a proper data store or storing as binary for example
ok so sqlite is better
?
Also You should know when You should use Sq and NoSql, there are áreas where one is faster than the other. But all depend on the encironent You are You are using
I think that also refers to that so many people know these famous json java libs, so the coding process does not take too long
“Better” requires you to define what you want
What are you looking for
Once you fix CommandSender it will fix the class
rapidity in querying a lot of information in a database
but its telling me the same error with the class?
Then yes SQLite is better
size isn't that big of a deal
Paste your current file
@upbeat hornet You cannot said that a database is better without context, because some database are better for some enviroments
what you mean?
Send your code
well that's why i'm asking in spigotmc instead of java
oay
Now that you’ve fixed the error
package de.hardy.test;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public final class Test extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("onEnable is called!");
this.getCommand("kit").setExecutor(new CommandKit());
}
@Override
public void onDisable() {
getLogger().info("onDisable is called!");
}
}
public class CommandKit implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
// Here we need to give items to our player
// Create a new ItemStack (type: diamond)
ItemStack diamond = new ItemStack(Material.DIAMOND);
// Create a new ItemStack (type: brick)
ItemStack bricks = new ItemStack(Material.BRICK, 20);
// Give the player our items (comma-seperated list of all ItemStack)
player.getInventory().addItem(bricks, diamond);
}
return false;
}
}
how do i change the ram on the spigot server
There’s still a decent amount of variety in Minecraft servers to make different databases better in different contexts
But if you want to query large amounts of data any database will be better than storing it as json files
I'm looking to store 1K+ dict(or hashmaps whatever) but all of them with relatively small size, and they need to be changed quite regurlaly
And what errors are you getting now
Class 'CommandKit' is public, should be declared in a file named 'CommandKit.java'
Class 'Test' is never used
so can i move the class to CommandKit.java?
you cant have inner public class in java
?learnjava
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.
Please i need recommendations for creating a custom tab completer for a command framework i'm creating
?
hello, can someone please help me how can I fix this problem in bungeecord minecraft server
02:06:46 [SEVERE] [
<-> Initia
lHandler - encountered exception: net.md_5. bungee.u til. QuietException: Unexpected packet received duri ng login process! 0a0d0a000d0a515549540a2111
JanTuck, I was planning something like:
Completer completer = Completer.Empty();
completer.register(0, List.of("suggest-1", "suggest-2"));
completer.register(1, List.of("true", "false'));
completer.complete(args);
Look at what ACF does.
Oh ok
abstract class CommandBase<T>(name: String) where T : SlashCommandData, T : SubcommandData
Can i even do smth like this in kotlin
according to docs, i should be able
is this just ij being goofy or what
@rotund ravine kotlin
yeah, looks like i misread docs smh
Jda le javacord?
jda
hate that SlashCommandData and SubcommandData doesn't have common interface
Haven't played much with generics.
Agree, i would did something like:
CommandData -> Normal commands
SubCommandData (implements/extends CommanData)
or smth like CommandData as common interface and both SlashCommandData and SubcommandData implementing it
or even abstract class
Yes
Goksi is there is any diff between using interface or abstract for this usage?
I always asked My self when i really should use interface or abs class
probably, as both slashcommand and subcommand have options, so it can be same implementation
no need to write it two times
also both have description
and ig json payload for discord api looks same, so it can be same impl
just assumption tho, there is probably reason they haven't done that ¯_(ツ)_/¯
hi
i am trying to change the display name of an item but it just won't work and i cannot figure out why
private ItemStack createRenderItem (boolean bool, ItemStack item) {
ItemMeta meta = item.getItemMeta();
String displayName = meta.getDisplayName();
meta.setDisplayName((bool ? "§a" : "§4") + displayName);
item.setItemMeta(meta);
return item;
}```
boolean currentBoolean = ChunkData.getBoolean(boolIndex.intValue(), this.booleansBitmask);
Bukkit.broadcastMessage(currentBoolean ? "true" : "false");
ItemStack renderItem = createRenderItem(currentBoolean, this.inventory.getItem(inventorySlot));
Bukkit.getScheduler().runTask(ChunkClaimsPlugin.getThisPlugin(), () -> {
setGUIItem(inventorySlot, renderItem);
});```
How do i change the display name of an item in an inventory?
it works when i try to change the item itself, i tried doing setGUIItem(inventorySlot, createItem(Material.CAKE, 1, "test"); and it was changing the actual item in that case.
but
Hey, has anyone created a plugin that allows users to add an object from a yml file in the console, to an arraylist and from in-game
it does not seem to update when i just change the display name.
does your thing write §a or the color doesnt change at all?
I tried creating that but not working as expected
the color doesn't change
the boolean changes
try with the chatcolor enum
i am printing the boolean in the bukkit.broadcastMessage thing
it changes so the boolean is not at fault
what is that?
bool ? ChatColor.GREEN + "" : ChatColor.DARK_RED + ""
okay.
does anyone here happen to know if the itemstack serialization on spigot support the new goat horns?
I have looked how ACF but i still cannot create a proper implementation, I'm mixed a Lot
the item display name color still won't change!
i dont even understand why
this is like
i have written code that is supposed to what i want it to do but it wont
and it is causing me an actual headache at this point
do you set the meta again
public static ItemStack createItem (Material material, int count, String name, String... lore) {
final ItemStack item = new ItemStack(material, count);
final ItemMeta meta = item.getItemMeta();
meta.setDisplayName(name);
meta.setLore(Arrays.asList(lore));
item.setItemMeta(meta);
return item;
}```
If you dont update the meta, the data you are updating wont change
yep, i am updating the meta.
make item meta not final
final Is used I'm Java to tell that a field Will be initialized and wont change
it still wont update the display name!
this may look like a simple problem but i had a really tough time narrowing down what the problem was
and it turned to be minecraft not updating display names
because i had sql operations running in the background and internal values updating.
and it was a pain to finally figure out that minecraft was screwing me away.
Anyone know why whenever I install a dependency it's always missing the dependencies of that dependency?
does that make sense
Well, never run io operations sync
Like when I use Redisson its always missing EPoll classes and other stuff
i am not running db operations on the main game thread.
i never do that.
if (this.chunkData == null) {
if (chunksTable == null) {
chunksTable = new ChunksTable();
}
this.booleansBitmask = ChunkData.changeBoolean(boolIndex.intValue(), this.booleansBitmask);
chunksTable.setBooleans(this.booleansBitmask, this.chunkCoordX, this.chunkCoordZ);
} else {
this.booleansBitmask = chunkData.changeBoolean(boolIndex.intValue());
}
boolean currentBoolean = ChunkData.getBoolean(boolIndex.intValue(), this.booleansBitmask);
Bukkit.broadcastMessage(currentBoolean ? "true" : "false");
ItemStack renderItem = createRenderItem(currentBoolean, this.inventory.getItem(inventorySlot));
Bukkit.getScheduler().runTask(ChunkClaimsPlugin.getThisPlugin(), () -> {
setGUIItem(inventorySlot, renderItem);
});```
Then it shouldnt effect Minecraft updating names
Is setGuiItem database call?
that is why you see the Bukkit.getScheduler().runTask(); function here, everything before that ran in an async function.
public void setGUIItem (final int index, final Material material, final String name, final int count, final String... lore) {
ItemStack item = createItem(material, count, name, lore);
this.inventory.setItem(index, item);
}```
FYI, runTask is used for running code on main thread
public void setGUIItem (int index, ItemStack item) {
this.inventory.setItem(index, item);
}```
this is the one
i have a function overload of that function name, that is it.
Maybe because the dependency you are installing have their parent dependencies with scopes provided/compile which arent download Kg I'm not wrong
yeah, i know that, i was updating the inventory in the main game thread in case minecraft does not like those updates in async functions.
Smh me not reading again, sorry
I'm also using Kotlin with Groovy if that makes a difference
anyone need software or website development services?
i am using Bukkit.getScheduler().runTask() to push the task to the main game thread from the async thread.
saas specialist here folks
yes
That should be posted a spiot blog
Who
I dont understand that doesn't make a diff
bruh, how do i update the display name..????
Associatimg your spigot acclunt, Will name you as spigot account name
And of you want to change spigot site name, you have to Donate
Of an item 😂
okay i just realised something
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Lmk if you find problem, your code looks good to me
nope!
bruh i just dont see it
what did i even do that makes it not do what i want it to do why
private ItemStack createRenderItem (boolean bool, ItemStack item) {
ItemMeta meta = item.getItemMeta();
String displayName = meta.getDisplayName();
meta.setDisplayName((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
Bukkit.broadcastMessage((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
item.setItemMeta(meta);
return item;
}```
lets see what this prints.
btw
i wanted to ask this for a while
but did not ask it yet idk why
but
is there a way to like compile the plugin and launch minecraft or just not have to launch minecraft?
so the way i am doing it is that i am compiling the plugin, copying the .jar file over to a server.jar plugin directory and restarting the server
everytime i compile
is there a better way to do this?
okay i think i found my problem
it is the createRenderItem() method.
You can compile the plugin directly on the plugins folder of your server
How can I specify the outputDirectory only for packaging a jar?
http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html this shows all parameters, but how can I set them in the commandline ...
I would configure an IJ enviroment so whenever you compile, your compiled jar ks put inside the plugins directory and also configure the Sever, so you can Start it from IJ
boolean currentBoolean = ChunkData.getBoolean(boolIndex.intValue(), this.booleansBitmask);
Bukkit.broadcastMessage(currentBoolean ? "true" : "false");
ItemStack renderItem = createRenderItem(currentBoolean, this.inventory.getItem(inventorySlot));```
private ItemStack createRenderItem (boolean bool, ItemStack item) {
ItemMeta meta = item.getItemMeta();
String displayName = meta.getDisplayName();
meta.setDisplayName((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
Bukkit.broadcastMessage((bool ? ChatColor.GREEN : ChatColor.RED) + displayName);
item.setItemMeta(meta);
return item;
}```
Please if you Will paste long code use
?paste
You can use String.valueOf for boolean instead of ternary
I just don't understand why name isn't changing for you, if all methods are called correctly
:-:
Dude, like, chill out for a second, I'm already searching your bug... Let's bet that "iT is JaVa beINg WroNG" won't hold till the end...
sorry
ok in hindsight this is not the place where i should be throwing a fit, sorry for being a nuisance.
Your problem is pretty messed up, if I'm right.
it is indeed.
You get the existing displayname, append a leading color-change and set it again. All while operating on the same item all the time. You probably keep on appending more and more color-codes to the head of the displayname which all get overriden by the last color code (first call).
Print something like displayName.replace('§', '&') to check if that's right.
You’re correct
Lol
You could solve that by stripping colors first, but I think that you should just have the vanilla string without colors somewhere else
That why i prefer working eith menús using a menú api, so them i dlnt have mostly this issues. Because you dont really mess with thousans of lunes for menús
Well, it kind of requires you to simulate the code in your head, xD. I'm not sure if you're used to doing this while writing it, as most people just like to relay that part to the actual computer.
Sorry for Ting but cellphone it's a mess corrdct what ever write
ok i am sorry i am indeed very blind, i will go back to fixing the problem. Sorry for wasting everyone's time.
You didn't waste my time. It was actually a nice little change from the stuff I've been working on for hours straight before helping you. I needed a break anyways, xD
its so obvious yet so well camouflouged in one's plain sight.
what a conversation
I'm my case beforr writing, i take around 30m-1h to think the lógics/models i can follows for doing that
It's pretty help a Lot
.
Lmao i thinking I'm really useless i have 30m actually trying to write my tab completaron logic, till haven't write a class Imagine tho
😡💀😂
I'm really wondering whether compression could speed up my video streaming process, or slow it down, xD. There's only one way to find out, I guess.
So, I'm trying to constantly spawn a particle when a player is nearby a location and I want to stop it if the player is no longer nearby the location, all works fine except that the BukkitRunnable doesn't stop. This is my code:
Location particleloc = new Location(world, -46.5, 111.5, 51.5);
if(loc.distance(particleloc) < 12) {
new BukkitRunnable() {
public void run() {
if (loc.distance(particleloc) >= 12) {
this.cancel();
return;
}
p.spawnParticle(Particle.END_ROD, particleloc, 5, 0, 1, 1, 0);
}
}.runTaskTimer(plugin, 0, 20);
}```
Probably is because the `loc.distance(particleloc) >= 12)` condition can't be reached at all, but I don't know how to do it right.
Also, if there's a better way to do this tell me :)
use the scheduler to hold task id so you cancel that way
but what you should do for your task is to instead reverse the condition
if the condition is met, then spawn particle
otherwise if not, it will won't hit the if statement and will return anyways
how do i check if a chunk is loaded or not?
isLoaded()
well well
if they already have a Chunk object, it's probably loaded
since getChunk() loads it
World#isChunkLoaded(...)
declaration: package: org.bukkit, interface: World
x and z are chunk coordinates
so basically chunk X = blockX / 16
depends, chunks can unload
depends in how they are obtaining chunk object that is
Ah @dry yacht you still have to help w/ the hologram positioning stuff lmao
How can I get the shield item from player inventory?
true
getEquipment().getItemInOffHand()
how to get inventoryMoveItemEvent for a custom inventory, not the player inventory
check if the inventory in question is not instance of player inventory
but if you want a specific inventory you might check its title or use custom inventoryholders (even though it's a bukkit API misuse)
How usually people send players to empty server from a pool? Have i parse bungeecord api response?
I hope someone knows
How do i check on rightclick if players heald item is horse armor
#do stuff
ChatGPT says i have to install bungeecord api plugin to my server
But i cant find it
Xd
Well it doesn't exist
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
can you elaborate or clarify?
I have few minigame servers and lobby server, i need to send players to empty minigame server from lobby when the event happeds
Seems straight forward enough. Just get all the servers, check the player count, and if empty, send them there.
Where exactly i have to do it?
do you not know the ip addresses of your servers?
Depends. Is this part of a plugin for the server or is this supposed to be a bungeecord plugin?
well they have a lobby server
wouldn't recommend a plugin on the bungee
all they need is a plugin on the lobby server to do this
Oh, fair enough. Then the messaging channel is what you'll need to use.
you can use messaging channel or you can use server list ping
server list ping won't work if you have firewall rules, but you can just use a vpn for it to still keep things secure, if the lobby server and mc servers are on the same host, its a non-issue anyways
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Okay ChatGPT says i have to get player count via parsing http request
chagpt is referring to what I said
Doubt that you can actually do that. lol
server list ping
You mean through the query port?
or you can do that too
anyways, just go with which ever you like better 🙂
we are not here to tell you which you should use, all three things are valid
I'd recommend the messaging channel as it's the most reliable.
not sure about most reliable, its probably the most documented with examples
Oaky thanks
so your choices are query port with http request, server list ping, or plugin message channel
its always good to have options 😄
Hey frost, do you remember a while ago when you and itzdlg were helping me make that mysql table for hug interactions?
Well, I think I kinda screwed up and actually needed that 3 table setup. I got it made, but I was wondering about inserting data.
It seems that I would need multiple queries and I wasn't sure if that was the right approach.
why is playervelocityevent barely ever called
i started falling, and for the duration of the fall only one pve was called
i'd assume it were called every tick?
i'm trying to detect a fall (so i'm seeing if velY = 0)
are there any other ways to do it
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() == Material.IRON_HORSE_ARMOR) {
player.sendMessage("hey");
}
}
}```
Can eny one help me with this on right click event? I want to make a gun that shoots snowballs, but i cant get it to send the "Hey" when i right click an iron horse armor. It dosnt send it
looks good to me, are you sure you've registered the event?
i think yeah
try to debug step by step then
don't worry about it
Cause it's not called anywhere in the project. That check is for project use. It doesn't take into account that it will be used by something else.
How can I get player heads without lag?
Well I tried saying this, but I was told I was wrong 😛
hey frostalf
any ideas on this?
idk it still dosnt send "hey"
it is barely called because the client doesn't inform the server about velocity, instead the server makes use of the player position packets to determine velocity
should i make a per-tick scheduler 🤔
it gets called at the start of the fall unfortunately
so to get around this you need to make your own task called every tick or if you want to save on cpu, you could make use of vectors to pre-determine where they will land and in how much time
sounds like pain :sip:
forewarning when I come up with the appropriate solutions and the precise ways to do it, I tend to forget such conversations and ways I was explaining 😛
so, caveat for those who decide to not head my infinite wisdom sometimes XD
jk, don't have infinite wisdom but the warning part still valid lmao
[11:38:29] [Server thread/ERROR]: Error occurred while enabling Moul v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Plugin already initialized!
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:255) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at me.roustytousty.moul.Gun.<init>(Gun.java:12) ~[Moul-1.0-SNAPSHOT.jar:?]
at me.roustytousty.moul.Moul.onEnable(Moul.java:13) ~[Moul-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:371) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:544) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:578) ~[paper-1.19.3.jar:git-Paper-386]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:492) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:635) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:434) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:301) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1101) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316) ~[paper-1.19.3.jar:git-Paper-386]
at java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: java.lang.IllegalStateException: Initial initialization
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:258) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at me.roustytousty.moul.Moul.<init>(Moul.java:7) ~[Moul-1.0-SNAPSHOT.jar:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source) ~[?:?]
at java.lang.reflect.ReflectAccess.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source) ~[?:?]
at java.lang.Class.newInstance(Unknown Source) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:83) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:154) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:413) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:321) ~[paper-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.loadPlugins(CraftServer.java:436) ~[paper-1.19.3.jar:git-Paper-386]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.19.3.jar:git-Paper-386]
... 3 more```
lol. Do you think you could take a look at what I've got currently? I tried to follow your original example but am not quite sure I got it right.
are you creating a new instance of your main class
I don't even remember my original example. I do remember we talked about it and I don't even remember exactly why I said you needed 3 tables
something something keys
I need to re-look at the chat for then XD
idk i have only 2 classes
oh no I remember now
It was for keeping track of interactions involving multiple people.
you needed a function
in your code do you ever call new Moul
This is what I interpreted from your original example.
you need to create a function to populate the table for you so you don't have to manually send the query everytime to obtain the information
I dont think so
@Override
public void onEnable() {
System.out.println("[Moul] We are online!");
Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getServer().getPluginManager().registerEvents(new Gun(), this);
}
@Override
public void onDisable() {
System.out.println("[Moul] We are out!");
}
}```
Main class
Can that be done with the jdbc driver?
from memory, this would appear to be correct
yes, you should be able to create a function from jdbc driver
why is your main class extending a listener if it does not have any events in it
just have to ensure the user for the connection has appropriate perms to create functions
it did before. i didnt remove it tho
its asking me to safe delete my main class for some reason as a warning
This MySQL tutorial explains how to create and drop functions in MySQL with syntax and examples. In MySQL, a function is a stored program that you can pass parameters into and then return a value.
See, this is what I think I ran into. Cause right now, with manual queries, I would have to do something like this.
Basically, send the first query to make the first data.
Then the second query is just there to get the interaction id
The third one finally puts the data into the remaining table.
it does not know that the class is used
e.g. plugin.yml uses it
and generally deleting your main class sounds like a bad idea
yeah that is how it would need to be done without a function lol
Yea, that's annoying and seems like an area for data integrity issues.
well idk still same error
I see. Guess I gotta go down that rabbit hole now. :3
so you aren't gonna send the second class are you
the error is indicated at
at me.roustytousty.moul.Gun.<init>(Gun.java:12) ~[Moul-1.0-SNAPSHOT.jar:?]
at me.roustytousty.moul.Moul.onEnable(Moul.java:13) ~[Moul-1.0-SNAPSHOT.jar:?]
at me.roustytousty.moul.Moul.<init>(Moul.java:7) ~[Moul-1.0-SNAPSHOT.jar:?]
https://www.spigotmc.org/threads/tutorial-how-to-read-stacktraces-solve-most-of-your-plugin-problems-by-yourself.48121/ @icy monolith
it was a nice discussion that day though I will admit 😛
Oh you wanted the other class
It could have ended better though. :/
public class Gun extends JavaPlugin implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
player.sendMessage("hey1");
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = player.getInventory().getItemInMainHand();
player.sendMessage("hey2");
if (item.getType() == Material.IRON_HORSE_ARMOR) {
player.sendMessage("hey3");
}
}
}
}```
But it is what it is.
oh did it end badly?
why is it extending javaplugin
I don't remember that 🤔
extends javaplugin means that it's the main class of your plugin
there only should be one per plugin
oh
He was pissed at me because I failed to explain how I wanted to store and manage timestamps.
oh
oh oh right
I didn't know it ended badly at the end
anyways, whatever its the past now XD
Yea, it was kinda my fault. I just couldn't explain what I was trying to go for properly.
I suffer from random memory loss, so sometimes I remember and other times I don't but regardless I have stopped trying to fight it and just go with it 😛
amazingly my super long term memory is great
so in like 1 year from now
I will probably remember that discussion at length for some stupid reason because my brain said it was finally important to remember it
please remember that i have to take out the chicken out of the refrigerator in 7 years
remind me if you feel like it, too
I rarely remember discussions I have on the net
I am trying to make a different API jar for my plugin.
By googling, I got this(ss)
but the problem is my main plugin is obfuscated. thats why I am getting "cannot find symbol" error from API module
Exclude your API classes within the obfuscator
How that is done depends on the obfuscator itself
obfuscating java is pointless
because pretty much anything can be deobfuscated and you'll look like a fool
there is one obfuscator that does work decently
but obfuscation in java is pretty much a case of "don't copy & paste my code"
what's the point though
if someone wants to steal your code they will
That's what licences are for
yeah
GPL, remember
if you want to go to court over that chances are you may loose
so naturally you don't
the only valid reason to use an obsucator is if you have some kind of size restriction going on. In which case an obfuscator may just solve it
Thus making the license useless
yeah that's true
that's just proguard
but obfuscating to make your code inaccessible is silly
Well, there is things like hardware that uses java, embedded systems and all that
well you don't have infinite room
Most obfuscators absolutely annihilate performance and readability
And size constraints
So, an obfuscator is really good at reducing size
should I need to use the obfuscator plugin(proguard) on root pom or on the plugin's module?
readability isn't important once its on the embedded system
and decent obfuscators like proguard don't sacrifice too much in way of performance albeit depends which settings you use
I never worked with proguard (outside of RE-ing code obfuscated by it), so cannot tell.
Read the documentation I guess
I'd hardly consider proguard an obfuscator.
PlayerInventory inventory = p.getInventory();
int coalAmount = inventory.all(Material.COAL).size();```
Someone knows how i can check for charcoal?
Because in 1.12.2 Material.CHARCOAL doesnt exist
which one do you use? ._.
I don't use any.
Most of us here don't use obfuscators
I use skidfuscator premium but it is in beta so sometimes things dont work as it should
as I explained above there is really only some niche reasons to use them, and if your use case is because you want to stop someone from stealing code well an obfuscator has never stopped that ever. Look at minecraft, we been making custom server jars since version 1.0.0 of minecraft which is way before they were giving mappings
@tender shard your knowledge is required on this niche thing
That being said proguard does work. Getting stuff to a readable state can take hours and automatic tools are few are rare beyond. For some reason I have one of the few actually working deobfuscators for proguard
Mfnalex uses his own obf
I don't think that it is public
well, everything under 1.13 is goofy, so maybe it's COAL with some data?
Thanks, i will try it. I think its (short)1 as durability
would make sense though - you don't want it [the obfuscation] to be reverse-engineerd
it probably still will be, but it'll take longer
I have yet to come across any obfuscator that has prevented me from being able to tell what is going on in the program
Yes with tools such as SSVM it's inevitable but you won't see tools such as java-deobfuscator picking it up automatically
ZKM as far as I heard does work nicely
But with callsite obfuscation and stuff you first need to run an deobfuscator for it to be readable
well then again, us more knowledgeable peeps don't really have a use to reverse engineer something anyways because we usually have a pretty good understanding of how it works to just make it ourselves
Like, I could care less about some random plugin on the spigot site that realistically it isn't even worth my time to mess with it XD
Yeah - the only use for that are nefarious reasons. For other uses proguard does the job just as well
does messing with item nbt still required using nms code?
depends on which NBT
AFAIK, yes if you don't want to use an api like NBTAPI.
There is the PDC, but I'm assuming you need to modify other specific aspects.
there is stuff that can be modified with the API, others where technically you can use the API but you wouldn't want to and then there is stuff you cannot do
alright thanks for the info
Like the UnsafeValues class allows modification, and item attributes can be read and written rather easily. Then there is also the PDC. For the rest I am not aware of workarounds that purely work on the bukkit api
Does anyone know a good voting plugin?
Like if you vote for the server on a website you get a reqward
Votifier
ty
umm im not that dirty minded but
i get what you mean rn
lol
i should change it
lmao yeah
my plugin had (or still has?) an action called "player-give-head"
when i created it i wasn't aware of what it meant
omfg
this ui is so good
thank you dude you're godly
oh my god
fortunately i've set up my gradle in that way i can change the name by only changing one field
gradle ftw
i wonder if themes would work with this new layout
i don't even care anymore
this is too cool
atom material icons and this
and i'm fully set
has a mac-like feel lol
sorta
true
it so smooth
bold font is overrated
this is perfect
the font weight is right between the ugly bold and ugly thin
does anybody have idea how slot plugin in inventory can be done like items in inventory go down each 10ms or so and after 1 seconds spining stops and the player gets items
slot machine type?
yeah
maven is the same way
im not sure how should i make that spining animation
10ms is probably java threads
but if you are fine with 50 you can do schedulers
to understand how it works you need to understand how we perceive motion
anyways, the slots have id's
you would group the slots that are in line with each other
and then ever so many ticks, you would change the item from being in the slot it is in, the slot below it
and so forth
but you would do this for the entire row at once
or if you wanted slot wheels
at different intervals for the columns
this gives the appearance of spinning
i.e. decrement/increment the item's slot id by 9
yeah but like i would need to reopen the inventory for the item in slot to be changed or ?
no
yeah i see fine ty
have fun to creating your slot machine 😄
man i hate those dramas with mod loaders
and minecraft launcher
PolyMC was a fork of MultiMC that implemented mod support integration with curseforge and modrinth
and then came its own owner by banning all maintainers from the project
Modlauncher/LegacyLauncher is stupid, agreed
Quilt is nice as they maintain quiltflower
I am not entirely sure what mod loaders have to do with spigot o.O
(has nothing to do with me being on the QF dev team)
I use MultiMC as the Vanilla MC launcher is totally broken on Win 7
how is it broken on win 7?
I use PrismLauncher which is a fork of PolyMC which is a fork of MultiMC
its actually cool
why utf8 works from config files but not directly from compiled class?
integrated fabric, forge, quilt and mod support right away from launcher
Looks up the wrong address to download MC so fails to launch the client
need to use the escaped utf character code
one click to download whole fps optimized modpack
one click for to install mod from modrinth or curse
blame something not embracing utf-8
If you are using Java 17 or beyond it likely is your IDE
set source code encoding to utf-8
not sure why that would be broken on win 7, I use the old launcher
understood
but I am on win 10
im on win 10 too, but modified to suit my needs
i hate how win 11 doesnt allow to move the taskbar
No idea. I used to use it, until it broke. Deleted every trace of MC off my PC and installed clean. Still broken
which old launcher
the main reason im not upgrading it
the one after they update the old old launcher
how can you see and edit a player inventory in real time?
the last .jar launcher?
get player's inventory
and open it
with openInventory() method
maybe? I have an exe
I actually prefer MultiMC now. The vanilla Launcher had a bad habit of forgetting login info when you used multiple accounts.
it works i've tried
yes but I cant see his armor
is it just like a java swing app with a webview
but the exe is just basically a wrapper for that I suppose
yeah
well you cant
the old launcher is the launcher that is launched in old windows compatibility mode
there's no way to see inventory UI
that version... shouldnt work anymore though? lolwtf
by invoking code from the server
it has no msa auth and at some point they redid the jsons
are u using a modified one?
unless you want to map armor slots to some kind of other container UI
cant create a custom inventory and listening to events?
Not that launcher, there is a launcher just after that, the one they had for a while to allow multiple profiles
ohh
that is the one I use, not sure if it still uses jar for it as I never really checked
yeah - then it's the windows compat launcher
you can, but i think you would need some NMS to sync the opened gui, with player's inventory, since you need to fake it
oh that one like right before they updated made the microsoft store one i think
yes
seems there is too many launcher versions XD
there really are lol
anyways once I had the nice profile stuff though I never saw the reason to keep updating the launcher
bc then theres the one before the last JAVA launcher that i remember was used up to like 1.5.2
best way to open inventory gui with armor slots, is to invoke Custom relfected NMS 4x9 Notchian container, in which the last row is reserved for other inventory slots (offset, armor, etc.)
I remember that one
and god knows how many more before that one
oh, lets not forget the launcher from twitch too
hmm, thx you
yeah those are for packets
that confused me for a while when people were always asking me how to use the twitch launcher
lets not forget when Minecraft had twitch integration 
still wish they didnt remove it, was kinda cool
you can re-add it
licensing issues in a nutshell
I liked that it was there too
i wouldnt doubt someone made a mod
although you can do something like this
with NMS
by mirroring NMS player's inventory to custom NMS inventory view
with spoofed packet container type
you don't need nms for that
how would you do that
you would need to sync it with player's container
sure, not hard to do API side
but its already built in NMS
i wouldnt bother by creating bugs which you would need to fix, if prompted
Just grab players inventory object, mirror it to the containers inventory object
is how you do it from API
not all that hard and not sure why that would create bugs
you still could?
you would need to sync both containers
ofc you could
but i would be too lazy, i would let the server do that 😄
with some reflection wizardry
that is basically the hard way
the way I described, the server does it for you without reflection or packets or anything else
not sure how the API would create a dupe bug with that
you need to manually sync containers
you could miss some inventory actions
etc
and items could be duped
not as manual as you think
What do i need to do to add a command? I want a command that saves players location to a list. and then a command to teleport player to a random element of that location. I just dont know how to do the command part. ive never made a command before xd
objects are very versatile in Java
you are making it sound like copying an object in Java is some trivial thing
Inventory Types are different
type doesn't matter
check spigotmc.org, it has a tutorial
it does, slot numbers are different
for me personally digging up NMS is easier than to map all the slots to new places, and manually sync them,
ofc multiversion support is done
but still
it only matters if this is some dynamic inventory system and it appears it isn't. Therefore, since it is a chest inventory you can cast the inventory to the type you need
chest inventory is larger then the players so, you are good
Hey is it possible to have 2 implements in one class
as long as you count the inventory slots in the player slot appropriately, not hard to map it to a chest inventory slot numbers
yes
yea you can, you cant extend two classes tho
ie. YourCommand implements CommandExecutor, TabCompleter
i mismatched it
u can if ur an interface 
implements this,that
it doesnt count for me
just separate the classes with ,
At that point, you might as well just implement TabExecutor since it's an interface that already does that.
didnt know that class existed
I know you were talking about examples, but I just wanted to drop that.
can this code be shorter?
public boolean sameTeam(final Player player, final Player other) {
final List<Team> teams = player
.getScoreboard()
.getTeams()
.stream()
.filter(t -> t.hasEntry(player.getName()))
.toList();
if (teams.isEmpty()) return false;
return teams.stream().anyMatch(t -> t.hasEntry(other.getName()));
}
i feel like i'm reinventing the wheel
i dont think so
its short already
writing this without stream api would be way bigger
there's no point to call #toList though
true
i'll do that
public boolean sameTeam(final Player player, final Player other) {
return player
.getScoreboard()
.getTeams()
.stream()
.filter(t -> t.hasEntry(player.getName()))
.anyMatch(t -> t.hasEntry(other.getName()));
}
well that def looks much cleaner
ackchually
public boolean sameTeam(final Player player, final Player other) {
return player
.getScoreboard()
.getTeams()
.stream()
.anyMatch(t -> t.hasEntry(player.getName()) && t.hasEntry(other.getName()));
}
this could be probably further optimized by writing this with for loops or digging up the implementation of bukkit api, but this seems clean and cross compatible
btw i'm a bit confused on "default" values of the config - say I have this in my onEnable:
this.getConfig().addDefault("aoe-radius", 3);
[...]
this.getConfig().addDefault("friendly-fire", false);
what do I have to call to make sure that all default fields are present in the configuration?
ConfigurationOptions#copyDefaults(boolean)
FileConfiguration#save(File)
oh i haven't been calling save, that's why
isn't that the same as calling saveConfig()?
seems like it
im so happy that intellij removed that pesky gradle tasks sidebar
yea I never use the built in config methods cos I want to be able to handle the exceptions myself and know when they are thrown
is saveDefaultConfig necessary or does it have another purpose? i'm confused on the docs
oh makes sense
it also becomes green when i'm building
#saveDefaultConfig() only copies the config.yml from inside your jar file to your data folder iff there is no config file there
big thanks, i'll try it now
is there a tryitandsee in cafebabe
?tryitandsee
ah
imajin please wake up we need ?tryitandsee https://tryitands.ee
Hello everyone,
I am making a bedwars minigame plugin.
What do you think is the most effective way to reset the maps once the game is over?
And in your opinion, what is the way to prevent players from breaking blocks belonging to the base map but still being able to break those placed by them?
I have a list of locations, How do i select a random location out of the list?
it's called ambient mode, not glowing effect
Hey, I'm having problems in creating a plugin. I followed this instruction https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/ to see how it works in a nutshell. After "installing" (as said in the instructions) the plugin my server is saying "Could not load 'plugins\demo-1.0-SNAPSHOT.jar' in folder 'plugins'. Anyone know what could've gone wrong? I quite literally just followed the instructions and can't figure out what I did wrong
GeoL
why vscode
?paste the stacktrace
?paste the stacktrace
Damn, we straight up sniped each other.
Just generate random number from 0 to list size - 1
list.get(ThreadLocalRandom.current().nextInt(0, list.size()))
if it were to be made by me protection would be handled in a gigantic byte array
Why size - 1?
Nah, latter is exclusive
^
same
but
Hey I m having problems in creating a
I can't handle that by this way
Resetting worlds is a bit difficult but I'd use the slime world format which probably has some way of doing it
oh sure you can. Have a gigantic bitmask to mark natural blocks, another bitmask to mark breakable blocks and the rest could be used to identify team allegiance (i.e. beds can only be broken by one team, etc.)
Alternatively you could use the whole byte to mark which teams can break which blocks - probably wiser approach
And if you need more than 8 teams use int, which supports up to 32 bits and thus teams
I was thinking of creating a copy of the world map once the game gets started, but...
Maybe it might become too heavy as task?
If even that isn't enough use longs which should defo be enough.
But at that point the map would be so large that such an approach is nonsensical
for the purposes of resetting the world I'd use a library that is dedicated to it, there definetly is one out there
nope
clone the (unmodified) world, transfer the players to it and delete the old (already used and useless) world
Do note that this is not anvil but rather the slime world format
create a master world, plugin copies that to another directory then loads it for use, when game is done it deletes it and does it again
and if you need multiple worlds for multiple games, just append a unique id to the end of the world folder on each copy
So, I can do that copy-thing using SlideWorldManager?
ok but how would i do that?
@Override
public void run() {
Location map = playerLocations[random.nextInt(0, list.size(playerLocations))]
for (Player player : Bukkit.getOnlinePlayers()) {
player.teleport(map);
}
}```
Like this? well it sends error for ``random`` and ``list.size``
sure
SWM uses a different world format which is meant for smaller worlds as far as I know
hmhm, what about renaming the world with an UUID?
cool
copying worlds through the folder brings up the issue of having duplicate world UUIDs
frost, do you know how a way to protect the base map from players?
elaborate?
so prevent them from breaking map blocks
uuid is generated via its name
oh
I thought it would store it in the uid.dat file
i thought tas would stand for something else lol
what is the purpose of uid.dat then?
hm ?
no the uid.dat is randomly generated if it does not exist
Do you have any ideas?
like in the world you want loaded?
?learnjava
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.
Either check if there is already a block in the original world which you keep loaded at all times or you just have a boolean for each block to note whether they can be broken or not
easier option then that
also this @icy monolith https://www.spigotmc.org/threads/so-youve-been-told-learn-java-first.560602/
lmao, that needs to either be added to the ?learnjava command or we need another command for just that.
?learnjava!
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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
Have you ever played in Hypixel's bedwars?
You can't break blocks in the map
I would like to know how to do the same in the map that was copied and will be used in the game
load up a test server with your map, create the regions you want with worldguard, copy the world guard data to the game server. Just because you are loading/unloading worlds doesn't mean you have to delete the plugin data too 😛
still best post https://www.spigotmc.org/threads/guide-beginners-guide-on-improving-your-codes-performance.396161/
maybe attach a timestamp to blocks? and see if it was placed before/after a certain point
they most likely keep an array somewhere in memory to note who placed which block
yeah a list of locations/blocks would be better
mhmhm... Isn't it too heavy?
And the answer to this, is no
try it and measure the timings ig
1k by 1k by 256 is just 1 GiB of memory - not too dangerous
not to hold locations
The tremendous size is the location
its like 200mb if anything
I'm still planning it, the bedwars are quite complex so, I would avoid starting programming without "looking at a plan"...
oh ok
Plus your worlds are likely not 256 blocks in height and you could use lazy allocations to reduce passive memory consumption
probably not going to be at y 0 either possibly
if you are going to use locations, not blocks, you can create a lighter location class without yaw & pitch
so you could clamp the locations as well
YOU GOTTA BE KIDDING ME
block locations doesn't have that anyways
https://github.com/Geolykt/Presence/blob/main/src/main/java/de/geolykt/presence/common/util/RegionatedIntIntToObjectMap.java try to understand the gist behind that class and then we can talk
hey got to finally use this somewhere lmao
looking at raw o notation performance will lead you astray
it really depends on your use case
what do they mean by next()?
LinkedX was more performant ages ago, but now it's slower
I don't see anything wrong with using the method I had mentioned earlier anyway
hmhm
CPUs are faster than RAM, linkedX was useful when RAM was faster than CPU
for example, while something might be O(1) and something else might be O(N) the latter could still be just fine because CPUs are insanely fast that it wouldn't matter anyways
the only time you really need to take this into consideration is when you are dealing with really large data sets
on small data sets it just doesn't matter
Also note that k/n should generally be near 1
^
I had a youtube video where someone explained this really well
where they made something and people kept complaining they didn't make use of the most efficient thing
but in the end it didn't matter because the difference was like microseconds
alrighty thanks guys
let me see if I can find it
Kickstarter link: https://www.kickstarter.com/projects/annarettberg/meow-the-infinite-book-two
This was a presentation I gave to the University of Twente in early 2021. It's a case study of how simple, straightforward coding can turn several thousand lines of code and 10's of seconds of runtime into a few dozen lines of code and a sub-second ru...
wait thats 2 hours
not that one
There are also algorithms that are O(2^n) while another that does the same stuff is like O(n^1024+n^1023+...). The O(2^n) may be faster for small sets (purely looking at the big-O-notation), but for larger ones the polynomial algorithm fares better
(or was it the other way around? Idk.)
Too lazy to compute such large numbers
no, it was a short 20-30 minute video
wait geol
So... I need to install in the plugins folder SlimeWorld to use its API
right?
yep. also note that this is NOT ANVIL
I cannot stress this enough since I know that you think that it is anvil
found it
Have you ever analyzed your algorithm and found out that it runs in O(n^2) and thought to yourself, "man I'm a crappy programmer...". Well, you are! But not for the reasons you think! If you think Big Oh = performance, boy have I got news for you. In this video I try to dispel this fallacy that programmers have assumed, that Big Oh complexity eq...
damn, I can't install third-party plug-ins, I was asked to do a "core"
that video I linked is really good to watch for those that like to always ask about most efficient methods XD
Fun fact: Hypixel uses that world format - in fact they developed it
Indeed, they simply didn't need all that extra data
I recommend people to just create their own sometimes though
as use cases vary
So, are you suggesting that I should sacrifice creating a core plug-in in favor of performance?
why isnt this ^ code kicking me after 2 seconds of unactive?
Well I'm telling you that you should sacrifice running on yatopia in favour of running some other experimental paper fork
shudders
yatopia?! What's that?
TimeUnit.MILLISECONDS maybe this is the issue
the laughing stock of the minecraft server admin community
Most unstable paper fork to exist. Was abandoned a few months ago (perhaps even a year ago by now)
must have not been notable enough for me to hear about it
It basically combined all patches of many paper forks into a paper fork
without any QA testing
I've seen a few Yatopia forks on mcm (bbb)
I can only imagine the amount of issues they must contain
at least Yatopia was free
Why is that issue?
wdym
Olivo! I needed you.
I wanted to know what you would suggest to do to protect blocks in a bedwars map to prevent players from destroying map blocks?
told you the easiest option
^^
I am also interested to know your opinion, I'm still in the planning stage
store all blocks placed in memory
Yeah just track all placed blocks
your players are not going to place a million of htem
ah ye that one
easier to track what they placed, then what the map already has 😛
I
want
to
prevent
them
from
breaking
MAP
blocks...
So just as worldguard does
isnt 2k millisecond 2 second?
correct, if the block they are trying to break is not in the tracked list of blocks placed
Im not talking about resetting the map
they don't get to break it
easiest way: make them only be able to place and break wool
there is more blocks in the map then there is of players placing them
and since you are only concerned about them placing, just only track that
thank y'all 🙂
why inst this working
you are kinder than you should be, thank you for you patience frost
hi. how do I get the exact block the player is looking at here?
I am using Location distBlock = player.getEyeLocation().add(player.getEyeLocation().getDirection().multiply(5 + (selection.depth + selection.width)/4)); but it seems to be hella inaccurate
Player#getTargetBlock()
geteyelocation actually gets where your eye is
this gets the targetted block, not the block xy blocks far away
What about Player#getTargetBlockExact(int maxDistance)?
well, I think I have explained that bad. These blocks do not exist really, I want to get (air)block the player is looking at xy blocks far away
?
then why isnt anyone helping
this is what should be used over the other one you suggested
@charred blaze
^
Pluggg#5737 definitely regrets to for the most part inform you that unfortunately, they essentially are unable to definitely assist with definitely your enquiry, which essentially is fairly significant. Please simply really ask again later or possibly kind of ask someone else about this enquiry, demonstrating that the person that ran this command generally regrets to kind of inform you that unfortunately, they for the most part are unable to generally assist with actually your enquiry in a subtle way. Thank you very sort of much for kind of your time and the person that ran this command specifically wishes you a really good day, so the person that ran this command really regrets to actually inform you that unfortunately, they literally are unable to definitely assist with very your enquiry, or so they particularly thought.
since the former would yield air after like 5 or so blocks
tf is cba
Probably should have started with that one yea...
yeah i realised that but i think they are ignoring me more
Can't be asked
or they are busy with something else ;-;
looks like spam that command
are you sure your task is being executed?
also, remember some things in the API are not thread safe
Wdym they don't exist? Packets?
its not executing thats why i posted it there (the scheduler)
I do not want to care about anything in the world. Just set the block x blocks away from the player in the direction it is looking at
Anything else in the method executes perfectly. It sends me numbers
ok
second, have you tried using execute?
oh no no no
im accessing the method from other listener's class
whats wrong
put overwrites it so no need to remove
doesn't mean you are using static appropriately and it just may be that static is your issue lol
a
since you don't seem to understand its repercussions
so many things wrong there
what is repercussions?
can you tell me
its a synonym for consequence
re·per·cus·sion
/ˌrēpərˈkəSH(ə)n,ˌrepərˈkəSH(ə)n/
Learn to pronounce
noun
plural noun: repercussions
1.
an unintended consequence occurring some time after an event or action, especially an unwelcome one.
"the move would have grave repercussions for the entire region"```
what is exactly wrong in the code?
is there a particular reason why you are not using bukkit scheduler?
yes actually
can i cancel bukkit_s scheduled thing if i want after some time?
yes
how
when you schedule the task you can store the task id for later
you can also cancel tasks inside themselves too
or store the whole task
wdym someone can know what is in my hashmap?
just depends how you are wanting to cancel the task
that isn't what they are referring to
I just realized. What's with the extra math on the #multiply?
player.getLocation().add(player.getLocation().getDirection().multiply(5)); should get you the block that is 5 away from the player's looking direction. You can use that location as a basis for whatever you need next.
read it on the google but how do i get task id of scheduled task?
?scheduling
its just as inaccurate
int taskId = (scheduler code)```
thx
then you invoke the scheduler api methods using that task id
to do things
like checking if the task has been executed yet
or cancelling
which event is fired if i rightclick a firework?
see how hella inaccurate this is
I'd probably call that lens distortion
blocks are tiled but your camera is not
so innacuracies pile up
I'd use a BlockIterator
and just get the last element
what are you trying to do? recreate sniper voxel?
just a needed part of my system
I want to get the block instantly when going over the edge of the block visually in first-person
so you want to know the block the player can see regardless of distance?
distance should always be a variable that I can change
im using player.getEyeLocation().getDirection().multiply(5 + (selection.depth + selection.width)/4) for that, but yeah as I said thats HELLA inaccurate
obviously
depth and width are ints
Yeah, then you have the issue of integer division - should it not be intended
when combined are probably not a multiple of 4
so I cast it to double?
or divide by 4D
therefore for you are probably getting a floating point and its being cast to int thus loss of precision
it could be that integer division floors down the floating point values
just like that?: 5 + (selection.depth + selection.width)/4D
1sec imma try that out real quick
you could ceil or use double or float
but that shouldn't solve anything outside of distance not matching
nop still the same
man my internet suddendly feels so slow
getServer().getPluginManager().registerEvents(new AFKListener(new AFKManager(this)), this);
can i do this? getting instance of class in another class
its not as if my download speed is bad, ping is hella bad, its like 10k ms
unlikely
Use JavaPlugin.getPlugin(AFKListener.class) instead
Unless you are ABSOLUTELY sure that this is what you intend
uhm no?
no to what?
I don't really understand your math
someone told me to remove statics from AFKManager i did but i cant use the methods from another class
so I can't help all that much
yeah, I fricked up the order of arguments in the #registerEvents method call
public keywords?
