#help-development
1 messages · Page 1818 of 1
1.18
which one should i use?
instance.getLogger().log(
Level.INFO,
"Successfully loaded the items file!"
);
or
instance.getLogger().log(Level.INFO, "Successfully loaded the items file!");```
i feel like the first one is more readable but idk
Yo this is a weird question but I have to ask it. In memory and CPU wise, is it better to save an array of XYZ cords to check if a block being broken is in those cords, or is it better to put like a starting point and ending point on the cube then calculating if the broken block’XYZ is inside the cube?
depends on how big the area is
Let’s say a 25 radius
Is it possible to make a mob that will be in private where spawn of mobs will be prohibited?
i want to heal the player, but show the damage animation, if i did p.damage(-1f); will that do what i need?
i'd say to use a mathematical representation and write some collision check code to see if the block is within the shape
heal the player and damage by 0
or send a damage packet
i tried that, but it didnt work
aabb/cylinder/sphere vs point collision check
ive never used packets and nms before
Well@it’s always going to be a cube
But how would you calculate if it is inside?
ya, so a point in aabb collision check imo is the best cpu and memory wise
Question, could you provide me with like a few samples of results and the used parameters, since it could be that the I messed up the order of operations somewhere ?
Is it possible to make a mob that will be in private where spawn of mobs will be prohibited?
I get you Damn that’s smart
thats gonna be very opinion based
(aabb means axis aligned bounding box btw)
anyone?
I mean yeah but which one is easier to read
your plugin doesnt have permission to access a folder
how/why though
the single line one
its not a private folder
the multiline one spans multiple lines it just looks like random symbols
[20:08:17] [Server thread/WARN]: at io.github.moterius.ofmagic.data.PlayerData.getItemCount(PlayerData.java:75)
[20:08:17] [Server thread/WARN]: at io.github.moterius.ofmagic.commands.CmdDbgGetPersistent.onCommand(CmdDbgGetPersistent.java:22)```
```java
//PlayerData:75
return items.getOrDefault(m.toString().toLowerCase(Locale.ENGLISH),0);
//GetPersistent:22
sender.sendMessage(data.getItemCount(Material.getMaterial(args[0]))+"");
HOWEVER
This works:
items.put(m.toString().toLowerCase(Locale.ENGLISH),count);
//
data.setItemCount(Material.getMaterial(args[0]),Integer.parseInt(args[1]));
That's practically the same code?!
the generics are the issue. It tries to register an listener for Event but you cannot listen for Event
why dont you
?paste
and ill see what needs to be changed
thanks, but how then i can make something like i did?
because im not entirely sure what youre asking
yh but in the case of the 1st one it could get to 120 characters really easily which would make reading harder
?jd
once again, swap the values of your Y and Z vectors
right now your vectors are in a Z-up orientation
minecraft is Y-up
declaration: package: org.bukkit.plugin, interface: PluginManager
god damn, Im way to in the mindset of geogebra
Why does the upper line of code work but the lower one result in a null from the getMaterial()
data.setItemCount(Material.getMaterial(args[0]),Integer.parseInt(args[1]));
sender.sendMessage(data.getItemCount(Material.getMaterial(args[0]))+"");
anyone?
so switcching the n method for the u method, since that is what I am assuming you mean with the y and z vectors
Could I get more context there?
im trying to run a command with one of the arguments being a material in string form
And you are sure that the Material#getMaterial is the issue and not something else?
must be because what im getting is this
(two different commands)
and the FIRST TWO lines of BOTH commands is this:
What is the NPE?
Material m = Material.getMaterial(args[0]);
Utils.msg(sender, m.toString());```
and it crashes at Utils.msg(sender, m.toString());?
basically
the 'caused by' reads
[20:22:34] [Server thread/INFO]: Moterius issued server command: /dbgset ENDER_PEARL 6
[20:22:36] [Server thread/INFO]: Moterius issued server command: /dbgget ENDER_PERAL
[20:22:36] [Server thread/ERROR]: null
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.Material.toString()" because "m" is null
at io.github.moterius.ofmagic.commands.CmdDbgGetPersistent.onCommand(CmdDbgGetPersistent.java:18) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]```
but as i said before both commands start with the same two lines of code
which both contain Material.getMaterial(args[0])
Show the code.
What happens if you use matchMaterial instead?
getMaterial is basically Enum#valueOf from what I garner, which may not be intended
ah i see
as for yapper
This part is the same in both commands and crashes for ONE at that first line
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Material m = Material.matchMaterial(args[0]);
Utils.msg(sender, m.toString());
Then yeah what geol said try matchMaterial
Firstly, you are a blessing for sitting trough with me to the bitter end.
Secondly, there seems to be a "-" somewhere, since now the circles appear in the right direction, but if I look down they point upwards
Ah there we have it ENDER_PERAL is spelled wrong
must be in the y
screw me
can you tell me what your pitch is when looking up/down?
thanks
negative is up
straight forward is 0
thought so
why does this throw java.lang.IllegalArgumentException: unknown world ?
are you sure its that
an empty file
And in the default config?
that is the default config
It is trying to deserialize a location, it shouldn't do that with an empty one
Might be a paper bug though, so go bother them
oh wait, then it wasnt emptry xD
nah, im not using paper for my plugin
just serverside
hi i want to do somthing whit hashmap whit my plugin but i don't now how i can get a inventory back if i do the same command
Yes, but if the server is doing things it shouldn't do then it is a bug within the server
I don't know how exactly it behaves but likely
alright, will put that in onEnable then
@zealous osprey ok try making the y component of the n vector positive
Alternatively add load: POSTWORLD
so it would be sin(phi) and not -sin(phi)
add that where
plugin.yml
it'll delay the onLoad call until after the worlds are loaded (I think)
Listening for the PacketStatusInPing packet
the issue is that this is the default according to the spigot wiki
tried that, doesnt seem to fix it
Edit: NVM It just looked as if it would be flat, but that was just due to my weird screen size
Wait, nope, there is an issue
@zealous osprey can you describe
is the circle the correct orientation when u look down
It kind of flattens into a elipse instead of a circle
seems to be
send code again for me pl
?paste
ok
@glossy scroll
This is what I mean, it sometimes is weird
try making the x component of the n vector negative
turning left will make it negative
p.sendMessage(textComponents.<String>toArray(new BaseComponent[0])); the (new BaseComponent[0]) needs array initalization
i havent updated my plugin since 1.16 someone is saying they can open chests and doors now where they shouldnt be able to did something change?
and i dont know how to do that
im setting up a plugin someone else made and implementing it into my own plugin
if yaw is 0, then yes, except if the pitch is 45
ok try
It is noteworthy that it jumps from +0 -> -0 & +180 -> -180
i do think you need the file and not the plugin download
thats what i meant. i have all the files for it
to 180 and then going over 180 turns it negative
pitch goes from 180 to -180 and yaw goes from 90 to -90
what are you building whit?
I can turn it into 0 -> 360 & 0 -> 180
someone wanna be a real one and send api
?
no dont do that yet
can you try to use the latest one i came up with?
.
porogram?
intellij
yes
A 45 pitch creates this weird elipse.
First image is with the pitch 45, second is the shape
can you tell i hate the minecraft coordinate system yet
is this the correct way to iterate over the main inventory + offhand?
for(int i = 9; i<46; i++){
inv.getItem(i);
}```
The moment we began
notch probably never took a calculus course in his life i stg
inv being player.getInventory()
how do i initialize the array?
i am not shure if you find out let me not did think i did now it but i had wrong thing
ah
p.sendMessage(textComponents.<String>toArray(new BaseComponent[0])); the (new BaseComponent[0]) needs array initalization. anyone know how to do this?
Has anyone worked with text-based tables?
I used | %-18s | %-3s | %-10s | %-10s | %-12s |%n from printf, works fine in console but not in minecraft because the font is not monospaced...
public static HashMap<Player, Inventory> playersInStaffMode = new HashMap<>();
Do some one now how i can make this to open a new inv and when i do the command again it gives me the old inv back?
does unregistering a listener stop any schedulers inside it?
public static Vector getSphericalVector(double radius, double yaw, double pitch){
double yawCos = Math.cos(Math.toRadians(yaw));
double yawSin = Math.sin(Math.toRadians(yaw));
double pitchCos = Math.cos(Math.toRadians(pitch));
double pitchSin = Math.sin(Math.toRadians(pitch));
double x = yawCos * pitchCos * radius;
double y = pitchSin * radius;
double z = yawSin * pitchCos * radius;
return new Vector(x, y, z);
}
nope not what we want
we want a circle around a given normal vector
Oh shit, forgot that I had that, was playing around with some stuff
conorsmine that is not enough info
what happens when ur move ur head
how does the circle move
It seems to work fine again when yaw is 0, but rotating in pitch, it roates the wrong way
does it rotate ok with yaw
it roates exactly oposite of yaw, so when I look up, the direction of the circle is also showing upward
how do i initalize an array?
?
Ima make a gif, gimme sec
sorry i think i need a video or to come on the server lmfao
so pitch rotation correct
wait
no
yaw rotation correct
pitch rotation incorrect
wait, what ?
oh yeah, pitch not yaw
ok
@zealous osprey try to make y component positive and not negative?
i think thats all that you need to do ?
Do I need to update JDK for the new spigot api version?
depends
Hell yeah, it seems to work
?paste
and i take it you can displace the circle wherever you want right
and then of course the radius is controlled by that r variable
should be able to by setting the .add() to any needed value
Is there a way to Inherit a command using vanilla jar with injection
does anyone have a tutorial for InventoryMenus? Im reading on Bukkit.createInventory, but the forums say InventoryHolder is a misuse of the api, and will be deprecated. Is there a "correct" way to do this?
yay
no offence, but can you create a thread for your issue, ive been trying to get help for a while but your messages keep pushing my answers up the chat
:>
you can set InventoryHolder to be null
we're done now
about the deprecation issue?
Sorry tho, will do so in the future
its fine, just remember to create a thread next time
Hi is there a way to iterate through player's permissions
Wait nvm that was a dumb question I was thinking something else...
https://paste.md-5.net/abifusixex.js
line 587
no suitable method found for toArray(net.md_5.bungee.api.chat.BaseComponent[])
can someone help
maybe toArray isnt the right process or whatever to use but ye
you cannot convert BaseComponent[] to String[] like that
well actually
its a bit more specific than that
you put in a <String> type generic
so the method is going to be looking for a String[]
you provided a BaseComponent[]
you cannot do that
its like putting in an integer for a string parameter
@drowsy bramble
what would be the formatting on that?
what?
declaration: package: org.bukkit.entity, interface: Player, class: Spigot
Whats the command to build the API in buildtools
?bt
that just gave me the server jar
so what do you want?
do you want the jd or the source?
not quite sure what you mean
hold on i think i see
Has anyone found a way to print tables, or stretch string lenths? Console works fine with printf but ingame i cant find a way as its not a monospace font
im pretty sure tab works pretty well \t
Hi, I register my custom type of entity. I init the datawatchers (the same wchch has EntityArmorStand), and when i try to spawn an entity i have en exception ->
Caused by: java.lang.IllegalArgumentException: Duplicate id value for 15!
at net.minecraft.network.syncher.SynchedEntityData.define(SynchedEntityData.java:90) ~[app:?]
at pl.tuso.xentitydev.entities.type.EntityDev.initDatawatcher(EntityDev.java:99) ~[xEntityDev-2021-12-11 20.48.jar:?]
at net.minecraft.world.entity.Entity.<init>(Entity.java:508) ~[patched_1.17.1.jar:git-Paper-386]
at net.minecraft.world.entity.LivingEntity.<init>(LivingEntity.java:281) ~[app:?]
at net.minecraft.world.entity.Mob.<init>(Mob.java:131) ~[app:?]
at net.minecraft.world.entity.PathfinderMob.<init>(PathfinderMob.java:19) ~[app:?]
at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:65) ~[xEntityDev-2021-12-11 20.48.jar:?]
at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:24) ~[xEntityDev-2021-12-11 20.48.jar:?]
at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:25) ~[xEntityDev-2021-12-11 20.48.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-386]
... 21 more```does anyone have any idea?
Code -> https://github.com/TheTuso/xEntityDev/blob/main/src/main/java/pl/tuso/xentitydev/entities/type/EntityDev.java
Sup, so someone create a PR that mentions I should relocate HikariCP. Is this a common thing?
What issues could it cause?
Like from what I hear now it's conflicting with one plugin
not sure why
Is there a way to change entity's walking speed without using attributes?
Like it is in the player interface
well, you cannot lhave 2 classes loaded with the same name at the same time
how do u use slowness arrows in launchprojectile
or any other kiind of effect arrow
wdym
doesnt it take a class tho
for launchprojectile
lol
i thought with launchprojectile it was smth like launchProjectile(Arrow.class)
Can i make a countdown on a scoreboard without a scheduler?
is there any native method for it
No
ok, ty
Whats wrong with scheduler tho
I need some help i coded a tabcompleter for a command and it doesn't show up the list i added it only shows the remove what can i do?
@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
Player p = (Player) sender;
if(args.length == 1){
List<String> value = new ArrayList<>();
for(String va : FileConfig.getConfiguration().getStringList("server." + p.getName().toLowerCase() + ".homes")){
value.add(va);
}
value.add("remove");
return value;
}
if(args.length == 2){
List<String> value = new ArrayList<>();
value.addAll(FileConfig.getConfiguration().getStringList("server." + p.getName().toLowerCase() + ".homes"));
return value;
}
return null;
}
Do I need to do getConfig().options().copyDefaults(true);?
how do I add text under the name of a player
does player entity support on hover display names in notchian client?
that requires entity handling, its impossible to add this natively
what does that mean still
i believe so?
whenever i set hide custom name byte field inside Metadata packet
my NPC nametag doesnt react to it
its possible to hide the nametag via teams
but is it possible to make it appear only on hover of the mouse
it means that you would need to make entity ride on player or track the movement of the player and teleport entity to its location, in order to make it work
both methods work quite well
tracking movement of the player requires more work to do, but it allows more customizability where you new line could appear
how do I make a bossbar display?
declaration: package: org.bukkit.boss, interface: BossBar
thanks!
thanks!
then add the player via Bossbar.addPlayer()
in order to show it
what does thang mean
im not native speaker sorry
im confused on how to use launchprojectile with an effect arrow
it takes a class
like Arrow.class
so idk how to make it work
i guess specify the class name of your arrow type
SpectralArrow.class
etc
i've never used it
but maybe its like that
wahts the class name of slowness arrow
then how would i make it an arrow with slowness
wait could i like get the projectile and then set the effect after it launches
Arrow arrow = entity.launchProjectile(Arrow.class);
arrow.addCustomEffect(PotionEffect.SLOWNESS, false);
try this ^
its almost the same as spawning the entity inside the world
you spawn the entity first, then you add the metadata
thx
np
potioneffect.slowness isnt a thing
is a 1-tick repeating scheduler (that updates a scoreboard and some values in a hashmap) bad for performance? or not really a problem?
java: cannot find symbol symbol: method getClickedInventory() location: variable event of type org.bukkit.event.inventory.InventoryClickEvent
How do i fix this?
send your code
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onInventoryClick(InventoryClickEvent event) {
if (event.getClickedInventory() == null || !(event.getWhoClicked() instanceof Player)) {
return;
}
Player player = (Player) event.getWhoClicked();
Inventory inventory = player.getOpenInventory().getTopInventory();```
But it has to do with maven or smth
Cuz I am trying to get it working again, but it errors out with the maven error
And I don't know why
send a screenshot of your screen with the code open
i would ask for like "is it imported" "is it a dependency" but just seems like filler
how i can make mapvote
well i was hoping you wouldnt select the text i was looking for
It has to do with InventoryClickEvent and it being build, but it just doesn't say what is wrong with using that dependency
send your pom
How would I make it not give a player a fish when they catch a fish? Cancelling does that the event, but it also keeps the hook in the water without retracting it.
try event.getHook().destroy()
Does not exist.
There is a remove() though so let me try that. .-.
Didn't work.
oh wait
setHookedEntity(null)
declaration: package: org.bukkit.entity, interface: FishHook
?
my code works
but i dont know how it works
i literally somehow hided the player's nametag
without team
NVM
my client went out of sync because i reloaded the plugin
i need to censor this until md5 sees what im doing with packets
class MyThread extends Thread {
@Override
public void run() {
}
}
oh
lol
ty
can i iterate somehow over all existing chunks of a world, even if they're unloaded?
config not loading default values or any values
i dont think you can
ah nevermind I can just do a crude patch
ie spawn in a 8200 block of bedrock when a chunk loads
dont ask
i couldnt think of a good title for my thread but its a weird issue
what would be an efficient way for making a EntityMoveEvent
Step 1. Don't
what if I have to tho
If you have to track every entity movement you need to rethink your design
That's bad to say the least
@young knoll entitytickevenr
Shall run 20 times per second per entity
no
Yes
Question how does MerchantRecipe work? is that "recipe"/trade then have a chance of appearing on a villager? does it need to be assigned/set to a villager ?
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.
@quaint mantle
okay that's kinda rude...
You have to set the new amount back into the map.
if you are new to java ^ those links will help 100%, as for an economy system your doing alright, but if you want your plugin to work with other plugins and shops I suggest using vaults api a lot of other plugins use this and / or work with it https://github.com/MilkBowl/VaultAPI
they have a create example for implanting vault ^
and vault will handle some nitty gritty things for you like saving player balances and such
this is a few years old so might be out of date but take a look see if it helps https://www.youtube.com/watch?v=fRxpx0fz_Nc&ab_channel=KodySimpson
@quaint mantle have a good night
https://pastebin.com/7r2qed1T
I need help here. Its a /home command with a 10 sec delay of waiting. the problem is when more Players use the command only the first player is going to teleport to his home but the second doesn't work...
You don't need all that.
You can get the Bukkit Scheduler and schedule a task to run 10 seconds after for the player's teleportation.
okay but how can i detekt if a player doesn't moved in that 10 seconds?
i have a set<UUID>
You can try a map of Player and BukkitTask
for example
Map<Player, BukkitTask>
You could initialize that map somewhere so you can have access to it on the command class
Then when the command is ran, put in the player into the key, and the BukkitRunnable into the Value
You could use the PlayerMoveEvent event to detect if a player moves and if he does while he is waiting to teleport, just get the task and cancel it.
from the map value
okay wait... i don't really get it how to make this right now...
Hey my main class name is Main.java and it's in the package "fr.jayrex.economybridge" and in the plugin.yml it added "main: fr.jayrex.economybridge.EcoBridge" but i get the error "org.bukkit.plugin.InvalidPluginException: Cannot find main class `fr.jayrex.economybridge.Main'" when i launch my server.
is your main class set in your plugin.yml?
Yeah it's "main: fr.jayrex.economybridge.Main"
np
but i don't understand why it's giving me that error
if it's set in the plugin yml and you've got it in src I'd say double check all the spelling that's usually what it is
what does the command look like?
big smart
Though as soon as you feel a bit comfortable with implementing commands through the standard plugin.yml and executor method, I would abandon it
I'm removing durability from the tool in a players main hand but when at 0 durability (or below) it goes into negative durability instead of breaking, how would I go about breaking the players tool in main hand (with animation of tool break, not just removing)?
In PlayerInteractEvent e.getMaterial().equals(Material.AIR) returns true no matter what i click
why
oh
nvm i think i know why
use == to compare Enums
oh is that it? i was thinking that was checking for item in hand
it is actually
item in hand
Yes, however still compare with == ```
getMaterial
@NotNull
public Material getMaterial()
Convenience method. Returns the material of the item represented by this event
Returns:
Material the material of the item used
you want getClickedBlock()
The reason being, There can only ever be one instance of an Enum. You are instance checking using ==.
.equals is to compare objects
like, does this apple equal this other apple
how can I update log4j to a newer version in my project
If you are actually using it as a dependency, update your depends
To prevent the library being exploited, it's urgently recommended that Log4j versions are upgraded to log4j-2.15.0-rc1.
If you are unable to update In order to mitigate vulnerabilities, users should switch log4j2.formatMsgNoLookups to true by adding:"‐Dlog4j2.formatMsgNoLookups=True" to the JVM command for starting the application.
very strange error with mongodb: it can't find an entry that was literally just set and can be found in the database
Would I require a web socket to load text over a players head using the same type of client?
Your question is too random to answer
You’re talking about client side?
yes
You’re talking about plug-ins here or mods?
mods
I believe that with a plug-in, you can manage the packets that are sent to a player and just show a different version of the floating text to the target client perhaps? I am not really sure
Mods? Oh that’s a whole different thing haha
Depends where the text is coming from
Is there any events for listening when Inventory#addItem is called?
if the item is added via a plugin, then no
I've ran into a bit of a quirk and I was just curious if there's any workaround. If you fill a dispenser with indispensable items it will still make a click sound and show the shooting particles. Is there any way to test for this event? BlockDispenseEvent doesn't actually fire since nothing is being dispensed. Fixed with: BlockFailedDispenseEvent from paper
how do I get the boss bars that are displayed on a player's screen?
to make some of them stop displaying
https://www.youtube.com/watch?v=9apL86E05Bc
I hope this help u, best than reading.
BossBars in 1.15 Spigot!
Patreon:
https://www.patreon.com/codedred
Donate to me :)
https://www.paypal.me/CGMax
Join my discord:
https://discord.gg/zMzXSgk
Follow the Twitch Streams:
https://www.twitch.tv/coded_red
------ Links ------
Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-develope...
just avoid them, or remove them best?
I'm displaying the health of mobs, and when the player hits a new mob, I want the bossbar to stop displaying
Then access to it, and avoid the log.
?
U can use #removeAll() if u want.
I don't want the boss bars of other players to dissapear
also, I'm looking at the getbossbars method, and why does it say " (dot) not created using createBossBar(String, BarColor, BarStyle, BarFlag...)" ?
full text is
Gets an unmodifiable iterator through all persistent bossbars.
(dot) not bound to a Boss
(dot) not created using createBossBar(String, BarColor, BarStyle, BarFlag...)
e.g. bossbars created using the bossbar command
what about the setVisible method? you might be able to do "bossbar.setVisible(False)"
sorry. it's not what i'm looking for.
I want to remove the entity for certain players. that the item is not visible on Ground
what kind of databases do you guys use on your plugins? I'm hoping I can have a database simple as SQLITE to store some infos
mysql, mongodb
its just text displaying on their head like saying Hello etc...
they're rather complicated if compared to sqlite
🤷♂️ I don't see how they are complicated
having to setup a dbserver prior to usage of the plugin
That's where Sqlite comes along...
Was just hoping to know
fi there were any other alternatives
.txt

is this a public plugin you're releasing?
ah ok
basically a sign that is a portal
2 signs connect to each other and make a portal
Btw
on java is there any recommended orm or something like that?
to use databases such as mysql, sqlite
and others
Kind of a long stretch:
But is there a way to set the burn length of lets say a stick or something?
In a furnace?
Yes, i think i found it FurnaceBurnEvent
is there a way to remove a certain amount of something from someone's inventory
im currently using this
e.getPlayer().getInventory().remove(new ItemStack(Material.DIAMOND,2));
but it's not removing anything
never mind i figured it out
I get this java.lang.NullPointerException: Cannot invoke "net.dv8tion.jda.api.JDA.addEventListener(Object[])" because "this.jda" is null
Here's my code
public class Bot extends ListenerAdapter implements CommandExecutor, Listener {
private Discord plugin;
public HashMap<UUID,String> uuidCodeMap;
public HashMap<UUID,String> uuidIdMap;
public List<UUID> verifiedMembers;
public Guild guild;
public JDA jda;
public Bot(Discord main) {
this.plugin = main;
startBot();
uuidCodeMap = new HashMap<>();
uuidIdMap = new HashMap<>();
verifiedMembers = new ArrayList<>();
jda.addEventListener(this);
plugin.getServer().getPluginManager().registerEvents(this,plugin);
plugin.getCommand("verify").setExecutor(this);
Bukkit.getScheduler().runTaskLater(plugin,()->guild = jda.getGuilds().get(0),20L);
}```
Can anyone help me?
jda isn't being initialized, you can't addEventListener to a null object
Can't I just add addEventListener to the startBot function using this
You need to initialize jda as a new JDA object, then it'll work just fine
How tho?
I've never worked with that library but chances are java JDA jda = new JDA(); with some kind of arguments in the (), if needed
Can I schedule a sync task for main thread from an async task??
Have you tried using the BukkitScheduler to schedule tasks?
Well - I should really be asking what you need it for
I have currently doing a check in main thread for a listener which might schedule a sync task, But I noticed it causes some spike lags so I decided to do the check async
BukkitScheduler should work fine, then
So if I call BukkitScheduler to create the task inside the async task it would be fine?
Should be, I've never personally created a task within a task but I don't see why it wouldn't work
Is JDA your "main" class? i.e. the one extending JavaPlugin
Okay then yeah just initialize it
im working on a plugin in kotlin, and it doesnt load the plugin when i start my dev server
can someone tell me if anything is wrong w/ my pom.xml (part 2 below)```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.narutopig</groupId>
<artifactId>BoRS</artifactId>
<version>1.0.0</version>
<properties>
<kotlin.version>1.6.10-RC</kotlin.version>
</properties>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
</resources>```
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals> <goal>compile</goal> </goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals> <goal>compile</goal> </goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals> <goal>testCompile</goal> </goals>
</execution>
</executions>
</plugin>
<plugin>
```
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Yes. Scheduler is fully thread safe
I tried with but still the same..
JDA jda;
That's not initializing it, my guy! In Java, that's just preparing a variable with a name and type, but you're not giving it anything to work with
From the official documentation
JDA jda = JDABuilder.createLight("BOT_TOKEN_HERE", EnumSet.noneOf(GatewayIntent.class)) // slash commands don't need any intents
.addEventListeners(new SlashBotExample())
.build();```
public class Bot extends ListenerAdapter implements CommandExecutor, Listener {
private Discord plugin;
public HashMap<UUID,String> uuidCodeMap;
public HashMap<UUID,String> uuidIdMap;
public List<UUID> verifiedMembers;
public Guild guild;
JDA jda;
public Bot(Discord main) {
this.plugin = main;
startBot();
uuidCodeMap = new HashMap<>();
uuidIdMap = new HashMap<>();
verifiedMembers = new ArrayList<>();
jda.addEventListener(this);
plugin.getServer().getPluginManager().registerEvents(this,plugin);
plugin.getCommand("verify").setExecutor(this);
Bukkit.getScheduler().runTaskLater(plugin,()->guild = jda.getGuilds().get(0),20L);
}
private void startBot() {
try {
JDA jda = JDABuilder.createDefault("x")
.build();
} catch (LoginException e) {
e.printStackTrace();
}
}``` That's what I use
Nope it doesn't
sorry wait no that will actually define it locally iirc
you dont have to define the variable type in startBot, its already defined
He closed it off before writing startBot(), it's not in scope ye
alright, thanks but still I keep getting this.jda is null
Also not calling it anywhere
right after you create the bot print it out see what returns
Um, sorry for the stupid question but how 😂
System.out.println(jda);
if thats null it means jda itself is returning a null
if not it means you're messing up somewhere
It's not even printing JDA, tried with System.out.println(jda); and Bukkit.getServer().getConsoleSender().sendMessage(jda); but doesn't seem to print
nvm I had to reload the server 😄
public class Bot extends ListenerAdapter implements CommandExecutor, Listener {
private Discord plugin;
public HashMap<UUID,String> uuidCodeMap;
public HashMap<UUID,String> uuidIdMap;
public List<UUID> verifiedMembers;
public Guild guild;
JDA jda;
public Bot(Discord main) {
this.plugin = main;
this.jda = startBot();
uuidCodeMap = new HashMap<>();
uuidIdMap = new HashMap<>();
verifiedMembers = new ArrayList<>();
jda.addEventListener(this);
plugin.getServer().getPluginManager().registerEvents(this,plugin);
plugin.getCommand("verify").setExecutor(this);
Bukkit.getScheduler().runTaskLater(plugin,()->guild = jda.getGuilds().get(0),20L);
}
private JDA startBot() {
try {
JDA jda = JDABuilder.createDefault("x")
.build();
return jda;
} catch (LoginException e) {
e.printStackTrace();
return null;
}
}```
Should work with that
Well I reloaded my server and it actually did fix that prolly cause of public JDA jda; i had before
I'm using PlugmanX prolly of disable/enable
Can't really think of a better place to ask, I'm trying to make a gradle task that automatically replaces my existing plugin with a newly built one, this is what I've got: groovy tasks.register('dobuild') { dependsOn 'build' doLast { java.nio.file.Files.copy(java.nio.file.Paths.get("C:\\Users\\admin\\Dev\\MC\\IsleOfReyven\\lib\\build\\libs\\lib.jar"), java.nio.file.Paths.get("C:\\Users\\admin\\Dev\\MC\\TestServer\\plugins"), java.nio.file.StandardCopyOption.REPLACE_EXISTING) } } But this tells me: java.nio.file.DirectoryNotEmptyException: C:\Users\admin\Dev\MC\TestServer\plugins
The copy call doesn't take a directory as output
You'll have to specify the actual file name
Oh, that makes sense, one moment
Ah that's bothersome then, nio might actually be trying to delete the file to copy the new one in with the REPLACE_EXISTING option
oh too bad
Isn't that the point or replace existing ? Delete old and throw in new
If you need to keep older versions of the mod for whatever reason, version control is easy
How can I find a string in my yml file?
FileConfiguration.getString(path)
Yeah but I want to find/get it when there are 100+ entries in the file and I don't know where is the path
getKeys(boolean deep: i prefer false)
^
that deep means if you turn on, it will search through other entries in the entries
btw example of that ^
You still need to relatively know what will be where though
like this
hello:
hello1:
messages:
1: "odl"
hello2:
messages:
1: "odl"```
if you use `getKeys(false)` at the path `hello` you will get `hello1` and `hello2` while if you use `true` then it will get the `messages` and `1`
oh thats what true does
always wondered but i didnt want to go through the hassle of trying
wait lemme check again i have bukkit codes here
I just know when i was learning spigot i was told to use false in many different articles so i was like i guess i do false
3-4 years later still doing the same thing xD
I'm actually having something like this
Data:
Yeagorn: 'string'
And I want to get the string assigned to the username
So basically getConfigurationSection("Data");
and iterate through it with getKeys(false)
the String is going to be the next field down eg Yeagorn
No, windows explorer doesn't delete the file, it simply modifies it, allowing you to replace it whilst the server is running, this isn't possible using nio because I guess java doesn't have that kind of FS interface
Yeah but I want the string 'string' as I mentioned above.
Not the username
eg. Yeagorn: "test" to get the test
not the username
tried with getKeys(true) still returns the username
yeah I see
the key will be the username, and you use the key to get the String value
Just make sure you use the key with the ConfigurationSection your already iterating over or youll be big confused xD
Hey folks, I'm looking for the obfuscated name of n.m.s.level.EntityPlayer#updateAbilities() (It's pre 1.17 name), what is it's name in 1.18+? I found w() however this doesnt seem to give the same result. XP levels on the client aren't updated 😅
idk much about NMS but cant you edit abilities with the base API?
i remember something about removing/adding/editing certain player abilities i did this to remove the attack cooldown players had, this was back in like 1.13ish
I'm currently manually removing the player from the world on the client and adding them back (i.e fake respawning, to reload their skin), so I'm not sure if thatll work
ohh i see, in that case i wouldnt know im sorry
Could totally try this though: player.setExp(player.getExp()); 🤔 I'd imagine that that updates the XP on the client too
How do I find out the coordinates of the snow that the snowman has set?
Youd need to track the blocks it water over iirc, what are you trying to achieve?
This sets the scale
ah, Ill want setTotalExperience then
It should but why would it need to update to reload a skin?
close enough 😂
Otherwhise it does not show
I want to remove the snow in 1 second
So you need to respawn the player, but only on their client
Store a HashMap of the blocks the snowman walks over (You can track it with some type of entity moving event, and check if its the snowman using the Snowmans UUID)
ahhh i see
I can send the code, for set experience
set Total Experience, get Total Experience
Yep
and one second later check the block above is snow or not
EntityMoveEvent does not work(
Okay then do this
create a timer and check the snowmans location ever x ticks
if location is same return
if different dont return and store the block
Curious, the remapped-mojang and runtime spigot jars do not contain the same classes 🤔
e.g most of the n.m.network.protocol.game. classes are different
example please
If the snowman does not go exactly in blocks, he puts 4 blocks of snow at once
So you just speed up the timer checking where the snowman but dont go crazy with how fast you check
like 2 times a second is probably the fastest check you need
I dont see snowmans moving that fast to travel more than one block in 10 ticks
I need to get a player's float experienceProgress, anyone got a clue what method would supply that?
Actually, that is getExp(), nevermind 😂
s
chech ls
check
can someone tell me how to make spawners spawn items like diamonds and i want to know how to make it so i can customize the Spawn Delay and Spawn Count. Thanks!
is there an event that is called when trees are generated during terrain generation?
Listen to SpawnerSpawnEvent i think
Store the location of the spawer you want to spawn diamonds
if spawner from spawner event's location == your stored location
cancel the spawn result and spawn a diamond ItemStack where the location of the spawner is (Maybe add +1 to the y value?)
I do not think so but you can check if the block generated is the type of tree block?
Eg check if its wood/leaves and cancel it somehow
im on fire tnight ngl
how much would filling the upper half of the nether with bedrocck increase the storage volume on the drive?
not much
what language are u talking
java
it depends on how many chunks are in the actual world
not really how many blocks per chunk
Unless your storing data
like chests, nbt datas etc
Because technically AIR blocks get stored
yea but how can i change the spawn delay and spawncount
the event handles that all
which event would that be? and, i'm not sure if doing it by block would work, but maybe there is a hacky way to find out which blocks are generated together
ah no im not. But that reminds me of something.
If i set the persistentDataContainer of a shulker box item, place it, mine it, and then access the pdc, is it still there?
IIRC its ChunkGenerateEvent? I could be wrong its been years since ive done this
What is a event
Negative
Because it gets converted to a block
i think?
might be worth testing
But i think it gets counted as a block once placed
imma do that when i have time but thaks
SpawnerSpawnEvent IIRC
In your event listener
look up a basic plugin tutorial
Its an Event hance the ending word Event
what is event lister
I think you're in the wrong channel, Omaster.
Possibly
wdym
If your looking for a plugin
Look up a Generators plugin
you're*
Im a devloper not a poet
XD
typo was intentional
Nope no command to do that maybe with Command Blocks though?
block != entity
items are entities
so you need to spawn items into the world
while also canceling the mob spawned from x spawner
how can i do this
oof
You would need to know how to make a basic spigot plugin first before doing this
where and how do i start
?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.
and once you understand basic java concepts: https://www.spigotmc.org/wiki/spigot-plugin-development/
you could also search on youtube how to make spigot plugins, some people i know learned it that way
what's the correct way of logging fatal errors causing plugin to disable?
Level.ERROR or FATAL exists doesnt it?
SEVERE
that one
will it mark it as error and print it red?
in my case that's not stacktrace
ah kk
it's invalid config file
ahh okay, then yeah log with SEVERE and then disablePlugin(this)
oh, it's correct but should i color it red?
i run it in intellij's terminal and it's white
not file, console
hes talking about latest.log
but
doesnt that strip colors?
Thats only useful if someone happens to be looking at the console at teh time
Handy, I guess its sysout that doesn;t strip
Yeah i guess thats why bukkit gives the error now when using sysout and not bukkit logger
I know I've seen many unreadable logs due to color codes
Thats just paper
(meanwhile me, specifically writing colored log files^^)
Im using spigot api though for this plugin
i just realized something
my api has depending on Paper, and the plugin im making right now is using spigot-api
how is this running LMAO
if you only use spigot methods you are fine
im using some of the adventure api though
i want to switch to json logs at some point though, and color them through a command that reads them
maybe maven compiles that automatically
that should be blowing up if you put it on a spigot server
json logs are so annoying
True unless adventure api is getting compiled alongside with it
lemme check
nope, i should change that though
they do require a bit more than just a grep, but with how often i search through them for specific fields it'd be easier at least for me to have them in a more structured file format
"Bukkit got a hugely expanded world generation API in 2021" does anyone know what this person was referring to?
Greetings, I'm making a table that displays litebans bans mysql table using php. But the problem is, litebans saves uuids in format 53909932-f794-33c0-9329-948045a4c1ce but not in the default minecraft uuid wich i can convert to nicknames. Is there any way to make litebans work with nicknames? Or is there any security reason why i can't do so? Thanks for helping me. (Note: I don't wanna use the default litebans banlist system)
You likely need to use LiteBans API to resolve that UUID
it likely resolves to some kind of LiteBansPlayer which you contains the Player instance
just a guess though
but worth looking into LiteBans API but it may be tricky to transfer to php
if the uuid format is the only problem, the conversion should be trivial
wym person?
Its a v3 UUID, iirc Minecraft uses v4
so you'll need to convert it to a v4 UUID
https://github.com/rutgerkok/WorldGeneratorApi second sentence in the description!
do you know any api that can do that?
You can probably do it yourself, just need to do some Googling on how UUID v3 differs from v4
The UUID class might even do it already
this is a plugin though?
yes, but they are talking about what this plugin adds that bukkit doesn't already provide
and mention that bukkits API got expanded in that regard this year
String yourUuid = "...";
UUID uuidV3 = UUID.nameUUIDFromBytes(yourUuid.getBytes());
String v4Uuid = uuidV3.toString();
``` You can try this, if itll work I have no clue.
I mean, remove dashes?
I think that will result in offline uuid wich wont work either
I used a worldguard api wrapper
hm?
Hi everyone, I have a question, I have a survival server with spigot and is premium, I want to turn online mode off, but if I do that, I think I'll lose all players inventories, stats and advancements. How I can do it?
worldguard = WorldGuardWrapper.getInstance();
Map<String, Integer> regions = worldguard.getRegions(location).stream().sorted(
Comparator.comparingInt(IWrappedRegion::getPriority).reversed())
.collect(toMap(IWrappedRegion::getId, IWrappedRegion::getPriority, (v1, v2) -> v2, LinkedHashMap::new));
You can 'calculate' the offline UUIDs, and then rename the files, be it manually or automatically
I have some code on that that might help
are you just wanting to go offline, or are you moving it behind a Bungee proxy?
go offline cause I have some fiends that doesn't have premium
String offlinePlayerNewName = UUID.nameUUIDFromBytes(("OfflinePlayer:" + newPlayerName).getBytes(StandardCharsets.UTF_8)).toString();
Thisll generate an offline mode UUID for a player, you can then map the online-mode UUID to a nickname, and then map that nickname to the Offline UUID, then remap all data files to the new UUID
Yeah but like why would it even like give me the null/none existant item stack xD
Oh i bet i need to call getContents instead
Where do i put that
That is up to you to decide 🙂
Are you a plugin dev?
I cant write the entire plugin for you, you'll have to do that yourself
A really noob one, but yes
Then what you are attempting to do is nigh impossible
I disagree with that
itll take some effort, but certainly possible
I've written a plugin that remaps Offline -> Offline so that players on an offline mode server can change their nickname, certainly it is possible for online -> offline too.
I have not that many of players in my server, I can manually change the uuid from the /playerdata
He needs to check each player online to get their current UUID, then calculate their offline UUID, find the relevant file in EACH world folder and copy the existing file to the new name, if it exists
Itll certainly take some effort and knowledge 🙂
Is just a survival world with only 3 worlds (overworld, nether, end)
I can make the players join the game and copy their uuid
In offline mode
interesting getContents also gives me empty (null) ItemStacks
The simplest way, loop all files in the playerdata folder of each world. Use the UUID in the file name, get the player name (while the server is still in online mode) then save it under the offline generated UUID
Yup, and to generate the offline UUID one can do this bit
Is there a way to iterate through an Inventory without getting null items or do i have to suck it up and add the one liner null check
is there a plugin that allows me to spawn items using a spawner and i can chnage the delay and the spawn amount?
you would have to either null check or a line to remove nulls, null check is simpler
Thats more of a #help-server thing for plugins
In mean, where I need to put that, in the onEnable()?
Yeah, just weird SpigotAPI returns the empty ItemStack at all when iterating
Is there already a way for nms with 1.17 and 1.18 ?
can u do me a plugin?
Just google "Generators Plugin spigot"
theres lots
This is a channel for talking about code so your better off talking the server section about this
does chunk load or chunk generate happen first?
Depends
well no
load happens after
but in some cases generate wont fire (Eg if chunks already generated)
in generation, it generates and then loads IIRC
thats fine i need a function to run on already generated chunks
Yep chunk load is the one you want
can some1 make me a plugin
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/
bro, give me plugin shop support 1.17.1
okay, sorry
Of course there is
I've been updating this plugin for 1.17 and 1.18 both e.g https://github.com/TheDutchMC/SkinFixer
Untested but this should get you started (if it doesn't work)```java
public void convertToOffline() {
File worldFolder = Bukkit.getWorldContainer();
for (World world: Bukkit.getWorlds()) {
File data = new File(worldFolder, world.getName() + File.separatorChar + "playerdata");
for(File file: data.listFiles()) {
String baseUid = FilenameUtils.getBaseName(file.getName());
String ext = FilenameUtils.getExtension(file.getName());
Player player = Bukkit.getPlayer(UUID.fromString(baseUid));
if (player.getName() != null) {
try {
FileUtils.copyFile(file, new File(data, UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(StandardCharsets.UTF_8)).toString() + "." + ext));
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}```
what do u mean with "get you started"
It means if it doesn;t work, its very very close. so fix it if it doesn;t work
call that method once with the server set to online
Ok, i'll test it in another world and if it works, thx u alot
you will be able to see if it works. It will double up all your player files
how can i terminate plugin in method body so, that i don't even need return statment?
It gives me an error with the "FilenameUtils."
Thats Apache commons
is shaded into spogot
so either add it as a provided dependency to your pom or change to depend on spigot instead of spigot-api
...
Attempting to build Minecraft with details: VersionInfo(minecraftVersion=1.8, accessTransforms=bukkit-1.8.at, classMappings=bukkit-1.8-cl.csrg, memberMappings=bukkit-1.8-members.csrg, packageMappings=package.srg, minecraftHash=null, classMapCommand=null, memberMapCommand=null, finalMapCommand=null, decompileCommand=null, serverUrl=null, mappingsUrl=null, spigotVersion=null, toolsVersion=0)
Error: Exception in thread "main" java.io.FileNotFoundException: work/minecraft_server.1.8.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:228)
at java.util.zip.ZipFile.<init>(ZipFile.java:157)
at java.util.jar.JarFile.<init>(JarFile.java:171)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at org.spigotmc.builder.Builder.main(Builder.java:411)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
???
did you set 1.8 instead of 1.18 in your dependencies?
intended
i'm compiling every version from 1.8 to 1.18
but for some reason 1.8 and 1.8.3 fails
with that exception
yeah, so.... how can I do that?
ending with Could not find artifact org.bukkit:craftbukkit:jar:1.8-R0.1-SNAPSHOT
if someone knows why, please let me know
here's the full log: https://github.com/NicoNekoDev/CitizensBooks/runs/4497217966
do not depend on CraftBukkit, Depend on Spigot
i'm using nms tho
so?
Depend on spigot not spigot-api
that is the first time i see people say that
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
delete both
depend on spigot no spigot-api, not Bukkit, not CraftBukkit
i mean if you dont want api from spigot, just use spigot-api
or if you want to use both nms and api then use spigot
it has nms + spigot-api
in 1.8?
i found only in 1.13+ they come together
Bukkit and CraftBukkit have always been in spigot
public class Main extends JavaPlugin implements Listener {
public void onEnable(){
getServer().getConsoleSender().sendMessage("get distance>> was enable");
getServer().getPluginManager().registerEvents(this, this);
}
public void onDisable() {
getServer().getConsoleSender().sendMessage("get distance>> was disable");
}
@SuppressWarnings("deprecation")
@EventHandler
public void onInteract(PlayerInteractEvent event){
Player p = event.getPlayer();
Action action = event.getAction();
Location pos1 = null;
Location pos2 = null;
if (p.getItemInHand().getType() == Material.STICK) {
if(action.equals(Action.LEFT_CLICK_BLOCK)) {
pos1 = p.getLocation();
p.sendMessage(pos1.getBlockX() + " " + pos1.getBlockY() + " " + pos1.getBlockZ());
}
if(action.equals(Action.RIGHT_CLICK_BLOCK)) {
pos2 = p.getLocation();
p.sendMessage(pos2.getBlockX() + " " + pos2.getBlockY() + " " + pos2.getBlockZ() + "second pos");
double a = pos1.distance(pos2);
int b = (int) Math.round(a);
p.sendRawMessage("" + b);
}}
}
help please i want to make it math the distance but it not working
it send an error
what error?
pos1 will be null when you right click to set pos2
move your Location variables outside the event to make them fields
wth is that code
Good names 🙂
functional interfaces
does that mean I no longer need to compile craftbukkit on buildtools?
i know the issue now that i look over it again
yeah i need to refactor it
you build spigot on buildtools
the naming is kinda bad for this API, but no end user will ever see it so meh
it shall stay for now
https://github.com/NicoNekoDev/CitizensBooks/blob/main/.github/scripts/buildtools-java8.sh
I mean I have this script that automatically builds versions... but it contains --compile craftbukkit argument
I'll try without arguments
no one ever needs a CB jar these days.
You peasants do
im a peasent if it means i dont have to write my own pom files
minecraft plugin builder
or whatever its called?
almost
yeah, that ones gets recommended for me often
I use Eclipse. I like to know what I'm doing
i don't use it
.
i use intellij i dont need to save
dont get me wrong i understand/know everything in the code, i just cant be arsed to write it all out everytime i make a plugin
I'd only recommend it to a very advanced dev who's got tired of writing the same files over and over
looks at my 30 repos on my github
Yeah.. same file 😅
i use intellij because I like to be more in control with how I do things
i just like it so i can save time
tbh i use intellij because it's simpler to manage stuff
im able to whipe out things so fast with the tab completions and things like the minecraft plugin development thingy
I can write in Eclipse but its gonna take me longer and i dont see a reason to put a bottleneck on myself
I could even write in notepad++, any dev should be able to relatively do that if you learned java
also, isn't IntelliJ written in C++ while Eclipse is written in Java ?
But... lets not do notepad++ plugins pls
meh languages dont matter for IDE's really
But C++ is generally better
c++ is faster
for like larger projects, as you can index files faster
IntelliJ is written in java
Java doesnt run as close to the CPU like C++ does but its still fast reguardless
eh true
bois
i just copy paste a preset folder to make a new plugin in intellij
does that even work in eclipse?
dont thnk so
i even made a whole repo just for decompiling minecraft 1.16.5 and applying patches to it
basically java on steroids
what do you gain from doing it manually over and over eitherway?
(i will not say that most of the codes in bash script i stole were from Paper and Tuinity)
it's really simple it won't benefit you that much will it?
copy paste the file
I just copy/paste as my files are almost completely automated. Just change a couple of line for a new project
Its useful for new people though
It reinforces knowledge
Doing the same thing over and over until you get it, like riding a bike