#help-development
1 messages · Page 472 of 1
Production is a controlled environment
one thing is testing mission critical code that can fuck with your database
Because I control it
another is just... making a test command and testing it yourself
if you're writing production code I assume you know what it does
Fuck that. Nasa blew up 100 mil of rocket engines randomly changing the hole design of a faulty part till they solved a problem.
The whole world is full of bodge jobs lol
lmao
Duck Tape and prayers
if it works don't touch it
Or duck tape and dreams if you prefer
flex tape? no?
if your only point if reference is a nasa problem then idk what to feel
incompatible types: int cannot be converted to org.bukkit.Material
Can someone help me?
you can't convert int to material
Speaking of what is an int
naturally
Show us the code
An int is not a material
?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.
Did u guys know they accidentally incinerated the apollo 11 flag on takeoff but never admitted it publicly?
U can tell it happened as they added a "put the flag X number of ft away from the lander" mission parameter into future mission briefs lol
public static Double getPrices(LojaEnum type, Sign sign) {
String[] linePrice = replace(sign.getLine(2)).toLowerCase().split(":");
if (type.equals(LojaEnum.COMPRAR)) {
if (linePrice[0].contains("c")) {
return Double.valueOf(linePrice[0].replace("c", ""));
} else if (linePrice.length == 2) {
return Double.valueOf(linePrice[1].replace("v", ""));
}
} else if (type.equals(LojaEnum.VENDER)) {
if (linePrice[0].contains("v")) {
return Double.valueOf(linePrice[0].replace("v", ""));
} else if (linePrice.length == 2) {
return Double.valueOf(linePrice[1].replace("v", ""));
}
}
return 0.0D;
}
public static ItemStack getItemLoja(String[] lines, LojaConfig loja) {
if (replace(lines[3]).matches("^[1-9](\\d)*(#(\\w){4}){1}(\\s|$)")) {
return loja.getCustomConfig().getItemStack("itens." + replace(lines[3]));
}
if (replace(lines[3]).matches("^[1-9](\\d)*(:(\\d){1,2}){1}(\\s|$)")) {
String[] valores = replace(lines[3]).split(":");
int idType = Integer.parseInt(valores[0]);
byte dataId = Byte.parseByte(valores[1]);
return new MaterialData(idType, dataId).toItemStack();
}
if (replace(lines[3]).matches("^[1-9](\\d)*(:(\\d){3,5}){1}(\\s|$)")) {
String[] valores = replace(lines[3]).split(":");
int idType = Integer.parseInt(valores[0]);
short dataId = Short.parseShort(valores[1]);
ItemStack item = new ItemStack(idType, 1);
item.setDurability(dataId);
return item;
}
int idType = Integer.parseInt(replace(lines[3]));
return new ItemStack(idType, 1);
}
They also accidentally overwrote the original moon landing footage
Lmao
They also blew up a Mars rover mission because they didn't convert from metric to imperial properly
Which line is the offending one
I bet it’s the last one
37
43
48
So
When you’re creating the item stack
You’re passing an integer in where it’s expecting a Material enum
e-nun
Btw... adding to ur plugin a custom color for DARK_AQUA is as silly as it sounds right?
I really hope this is at least 1.8
Everything has a name now
Where numeric ids were still a thing
is that your new thing? to be an e-nun?
Yes
Very holy
https://prnt.sc/XZdkf72RgF2f
to be honest I didn't understand anything, here's their line, can you tell me what I should change?
I'm going to bed as deadass I'd love to stay and help but Xms profile picture is legit nightmare fuel and I'm about to head tk bed 😭🤣
hahahahaha
yo, coding in kotlin, have an issue with storing the damages players have done to specific bosses, there may be multiple bosses at one time so they are differentiated via UUID, heres how i initialize the hashmap containing the damages.
First UUID is the boss's UUID, second is the player/damager, Int is their damage done.
var damageHashMaps = HashMap<UUID, HashMap<UUID, Int>>()
here is how im trying to add on their damage, when they do damage (sloppy because ive honestly been trying everything)
damageHashMaps[victim.uniqueId]?.set(damager.uniqueId,
(damageHashMaps[victim.uniqueId]?.get(damager.uniqueId) ?: 0) + event.finalDamage.roundToInt()
)
no matter what it seems like its never adding on the damage im doing, it always says i've dealt null damage, which im tracking via two statements,
// INITAL DAMAGE DONE
damager.sendMessage(convertColorCodes("&cYou did ${event.finalDamage.roundToInt()} damage | TO: ${victim.uniqueId}", false))
// Statement above is here
// TOTAL DAMAGE DONE
damager.sendMessage(convertColorCodes("&cYou've dealt ${damageHashMaps[victim.uniqueId]?.get(damager.uniqueId)} damage | TO: ${victim.uniqueId}", false))
if you want sses of whats showing in chat, dm me
I wouldnt round raw data like that. Round it when its being displayed but keep its precision in the backend.
Im assuming your problem is here:
damageHashMaps[victim.uniqueId]?.set(
Do you put the victim in the map at any point?
I would use computeIfAbsent for that
private var damageHashMaps = HashMap<UUID, HashMap<UUID, Double>>()
fun addDamage(defender: UUID, attacker: UUID, damage: Double) {
damageHashMaps.computeIfAbsent(defender) { HashMap() }.compute(attacker) { _, v -> (v ?: 0.0) + damage }
}
This solves the problem of you having to manually put values in the map.
It just computes them if they are not present or null
i really wanna learn java plugin development, im using kotlin to kind of get the basics of plugin development beforing jumping into java
ykwim
...
thank you, ill update you with the result
(ik that sounds dumb, but it makes sense in my head)
You shouldnt jump from kotlin into java.
If you start with kotlin then you are missing the biggest selling point of it.
Why dont you start with java in the first place?
Then you can jump into kotlin
dont people always recommend java over kotlin?
Not always. A lot of people prefer Kotlin, but I've always really just used Java, an only a tiny bit of Kotlin
...
I honestly think it more comes down to personal preference.
Depends on the community. But kotlin has a lot of features that kind of
rely on you knowing a more verbose and explicit language like java.
If you want to use Kotlin, it's upto you. It is widely used, but java itself is more common
Ok but literally all resources on spigot plugin dev are in java... Now it makes even less sense
im very new to plugin dev so i decided to dip my feet into it with kotlin
youtube tutorial for plugin development, they happened to use kotlin the entire tut
I wouldnt say its "widely used"
Its pretty much a hipster language with
quite a few baby flaws in them still.
Personally, Id recommend starting with Just Java until you get a good grasp on plugin dev.
thats how i learned
whether you use kotlin or java doesn't really matter, it gets compiled to bytecode the same
it definitely affects how much help you can recieve though especially for plugin dev
Currently, I mostly just use kotlin in build files and mostly java for everything else 😛 Not ideal probs, but Kotlin build files are clean 😛
kotlin build files.. (?)
You speaking about using kotlin DSL for gradle?
i understand java, its just a matter of translating it in my code
I'll get there one day...
Ah ok. Yeah i also dont like groovy. So Kotlin there all the way.
kotlin dsl gradle files are so sexy
I went from maven, to normal gradle, to kotlin, and won't go back. Kotlin DSL is quite nice
Apart from looks, i've found Kotlin DSL to build quicker and give a little better performance as well as reducing build file size
btw @lost matrix worked perfectly, thanks a ton
not sure who has issues with build file sizes
Noone 😛 But smaller file sizes are always better ;P
not necessarily
means more for the compiler to interpret or something in between to do it
It's mostly just the readability and performance mostly that I like Kotlin DSL for.
maven and gradle are performant too
it just depends if you know either of them well enough
Just remember: Not persistent
That's true. I came from using maven non stop, so I won't ever deny it's usability. or force people to change. Both are good. I am just more comfortable with gradle (kotlin DSL) now.
thats fine, seems it clicks for you with gradle
and that is really the issue sometimes and why we have so many varieties 🙂
Plus, you can't deny, kotlin dsl files do look way better 😛
I don't use kotlin
Show the stack trace
Maven: https://pastes.dev/YitZjG1Vxk
Kotlin DSL: https://pastes.dev/DDRurZmTJQ
Quite a noticable difference 😛 One day i'll finally update all my plugins properly.
?paste Then paste it.
If its long then its probably a stack overflow
InventoryOpenEvent -> open inventory in it -> InventoryOpenEvent -> open inventory in it -> etc
Pretty clear
The code is shocking, but setting clickedCrafting to false before calling openInventory would fix that particular issue
My guy you have been here for years on end.
if(clickedCrafting) {
clickedCrafting = false;
event.setCancelled(true);
This is the fix suggested by md
Im also working on guis right now 
woooo
how do you make the bottom slots not hilight? in game
Hm?
Let me check what you mean ingame
Which line?
Not sure what you mean but there is nothing highlighted currently
don't slots hilight when you hover over them in game?
I always see it with default inventories
maybe I'm halucinating
Oh yeah. The texture completely overlays the inventory
oh okay
you can't put an element in a 9thg slot in an array if it doesn't have a 9th slot
BettaCore
abstract is fun
Hello! Is there any good way to create a menu and show the menu to a player from a bungeecord plugin? without having any spigot plugins..
Does anyone know why my nms npc plugin isn't working, when i run the command it works fine but when the player joins it doesn't show them the npc:
https://paste.md-5.net/pitunemiri.java
https://paste.md-5.net/apixigolih.java
https://paste.md-5.net/wuxiyutoxo.java
https://paste.md-5.net/mogeyexofo.cs
BungeeCord is a proxy. It should not be kept as small and ligthweight as possible.
GUIs are something you should not have on your proxy at all.
First of all: What is the point of passing a player if you loop over all players on the server anyways?
public void spawn(Player player) {
System.out.println("Looping");
for (Player p : Bukkit.getOnlinePlayers()) {
System.out.println("Looped");
CraftPlayer cp = (CraftPlayer) p;
ServerPlayer sp = cp.getHandle();
ServerGamePacketListenerImpl packetListener = sp.connection;
packetListener.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
packetListener.send(new ClientboundAddPlayerPacket(npc));
}
}
Use 3rd party libs if not want to use packets.
oh yeah i should remove that
Next: You are never setting the position of the ServerPlayer which means he will always appear at 0, 0, 0
That is probably your problem
no its not because when i go to 0 0 0 even if i join the npc still doesn't appear
So the npc appears on command but not if you rejoin?
yes if i do the npc command it does but when i rejoin it doesnt appear
What about your debug messages?
none of them trigger for some reason
This means Data.npcs is empty
but idk how it could be empty if an npc is added to it when the command is run
There is so much to unpack here to be honest.
But how can I achive this? only with a spigot plugin?
Yes
Alright lets start by cleaning up your code a bit. You alright with that?
oh my god i'm so fricking stupid
i removed the add to npcs list when i was changing the code to work with an NPC class
Cool, so thats solved.
what were you suggesting about cleaning up my code btw
But for the future:
- Never make anything that has a state, static. For example: List, Map, Set etc. <- Never static
- Never expose collections. No getter or setter for Lists, Sets, Maps etc. Ever. No exceptions.
Here is an example for a basic manager class:
public class NpcManager {
private final Map<UUID, NPC> npcMap;
public NpcManager() {
this.npcMap = new HashMap<>();
}
public void addNpc(NPC npc) {
npcMap.put(npc.getUniqueId(), npc);
}
public void removeNpc(UUID npcId) {
npcMap.remove(npcId);
}
public NPC getNpc(UUID npcId) {
return npcMap.get(npcId);
}
public List<NPC> getAllNpcs() {
return List.copyOf(npcMap.values());
}
}
You should create one instance of this in your onEnable() and then pass
this instance around.
@lost matrix i found the problem, i forgot to add the ```@EventHandler
Error occurred while enabling money v1.0.0 (Is it up to date?)
java.lang.NoClassDefFoundError: org/bson/conversions/Bson
Could not load 'plugins\MainPlugin-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/mongodb/ConnectionString
Forgot to shade in the mongodb driver
what about the bson error
Thank you to everyone here that's helped with advice on Spigot the last month and half. I completed a ChatGPT based plugin for Inworld.AI built out and running an Alice in Wonderland themed world.
Hello, how can run my test server from Intellij?
Ah thank you !
Like you read variables out of array anywhere else
why cant you
So? You can nest infinitely many for loops
Idk md pinged me so i sent it
fair
they came back like 3 or so hours later asking why it didnt work
they had it in the compiler plugin
😂
Why no workings
I'm late to the party here (sleeping). If you rejoin you have to resend the NPC packets as they don;t exist as a real player.
Ugh the post even says not to do that
reading is hard
This makes very little sense...
What are you trying to do
Create a set of integers that should be ignored.
Iterate over all slots and dont fill those in the set.
u using empty as the index
i assume you need cg
as the index into the inventory
how can check if itemstack can be 'repair'
check it's damage
0 is full, si?
Material#getMaxDurability?
so when item is any planks or some else items then maxdurability be 0?
Why not try and see
already work
any better ways to store a list in a mysql db than TEXT and String.valueOf(List)?
basically want to store a list of material names for ex FISHING_ROD, COMMAND_BLOCK, etc.
but only a few
depends on your database setup, but generally no
aw man
one collection with empty slots and and loop for each space in inventory and if collections dont contain slot then set itemtack
and for the future Inventory#firstEmpty return -1 when there is no free space
When I spawn a skeleton using the method below it doesn't shoot arrows. Does anyone know why?
https://paste.md-5.net/xorozajoxi.coffeescript
Either blob or a new table. Latter would be the proper relational approach.
Give it a bow?
i does have a bow that is just an example
AI issue?
Hello everyone, I just have a problem with the rotation of a player head. I'm trying to set the rotation with the following code:
block1.setType(mBlock.getMaterial());
block1.setData(mBlock.getData());
BlockState state = block1.getState();
Skull skull = (Skull) state;
skull.setSkullType(SkullType.PLAYER);
skull.setOwner(mBlock.getPlayerName());
skull.setRotation(BlockFace.EAST_SOUTH_EAST);
skull.update();
Unfortunately, the head just does not get any rotation.
What version are you on?
Unfortunately still on an old, 1.8.8
is there a way to get the world from OfflinePlayer?
You could try to read the players save data
or is that only possible with nms?
is there a way to only register full strength hits?
There's no api method for this so yeah nms
okay thanks, do you happen to know if paper has anything for this in their api?
?whereami
You can get the float which determines the attack cooldown of the player
in the EntityDamageByEntityEvent. You just need to hope that its set
after the event or else it will be always 0
alr
how do I add comments in my config
// = single line comment
/*
*/ = MUlti line comment
or .addComment after using .set to add a Section
there isnt a need to tag it imo
you should hopefully know whats in everyslot
so just keepa set or something with the slots they can access
if (itemInHand.getType() == Material.matchMaterial(config.getString(itemPath + ".material"))) continue;```
not valueof
can I get the path from a file to another? let's say i have a file with path config/test/file.yml and config, can I somehow get test/file.yml?
?…
um?
i need the string test/file.yml in this case
if you have the file you can go up the parent
basically i need to call plugin.saveResource and I have the File object, but the method takes in a local path from your config folder
saveResource gets the resource you specify the path for. It saves into your plugins data folder maintaining teh full path from your jar
Is that new or was I blind all these years that I overlooked it each time
It’s not new
Hello how can I make tab show all vanish players?
Is it possible to list all the biomes the server has. even custom ones from mods and things
Not with the api sadly
The app im making will be able to Soon 😎
Once the PR to remove the old enums is merged you will be able to
how do u fill a large area with blocks? can you also randomly add other blocks ?
?workdistro
Random does not have a method that takes a lower and upper bounds
However ThreadLocalRandom does
looks good to me
Ask chatgpt
no, its ok if there is a big lag spike, cuz i need to fill it in only when the world loads (so players cannot join there)
basically, i want to make a big 100x100 stonbe square
but i dont need the workdistro thing there right?
100x100x1?
o well if u dont mind the lagg spike u dont need it
u will probably experience one tho
again, its ok cuz its on worldload
u can greatly improve performance by using a specific way to set the blocks tho
if thats something u want u could look into that
wait and how do u set a block?
World#setBlock
👌
thats the slow way 
ik
might be fine for his use case tho
Not really
is there a way to have tab completion in acf from an ArrayList instead of the stupid ass "*" which doesnt actually do anything
register it
and the fast way? :>
Setting a block with no physics is nearly as fast as you can go
commandManager.getTabCompletions().registerX or smth
Other than like, writing directly to the region files
so just manually do it?
theres no need for that tbh in your use case
ok
u can just set with no physics and u will be fine
is there a way to add a fake player to the tab list? i dont need a real player entity in game , just a name showing up in the tab list , how would i do that?
the username 💀 🤣
ok "roxyXD" very helpful support you can go leave now
chatgpt tbh
your not helpful
guys is the spyglass overlay fully clientsided
chill man
i believe it is yes
hm, is there a way to simulate a spyglass event for instance if i have a server resource pack
are there any other vignettes/overlays
that can be triggered by the server
yea, underwater. idk if that can be triggerted by server tho
pumpkin
oooh yeah
oh yea pumpkin is a good one
good call
does that require the item on the head or can i send that through packets
time to do some googling
found something useful
craftPlayer.getHandle().b.a(new PacketPlayOutSetSlot(0, 0, 5, CraftItemStack.asNMSCopy(itemStack)));```
Idk if that works on itself
But yeah
Yeah you can do that with fonts
And yes all textures are pngs
mhm
@tardy delta so how do I get the args for tab completion now? what will the tab completor consider as args and what will it consider as the command
If this is ACF, there's an annotation for that too, no?
At least from my once or twice use of it
@CommandCompletion?
i hate the large amounts of annotations that you'll have to add
@CommandCompletion exists but the issue is that you have to add every arg manually like this
@CommandCompletion("a|b|c|d") so I dont think I can have a list of all OfflinePlayer(s) there like in normal tab completion
I know for certain there's an annotation you can put on a method to provide more dynamic args
CompletionProvider or something like that. I dunno. It's been like 8 months since I've worked with ACF and I still hate it
any idea why its not generating anything? i put it in the method where i generate my world
How NPC plugins generally work with spigot e.g. what kinda of entity do they spawn In. I've never worked with any NPC plugins. e.g. do they tend to extend HumanEntity for NPCs or something else?
you can check my saving method you can take some stuff of it'
wdym?
did you actually check at 0, 0, 0?
wdym?
Your center is at 0, 0, 0 in the world.
Did you tp there and check?
Also: Location#add() mutates the location.
So use
center.getBlock().getRelative(x, y, z).setType(Material.STONE)
like this?
Yes
btw the world variable is just Bukkit.getWorld("world")
Probably even better to get the center block only once
Location center = new Location(world, 0, 0, 0);
Block centerBlock = center.getBlock();
...
centerBlock.getRelative(x, y, z).setType(Material.STONE);
So this code always generates a sphere around 0, 0, 0
Did you tp there and check if the sphere is actually created?
like this?
Sure
ofc yes
Well not a sphere. Should be a cylinder there
Depends on what you are trying to do
a cube that has 10% air and that goes from bedrock to y100
For a cube you dont need the distance calculation.
If you remove that then you dont get a cylinder but a cube
remove what?
yea exactly
so like this?
Yeah. And dont forget formatting your code
Hello how can I show all vanished players in tablist?
I mean vanish should not hide them
In tablist
whats the function for sine and cosine
You need a custom packet implementation for that
sin and cos
it no work
Is there some information about that?
Math.cos ig
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
oh i didnt uppercase the m in Math
no worries
I meant specially for tablist
nice it works 😄
But anyway thanks
Nice
is there a way to remove that lore from the item and just have blank lore which I can edit to only have lore I want it to have
You need to hide the entity but not the player information+
item.addItemFlag(ItemFlag.HIDE_ATTRIBUTES) or smt like that
then just add lore
nois
completion provider is not a thing
Guess not
Maybe it was a custom annotation or something at the server I was working with
https://www.spigotmc.org/threads/free-code-sending-perfectly-centered-chat-message.95872/ I use this method, and when I have the chat on max weight, it works perfect, but when I have the chat with 150px weight, it doesnt work, what should I use instead?
Font Info Enumeration: http://pastebin.com/9Be2DF2z
Method to send: http://pastebin.com/BADd6K43
Many just recommend using a...
You need to register a command completion with a key.
For example
Register context resolver for your class
commandManager.getCommandContexts().registerContext(ActiveCollegeUser.class, context -> {
String arg = context.popFirstArg();
return activeCollegeUserManager.getByName(arg);
});
Register completion with an ID
commandManager.registerCommand(new TeleportCommand());
commandManager.getCommandCompletions().registerCompletion("ActiveCollegeUser", context -> {
return activeCollegeUserManager.getUserNames();
});
Use completion ID with @ prepended
@Subcommand("here")
@CommandCompletion("@ActiveCollegeUser")
public void onTpHere(Player sender, @Values("@ActiveCollegeUser") ActiveCollegeUser target) {
TeleportManager teleportManager = CollegeCore.getTeleportManager();
...
}
well it's jank code to fix a jank problem
if you change how the jank works underneath you'll obviously have issues
Realistically there's no way to detect chat length
is there a way to add some kind of data to blocks? basically i want the blocks generated from the cube to be different then other stone blocks so if u beak them you can detect that
Just create a BoundingBox around those blocks and check if a Block was broken inside this BB
in the BlockBreakEvent
oh so u cannot do that just in spigot itself?
Nope. Blocks dont have any kind of data storage unless they are TileStates
is there a way to make a Location into all of its seperate parts
Guys I’ve literally been trying to learn how to code guis for a day and I still can’t
and how u do that with this dep?
World world = location.getWorld();
double x = location.getX();
... and so on
Thats a guide which explains in detail how ive done it
ok yes but i want to make a variable that is a location but with modified elements for something like setting a block to a specific location
Then just create a new instance of Location...
Location other = oldLocation.clone().add(10, 0, -3);
other.getBlock().setType(Material.STONE);
No idea what you are trying to do
Hello i hope you're doing well.
How do I make "named" fake entity in Protocollib in 1.19? (Not on packet event listener, i want to name my fake entity when i spawn)
I couldn't find how to name my fake entity via protocollib in 1.19
thank you in advance!
Just send a metadata packet with a changed name
private PacketContainer createDataPacket() {
PacketType type = PacketType.Play.Server.ENTITY_METADATA;
PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(type);
packet.getIntegers().write(0, this.entityId);
WrappedDataWatcher.Serializer byteSerializer = WrappedDataWatcher.Registry.get(Byte.class);
WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
WrappedDataWatcher.Serializer boolSerializer = WrappedDataWatcher.Registry.get(Boolean.class);
List<WrappedDataValue> dataValues = new ArrayList<>();
Byte flags = 0x20;
dataValues.add(new WrappedDataValue(0, byteSerializer, flags));
Optional<?> optChat = Optional.of(WrappedChatComponent.fromChatMessage(this.text.replace("&", "§"))[0].getHandle());
dataValues.add(new WrappedDataValue(2, chatSerializer, optChat));
Boolean nameVisible = true;
dataValues.add(new WrappedDataValue(3, boolSerializer, nameVisible));
Byte armorStandTypeFlags = 0x10;
dataValues.add(new WrappedDataValue(15, byteSerializer, armorStandTypeFlags));
packet.getDataValueCollectionModifier().write(0, dataValues);
return packet;
}
Example for armorstand with some other stuff added
ohh thank you for long reply i'll try!
I need some mcp gurus which can explain why when you modify minecraft client side code to hit over 6 blocks minecraft doesn't let you
hits simply don't register
You mean on a notchian server?
wha
no even in a singleplayer world
well actually this thing happens on servers without anticheats and plugins
Did you extend the ray trace?
so I thought people here would know
not really there is a variable that equals 6 when you are in creative mode and 3 when you are survival mode, I made it like 100 but the hits don't register
poorly explained because I don't have the code atm
since I am not at home
hmm, it seems "WrappedDataValue" doesn't exists
in 1.19 Protocollib
- Never make collections static.
- Never make collection public.
- Never write getters or setters for collections.
It makes your code, really, really fragile and you will spend
hours fixing bugs that originate from this.
Thats for 1.19.4
whats the problem with static collections?
just wondering
I mean that you should never write getters or setters for collections.
like public List<String> getArray() {
rrturn array;}
Here is your fix btw
for (UUID uuid : List.copyOf(queuedPlayers)){
String server = serverQueued.get(uuid);
removeFromQueue(uuid);
Bungee(Bukkit.getServer().getPlayer(uuid), server);
}
Explanation: You can not modify a collection while iterating over it
collections are mutable and stateful.
Anything thats mutable or stateful should never be static.
yeah but i'm using latest version of protocollib: group: "com.comphenix.protocol", name: "ProtocolLib", version: "4.7.0"
Thats not even close to latest
Thank you
oh my bad ima change it to 4.8.0
just saw github readme and thought it was the latest
Hmm i changed to
implementation group: "com.comphenix.protocol", name: "ProtocolLib", version: "4.8.0";
but still I dont have tht
You just create on single instance in your onEnable and then pass this instance around.
This will lead to much robuster design. This is one of the most important design rules.
What spigot and java version are you on?
ugh
?1.8
Too old! (Click the link to get the exact time)
Then use the ArrayList constructor to copy the list
Also not the latest
don't server jars do anything about reach?
Depends on the server jar. But that should be of no concern for you if this problem occurs in singleplayer.
isnt there like any method to send centralized messages?
hmm what's the latest version?
This heavily depends on the font used by the client.
So its simply not possible to get a complete solution for that.
I see 4.8.0 is the latest release in github
ok
whats ActiveCollegeUser.class?
A class in my project
chatgpt man
the class with the command in it?
experience. ConcurrentModificationExceptions only occurs in 2 cases:
- Multithreading
- Modifying a collection while iterating over it
uhm i did "com.comphenix.protocol", name: "ProtocolLib", version: "5.0.0"; and everything doesn't exists (like PacketContainer, Protocollibrary class)
it seems 5.0.0 doesn't work
Can you please do a little bit of research on your own
Idk... Try registering the incoming channel as well
Ohh thank you! it worked
thanks, it works
oh god it took me 3 tries to find it
its a c to C in bungeecord
i have a bit of a conundrum
er actually
wait can I do JavaPlugin#getPlugin with an interface?
is there a way to just grab the names of these items from this entire thing somehow? (the list of items can be infinitely long)
I do not care about the content inside or outside, just the names of the items in a nice little list
Get the "items" sections and call .getKeys(false) on it
beat me
my plugin implements an interface
how do i make it so a particle is always 1 block in front of the player?
I was going to use a registered service provider for other plugins to get that interface
but you can't do that in onload
and I need it to happen then
and I can't have a singleton inside of an interface
Get his eye location, get the direction of the eye location
add the direction on the eye location, spawn a particle on this offset location
Hello, I'm wondering if Plugin Message Channel (like giving information from bungeecord to spigot or spigot to bungeecord) uses many resources
I have implemented Level system in bungeecord plugin and i'm getting level from bungeecord plugin via plugin message channel
Also, would it better to implement money/hologram/level/profile system in bungeecord plugin or spigot plugin?
Why?
BungeeCord is a proxy. It should be kept lightweight and not used for server level mechanics.
But imagine putting same codes for every plugins of servers (like RPG, Lobby) because level system is all same
Then put those plugins on every server
what would this look like xd
Show me what you have tried so far
having issues with getting the "items" section as something that I can call #getKeys(false) on
every plugins on different servers should connect to database and there's a lot of code in leveling system
wouldn't it better to just put level system in 1 single bungeecord plugin?
I know getString, get, etc. none really give me a yamlconfig object
Location location = player.getLocation();
Vector facing = location.getDirection().normalize().setY(0);
Vector normal = facing.crossProduct(new Vector(1, 0, 0));
normal.normalize();
Location loc = location.clone().add(normal);
literally getSection("items")
Location eyeLoc = player.getLocation();
Vector direction = eyeLoc.getDirection();
Location inFront = eyeLoc.add(direction);
how would one make PVP Bot?
Server-side
something has to happen in my plugin in on enable
so other plugins have to register before that
Can you not run it one tick after enable
Sounds flawed... Why cant they register something retrospectively?
no takes too long
server will crash
watchdog
they can, but you have to rebuild the entire resource pack again
i should do it asynchronously but
I just don't feel like it today
its not the day for that
does anyone have an idea? thank you in advance!
TLDR; Would it better to implement level/profile/hologram system(Same system on every servers) in bungeecord plugin or spigot plugin?
current status of the next MineMemer commit
tons of stuff coming 😉
most important of which, the ability to actually use the plugin
you release entire updates as 1 commit?
not exactly an "update"
the plugin version is currently vBeta -0.8 for a reason
half of that is fixes
also to answer your question, yes
vbeta -0.7 gonna be a big one
InventoryHeldEvent. What should I get? How can I get Item from previous slot?
like, it gives 0-8? or position in inventory?
0-8 iirc
wait, idk why but ur dependency doesnt work... did i do something wrong?
You can just use getItem
Hey!
I have strange instancing problem, where suddenly (without manipulating collections) the number of total instances in pool drop to 0
and I can't figure out why.
The code is long, so if anybody is interested in bug finding, please DM me :)
thx
Why not just send a GH link or paste it
?paste
Hello. Can you tell me why I can't find DustOptions?
Version?
1.12.2?
That's probably why
That is, on this version I am without the ability to customize the display of the particle in my own way?
Packets
Is the https://sessionserver.mojang.com/ down for anyone else?
welp GH is private but I can provide some code
[dont mind the shitty code rn, im trying to fix instancing for like week and I rewrote it x times]
WorldInstance - https://paste.md-5.net/ewiwusimig.java
Pool - https://paste.md-5.net/uyotipuveq.cs
StressInstancing ( just so I get those debug variables quicker) - https://paste.md-5.net/jivefuvihe.java
Results from the Stress [second iteration, first always fails at 4th]:
- for some reason the server restarted itself
can be more?
What
detailed
Use NMS to send a packet directly
@lost matrix
Why do I need to send a package if I need to change the particle? I do not really understand
loc.getWorld().spawnParticle(Particle.REDSTONE, loc.getX(), loc.getY(), loc.getZ(), 0, red,green, blue);
but seriously, it's so simple thx
- Log: https://paste.md-5.net/qeyakotagi.makefile
Map selection is at top with[RANDOM]"header"
dunno why it drops the number of instances all the time
so i just want the particle be 1 block in front depending on the pitch
not yaw
a particle spawned in front of a player but ignoring the yaw would be very wierd
yaw = player turning around
pitch is looking up and down
like vector y?
direction.setY(0).normalize()
Set y of direction to 0 and normalize before adding to location
how strange, because in the documentation the parameters you gave are marked as offset
and by themselves they are like a campaign and are responsible for offset, not color
Fine...
also, the parameters inside the classes are so well named, the first time you can’t tell what some are responsible for
by any chance is there any way to just get a way that a player is facing and using that in like vectors and things
?paste
Head facing or body facing?
head facing
getEyeLocation.getDirection
How do I fix this? I want to use NMS in 1.19.4
?nms
so, therefore, I can't do an offset for the particles?
bro how does that help me i just created the project and deleted "-api"
read it
yeah, read it
What is reading
quick question - would I have to add another plugin that is on the server as a dependency to access it? (which requires bundling it in my jar) Or would I just use PluginManager#getPlugin?
I have all my plugins in a parent directory. Would I just add this as a dependency in my parent POM?
<groupId>mc.scorchfield</groupId>
<version>1.0-Beta</version>
<scope>provided</scope>
</dependency>```
and then in my ScorchCore pom I somehow override that?
which I do how? I've tried using tutorials everywhere, but they don't work.
I was wondering if anybody could tell me how you change keybinds for a plugin when there isn't any option I can see
what keybinds
If this is your own plugin just build it using mvn install
Then where do I put the jar?
you don't
so this says sneak in the description line but I don't want the ability to be sneak
Repulsion:
colouredName: <bold><black>Repulsion
description: When you sneak, entities are repelled!
skills:
repulsion:
skill: REPULSION
multiplier: 5 # set this to a negative number to attract.
radius: 3
entityBlacklist:
- ARMOR_STAND
mvn install installs it to your mavenLocal
You can't change that
so is this impossible to change
so I would cd into the directory and then run mvn install?
yes
conor is there any way i can change the keybinds somewhere?
keybinds for what
then yes just build maven install
this
what is that
so mvn install while in the directory of the plugin?
yes
its a command that says its description is sneak to use but I don't want sneak and I don't know how to change it, the plugin in called Superheroes | Classes, Origins, Heros
is that in the plugin.yml?
im very confused
first of all
did you make this plugin
no
ok what file is that in?
this.
it's been doing something for about 3 minutes. no output..
I can't screenshot irritatingly so it's hard to explain and im no expert with coding and stuff
Spigot does not have any support for "keybinds"
How do I call "WorldServer" in 1.19.3 NMS
thats what i said.
The reason sneak is used is because that is one of the few buttons you can detect
isn't there a key press packet?
no
lol I wish
Well sure
but that's too much
But spout is dead
this finally finished. Do I have to do anything else? It's in the usual target folder
what does the Entity#getVelocity() means? It is the speed per second or per tick?
you could create a fabric mod
its a vector, vector.length() gives you the distance traveled per tick
i know it is a vector
Is there a preferred way to run a .sql file in a plugin?
I just wanted to know if it was second or tick
Spout didn't survive so I doubt any attempts to remake it will last long
Do I just use BufferedReader()
Is it possible to make a FileReader or reader from plugin.getResource()
Why do you need a filereader specofically
Oh just a reader
You can use an inputstreamreader
There you go!
So that means I can get the file from resources without copying it to the folder, right?
Yep
np
Is there a way to let a player walk automaticaly to a point?
i need a good intermediate command idea
does any 1 know why this wont work?
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
like it doesnt send the message
but it should
cuz i broke a non-player placed block
Add debug statements
why are you storing/checking BoundingBox ?
basically, in an area u can mine blocks and when u do it prints out that message, but if u place a block and mine it, it should not say the message
you are not checking inside an area
you are checking your Collection has the specific BoundingBox of that Block
is cionMine a BoundingBox itself?
yea
ok makes more sense
You can check if it contains a vector instead
ITS JUST THE LAST IF STATEMENT
I doubt that is the issue but yeah
sry caps
if its not a player placed block then surely you want if your Tracker doesn;t contain
wait lemme add a debig before that
so if (!PlayerBlockTracker.isTracked
I assume your tracker only tracks player placed blocks
no, cuz even if i break a block that i placed inside the bb it still doesnt work
btw this PlayerBlockTracker thing is a dep from @lost matrix
are you trying to send the message ONLY when a non player placed block is mined in that area?
yes
then definitely use !
then your .isTracked is always returning true
you need to show some code is all
Hm?
I expect 20 online absolute maximum in my server, i have like lobby and 2 minigame servers, also alot of worldedit stuff, what i have to choose for better performance 2x3.3Ghz or 1x5Ghz ?
oh i just realized 😅
yeah you never initialized it
Depends on the CPU architecture
Does it throw an exception?
.
null instance
u talking to me?
he is
so what should i do?
the block tracker needs to be on your server
and in your pom it needs a scope of provided
E5-2695v4(2core 3.3Ghz) i9-9900k(1core 5Ghz)
how`?
Hello, I need help with something I'm looking to remove the following from bungeecord, but I have no idea how to use java, would anyone help? (I doubt but thanks anyways)
https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
alr
Correct
Why?
Will worldedit things work better on higher frequency single core?
Now this is a hard decision. Usually higher single core performance is always better for minecraft.
The problem is when you are doing IO, which should be done on a different thread.
Worldedit yes
also, is there a better way to check if a block mined is inside of a specific location
cuz bb is kina weird
I want to make a public proxy that anyone can add a server, and the plugin messaging system is a security risk, since anyone can add any server anyone could literally do anything within the proxy
you might want to use .overlaps rather than .contains though
so partial covered blocks are included
Not necessarily but you can create a plugin that just listens to the pluginmessageevent and cancels it
yeah... the issue is i know 0 java
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Rip
Then you will have 0 chance
shit
I missed the message where he explained why he wants to do this nonsense
Here
.
makes more sense when you know the context
wait are you using a shared host that only gives you 1 core ????????
Can you even dynamically add servers to bungeecurd?
you can
Yes
yes
you gotta be hacky but you can
Havent used bungeecord since velocity came out
yep, currently
@lost matrix
how
you didn;t put the plugin on your server
you dont have TAB
Would be nice if you would just stop shading the plugin into yours
wdym?
*And installed it on the server
welp I'm going back to old roots
how would i make a target player variable
for a command
Player target = (Player) args[0];bc this aint workin
getPlayerExact 
So you mean i should go for 2x3.3 cores rather than single but faster one right?
yes
thats more like an ew
Newer versions benefit more from multiple cores
Ok im kind of lost wrapping my head around this.
If you disable the plugin messaging channel then you cant even transfer the players
between the servers. The player will always just join the fallback server.
Unless you have some command on bungee level which would allow the player
to choose a registered server. But why would you do that?
wdym by that?
If you only give a single core to your server you'll have a lot of fun
figuring out why everything takes 15 years to load
More core vs more hz?
In your pom:
Add
<scope>provided</scope>
to my dependency or else the maven shade plugin will
copy it into your jar
1 5ghz gaming cpu core vs 2x 3.3ghz server cores
but i did
you can't do jackshit with a single core
windows won't even boot on a single core system
Lmao
Did you also put the PlayerBlockTracker jar into your plugins folder?
Tell it to go feck itself
Smh
none of my plugins would work on a single core system either
No plugin which does an IO would be happy with that
di i have to do that
I abuse multithreading to a certain extent
Woah that crazy guys
can u send me a link to the plugin?
Well, im not forcing you to use this plugin.
yea but like do i have to use it for it to work
how can i get a chest gui to appear for a player
Did you just ask me if you have to install a plugin in order to use it?
nvm
Let Bukkit create an Inventory and open it for a player.
Bukkit.createInventory(...)
alr got it
so I started like improving my plugin code but I am stumped at one thing, I have this translate feature where I can translate the plugin strings in menus and player messages etc called TranslationData (which just loads a yml file similar to en_us.json for example) but in teh old code I had it static since there is only one of it, but I don't know if that's the best way to approach it
the annoying part is that I am using it all over the place
There's a client called eaglercraft which runs on the browser, and there it uses special connection (wss://) but it can be translated to a normal connection using a proxy + plugin, but its only for specific servers, my idea here is to make a public proxy that anybody can use to connect to normal servers
so "simple" DI will take some time to implement...
well doesn't matter too much
Its not like you need to add or remove translations on runtime. Could as well just use an enum.
correct
no I want users to to be able to make their own translations and stuff
Yeah but not on runtime i suppose. Only loaded from configs.
and a lot of translated strings use arguments too
yes that's true
you can only change translations in the config
well, I doubt anybody will help so I'll just leave the channel
but even then idk how to implement what you are suggesting
Have a nice day
@AllArgsConstructor
public enum TranslatedMessage {
GREET("msg.join.greet", "Hello %s!");
private final String path;
private String translation;
@Override
public String toString() {
return this.translation;
}
public static void loadTranslation(FileConfiguration configuration) {
for (TranslatedMessage message : values()) {
message.translation = configuration.getString(message.path, message.translation);
}
}
}
@EventHandler
public void onJoin(PlayerJoinEvent event) {
event.setJoinMessage("§f" + TranslatedMessage.GREET);
}
Simple translation example which uses an enum.
Should probably do some more magic so that you only need to add new values to the enum
and the yml file gets filled up with the missing values
yeah, I guess the main benefit of making it an enum is usability
but apart from that its pretty much identical to what I already had
thanks for your insight
But feel free to just copy the code into your own project and change it to your needs.
also another question, how do libraries do stuff like scheduling tasks without knowing the Plugin ahead of time?
like is that just di across the world whatever or does it depend
Depends on the library. If its a standalone library then it simply has its own JavaPlugin class.
it somehow doesnt work, it even returns false for player placed blocks and non-player placed blocks
Creative placed blocks arent tracked
ohhhhh
ehh I'm not a big fan of hardcoding stuff
Given we're working with files, I'd probably have a built-in messages.yml file and just copy contents over
I should maybe make this bigger
And im not a big fan of Strings. The big benefit of an enum is compile time safety.
valid
hmm
I just came back to say that I undervalued your approach to using enums at first, its actually pretty clever now that I look more into it 😛
yo
I just spent 15 minutes on godot and I think I am ready to make the next pokemon game
lol
"yeah I am a voice actor, famous for my line that goes like 'uhuhuhuuhuhuhuhuhuhu'"
hey some people are famous for saying gigity, fame is easy
would anyone have any idea how i can get a Player from an essentials nickname, Essentials#getUser doesnt work and i cant find any other methods like it and they have 0 api docs
package index
doesnt really help me
Probably iterate all and check nicks
can I schedule a task on the scheduler from another thread/asynchronous task
like if I have an asynchronous task running and then I want something to happen synchronously can I use scheduler#runTask
Yep
awesome
That's how async database calls are done
You do the query async and then do stuff with the data on main thread
god i fucking hate essentials
bukkit's scheduler is a bit lacking
@sullen marlin can you make an executor that delegates stuff to the main thread so we can use futures?
copypasting mine around can get annoying
can i get drops from block break?
you get drops in blockdropitems event
what would be the best way to communicate between backend plugin and proxy plugin
i have a minigame deployment system ready to be used
make a packet system
just want to know how i can get the lobby, for example, to ask the server to create a server for a player
make your lobby plugin send a packet to the allocation system controller
would it be UDP
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
would i do the same for the server status thing
since i don't want players connecting to in-progress minigames i want to make the servers tell the server controller that they are full/in-progress
surprising you got all that stuff done and don't know what a packet is
i know what a packet is lmfao
hi, what is error ot line 13,14:
https://pastebin.com/ZAwRwmje
have you defined "config"
who needs the ultimate java course?
its a 12 hour video and its very well explained
Hello ,
should : player.damage trigger the EntityDamageEvent?
yes (i dont know what im talking about)
it does not do the debug
this is both events and in the same class and both registred..
yeah tbh idk what i'm doing with it
give me the link plss
surely help me out a bit
Im interested on it
I'm having some issues adding rows to my sql database
The updateQuery gets executed but the data isn't sent
And I tried doing it from terminal and it just thinks constantly
And eventually says failed
[2023-04-15 19:07:45] [40001][1205] Lock wait timeout exceeded; try restarting transaction
Why would it be locked
Or better, what could be causing the lock
SQLite?
Mysql
then idk
nvm
Still can't actually insert stuff to database
And the tables are not locked
From command line it thinks for around 50 seconds
@modern plume @sterile token https://youtu.be/xk4_1vDrzzo
Java tutorial for beginners full course
#Java #tutorial #beginners
⭐️Time Stamps⭐️
#1 (00:00:00) Java tutorial for beginners ☕
#2 (00:20:26) variables ❌
#3 (00:32:58) swap two variables 💱
#4 (00:36:42) user input ⌨️
#5 (00:44:40) expressions 🧮
#6 (00:49:13) GUI intro 🚩
#7 (00:55:01) Math class 📐
#8 (01:01:08) ra...
should i use tcp or udp for this
He said he wanted it
I need help with my sql issue
I had to install SqlServer just to be able to debug further
I have no idea why it just waits for 50 seconds then fails
Ok I figured something out... keep a connecting alive to the sql database is what's causing nothing to be able to happen, when my server is on and it connects I can no longer interact with the database at all, including requests from the server itself
which one would be more reasonable for this use case scenario?
Let's see
TCP has slightly higher latency but can detect if it didn't send through, and resend itself
so you never lose connection unless a wire gets cut
Should use hikariCP
Or UDP, which is slightly faster, but has packet loss
It’ll handle that for you
But
I'm using IBatis because I wanted to execute a .sql file from the plugins resource folders
This but idk how I would set it up
You gotta master the basics
only a plugin on teh proxy can add a server.
I know I have already set that up
So if you are creatign servers externally you have to be able to talk to yoru plugin on the proxy
I just want to let backend servers communicate with said plugin
How can I have HikariCP execute a .sql file to generate tables
then Java sockets
So like, if they click play or smth, it creates the server and sends them
click play?
In the lobby
you mean in game?
then you must have a plugin which offered them the "play" message
Couldn't you just make a proxy plugin for this
I don't really see a need for sockets
I am doing that
I have done that
yes no need for sockets