#help-development
1 messages · Page 561 of 1
There is no reason to run the game at a higher framerate than your monitor
your bios probably has internal disabled
Just switch it back
turn it off and plug it back into it's original place and boot it
ok can i switch it back
And limit your fps
yes
move teh cable back and then enable vsync
ok
Enable vsync or limit fps
install sodium and limit your fps to 60 or enable vsync so it limits it to your monitor's refresh rate
I have an i7 3770k with a GTX 1070 with 32 gig of ram. I run at 60 fps/vsync
dang
dang theres no method for just getting the vanilla name of an item still
send pic
I';m betting you bent a pin moving the cable
send cable pic then 😭
how to indent new line?
i think its the correct one, look
that chat? gotta split it on \n and send each msg apart
oh
we dont know, send us a picture of your cable's pins
did you apply a lot of force when you were switching ?
That monitor cabel does not looked plugged in to me
this is the text for TextDisplay
it looks like its wedged
ok wait
no hdmi cable?
also the pc didnt look likeit was even turned on, ethernet leds werent flashing
If it doesn't work, you should maybe have to do multiple textdisplay, one for each line
hmyes very clear
cable looks good
what do i do??????
💀
plugin it back in and make sure you didn;t knock any other cables loose
ok wait
I'll test out soon and give you updates
does it have power?
is it actually turning on?
what sound
help pls
turn yoru monitor off then back on
idk
[16:13:58 WARN]: at RCore-1.0-shaded.jar//dev.relismdev.rcore.storage.localStorage.lambda$set$0(localStorage.java:45)
[16:13:58 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[16:13:58 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[16:13:58 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)```
in my msgListener class i can access the socket object and emit/listen, but on my localStorage class (in which i imported the socket the same way as the msgListener class) it throws ...localStorage.socket is null, anybody know why ?
ill let the help desk guy handle this lmao
with button? already tried
😄
run away from home
check if the video cable is plugged in correctly both ways
use dependency injection pls and make it final, variable isnt initialized in that class
fruits
how
Variable socket is null. You shouldn't use static abuse and take advantages of Java objects, that's maybe why you couldn't easily figure why it is nukk
wait i have idea
youre slow
time for a refactor bois
some time it was doing this like that and i just needed tu punch case little bit 💀
i looked into the di you told me about yesterday and didnt understand a single thing
just pass a param into the constructor and set it as a field
You should probably learn java properly before playing with advanced things such as Sockets
for the socketHandler class ? i need to pass a param when instancing it ?
ok nothing. its still like that
just pass it into the constructor of the class that needs that socket
what do i do now?
do yall know how i can get the collision box of a block entity
true, but i know how to use sockets since ive been coding in js for a good amount of years lol
raw sockets :(
power everything off (including monitor). Wiggle every cable to make sure it is correctly seated (including those in the monitor). Power on monitor, then turn on PC
hey
If it still has no video you need to open it up and make sure your video card is correctly seated
what does wiggle mean sorry my english aint good
Need parents consent if a minor
bruh what have i done
:)
move a bit
did you tighten the screws on teh cable?
seriously
yes
dead cable or video card then
thanks i guess
yes
can u guys look in screen i sent
what screen?
photo
its not there for me
wdym
test
its not there for me
discord had a stroke or was that just me?
na same
yes it had
how can you set the health of the wither? Modifying their attribute and setting their health doesn't work.
another ddos attack 👀
After I updated the version to 1.20, 'CraftItemStack' does not exist. How can I change ItemStack to nms
I mean, the class is still around
?bt
so your setup is scuffed/wrong import ?
i run it using --rev 1.20.1
and how are you importing it
maven
Intellij
clear caches?
I told you not to move it 😉
as the PC boots it's detectign a video card
but no output
monitor or cable is most likely
It worked! Thanks
I thought it worked, but i get this error when the server loads the plugin
yopu did not reobfuscate
did you not compile using mvn package?
I build using intellij artifact, and this is my plugin pom:
you probably broke it yourself moving the cable
I found this 3 libraries with red texts
public class BotConfig {
private static final FileConfiguration fileConfiguration;
static {
fileConfiguration = LinkCommand.getPlugin().getConfig();
}
public static String getToken() {
return fileConfiguration.getString("token");
}
}
is that a bad way to something like this. (Getting a value (String) from the config.yml file)
there's your issue. You cannot use build artifacts
you have to use maven
mvn package
Can you let me know how to do that in Intellij
public void teleportToVault(Player playerName) {
if(!(playerVaultCheck(playerName))) return;
Location spawn = plugin.getServer().getWorld(playerName.getName() + "'s Vault").getSpawnLocation();
playerName.teleport(spawn);
}
Will this teleport the player to that world, or just teleport to the coordinates from the current world?
upper right, there's a "maven" tab. Go there, then "Your Project" -> Lifecycle -> Double click on "package"
you can also create a configuration so you can just hit the play button.
Wow it worked!! Thanks a lot!!
Calling your player instance "playerName" is very confusing but this code will teleport the specified player to the spawn of the world "<playerName>'s Vault"
yeah I put it to playerName because it helps me understand what I'm currently looking at.
But that will work? it'll teleport them to that world, and to that worlds spawn?
Well if the World exist, yes
It'd be better if
"please like subscribe coment and don't forget to try it"
I have checks in for that, so hopefully nothing will break.
What kind of input does the Location data-type take?
For reference, 0,0,0 is something it won't accept
declaration: package: org.bukkit, class: Location
Should be 3 double
Location takes a World object then 3 doubles.
world x y z yaw pitch
world x y z
Your ide will scream possible constructors at you
where yaw and pitch are just default(0, 0)
Assuming you are not using notepad
Damn... It will get hard to get used to the 1.20.1
?
ohhh, ok
I have this code for custom configs: https://paste.md-5.net/avikohudiv.java
It is actually saving the file into the plugin folder, but not writing the stuff i write into resources:
Supposed to write this:
Actually looks like this: https://cdn.discordapp.com/attachments/741875863271899136/1117990345154764841/image.png
How would I create my own location?
Location loc = (world, x, y, z)
doesn't work...
by learning about constructors
and object instantiation.
Elaborate please
?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.
Bro.... I know what constructors are and instead of ?learnjava screaming at me actually explain
nothing to elaborate about, thats not valid syntax
well we arent
this isn't really a learning java server its pretty much just spigot help, not many people here wanna teach java
The only reason i ask for help in dm's is so people can't shit ?learnjava like they just drank 12 litres of blender'd taco bell
oh now hes gonna ask it there
the server is literally a Learning server though
Location, is a spigot function. I would like to add +1 on z axis. Are there any ways of doing this.
thats not even a function
you can create a new location and add 1 to it with the add method
yes
Thank you for your valuable answer and interesting contribution to this conversation.
declaration: package: org.bukkit, class: Location
I already sent it
i was wanna try to help but i don't know too
Sarcasm will get you nowhere here
oh sorry
Thank ou. I'll read through this
i didn’t see
hows he gonna call a method if he cant even create an object
#notmyproblem
honestly should join the java learning server i sent if he wants to learn java
their are people who want to teach and explain java there
how do i get tripwire face in "if" ?java Tripwire tripwire = (Tripwire) e.getBlockState().getBlockData(); if (e.getBlockState().getLocation().getWorld() != null && tripwire.getFaces().add(BlockFace.EAST)) {
getFacing
why are you doing that in a if statement
unless your checking for it to be a success j thought #add was void
j thought
i
i need check if tripwire face is east
autocorrect
j thought too
but what need i do ?
?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.
man
learn about the == operator
what does that have to do with anything
for checking what face it is?
seems like the only command purple name'd people know is ?learnjava
don’t be salty 😅
I assume they didn't know about #getFacing
I mean it's true 🤷
elgarl gave it to them earlier
oh maybe they didn't see it
am i get wrong block ?
hm? one second
getFaces().contains()
maybe instead of posting useless gifs actually tell us what we did wrong and explaining it instead of making people who don't understand something shit because they don't understand something
if you told a goldfish to climb up a tree it'd feel stupid
it was joke
🙂
i mean at that point i'd agree
bro calm down
but where we know basic stuff, and we just want to progress helping us is more useful
then sending an entire resource with 72,000 pages worth of stuff on java
you didn’t know how to initialize a class
could you just stop talking here for a second. I sent you a server that deals with Java Help, as well as sending ?learnjava which sends useful links regarding basics like constructors classes etc. You have ignored everything I sent and continue to be a nusence
that’s more basic then basic
Your idea of "knowing the basic stuff" is different to ours it seems
bro i like u
I found out what i needed
im newbie too
Location newLocation = blockCoord.subtract(0, 1, 0);
they tell me to learn java
yes
shouldn't you clone locations? I've always wondered
I know how to do that 😭
always returns a clone
you've been here more than a few days, perhaps a week or more?
ahhh
I feel dumb for always doing Location#clone#method
then
no 😭
week alright im not newbie
goddamit
Dep[ends how you get teh Location. they are not always clones
^
that has nothing to do with learning java
stop being so salty
it has to do with spigot internals
only use clone if you keep using it in your code and are worried about modifications (maybe)
ahh In minigames I alway pass in clones etc to constructors
so it makes sense
go back to posting "Learn java" gifs in the java discord
a constructor doesn't
then that’s normal
ahhh okay I thought I was dumb
why the mushroom look like that
damnnn nice
always wanted me a mushroom house
its tripwire and this is mushroom colony
looks sick
is that vanilla ?
ahhhh rip tripwire :(
yes i did with resourcepack
💀
i see
??
chase?
for what, item drops?
my dyslexia kicked in for the better, reading it as chance
you'd have to construcot like kinda of a loot table
everything
make an item destroy event
then do random 1,3
^
even better you could use BlockDropEvent and change the item drops iirc
That works too
^
^
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockDropItemEvent.html ah here it is
declaration: package: org.bukkit.event.block, class: BlockDropItemEvent
?whereami
@vague swallow the chad is still here
I thought I already did BlockDrop temEvent with you poinetr?
i tried this method but i can't do
is isnt set material in first index ?
I'd empty out the list and add your drops
tbh
instead of trying to find it in the list
I mean I'd assume it'd be in the first slot
Its a Collection of Items, you have to get each Item, get it's ItemStack and modify it
im using but for to drops i use dropitemnaturally
no point
isn't the list mutable?
I already showed you how to modify the drops in BlockDropItem
I'm pretty sure you could just edit the list
no? that is kinda lame :(
You can modify each result but you can;t add
is that an NMS thing or just spigot abstracting it so you can't
No clue
For just replacing existing drops or blocking it's fine
as its all Item wrappers
this is the moment of all time
wait chace is luck or chance is luck in english ?
btw @eternal oxide coding what you sent me into something that fits what i'm doing is taking a while but it's working i think
?
Chance is how probably something to happen
luck is something is more likely to happen
e.g., if you were lucky, then you would be more likely to win the lottery/at casinos
but there is always a chance you will win something
(Don't go gambling, very small chance you will win)
(It woulnd't be a business if it didn't make money)
alright but ineed custom drops for % chace
yeah
who cares, 90% of problems asked here is not spigot related problems but dev stupid ones
Why would you need a runnable for loot drops?
i don't need
i just give example
BukkitRunnable will work fine
you don;t need any of it. you don;t even need dropNaturally
you could create a function where you input the chance and it outputs true or false,
public void chance(int chanceOfDrop) {
// random of 0-100
// if random is between 0 and chanceOfDrop return true
// else return false
}
good idea
Np
u mean i need use setdrops ?
no
just use ThreadLocalRandom
to get pseudo ints. its good enough
concurrent better
why so
most random
plus if pointer was mentioning runnables then mutlithreaded safety would be important
It won't matter enough
btw bukkit have random thread or i need use java one ?
public void onBlockDropItem(BlockDropItemEvent event) {
event.getItems().forEach(item -> {
ItemStack drop = item.getItemStack();
if (drop.getType() == Material.WHITE_CONCRETE) {
ItemMeta meta = drop.getItemMeta();
meta.setDisplayName(ChatColor.WHITE + "Granite Bricks");
drop.setItemMeta(meta);
item.setItemStack(drop);
}
});
}```Just fill in your drops, instead of this.
wait
how u see my code ?
where u know granite bricks ?
I gave you the code to start with 🙂
spigot 👏 should 👏 implement 👏 adventure 👏 api

what is wrong with BungeeChatAPI
eh doesn’t align with the project goals
adventure api?
you could PR it but it'd probably get denied
BaseComponent[] 
my favorite 😍
adventure api has more options
spigotchan says no to Adventure API
you know you’re able to shade adventure api yourself right?
I've said this before. The only way Adventure would ever get integrated into Spigot would be if a downstream contributor created a pull request to do so
your not limited to what spigot gives you
Adventure API ? why dont you adventure and touch some grass
And even then, you'd have to somehow convince md to use a library not maintained by Spigot
you are saying I should poke kash to push the entire adventure patch 
yea but its a pain in the ass sometimes, because paper bundles adventure inside it when spigot doesnt

Not a problem for Spigot
if you really wanted to you could host your own spigot fork with adventure shaded
honestly what would that do xD
whats the point of forking spigot to have adventure in it xD
i’m just throwing ideas for dovidas
ah 😅
and md5 won't even merge the Bungeechat API 😭
I just want my components mann
Trying
i should push this sticker to plugin users then
what about guava
🤣
But tbh Paper is just Spigot with some additions and some simple changes. All Spigot plugins are working on Paper
Guava is a pretty well-established standard and we actively use Guava features in Bukkit
for now 🥲
it works because devs tend to support both
Lmao you're back
how many times a day do you get pinged
there are many features on paper that would break on spigot if used without any wrappers by devs
0 usually
not you 🙄
I only test against Spigot
And here are more good and active helpers
not really often. I don't get pinged when someone does !whoami
paper devs can go enjoy their built in text components
I mean ?whereamI
i have strings
for example there are experimental brigadier api support on paper
try using that on and spigot support is gone
Strings is better
The devil gave me too many strings

is that for handling minecraft commands?
me have no more soul
kinda, it allows you to use native minecraft brigadier command api without reflections and any shenanigans
basically bypasses bukkit command api
yeah yeah
tbf bukkit command api isn’t horrible until you have more then 4 commands
😅
if true {
if true {
if true {
if true {
True = false ;
False = true ;
while True {
system.out.println("Something")
}
}
}
}
}
HELPPP WHY MY CODE NO WORK
#define true false
#define false true
C what you did there
why are the insults getting so personal 😭
Ntdi can you re-post the gif

omfg
you know that song is about depression and 5 grams of cocaine
about a guy struggling with his addiction
and pushing people out of his life for drugs
it's depressing asf and some rando on the internet played it over a cow dancing
and now it's a "meme"
nah #define false rand(10)
its a good song
yep
okay
is it possible I could do it in onLoad to avoid having to unload it
just have it already be unloaded
try it maybe it’ll work
just load
only if you have load: STARTUP
that's the whole point
it changes when the plugin loads
BUT check Bukkit.getWorlds().isEmpty(), else the server is restarting
the default is POSTWORLD
Not really
using onLoad messes with nothing
onLoad is too late unless you use load: STARTUP
does some1 here know if its possible to show an inventory on hover text?, i thought it was but i cant remember
yes, POSTWORLD runs onEnable POSTWORLD
onLoad runs when your plugin is loaded, BEFOR worlds
onEnable always runs post world
nope
I can 100% guarantee, with POSTWORLD onLoad runs before worlds
why don't we test it?
I already use it
okay well my plugin currently loads postworld
so let me restart my server and see when it loads
NO
i mean its currently set to postworld
stop/start
I'm pretty sure he's right. Plugins get loaded before the worlds, hence #onLoad(), then the worlds load, and then all #onEnables() get called.
yes i am stopping my server and starting it
Yes that’s what restart means
as I already said reload will not work as teh worlds remain loaded
pretty much
on a startup in onLoad Bukkit.getWorlds().isEmpty() will be true and you will be able to modify the base world files
okay yea it loads my plugin before the world
so it really should be called enable
not load
The worlds may not be in the worlds lost yet
But I think they are loaded in memory
no worlds are not loaded in memory, if thats what you mean
like coll it doesn't show the preparing spawn area text until after my plugin loads
and some enable before that and some enable after it
mine enables after it
so yes it changes the behavior of enable, not of load
which means the setting is named incorrectly
but now it can never be changed
Guarantee 100% in a POSTWORLD setting onLoad runs before the world files are even touched.
truly tragic
its teh plugin onLoad not the worlds
Spigot loads all plugins, then loads worlds, then runs each plugin onEnable
Which is why you will error out storing Locations in your config if you access yoru config in a Field or before onEnable is called
elgarl who are you talking to
The world, it's listening
we're just saying that the setting in plugin.yml is currently misnamed
because it's called "load"
but it doesn't change when the plugin loads
the plugin always loads and calls onLoad before the world is loaded
its when it enables that the setting affects
so it shouldn't be called load
must've
correct it shoudl be called enable not load
perhaps get a new entry added. Does exactly the same just called enabled
the least we could do is change the entry on the wiki
leave load: available but scrub all references
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i would do it but I want to get confirmation from md first about what it does
so we'll wait and see if he responds to my ping
i do this for random
its fine ?
so a chance of 50 would apply both
oh i knoqw
in that modified 40 would apply to both
i need delete =
yep 🙂
yes
alright ty
tripwire.getFaces().contains(BlockFace.EAST)```
u guys said use getfaces.contains
but if i do
not work only for EAST
works for all EAST faces
i mean
EAST, NORTH or EAST or EAST, SOUTH, WEST
i wanna only for EAST
am i need use equals ?
what exactly are you trying to check?
i wanna check tripwire EAST face
but tripwire have much faces
EAST-NORTH-SOUTH
EAST-SOUTH
NORTH-SOUTH
those are enabled faces. You want to see which direction it is facing?
contains is checking all east faces
wdym i only wanna check
east face
not east-south
or more
now sure what you mean by that
No idea what you are asking
I can;t read text in vidoes on discord
ah
first one is tripwire[east=true] so drop mushroom
second one is tripwire[north=true] so no drop mushroom
third one is tripwire[east=true,north=true] so drop mushroom
but i don't wanna third one
only for first one
and i did t his in my code
tripwire.getFaces().contains(BlockFace.EAST)
wait
i changed
yeah I believe a tripwire is going to have all faces on a plane, N,E,S,W
third one is drop mushroom bcs i did contains
The getFaces on TripWire is not the directions it is facing
ah yes
its teh faces which are enabled
so you could place next to it and it will auto connect
its not the facing of the block
have you tried setting the faces when you place the tripwire?
Thoughts on List<T> list = new ArrayList<>(), listView = Collections.unmodifiableList(this.list);?
yes
but i can add more blocks with tripwire and they faces will contains EAST
example my next block is desert-grass and this faces is east,north this drop mushroom _?
yep you only set one face
set all the rest to false
tripwire.getAllowedFaces().forEach(face -> { tripwire.setFace(face, false)};
or soemthing like
then set the only face you want
to do what
Just how it looks
forgot <> and newline
remove this lol
whats supposed to not look good lol
Two variables in one line initialization
just dont
yeah ik, looks kinda bad, wanted a second opinion
ong
faster for who
@hybrid spoke Project in question is around 8.3k lines (excluding whitespace/comments)
bet you can do that in 10
Maybe
for any chance any has a command with sign using many colors in text?
wdym
is it possible to get all tab completes programmatically
what i mean is
for example, entering the string "su" and getting back an array of all tab completes such as "summon"
Like a CommandTabCompleteEvent or something?
im not trying to create my own tab complete
Is this what you are looking for? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandSendEvent.html
oh ignore me, I didn;t read your question
You can theoretically call the tab complete method for the command yourself
If you have the command instance
iirc it's a public method
What am I meant to use in replace of ChatColor? since I see ChatColor is deprecated?
You are depending on the paper api
Yes im aware
I assumed it was fine to talk about a paper api in here? if not please direct me to the support server for paper
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
Thank you
Why do people still assume that? Paper is a fork. All forks should be considered as a separate project.
I do consider it a seperate project.
I just assumed since it was based on spigot, the people inside of the spigot server would be okay answering a question about it
I guess I was mistaken
Didn't know paper was gay, ah, it's month of the pride
June 💀
hello, How get Signe Lines condition in java ? please
why are people extending InventoryView? wtf who does this
to add metadata from plugin's side
then it could be passed to another plugin
via events
and if plugin has interface classes
it can access them
I'm jsut reading through papers comments
on Them adding adventure compoents to setTitle
and apparently people use InventoryView?
just deprecate setTitle(string)
I feel like if you're extending InventoryView there just is a better way, but either way your plugins going to break in the 1.20+
tile
Lurking in paper prs is so fun
@young knoll when are you gonna push the BuildTools GUI stuff
i'll be around to test it whenever I'm just bored and wanna click some buttons :P
PresistentDataContainer was implemented in what spigot version?
1.13
thank you
It was the best thing they ever implemented
the point of it is to save data in minecraft itens that get serialized and unserialized? (or am I not getting something?)
pdc on offline players will be the best thing ever
It saves data on itemstacks or entities.
Or things like signs and chests which are technically not blocks.
for...?
tripwire faces
data
So if I give a player an item whose pdc<String,String> "name" = "hi" even after the server restarts, if i get the item's pdc and try to grab the string by key "name" I'll get hi?
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.type.Tripwire (org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData and org.bukkit.block.data.type.Tripwire are in unnamed module of loader 'app')```
getState just gets a snapshot of the block at that instant.
look at your other code, you already did it
Yep. It can be used to store data without files, though it is only accessible when the entity exists in the world or in reference.
ooh ok
no my other code is only for "check face in if"
but this sets
i need set false to other faces?
same place
back in my good old days of Skript I'd check the item lore lmao
(dont kill me)
ikr, same
I didn't use Skript tho
But yeah, saving data in the lines on a sign sucked because then you had to have specific information visible. Now it's all invisible and the formatting can look like whatever you want.
NBT requires NMS code, no? That would break across versions.
Idk I never did NBT in java only in skript xD
ooh so that's how wit works
Accessed without nms though
^ big plus
if you use /data you can see the pdc data
Any ideas for first minigame plugin?
Maybe duels or something
Well, if you have worldguard and need to do something worldguard related, there is no other choices
I was thinking about having it when making a minigame
For what?
As a first minigame Duels
There would be a arena region and a lobby region.
Alright
Hey 🙂 I'm trying to change a player trim, and here is my code:
ArmorMeta meta = (ArmorMeta) e.getNewItem().getItemMeta();
meta.setTrim(new ArmorTrim(TrimMaterial.DIAMOND, TrimPattern.SILENCE));
e.getNewItem().setItemMeta(meta);
But nothing happens, no error, just nothing
there is no getNewItem() method in any Spigot event
I'm using the paper PlayerArmorChangeEvent method
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
?whereami
okey
does logging in an enum not work or something
logging in an enum?
yes
explain
like plugin.getLogger().info("text")
where are you trying to use it?
in a method in an enum
then it will run when you call the method
its not though
then you are not actually calling it or its erroring out
So I kinda feel like I need a little help on this
I plan to follow MVC architecture
A arena model is going as follows:
public class ArenaModel {
private String name;
private Player playerOne, playerTwo;
private Location spawnOneLocation, spawnTwoLocation;
private Cuboid arenaCuboid;
private Cuboid spawnOneCuboid,spawnTwoCuboid;
private ArenaState arenaState;
private Listener arenaListener;
}```
Would make a areaState a enum be a good idea?
maybe it's going to be
WAITING
FIGHTING
FINISHED
Then an enum is fine
im pretty sure its getting called
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i know for sure its getting called
so basically, i have an enum (LogUtil.info() is a wrapper for plugin.getLogger().info()):
public enum CollisionData {
PITCHER_CROP(((player, version, data, x, y, z) -> getPitcherCropBox(version, data)), StateTypes.PITCHER_CROP)
private static CollisionBox getPitcherCropBox(ClientVersion version, WrappedBlockState block) {
LogUtil.info("Pitcher Crop");
switch (block.getHalf()) {
// there is too many cases here to send, but it returns a collision box.
}
}
}```and i have code that gets the value:
```java
CollisionBox data = CollisionData.getData(state.getType()).getMovementCollisionBox(player, player.getClientVersion(), state, x, y, z);```the returned data is correct, but no logs are sent
(StateTypes is from packetevents)
yes
Is ur method getting called?
Yea probably
have you tired using the
LogUtil.info("test text, print on startup");
outside of the function
logutil works fine
what is yoru getData method?
public static CollisionData getData(StateType state) { // TODO: Find a better hack for lava and scaffolding
return state.isSolid() || state == StateTypes.LAVA || state == StateTypes.SCAFFOLDING ? rawLookupMap.getOrDefault(state, DEFAULT) : NONE;
}```
rawLookupMap is a hashmap containing every StateType and associated data
I see no issue with those snippets
public static boolean vaultCheck() {
for (World world : plugin.getServer().getWorlds()) {
return world.getName().equals("VaultTemplate");
}
return false;
}
Does this look wrong?
getWorld() != null maybe, idk if that throws
works fine
so its not calling your lambda or it's consuming the error
actually
your getOrDefault is just a map lookup, so isn;t hitting the enum
oh yeah that would probably be it
everything throws. This just doesn't work. i get an error in my console java.lang.ExceptionInInitializerError: null and it points to that block of code.
when are you running that code?
I have a check on server startup, and it gets ran in a command.
when at server startup?
@EventHandler
public void onPlace(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (e.getItem() == null || e.getClickedBlock() == null) return;
BlockFace blockFace = e.getBlockFace();
Block block = e.getClickedBlock().getRelative(blockFace);
Block block2 = block.getRelative(BlockFace.DOWN);
ItemStack item = e.getItem();
ItemMeta meta = item.getItemMeta();
BlockState state = block.getState();
Tripwire tripwire = (Tripwire) state.getData();
if (meta == null) return;
if (!meta.hasCustomModelData()) return;
if (e.getHand() == EquipmentSlot.HAND) {
if (item.getType() == Material.PAPER) {
e.setCancelled(true);
e.getPlayer().swingMainHand();
tripwire.setFace(BlockFace.WEST,true);
block.setBlockData(tripwire, false);
}```
@eternal oxide i can't fix that error
java.lang.ClassCastException: class org.bukkit.material.MaterialData cannot be cast to class org.bukkit.block.data.type.Tripwire (org.bukkit.material.MaterialData and org.bukkit.block.data.type.Tripwire are in unnamed module of loader 'app')
Like the very start.
no ide errors but i got this error in console when right click block
you sure the relative is correct type?
Exactly when? None of your replies tells me when it checks
am i need check relative is tripwire ?
when i first login and trigger the getuser method, it finds a match in the userMap, but when i relog and trigger it again - it doesnt find a match: https://github.com/crackma/PVPCore/blob/master/src/main/java/me/frandma/pvpcore/user/UserManager.java
https://github.com/crackma/PVPCore/blob/master/src/main/java/me/frandma/pvpcore/user/implementation/PlayerLoginListener.java
i need set tripwire with faces to clickecblockface
new CheckAndExtrude().checkBlock(newLocation, mat); Would this run the function inside of that class?
Doesn't seem to work at all so i'm just double-checking
well idk about the code, im just saying
yes
hmm that's wierd
doesn't seem to run at all
bruh i sent that message a few hours ago 💀
Don't compare the UUIDs with ==. You should compare with .equals(). == will referentially compare the objects meaning they need to be the exact same instance in the same place in memory, whereas .equals() can be overridden and will check the contents of the object (which in the case of a UUID would be its least and most significant bits)
lmao
aaaa
All that being said, your whole getUser() method is unnecessary. You can replace the whole body of that method with just a map.get() call
thankyou
I dont understand what you are trying to ask. I have the check in the onEnable, and on a command.
public User getUser(UUID uuid) {
return userMap.get(uuid);
}```
Choco can u help me ?java.lang.ClassCastException: class org.bukkit.material.MaterialData cannot be cast to class org.bukkit.block.data.type.Tripwire (org.bukkit.material.MaterialData and org.bukkit.block.data.type.Tripwire are in unnamed module of loader 'app')
why i got this ?
@EventHandler
public void onPlace(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (e.getItem() == null || e.getClickedBlock() == null) return;
BlockFace blockFace = e.getBlockFace();
Block block = e.getClickedBlock().getRelative(blockFace);
Block block2 = block.getRelative(BlockFace.DOWN);
ItemStack item = e.getItem();
ItemMeta meta = item.getItemMeta();
BlockState state = block.getState();
Tripwire tripwire = (Tripwire) state.getData();
if (meta == null) return;
if (!meta.hasCustomModelData()) return;
if (e.getHand() == EquipmentSlot.HAND) {
if (item.getType() == Material.PAPER) {
e.setCancelled(true);
e.getPlayer().swingMainHand();
tripwire.setFace(BlockFace.WEST,true);
block.setBlockData(tripwire, false);
}```
debug block type
BlockState#getData() returns MaterialData, not BlockData
actually i tried
You need to use getBlockData
left rigth click actions and so on
leftover from list of user
You also definitely don't need the state from that block at all
BlockFace blockFace = e.getBlockFace();
Block block = e.getClickedBlock().getRelative(blockFace);
Block block2 = block.getRelative(BlockFace.DOWN);
ItemStack item = e.getItem();
ItemMeta meta = item.getItemMeta();
Tripwire tripwire = (Tripwire) block.getBlockData();```
is there a cleaner way to do this, that wouldnt error on the fromString or value of
UUID minecraftUID = null;
if (userDataObject.has("minecraftUID")) minecraftUID = UUID.fromString(userDataObject.getAsJsonObject("minecraftUID").getAsString());
Long discordUID = null;
if (userDataObject.has("discordUID")) discordUID = Long.valueOf(userDataObject.getAsJsonObject("discordUID").getAsString());
what do you want it to do if uuid or long isn't valid ?
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.type.Tripwire (org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData and org.bukkit.block.data.type.Tripwire are in unnamed module of loader 'app')
leave the value as null
best bet is try/catch, i dont think there is any method such as TryParse in c#
kk thanks
@EventHandler
public void onPlace(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getHand() == EquipmentSlot.OFF_HAND) {
return;
}
Block clickedBlock = event.getClickedBlock();
if (clickedBlock == null || clickedBlock.getType() != Material.TRIPWIRE_HOOK) {
return;
}
ItemStack itemStack = event.getItem();
if (itemStack == null || itemStack.getType() != Material.PAPER || !itemStack.hasItemMeta()) {
return;
}
ItemMeta itemMeta = itemStack.getItemMeta();
if (!itemMeta.hasCustomModelData()) {
return;
}
Block block = clickedBlock.getRelative(event.getBlockFace());
Tripwire tripwire = (Tripwire) state.getBlockData();
event.setCancelled(true);
event.getPlayer().swingMainHand();
tripwire.setFace(BlockFace.WEST, true);
block.setBlockData(tripwire, false);
}```
This is how I would rewrite this for a number of reasons
- Early return to avoid unnecessary nesting
- Checking very fast conditions early on (ItemStack#getItemMeta() can be expensive, so we want to avoid it)
- Remove the BlockState because you don't need it at all, you're just operating on the BlockData anyways
omg
early returns
That would probably accomplish what you were aiming for
Wrote it all in Discord though so mind any typos or syntax errors
actually my plugin works if player right click any blocks and if clicked block face is air set tripwire with face
Desktop, yeah. I'm not on mobile lol
that would be big flex if it was mobil lol
the pain thb when writing on mobil
writes java code on an old nokia 🤣
I’ve written so much java code for people here on the phone
so painful
I need to find a way of getting all the coordinates of connected blocks of the same type. This is so that I can extrude them whichever way the player is facing. I've already written code to extrude one block, however i need to find a way of finding all connected blocks without a loop/very simple loop. Any ideas?
(no speenfood)
do you already know constructors or was that another dude
I know how to use constructors.
tell me
can i give an example?
yes
huh
did you give up on teh code I gave you?
the Connection class suports addng custom types
public final class Class_Name {
public void Class_Name(JavaPlugin plugin) {
this.plugin = plugin
}
}
naming conventions where
You follow conventions in examples 💀
Otherwise the one reading it might fail to follow the conventions
otherwise the examples will come to your house at night
@EventHandler
public void onPlace(PlayerInteractEvent e) {
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (e.getItem() == null || e.getClickedBlock() == null) return;
Block block = e.getClickedBlock().getRelative(e.getBlockFace());
Block block2 = block.getRelative(BlockFace.DOWN);
ItemStack item = e.getItem();
ItemMeta meta = item.getItemMeta();
Tripwire tripwire = (Tripwire) block.getBlockData();
if (meta == null) return;
if (item.getType() == Material.PAPER &&
block2.getType() == Material.GRASS_BLOCK &&
block.getType() == Material.AIR) {
e.setCancelled(true);
tripwire.setFace(BlockFace.WEST,true);
block.setBlockData(tripwire, false);
}
}```
Is this code supposed to work?
That's not a constructor?
Yeah that code isn't even correct
XD
i bet neither of us saw 💀
i might be getting hella confused
It's just a method named the same name as the class
the creepy pasta writes itself
constructor has no return type
why didnt you use the code choco sent
atleast that's what someone told me it was, but ty for the clarification
when i have itemstack array sometimes random items' amounts just decrement
not doing what i want to do
so modify it
public class Class_Name{
int AverageVariable;
public Class_Name() {
AverageVariable = 2;
}
}
i do
what jree fava lessons mean
no
ok
is there still no solution?
?naming
?conventions
Not that I know of
Bruh
it doesn't have to be 😭


