#help-development
1 messages · Page 1536 of 1
use 90001
it outputs the same doesnt it
90_000???
90_000 is a string I would asume
my vault depositit method doesnt work either
so its an integer
never looked at it lol
Is it works on practic?
lemme try it
why even coming to that idea :/
and there is a random between 0 and 89.999
where does the compile maven function go to lol
nvm ima use package
erm
public Economy eco;
@Override
public void onEnable() {
// Plugin startup logic
if (!setupEconomy()) {
System.out.println("This plugin requires Vault & Economy plugin.");
getServer().getPluginManager().disablePlugin(this);
}
}
it disables and i have vault and essentials
dafuq
and yes it prints that
private boolean setupEconomy(){
RegisteredServiceProvider<Economy> economy =
getServer().
getServicesManager().
getRegistration(net.milkbowl.vault.economy.Economy.class); // Checks for Vault
if (eco != null)
eco = economy.getProvider();
return (eco != null);
}
is your plugin loaded before or after vault?
did you depend it?
did you reload maven?
add it as a dependency
?paste
name: DevTool
version: ${project.version}
main: me.barry.devtool.devtool.DevTool
api-version: 1.16
depend: [ Vault ]
authors: [ barry ]
it is dependency
in your plugin.yml
does it have to not be capital letters or something small like that lol
just like this depend: [Vault]
io.github.FourteenBrush.MagmaBuildNetwork.listeners.LockListener.onInteract(LockListener.java:45)
in your case softdepend would be enough
ima try
that line is empty
._.
no it still doesnt work
[12:05:25] [Server thread/INFO]: [DevTool] Enabling DevTool v1.0-SNAPSHOT
[12:05:25] [Server thread/INFO]: This plugin requires Vault & Economy plugin.
[12:05:25] [Server thread/INFO]: [DevTool] Disabling DevTool v1.0-SNAPSHOT
what are you using for compile?
maven
IDE
😂
strange
happened when i use this
/**
* Clean up any left over lock data that is no longer valid.
*
* @param event
*/
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event){
PersistentDataContainer container = event.getChunk().getPersistentDataContainer();
BlockState blockState;
for (NamespacedKey key : container.getKeys()) {
if (key.getNamespace().equalsIgnoreCase(Main.getInstance().getName())) {
String[] data = key.getKey().split("_");
if (data.length != 3) continue;
blockState = event.getChunk().getBlock(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2])).getState();
if (!(blockState instanceof TileState || blockState instanceof Lockable || blockState.getBlockData() instanceof Openable)) {
Main.getInstance().getLogger().warning(String.format("Unknown Lock removed! %s.", key.getKey()));
container.remove(key);
}
}
}
}
ah maybe ?paste was better but yea
?paste
smh
hm
it enables vault before my plugin now
but it still disables
this is the main
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
have you tried checking the local variable to see if it is null?
https://paste.md-5.net/uzogibabas.css can someone plz help me
i think it works now
not really
well the vault problem is fixed
now it doesnt do anything when i jump xd
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
does absolutely nothing
nice debug 👌
have you set up the redis and your database system correctly ?
How would you turn a EntityCreature into a Bukkit Entity?
thanks lol
it works for everything else
it doesnt even broadcast that though
this.getServer().getPluginManager().registerEvents(new JumpEvent(this), this);
this is the right way to register an event right? or am i going nuts
correct
implement Listener and annotated?
This is Spigot not paper
well i needed the paper for jump
wtf still nullpointers
bump
@EventHandler my dude
i get a nullpointer at this line :/
p.sendMessage(ChatColor.RED + "This block is already locked!");
oh my ty im dumb
p is null
then thats not the line thats null
Not used it much
the 90_000 works fine
There should be a getBukkitEntity() method
Could you turn CraftEntity into Entity then?
yes
How would you do that? Just cast?
the CraftEntity is just the implementation version of Entity
you probably dont have to
not understanding why
[12:28:48] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to MagmaBuildNetwork v1.0
org.bukkit.event.EventException: null
LockListener.java:46 show line 46
.
doesnt do anything now with the formatting...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
okay, full code
fml
i changed it so let me try again
how do you guys suppose i would format a number with . and ,
just make it ###.###.###.###.###,##
ok ty
ah found it
oh, that's very useful
does it have to be a double
or can numberformat work with ints too
ahh it works
ty elgar
How do you convert a raw slot position to separate x y positions in a chest inventory?
My math is a little f'd up.
For example let's say I have the raw slot pos 12 the x y should be x: 4, y: 2
Top to bottom Y dimension, left to right X dimension, though you need to pre-assigned those values somewhere I guess? Something like a grid? and uhm, start from 0 x and y can be 0 too
Why'd you need to pre assign them? I already made an algorithm to convert x y positions to raw slots, so it's definitely possible to convert them back.
just revert that function then
math
send the function
lemme try revert it
reverse*
You mean calculate the inverse function?
yeah basically
Hello! I am letting a FallingBlock float up with setting the Velocity. Can I somehow stop the block when he is 20 blocks above the starting point?
I don't think I've ever needed to find the inverse of a function with 2 param.
Not sure how it's done.
pls ping me if you answer so I will see it thank you
public static int calcSlot(int x, int y) {
int i = 0;
i = ((x + 1) - 1) + ((y * 9) - 1);
return i;
}
ah, yes that looks similar
I don't know why you made the i variable tho
Thanks anyways!
Why ((x + 1) - 1) ?
wait hold on
You got this wrong
You got the exact opposite of what I'm trying to do.
I want to convert raw position to x y
im not that mathematically genius
Alright, so I guess you can take the clicked slot and do the / 9 and then take the reminder and multiple it with the reminder that you got from the clicked slot
just java int y = value / 9; int x = value % 9;or something close
e.g: for a chest with 62 slot, we pick a random number let's say 30, we do 30 / 9 = 3.3, which means it's on the fourth line and then we do 3 * 9 which is 27 and then 30 - 27
ah, yes, much better 🤣
whats the % on a calc
modulo
the remainder basically
modulo is the best
Oh, yea, I was overthinking. This makes sense. Thanks
hey guys ! anybody who knows about Gson ?
I've supposedly created a TypeAdapter for Vectors (a writer and reader that write vector to string and return a vector when read).
- I'm not sure if that's all I need to do or if I need to create a custom "serializer/deserializer" ?
- What I actually want to json write and turn back in is actually a Map<UUID,Collection<Vector>>. I think gson is able to handle Map and UUID, like it has premade function, so is it possible for me to use them and only "provide" my Vector adapter ?
Many thanks !
the bible 🙏
Vector already implements ConfiurationSerializable which has serialze and deserialize methods
elgar i got an error when trying to use your onChunkUnload method
what error?
hmm it isnt in Gson then ,right ? cause I tried to Gson a Map<UUID,Collection<Vector>> and it doesnt seem to work.
line 71 is this
blockState = event.getChunk().getBlock(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2])).getState();
a Vector is 3 doubles, but Vector serialize returns a Map<String, Object>
Hmm right, maybe I can turn the UUID to string easily, but what about the Collection<Vector> ? will it handle it ?
it should
Ok I will try it then, thank you
one sec
np
don't divide, use a bitmask
yep
it says it requires a number from 0 to 15
or, well, floor the double and then use a bitmask
these are just coordinates right?
yes, it has to be converted from a world coord to a chunk coord
ow these are chunk coordinates
actually we can just use mod 16
ki
um, true
you need to take the world coordinate and separate the in-chunk block coordinate from the chunk coordinate
the easiest way to do that is a bitmask
you can also do some math with divides and floors and shit but a bitmask is easiest and anyone who has done similar logic before will understand it better
idk what a bitmask even is smh
int block = world & 0b1111
I am working with IntelliJ in a Java project and I need firebase (i already added the firebase API). I found this code on the Internet:
FirebaseOptions options = FirebaseOptions.builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://databaseName.firebaseio.com")
.build();
FirebaseApp.initializeApp(options);
But it didn't work because it threw me an error for FileInputStream, for .fromStream, and for InitializeApp. I don't know how to fix the problems and I can't find good documentation or tutorial that can teach me how to use firebase in Java. Please help me how to connect firebase project to my Java project.
My code: https://i.stack.imgur.com/CvK0o.png
blockState = event.getChunk().getBlock(Integer.valueOf(data[0]) & 0b1111, Integer.valueOf(data[1]), Integer.valueOf(data[2]) & 0b1111).getState();
What error
Actually nvm
not understanding but thats something else
Its a bitmask, basically it tells the value to ignore all bits except the minor 4
?learnjava do this before advanced projects
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.
int blockMask = 0b00000000000000000000000000001111
int chunkMask = 0b00000000000000000000000111110000
int regionMask = 0b11111111111111111111111000000000
of the 32 bit coordinate, the lowest 4 bits represent the in-chunk coordinate
an unsigned value from 0 to 15
the next 5 bits represent the chunk coordinate in the region
an unsigned value from 0 to 31
the rest of the bits represent the coordinate of the region itself
for example, take the coordinate 625
which in binary is 0000001001110001
the last 4 bits, 0001 represent the block location
0001 is 1
so a mask of 0x0F
the chunk location is represented by the next 5 bits
00111
00111 is 1 + 2 + 4 which is 7
and the region's location is the remaining bits, 0000001
and 1 is again 1
so, the coordinate 625 is located in region 1, chunk 7, block 1
what do they mean by Mask?
they mask a value
exposing or hiding parts of it
something & 0b1111 hides, or masks, everything except the last 4 bits of something
any bit set will allow that relative bit to be counted
oh
any 0 blocks it
sort of yes
i get it
it's a bit-wise and operation
so 0b1111 or 0x0F only counts the last 4 bits
each individual bit is tested for "are both of the bits true"
so when you give it a value where only the last 4 bits are true, no other bits can pass the test
Errors: FileInputStream: Unhandled exception: java.io.FileNotFoundException Error 2: .fromStream: Unhandled exception: java.io.IOException Error3: .initilializeApp: Cannot resolve Symbol
11010
& 01111
= 01010
and conversely
11010
| 01111
= 11111
and with xor
11010
^ 01111
= 10101
Look, I already coded the main backend and algorithms in Java, I just need help to connect firebase and send there the datas
integer.valueof returns an Integer
which gets unboxed into an int
which is redundant
use parseInt which returns an int directly
but when is chunkUnload called?
Assumably when the chunk is unloading or post that
before it
the chunk loading and unloading going under the hood is kinda weird now
mojang has like load and ticket levels and shit representing different states of being loaded and ticked
Myeah not my expertise. Oh lol
the api, in typical bukkit fashion, of course reflects absolutely none of this
🥴
the chunk will still be in memory and probably will still be loaded for a few seconds to a minute when the unload event fires
well i lock a chest and when i open it it says already locked
https://paste.md-5.net/ihusaxedek.java
Oh fr, but then it wouldn’t require a load during that time?
it's in memory somewhere in the actual nms
just the bukkit api considers it unloaded
Ah fair
because its load level is lower than full, or something
but, it's still there, and can even still be ticking
and can still contain entities that are not invalid or unloaded
that will show up in world.getentities
Oof
it's a mess
Not documented in javadocs I suppose also
as if anybody updated the javadocs whenever mojang pulls something like this
Is Bukkit's ConsoleCommandSender the same as Bukkit.getLogger() when you want to send messages? Or is it something else
No
These are all java basics errors hence why I linked the learn java...
Errors:
- spelling mistake
- You never handled the exeption with try and catch
- Method call outside of method or instance/class variable
Bukkit#getLogger gives you a java logger I believe which is used to log stuff
Yes I understand the purpose of loggers
Like logging things on different levels, logging async or flushing it to something
And what is ConsoleCommandSender then?
Colorful loggers
Just an abstraction of System.out.println essentially lol
Srs? Never knew that
(Not really)
But almost
Haha ok, but you can send colorized messages to it?
Yup
Also with & colors if you translate them?
Yeah
Nice!
Hello! I am letting a FallingBlock float up with setting the Velocity. Can I somehow stop the block when he is 20 blocks above the starting point?
you can send colored messages with the loggers as well
Any character you like tbh
Ok
using the console command sender as a logger is fucking retarded
Bukkit.getConsoleSender().sendMessage("[" + ChatColor.RED + bla bla bla
it will respect zero of the end user's logging configuration
Nice
Set NoGravity flag (and possible tweak velocity)
Yeah but ofc doing color shit requires ur console prompt to support colors
Ok I understand
okay and how can I check if the block is over a specific height?
store the specific height and compare
should I make a scheduler and check everytime if its there already?
^ and since it's moving you might have to use the scheduler
oh okay haha
Guys can someone help me with using ConfigurationSerializable, i dont understand and the doc doesnt help me
Do you know what serialisation is
public void onDisable() {
Map<UUID, Collection<Vector>> classmapp = Territory.getAllTerritories().asMap();
Map<String , Collection<Vector>> newMap = new HashMap<String, Collection<Vector>>();
for(Map.Entry<UUID, Collection<Vector>> entry : classmapp.entrySet()) {
newMap.put((entry.getKey().toString()), entry.getValue());
}
ConfigurationSerialization.registerClass(newMap.getClass());```
yea
this may look dumb atm
what are you trying to do
but I'm trying to convert my map into a Map<String, Collection<Vector> because ConfigurationSer handle only map<String,Object> as far as I understood
I want to store this map into file
I also saw that you must register the class or something that's what im trying to do last line
Right, ok i am really not the person to help with this
how can I delete the falling block?
😦
I am not completely familiar with this
don't use the config api as a store-random-shit api
yea it's understandable, kinda tricky
I tried using Gson but apparently this bukkit ConfigSer handle Vectors already so..
might try back with gson
can I somehow delete a falling block?
its an entity, remove it
okay
is it possible to access the loaded class from the bungeecord plugins in a spigot plugin?
with reflection I think it's doable
ok and is it possible to hide players with bungeecord or only with spigot plugins?
https://hastebin.com/ofocabuvek.properties Is this a bug? It looks like a bug - The block breaks fine in-game
why does my falling block get spawned not exactly in the location? It gets spawned a little bit off everytime..
FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(location, Material.GRAY_CONCRETE_POWDER.createBlockData());
Check your location X Y Z, sometimes they can be set at floats of + or - 0.5
print it out and double check it 😉
Then I'm not sure 😄 possibly a momentum thing being set somewhere?
the center of a block is at 0.5
Block::getLocation returns the location of the bottom-north-east corner of the block
okay thank you
Hi, I am working on a Minecraft plugin in a Maven project. I have to use Firebase because I need to fetch data from there and send data to there. Now I don't even know how to connect to my database (I already implemented the firebase API to my pom.xml). I didn't find any kind of documentation or tutorial that can help me. Can somebody send a link to a doc or to a tutorial that can be useful?
Bungee PlayerJoinEvent ?
An exception occurred while getting the Javadoc
--> Unknown Javadoc Format for...
is it possible to make so when i go spectator mode if u do tab that u can see my name normaly
cuz when i go on my server and do spectator mode to see if people hacking everyone is like oh nice spec mode
not sure if its achievable over packets. otherwise do a custom spec mode
how do u do a custom spec m ode
He should use packets, otherwise hacked clients who listent to packets for the tabs will be able to see him
Player::hidePlayer hides the player and shouldn't send any packets pertaining to the hidden player
at least it does on paper, dunno bout splögget
doesn't matter, he wants to have his name visible
ye but when i completely hide myself they also get angry lol 😦
Just hide an alt account
lol how
Anyone knows how to check if the config.yml differs from the baked in config?
Oooh, I misunderstood what he wanted
add a hash, version number or whatever and compare them
ah, just compare the values
compare the content of the configs
ah
or check the file size
the real question is why?
tldr i need the config present but I have to edit it often. I don't want to delete the file every time i build the plugin
but i also want to avoid a delete and save of the default config to spare the drive
why arent you just adding defaults?
config.options.copydefautls
add the new config options
to alrdy existing oe
whats the code for that?
getConfig().options().copyDefaults(true);
Can somebody help?
that works even if the values are changed in the config in the plugin folder?
shouldnt update alrdy existing entrys
ye i need to do that
because its likely i get from listen:[stone] to something like listen:[stone, diorite] when adding more functionality
Hi friends ! so I have a Multimap<UUID,Vectors> that links and store user to vectors. But the problem is each time a player (me) disconnect and reconnect, it doesnt identify the UUID as the same although it identifies it as the same entry key ! I dont get it, isnt it supposed to be an unique UUID ?
meaning it wont update it if it alrdy exists
can someone help please
ur in offline mode?
shouldnt matter,the uuid its rather obvious by the name unique
it changes if youre in offline mode
its created based on ur name
wym oflline mode ?
after its always the same
server mode
cracked
also why exactly a multimap?
Well because I need several Vectors associated to each players
it's was easier that way than iteratie through collection etc each time
Hi my plugin throws this Could not pass event PlayerJoinEvent to SurvivalMultiplayer v1.0.0 org.bukkit.event.EventException: null should i use the async version of PlayerJoinEvent? (AsyncPlayerPreLoginEvent)
anyway the uuid should be the same no matter what
Firstly give the stacktrace and that is the the async version.
Not the*
I'll just throw you my code so u can see maybe what's wrong if u will because it's incomphrehensible
It's a different event that does different stuff
show us how you set the map
uhh the stacktrace is just a bit large.. let me put it in a pastebin link
well it's a bit complicated because I use Gson and converts multimaps to map and then back but I dont think it's the problem tbh
here is block event
I should have "you destroyed yr own block"
and it works well
untill I disconnect reconntec
actually there isnt any Gson thing unless I shut down the server, while here the problem happens only when I disconnect and works well before
so it's the exact same map
are you using put on playerjoinevent?
if you are talking about the Gson thing, no, I use it on OnEnable
and onDisable it makes a conversion
so you add players based on your saved data on enable
yes, I reconstruct the Map if u will
and not do anything that removes or adds elements to the map on join or leave
i just noticed this huh Caused by: java.lang.IllegalArgumentException: Plugin already initialized!
but the problems happens even when the map is empty, I start the server so it creates a null map. player will place a block which will put it into the Map
at this point everything works fine
they destroy the block and their UUID recognize em as the same
but IF I disconect (no restart), the UUID isnt recognized as the same anymore
So there isnt even a conversion Gson/Restart happening ! It's the exact same Map !
which is really weird
no no event whatsoever beside placeblock and remove block
I dont get it lol
the uuid OBJECT (UUID@<memory_address_here>) changes, the UUID doesn't.
Compare UUID as strings
@quaint mantle
Can you manage the whitelist with spigot?
It works now, Moterious you are the man ! thanks
@noble spire
- somehow get the player
- player.setWhitelisted(true);
remember to activate/reload it
wdym?
if you add a player to the whitelist theres a good chance he cant actually join
since the server still has the old whitelist loaded
Bukkit.setWhitelist(boolean active);
Bukkit.reloadWhitelist();
ah okay thanks
np
wait, what if the player isn't online
ah, should I then manually edit the whitelist file and reload it?
declaration: package: org.bukkit, class: Bukkit
you sure?
name to uuid doesnt work
no, but you can use mojang's api
true
high chance of not working correctly
not true
also
yes its deprecated as a warning because it makes a request to mojang
not for removal or anything like that
hmm, mojang's api is super easy to use tho
well you can just run /whitelist add <name> in console since... it does the same thing. grabs uuid and puts it in whitelist
Server#getOfflinePlayer does the request for you and wraps the return with spigot api interface
why put it in a plugin in the first place?
that's not what I'm asking 😳
well to your original question, Yes, and depending on how secure you want it, its either very easy or a bit complex
what if they don't exist?
you get null
to that method an offline player object exist with every possible name
read the javadoc
oh offlineplayer
they do, if there is a player with that name
If you want only legal names, you'd have to check that yourself
whitelist command recognizes non existent players
yeah, I'll just use the mojang api ig
it firstly searches through the cached player list inside the server and if he can't find a player with that name it requests the uuid from mojang
👎
thats probably the reason why its deprecated because if the player was already on the server and names changed it returns the wrong uuid
it uses the player name
would just run that method async since it can slow down the main thread
nope
nope
its deprecated because it requests to mojang as cloncure just said
nope
dont involve offline mode 
cuz the only responses the whitelist command gives me are either 'added <player> to whitelist' or 'that player doesnt exists'
i am not sure what whitelist add surely does
probably just iterating through the cached player list
so the player have to ping the server or have to try to connect to it to get cached
well for me i can add people that were never in any way connected to the server
tried bachibachi and it worked
maybe it does make a request then 😮
#general? This is getting a bit off topic
its not
okay ¯_(ツ)_/¯
and even if its not prohibited
just if any1 asks a question here
while there is offtopic
same here
maybe ur whitelist is corrupt
don't think so. seems more like a list of names where the name just gets added to
but
hm
its uuid and name
How could I make a rectangle radius?
whitelists are weird
i think he want to do it in minecraft
interesting
JavaPlugin#getResource works with folders, right? E.g. lang/en.yml
yeah that probably wont work on my server im running linux
actually it usually has no issues but just in case
what wont work
yes I was planning on doing Paths.get("lang", "en.yml") anyway, I guess that would work, right?
better
as for @tall ridge if a os uses a different internal file separator the File.separator grabs that but if it is defined with '/' it crashes
can you switch it to \?
same issue
for example windows would not register it as \
since the backslash is on windows the escape character
so you would use \ on some os, but on windows it needs to be \
see tried to do a double backslash there
\\ on windows 👍
I'm trying to fork Craftbukkit to make a contribution. All I've done is clone my fork from the stash and apply patches. Can anyone point me towards how to solve these pom.xml errors?
you need to have the craftbukkit api linked as well
public class MainMenu{}
I am making this for inventory what will be after implements?
InventoryHolder
Err. What do you mean by that? I'm modifying Craftbukkit itself, so I don't need to add it as a dependency to itself if that's what you're suggesting..
@Override
public Inventory getInventory() {
return null;
}
I am not familiar with this :/ Inventory gui = Bukkit.createInventory(p, 27, color("&8&lGUI")); this is what I do
add an instance inventory to your class and instantiate it in your constructor like that
you return it over the method
can i set custom hardness for block?
lol, this channel's too active. i'll just make a thread
instance inventory?
that's what I am making, a inventory
._.
😕
Just run build tools
I've done that already
And change the remote of the created Bukkit and craftbukkit projects
@quaint mantle inform yourself about instance variables and you will understand it hopefully
You might also just create a pom.xml file as a root
In which both Bukkit and craftbukkit are listed as modules
is there a listner for placeing blocks
BlockPlaceEvent
wut?
hey whats the shortcut thing called in intellij settings > keymap for this?
like for the //
control + /
ty
for a comment?
i just told them
oh
if so, i would like to have that too
yea for comment
Err, how do I go about this? I haven't done too much with Maven besides the basics really - dependencies/repos, java version, char encoding
ah
Alright, well much appreciated
public Inventory mainmenu;
@Override
public Inventory getInventory() {
return mainmenu;
}
``` like this?
I tried asking elsewhere as well, but it came to "Why not use paper" instead of actually pointing me towards anything.. xD
yeah, you just have to instantiate it in your constructor now
just like you did before
but just for this inventory
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>Bukkit</module>
<module>CraftBukkit</module>
</modules>
</project>```
Ohh, okay. That's really simple.
Plug it into the root dir if your build tools
Change the group and artifact Id, doesn't matter what to
if i import bukkit listner will it work on spigot 🔰
spigot is a bukkit fork
They use the same Listener, but there's no point in using Bukkit instead of Spigot really.
Who actually used bukkit what
i think he got confused by the package name
Ah XD yeah maybe
im watvcing a tuturial and hes using bukkit
close it
no its not if hes using bukkit
What build/dependency management tool does it use
@hybrid spoke
public class MainMenu implements InventoryHolder{
public Inventory mainmenu;
MainMenu(){
Inventory main_menu = Bukkit.createInventory(Player, 54, color("&7gui"));
}
@Override
public Inventory getInventory() {
return mainmenu;
}
private String color(final String message) {
return ChatColor.translateAlternateColorCodes('&', message);
}
}
pls guide
well hes only one that teaches block place
event
make your constructor public, don't create a new inventory, use your mainmenu instance var.
doubt it
did you even google?
yes
yes actually
oh well
all those are bukkit 🙂
its spigot
spigot is just a bukkit fork
so it uses the bukkit methods, classes, packages, humans, pets
is it the same with paper? Can't remember...
k. Are on spigot the elytra dupe and the book disconnect dupe fixed?
why do you even need a video? the spigot wiki has tons of written guides tons of topics
becuz im new to java
to be fair javadocs are a bit hard to read
so you cant read?
and eclipse and everything
buuuuuuuuuuuuuuurn
oh right is there a 1.17-api-source.jar yet?
yes, its on the nexus
where
ok got it, also do we have to make ItemStack and ItemMeta for each item in Inventory?
just if you want to modify it
just like the name, lore etc
otherwise you can just add a new ItemStack(Material)
ok where
?jd
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
google next time
how to create multiple configs?
FileConfiguration config_players = null;/
File config_players_file;
File dataFolder = this.getDataFolder();
public void savePlayerConfig() {
try {config_players.save(new File(dataFolder, "config_players.yml"));
} catch (IOException e) {
this.getLogger().log(Level.SEVERE,"Could not save file 'config_players.yml' due to unexcepted error.\n"+e.getMessage());}}
public void loadPlayerConfig() {config_players = YamlConfiguration.loadConfiguration(new File(dataFolder, "config_players.yml"));}
public FileConfiguration getPlayerConfig() {return config_players;}
public void setPlayerConfig(FileConfiguration p) {config_players = p;}```
@quaint mantle
And how to get data from them? :D
just well grab it?
make the config static then you can access it from everywhere once its loaded
oh and public
import org.bukkit.plugin.java.JavaPlugin; why does this import not work "Description Resource Path Location Type
The import org.bukkit cannot be resolved event.java /pluginv2/src/pluginv2 line 2 Java Problem
"
are you building with the bukkit api?
i dont know what that means so no
screenshot the error, the stuff you copied makes little sense
and are you using maven or gradle, or just importing jars?
nvm dont worry about it
in onEnable()?
he will probably just copy&paste it
?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.
^ @quaint mantle
I didnt
for what the question then
cause how will the config load if its not in onEnable
load it with loadPlayerConfig() in onEnable but remember it assumes the config FILE exists
hello i need help with SBAHypixelify as the shop is not working am i supposed to ask that here?
no
ok
Hey guys, is it better to store new instances in a HashMap, or it doesn't matter ?
return new PlayerData(uuid);
}
what is use of File main_menu_file; in this?
How would I go about making something like this? https://i.imgur.com/xdjEz9x.gif
There are multiple different types of tnt along side regular tnt, and I cannot figure out to tell them apart so it would work when its stationary and launched
I’m not sure what your question is really
How to tell apart the different TNT’s?
yes
how would I tell which one is which like if its launched from a tnt cannon for example
i tried using location but had that problem ^
a tnt is still a entity,add some metadata to it when its launched or smthng
I mean it would probs be a chain cause like
Item -> Block -> Entity -> Explosion
?pdc the entity
but you would need to listen for the block being placed
dispenser?
Different eventListener i guess
..
but still using the pdc
to mark it as a special tnt
and then onEntityExplosion just check the pdc
and apply the correct effects
Hmm, okay. I’ll give that a try. Thank you
in SimplexOctaveGenerator#setWScale() wat is W-coordinate ?
How would I go about getting the entity on blockplace?
WXYZ 4 dimensions duh
you could cancel the place event on monitor priority (sin) and spawn your tnt instead
maybe highest, monitor only if needed
ah, okay
just make sure you ignoreCancelled
4d in a 3d game ?
wow the speed of that reply, wat is ur wpm
at least 4
i think its more that lol
my statement stands
ok ty anyways
Its only because he has 12 fingers.
i c
that explains alot lol
you're not talking about spawning Primed TNT are you?
isnt that what you want
what are you trying
.
i lit it with flint and steel
is it a special block?
dont think so, let me check
store the entity on interacting with tnt
Recreate the tnt
or i think there has to be an event for that
otherwise store that block on place and check if the tnt, which is getting activated, is this block
it literally says tnt @granite stirrup https://i.imgur.com/b9blSvC.png
am i missing something?
U can't?
not sure
custommodeldata is for itemstacks
huh ok
so you need to, at some point, store data in the placed block itself?
I think there was something for blocks
they do not
and store the type of the tnt there
this is what i was told (and what i was kind of trying to do last night) #help-development message
the location wont work if the tnt is launched from a cannon tho
If i remember right you can put additional info into blocks but i cant tell you if its permanent
isnt it still an entity at that time?
the block data i sent is your best bet, puyo
not an issue
I mentioned shooting in my original quesiton
grab the block where its placed and when its lit just keep track of the created tnt entity then do something when it explodes
alright, thanks
Is there an event for lighting? i looked and only found the prime event which doesnt seem to trigger until it explodeds
check if someone rightclicked with a lighter
They probably can considering you can stuff chest nbt in a spawner and it still works
as a chest
Lol what
what about redstone
iirc there isn't an event which handles tnt lighting
PR it or something
@quaint mantle the primeExplosionEvent triggers just before an explosion and there is no specific event for a tnt
however something worth looking into is entityspawning
and checking if its a tnt
problem is you dont get the block that way
Also it would be possible, if cumbersome, to track the different things that can ignite tnt. Alternatively, make the tnt automatically lit when placed
@hybrid spoke EntityExplodeEvent: Called when an entity explodes
ExplosionPrimeEvent: Called when an entity has made a decision to explode.
neither of those are fired when the tnt is lit
i was just correcting jeff, not responsing to the topic
imma check the explosion prime event brb
ah sorry
BlockFadeEvent might be called for it, or BlockFromToEvent, or BlockRedstoneEvent
i misunderstood
there is literally no event for when a tnt is lighted
would think of EntitySpawnEvent
but probably not
you can check those for TNT block, then store that location for a tick and wait for a tnt entity to spawn in that location
then you have your entity reference
BlockFromToEvent is only for liquid and dragon eggs
then try the others ¯_(ツ)_/¯
alright
the main point is, try events you think might work until something comes up
i like to just put a bunch of handlers for events i hope would work, and then just try it
you could try this since a primed tnt is getting spawned
ye, thats not a bad idea.
thank you guys
this would not allow for a reference to the block
but i think the only way is to get when a tnt could get activated (redstone events, interaction events)
since the block is storing some data
BlockPhysicsEvent is almost definitely called for it lul
alternatively you could look over this https://github.com/WASasquatch/BlastRBrandTNT/tree/master/src/wa/was/blastradius/events
code.
although if you're using @waxen plinth's library, the DataBlock probably wouldn't get auto-removed when the TNT is ignited; so you could use the entity's location for a reference to the DataBlock
Hey, any easy way to parse date via chat in format such as (51D5h3m) without reggex?
w h y
Basically, I want to get, the duration for something via command arguments and then append it to the current date
just use regex?
i dont think theres any ways without it
;-;
Same here 🤣 not so familiar with regex 😄
use UUID
yeah idk regex either
i saw the Date class maybe it be able to do it
Hello, will concurrent modification exception be thrown if I delete (set to null) one of configuration sections while looping them?
you could also compare uuids or names
probs uuid
idk some people do it
names change, thats a bad idea
ik
Nope, not for that, it converts the date from a string like: 2021-06-26T21:58:56.005166200 to a date
F
k
no dont use uuids
it already compares the UUID but it also compares if it's the same entity id (i.e, the player hasn't relogged)
oh then this is fine
why not lol
@sage swift you're confusing me 🤣
oh xD
if someone relogs then a player object from before they logged out will not be comparable to the current one
it's not that big of a deal, though if you want to be extra cautious then you should compare uuids
it is a big deal
not really
use players if you want bad practices
songoda style, one may say
there is no way someone can relog within the same tick
teach yourself bad practices
right
k i switched my thing out to compare UUIDs
Songoda plugins use player objects for identification?
no but they are widely regarded as badly coded
what arguments did you pass in
Inventory inv = new Bukkit.createInventory(player, 18, "lol");
but intellij shows me as an option
whenever im beginning to write it
ah yes new Bukkit.createInventory
wttf
why would you create a instance of Bukkit.createInventory can you even do that with methods XD
is it possible to add a chat cooldown in chat with essentials?
No to my above thing
help-server
ok
?
EXCUSE ME
excused, 1.8 user
wym bye bye
ur outaded
uh its 1.16.5
kinda true cuz 1.8 its higher than 1.16.5 XD
public void openWorkbench(Player player){
Inventory workBench = Bukkit.createInventory(player, 9 * 6, ChatColor.color("&7["));
ItemStack glass_black = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
ItemMeta meta1 = glass_black.getItemMeta();
meta1.setDisplayName(ChatColor.color("&7"));
glass_black.setItemMeta(meta1);
for (int i = 0; i < 44; i++) {
workBench.setItem(i, glass_black);
}
ItemStack glass_red = new ItemStack(Material.RED_STAINED_GLASS_PANE);
ItemMeta meta2 = glass_red.getItemMeta();
meta2.setDisplayName(ChatColor.color("&7"));
glass_red.setItemMeta(meta2);
for (int i = 0; i < 44; i++) {
workBench.setItem(i, glass_red);
}
}
Why cant i call this i made in my utils class dafuq
I only help 1.17 no nms
no your not
pls halp nms
how are you calling it
🧢
i love how they changed EntityPlayer.playerInteractManger to EntityPlayer.d in 1.17, that really makes me happy