#help-development
1 messages · Page 597 of 1
Yikes
Man I really wish I had my beautiful Rust .clone()
This did work tho, thanks a bunch
Another question.
public class PlayerDeathListener implements Listener {
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
// Save the player's inventory
Player player = e.getEntity();
ItemStack[] beforeDeathInventory = player.getInventory().getContents();
e.setDeathMessage("You died lmao");
// Wait 5 seconds
new BukkitRunnable() {
@Override
public void run() {
System.out.println("Restoring inventory of player " + player.getName());
// Restore the player's inventory
player.getInventory().setContents(beforeDeathInventory);
}
}.runTaskLater(player.getServer().getPluginManager().getPlugin("FirstSpigotPlugin"), 100L);
}
}
the .runTaskLater(player.getServer().getPluginManager().getPlugin("FirstSpigotPlugin"), 100L); feels like a workaround to me. How can a listener from a different class have access to the top level Plugin?
I can of course just throw this into the Plugin class, but I want to be able to separate them
It seems odd that I would need to put everything into my main file just because I want a timer
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
pass it in the constructor
you can also just use PlayerDeathEvent#setKeepInventory(true)
Yeah I just wanted to test out implementing it manually
If I want to modify the behavior of a station - such as setting a cap for level cost on an anvil - what part of the API do I use?
youll also need to do getArmorContents
Like events work for reactive stuff but what would it be for interactive stuff
good point
theres an event for anvil craft
one sec
declaration: package: org.bukkit.event.inventory, class: PrepareAnvilEvent
wdym interactive stuff?
I want to make a plugin which both caps the levels on anvils and also allows for the plugin user to specify enchant max levels
For instance you could enchant to Sharpness X in an anvil etc
I don't know what the terminology is here
Modifying behavior of interactable blocks and menus
yeah it wll still be through events
Oh that's odd
Do I have to do a lot of it manually or is there a built-in feature for setting max enchant levels
yeah itll be mostly manual but its not a huge amount of stuff to implement
Will it be like (pseudocode)
On player puts two items in anvil
For each duplicate enchant
If levels are same && levels + 1 < max enchant level
Add enchant with level + 1 to result item
Else
Add highest level enchant to result item
For each other enchant
Add enchant to result item
yeah smth like that
So I'm sort of reimplementing an anvil
How do I keep some of its features to prevent having to rewrite the whole pricing system and stuff
Oh so I legit just cannot
🪦
yeah trying to extend existing minecraft systems is a bit fucky lol
I can see how that would become very difficult with more complex systems than anvils
i.e. enchanting tables
yeah thats why people usually make their own inventories when making custom enchant systems
Inventories for what? The enchanting table?
Yeah I've always found those types of interfaces to be very cringe
I typically avoid them (when choosing plugins for servers)
anvil should be pretty straight forward tho
you're not really changing the functioanlity of it
Wait do I have to reimplement its actual menu too?
nah you shouldnt have to
just listen to the prepare event and set the result accordingly
Why do enchanted books not show up as enchanted using ItemStack.getEnchantments()
They're enchantmentstoragemeta
Difference between enchanted book and book storing enchants
Anyone know how to set the variable to true? DEFINE PUBLIC STATIC Z isThere as right now its false I thought ICONST_1 was true but apparently it's not. This is editing with assembler
?
what?
Asking about your attempted solution rather than your actual problem
I said I tried ICONST_1 because usually that's true but its not at this moment
Wait so something can be an enchanted book with meta or with enchantments?
Like it can have both?
Yes
Inventory inventory = e.getInventory();
ItemStack leftItem = inventory.getItem(0);
ItemStack rightItem = inventory.getItem(1);
if (leftItem != null && rightItem != null) {
// Get the enchantments on both items
Map<Enchantment, Integer> leftEnchantments = leftItem.getEnchantments();
Map<Enchantment, Integer> rightEnchantments = rightItem.getEnchantments();
Map<Enchantment, Integer> resultEnchantments = new HashMap<>();
// If the item is an enchanted book, additional enchantments must be determined using the item meta,
// rather than ItemStack.getEnchantments()
if (rightItem.getType() == Material.ENCHANTED_BOOK && rightItem.hasItemMeta()) {
ItemMeta meta = rightItem.getItemMeta();
if (meta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta enchantmentMeta = (EnchantmentStorageMeta) meta;
Map<Enchantment, Integer> rightMetaEnchants = enchantmentMeta.getEnchants();
rightEnchantments.putAll(rightMetaEnchants);
}
}
// Calculate the level of each enchantment
for (Map.Entry<Enchantment, Integer> entry : rightEnchantments.entrySet()) {
System.out.println("Evaluating right enchantment: " + entry.getKey() + ", level: " + entry.getValue());
Enchantment enchantment = entry.getKey();
int level = entry.getValue();
resultEnchantments.put(enchantment, level);
}
ItemStack resultItem = leftItem.clone();
// Add the enchantments to the resulting item
resultItem.addUnsafeEnchantments(resultEnchantments);
e.setResult(resultItem);
}
So I'm getting an error at rightEnchantments.putAll(rightMetaEnchants)
It works somehow tho lol
Caused by: java.lang.UnsupportedOperationException
at com.google.common.collect.ImmutableMap.putAll(ImmutableMap.java:890) ~[guava-31.1-jre.jar:?]
at com.lthoerner.firstspigotplugin.FirstSpigotPlugin.onAnvilPrepare(FirstSpigotPlugin.java:56) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
Foreach then addEnchant
Its unchangable map
Ok, I have another related question because I'm confused
I’m making a simple silk touch spawners plugin and have run into a problem. Is there a way to set the spawner type in the ItemStack ItemMeta or do I have to manually handle block placements to place the spawner and set the type from PDC
Is there even an item meta type for spawner mob
Nbt
@EventHandler
public void onAnvilPrepare(PrepareAnvilEvent e) {
Inventory inventory = e.getInventory();
ItemStack leftItem = inventory.getItem(0);
ItemStack rightItem = inventory.getItem(1);
if (leftItem != null && rightItem != null) {
// Get the enchantments on both items
Map<Enchantment, Integer> leftEnchantments = leftItem.getEnchantments();
Map<Enchantment, Integer> rightStandardEnchantments = rightItem.getEnchantments();
Map<Enchantment, Integer> rightMetaEnchantments = new HashMap<>();
Map<Enchantment, Integer> rightAllEnchantments = new HashMap<>();
Map<Enchantment, Integer> resultEnchantments = new HashMap<>();
// If the item is an enchanted book, additional enchantments must be determined using the item meta,
// rather than ItemStack.getEnchantments()
if (rightItem.getType() == Material.ENCHANTED_BOOK && rightItem.hasItemMeta()) {
ItemMeta meta = rightItem.getItemMeta();
if (meta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta enchantmentMeta = (EnchantmentStorageMeta) meta;
rightMetaEnchantments.putAll(enchantmentMeta.getEnchants());
for (Map.Entry<Enchantment, Integer> entry : rightMetaEnchantments.entrySet()) {
System.out.println("Identified meta enchantment on right item: " + entry.getKey() + ", level: " + entry.getValue());
}
}
}
// Combine the standard and meta enchantments together
rightAllEnchantments.putAll(rightStandardEnchantments);
rightAllEnchantments.putAll(rightMetaEnchantments);
// Calculate the level of each enchantment
for (Map.Entry<Enchantment, Integer> entry : rightAllEnchantments.entrySet()) {
System.out.println("Evaluating right enchantment: " + entry.getKey() + ", level: " + entry.getValue());
Enchantment enchantment = entry.getKey();
int level = entry.getValue();
resultEnchantments.put(enchantment, level);
}
ItemStack resultItem = leftItem.clone();
// Add the enchantments to the resulting item
resultItem.addUnsafeEnchantments(resultEnchantments);
e.setResult(resultItem);
}
}
What method lets me set NBT data
So this seems like it should work but it doesn't seem to be identifying meta enchants at all anymore
// If the item is an enchanted book, additional enchantments must be determined using the item meta,
// rather than ItemStack.getEnchantments()
if (rightItem.getType() == Material.ENCHANTED_BOOK && rightItem.hasItemMeta()) {
ItemMeta meta = rightItem.getItemMeta();
if (meta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta enchantmentMeta = (EnchantmentStorageMeta) meta;
rightMetaEnchantments.putAll(enchantmentMeta.getEnchants());
for (Map.Entry<Enchantment, Integer> entry : rightMetaEnchantments.entrySet()) {
System.out.println("Identified meta enchantment on right item: " + entry.getKey() + ", level: " + entry.getValue());
}
}
}
In particular, this part
It actually was working in this form
But it's not identifying them anymore
how can I get the rotation of a Material.PLAYER_HEAD?
Do I need to cast it to a Skull?
public static Map<Enchantment, Integer> getAllEnchantments(ItemStack item) {
if (item == null) {
return null;
}
// Get the "standard enchantments" of the item
Map<Enchantment, Integer> enchantments = new HashMap<>(item.getEnchantments());
// Get the "meta enchantments" of the item, which are usually only present with enchanted books
ItemMeta meta = item.getItemMeta();
if (meta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta enchantmentMeta = (EnchantmentStorageMeta) meta;
enchantments.putAll(enchantmentMeta.getEnchants());
}
return enchantments;
}
Ok I came up with this
But it still does not work lol
It seems that the meta enchantments are being identified, but not actually saved/stored
Oh, apparently you have to use .getStoredEnchants() on the meta
gun recoil
declaration: package: org.bukkit.block, interface: CreatureSpawner
On place/break block wait one tick then do things.
is it possible to make 3d textures/models for armor?
NBTApi
Use blockbench
How can I place a block with the plugin?
CreatureSpawner spawner = (CreatureSpawner) block;
I want the plugin to place this block where the player wanted.
You can getBlock from location and setMaterial
Yes ofc
is there a list for all the inventory slots in 1.19 for player inventory? for example, which slots are hotbar, which are armor, etc
why is this now randomly existing
i don't remember it just randomly spawning in my ide yesterday
Hello, can someone help me with attribute modifiers ?
I'm trying to copy all the attribute modifiers from an armor to another armor, especially the ones that mention "+8 Armor, +1 Knowback Resistance", like the very default ones for vanilla armor.
Here's my old code, which is still working, using NMS:
ItemStack newArmor = initialArmor.clone();
net.minecraft.world.item.ItemStack nmsInitial = CraftItemStack.asNMSCopy(initialArmor);
net.minecraft.world.item.ItemStack nmsNew = CraftItemStack.asNMSCopy(newArmor);
for (net.minecraft.world.entity.EquipmentSlot slot:net.minecraft.world.entity.EquipmentSlot.values()){
Map<net.minecraft.world.entity.ai.attributes.Attribute,Collection<AttributeModifier>> all = nmsInitial.getAttributeModifiers(slot).asMap();
for (net.minecraft.world.entity.ai.attributes.Attribute attr:nmsInitial.getAttributeModifiers(slot).keySet()){
for (AttributeModifier mod:all.get(attr)){
nmsNew.addAttributeModifier(attr, mod, slot);
}
}
}
newArmor = CraftItemStack.asBukkitCopy(nmsNew);
Here is my new code, using bukkit api, but isn't working (at least not for the very basic attributes)
newArmor.setAttributeModifiers(initialArmor.getAttributeModifiers());
Hello, how can I use the SkinsRestorer api to apply a skin that is redirected by a url?
Do you call setItemMeta
nope, this isn't in the item meta tho (but in itemstack)
- Should I do this in ItemMeta instead ?
- Or are you making sure that I'm not overwriting the item with a different meta afterwards ?
oh and hear this:
it works for custom attributes (like if i give myself an item with weird attributes it works)
it just doesn't work for the most basic ones like the ones we find on default diamond armor, etc
yeah seems pretty much what i want
i also noticed there was getAttributeModifiers(equipmentSlot)
But after checking the source code, I realised that getAttributeModifiers(equipmentSlot) is included in getAttributeModifiers()
So it shouldn't be the issue
Sounds like it might not include default modifiers though?
yeah
i mean i havent checked ALL the source code
so i still don't know where/how it retrieves all the attribute modifiers
You can check if it's giving the ones you expect though
oki i'll try to debug that
bump
?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.
also please use english if you want us to understand what you mean
Hello, how can I use the SkinsRestorer api to apply a skin that is redirected by a url?
i think it'd be a good idea for you to join their discord and ask there, because it's not very likely that many people here have used this api
Nice
I think it's when he first mined, it mined really fast and second time its good
if i disable the player's ability to drop items, is there any other way that they can get rid of them?
i'm making a market system and i want to prevent dupes when the selling GUI is open
so the player chooses what item from their inventory they want to sell and the GUI is open where they select the amount of the item
of course i want to prevent the player from dropping the item because it's still in their inventory
death
it was my second thought, but in that case the inventory will be closed and the sale will be aborted so it's fine
I confirm this statement.
https://i.imgur.com/n6y9Nlr.png
First log: when i had a default diamond armor in main hand
Second log: when i had a diamond armor with special attributes
Break, like if it's a sword
an armor piece could be broken yeah
but not a sword i don't think, how would a sword be broken while the player is in a gui
Oh, okay
real quick what's the plugin size limit on spigot again?
4mb
Wait, plugins have a size limit?
Makes sense ig
yeah I do that for some of my other plugins
is your tower defense plugin coming out
ah alrighty
Tbh it looks in a way bedrock-styled, because java servers usually don't bother making custom models
I didn't just bother to make models, I bothered to make a whole plugin that manages models in spigot
yeah that's not a step ahead, that a storey ahead
I know what I'm gonna use for random bullshit I sometimes make now
HangingBreakEvent.RemoveCause: what type of cause is responsible for a torn leash from distance of more than 10m?
not officially released on spigot yet as I am wrapping up some testing
but it seems to be working just fine
try it and debug, i'd assume default or entity
this was fully generated using the plugin
Wait, does that mean we kinda have the ability to create custom blocks now? Like, with custom textures and models and all the cool stuff
yes but this is not the best way of doing blocks specifically
there's three main ways of making models
one is using noteblocks
Idk if there is some kind of blocky custom model data or somethung
one is using item frames
and one is using armor stands
I'm using armor stands exclusively right now but I plan to probably add compatibility for the other two methods in the future
noteblocks are better because there's a real block you can hook up to
Actually, why wouldn't mojang add like block custom model data?
why are you using armor stands if noteblocks are better? are they easier to work with?
notblocks are only good for making blocks
I don't currently give a shit about making blocks
fair
I wonder if I can make multiblock machinery like immersive engineering (I think it was that) using that plugin
ideally I'd like for FMM to become an easy way for other devs to implement their own custom models into their plugins
you can raydan, it would just be a bunch of work
Like building something out of blocks following an instruction, using some item with custom model data to be like the hammer and boom
once you have a way to display the models everything else is just a function of your patience in developing a system
And since we already got a pretty interesting concept for tech mods with energy that could be implemented in a good way
I need to stop thinking of that shit, because I try to do what I say I'm going to do and that is gonna take me multiple nights to get it working
hey magma
maybe you'll like a super tiny contribution lol
public static double decimalPlaces(double value, int places) {
final double number = Math.pow(10, places) * 1.0;
return Math.round(value * number) / number;
}
public static double fourDecimalPlaces(double value) {
return decimalPlaces(value, 4);
}
public static double twoDecimalPlaces(double value) {
return decimalPlaces(value, 2);
}
for your Round class
tested
oh no they're reading my utility classes
😄
I don't even use two decimal places lol I only copied the class from one of my other plugins
but sure PR it
yo could be a dumb question but what should "key" be when creating a new NameSpaceKey?
your literal key. f.e. if you wanna store how many breads the player has eaten, the you could do something like
eat-bread
yourplugin-breat-eaten
or whatever
okay thanks
the plugin name is already part of the key
turns out i don't know shit about git command line
how do i pr from there???
in intellij
is there any way to increase "durability" of lead? i wanna increase it torn distance from 10 to, for example, 45
only NMS?
So I want to make a discord-minecraft verification by storing a key that player must enter in the server in the database and checking whole database for the key but now I'm thinking about storing the keys in hashmap in my plugin and just adding them to it when discord command is sent, which one is better to use
Also I don't know how to do the second one
(receiving the key from discord bot)
Hey, i am trying to "change" the recipients of a message however there is no setter for that in the PlayerChatEvent. i was thinking of just calling a new PlayerChatEvent with the updated recipients however that would just create a loop anyone have an idea how i could make that work?
then you can easily sync data between them
u wanna do Discord Verification?
Yea
just remove any recipients you don;t want
i'll keep silent with my ready plugin, better...
use Map :)
so when a command like "/verify" is ran in minecraft, you store the key and uuid in the hashmap and your discord bot can work with that
(or the opposite, the command can be ran in discord, but the point stays)
can't do that because there is no setter for it
Okay thanks
if i use .getRecipients it just returns a copy of the list
elgar, do you know how to pr in intellij? i can't figure it out lol
its not a copy
hmmm alright let me try it
Sorry I don;t use IJ
what about cli
I do it all in Eclipse
ah kk
i cannot manage to 😭
How to receive discord bot events in plugin
If you clone a repo you make yoru changes push back to your cloned repo, then on Github create a PR to upstream
Like if discord user used a command, I receive the event inside my plugin
make your plugin and bot in one jar file
not separately
Sorry, you were right. Thanks for the help!
I'm not into that, if my server would stop, the discord bot would stop
And I want to make server shut down info
did i clone it though, i have nothing new in my repos
i'm pretty sure i'm working directly with the fmm repo
jda.shutdownNow
(if i correctly understood u)
you need to clone it not just import from git
Okay but still, what about the commands that bot has
slashcommands?
JDA: SlashCommandInteractionEvent
something like that
I'm not asking that
yea
run your server 24/7, why not?
ok actually i did clone it
What about crashes?
auto-reload
are horse armor meta instance of ArmorMeta ?
you need to clone, import your cloned repo, not original, make changes, push changes, then create pr
i am doing something wrong
i tried cloning from cli git clone url, opened the directory in intellij, made my changes and tried to commit&push, but it wouldn't allow to push. why????
Hi, what event can be called dice when a player connects in a bungeeCord plugin?
if there any way to listen for torn lead? (a leash being torn)
public static void sendHoverableChatEvent(Player player) {
TextComponent messageComponent = new TextComponent("Hoverable Text");
messageComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("This is a hoverable text").create()));
Player.Spigot spigot = player.spigot();
spigot.sendMessage(messageComponent);
}
is what i use
ok so i cancel the event and do this instead?
cancel what event
chatevent
i know that it's deprecated and im using async
but i don't want to type it all in
im just referring to the event
are you using paper
ye
we dont use the word paper around here
what is lead torn
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
event.setCancelled(true);
Player player = event.getPlayer();
TextComponent format = new TextComponent();
player.spigot().sendMessage(format);
}```
ah my bad
how?
PlayerInteractEntityEvent probably
nope wt
i think it will not work, cuz torn isnt interaction
i think it will work
why?
yeah but you can check other things
how do leads even work
already did
i do listen for PlayerInteractAtEntityEvent, then when it already leashed at entity, leash will become an entity in HangingBreakByEntityEvent/PlayerInteractAtEntityEvent/PlayerLeashEntityEvent
but still i need know how to listen for this
hm i have an idea
? (i need without teleportation yeah)
nvm
the idea was gone? 😂
what exactly did u tried? mine method works for player leashing
it was a pof thing
cuz even if it worked the server would have terrible performance
check if the Entity interface has the isLeashed boolean
cuz im currently on legacy
it might
🤷🏿♂️
hold up
this might work
@urban mauve i found out the event for when a leash is broken of a fence
but not i f the player runs too far
i dont need this so
what do u neeed
.
i thoughts it only with NMS
Let's say I have two java files with their own servers and one of them is a spigot server and one of them is a discord bot, I can't connect those two into one, and i somehow need to execute a function when the event is executed on the other java
So when event on java 1
Execute function on java 2
put it in the same jar
I said "I cant connect those two into one"
Put the discord bot in the spigot plugin
?
why? i can
How when it needs memory
what
?
look at DiscordWhitelist
BECAUSE I DON'T KNOW HOW, and also the hosting tos
when the player goes too far away
learn then...
maven or gradle?
If you have a discord bot, you need to host it on discord bot option not Minecraft option
mine bot hosting when u start server
yea?
yeah let me show u a vid
k
i need to prevent drop default lead
Is there some guide to adding structures with custom loot tables?
you can easily run a discord bot through a minecraft plugin. just use JDA and shade it into the plugin, then create your JDA instance in onEnable() or whatever
or Discord4J but i dont like it
Hi guys, I'm getting into developing custom world generations in the new versions of minecraft. Documentation is unfortunately limited, can anyone help me get started the right way?
this ^
just look at many Discord plugins, like DiscordSRV, DiscordWhitelist, DiscordIntegration, etc.
Is the problem the spigot integration or world gen overall?
@urban mauve
dont ping me please, i see all
ok
Kinda like discord whitelist but inverted
wdym?
Player must verify on mc server to gain access to discord server
Alex do you have any idea how to pr from intellij because I'm failing to understand
I was here
fork?
alright let me try this now
How i can connect to database and get every value from the table
now that i've pushed, how would i go about pring this fork into the original
on github there will be a pr to upstream somewhere
public static boolean isCompatible(Material material){
String materialName = MulticolorArmor.getMaterialName(material);
return (materialName.equals("wooden") || materialName.equals("stone") || materialName.equals("leather") || materialName.equals("iron") || materialName.equals("golden") || materialName.equals("diamond") || materialName.equals("netherite"));
}```
have i forgotten any ? (for any kind of tools/armors)
material name will never equal wooden though
did you mean to use startsWith()?
chainmail btw
my first function extracts the prefix yes
and it's lowercase all the time, right?
ye
kk then
^
i use my first function for other stuff too thats why i didn't use startswith
also, turtle helmet?
and elytra if we're talking all the equipment
nah not elytra
kk
ty ty
TextComponent is messing up my hex color codes
what do i do?
@EventHandler
public void onChat(AsyncPlayerChatEvent event){
event.setCancelled(true);
Player player = event.getPlayer();
String prefix = TextHelper.format(translateHexColorCodes(PlaceholderAPI.setPlaceholders(player,"%luckperms_prefix%")));
player.sendMessage(prefix);
TextComponent format = new TextComponent(prefix);
player.spigot().sendMessage(format);```
result:
How do I properly calculate the position of chunk coordinates again?
Was this enough?
chunk.getX() >> 16
i think its 4
Yeee, it's 4, my mistake
is there a function to paginate a string into book pages ?
so they don't get truncated or smth
I made one myself - it ain't perfect though. Also since a texturepack changes the text size and books are entirely clientside it only works with the default font
So no, there ain't one in spigot
ah yeah, its kinda a hassle i see
okioki
yup can't really make it perfect
If you would want to make one (for the default font) the size of the letters is on the wiki
hggghhhf
oki thx
Client side bug, after setType of this block to bedrock and again diamond_ore my pickaxe with dig speed 30 act like a normal safe dig speed 5
Interesting statement! Can you elaborate?
@EventHandler
public void blockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() != Material.DIAMOND_ORE) {
return;
}
event.setCancelled(true);
lifeBlockGame.removeHP(1);
if (lifeBlockGame.getHp() > 0) {
block.setType(Material.DIAMOND_ORE);
} else {
block.setType(Material.BEDROCK);
}
}```
simple listener
and replace from bedrock method
private void addHP(int hp) {
int newHP = this.hp + hp;
if(this.hp <= 0 && newHP > 0){
this.getBlockLocation().getBlock().setType(Material.DIAMOND_ORE);
}
this.hp = this.hp + hp;
}
?paste
is there an event that runs when new day starts?
https://paste.md-5.net/acobohetav.cpp
to give you a headstart: That's what I use.
As I said it can probably be optimized and it's not 100% bugfree. If you see anything and fix it feel free to let me know
are H2 databases good? should i use something else? (i just gotta store to some player UUID an id and a balance)
i see, yeh it's the kind of irritating "case by case" function to make;
thanks for your code, i don't think i will use it because i changed a bit my mind, but it's useful to have some stuff at hand 🙂
aren't &lBOLD characters wider than their normal versions?
Would make sense, yes. Never used bold characters in books. That's something I'd then have to adjust. Thanks for mentioning it
Hi, caffeine is good for caching ans database optimisations ?
I come back yesterday where I was looking for a way to optimize my results, I finally turned to caching, when a player connects, I recover his data and the stock in cash with caffeine, and when the player disconnects I send them to the database. Also I would like to add a system that automatically sends data to the database every 15/20 minutes, so with a dozen players connected, this would involve a dozen requests to the database in a short time, its risk generate lag or is it nothing? (Or else send them gradually?)
as long as you are off the main server thread you are good
How to know?
That’s a good question
And my my methode using cafeine is good ?
Usually you’d use java std classes to deal with concurrency
I mean caffeine is just really nice for soft, weak and expiring caches
if u just need a data sync buffer u dont need caffeine
you mean caffeine is only good for storing little things?
Cache need to sync
If you have a lot of connections modifying data, you may gonna have a problem.
and so caffeine is more for small or big data?
then how to do?
we all need a little EUFUP in our life
d?
User Stupidity Protection
yep usp it is
why not just udp?
well that short already exists lol
fair enough
thats a protocol
oh ye
No lmao
coffeine always good
If u just wanna sync ur data with ur db every x period
Then u dont need caffeine
As said
This
man
If u have data that should be removed automatically after a while then go with caffeine
woman
look of disapproval?
load in chunks beyond a certain threshold as hollow, culling anything that is not the outermost block that might be visible
Caffeine need for just easily use data. So you dont have to manually create queries.
My autocorrector💀
i'm talking about cocaine bro
Hi, is it possible to make script so in specific season the leaves and grass color changes?
Yes but you’ll need NMS
i need it to get some info about the user when he logs in, the problem is that i need info from each user every time a chat is sent so dealing with direct requests is really not optimizes but otherwise I could have just made a hashmao where I store the player and the data but doing with caffeine is always better I imagine?
is it possible to remove that box? it really throws me off
Press insert
ok, could it be possible to make it whit resours pack?
Hmm
Maybe with optifine features
ok now i cnow why there almost no season plugins :)
It’s actually fairly easy to make if you know your way around NMS and packets
"easy to make if you know" :)
lt?
cepelinas
? :D
?paste
How i can give player an item when user used a discord bot command
Nevermind tho
How to connect jda with spigot without breaking the plugin
Yea just asking how to connect it, like how to initialize discord bot
But like where? To onEnable?
i mean yeah you want your bot to enable when your plugin does right???
You can shade it or libraries feature it
^
But like how to add it to the plugin? So like it's full in one plugin??
why am i dividing by zero here? Math.max(((double) woodcutting.getXp()) / (woodcutting.getStarterXp() * woodcutting.getLevel()), 1.0)
skill abstract:
public abstract class Skill {
private static int STARTER_XP;
private int level;
private int xp;
private static double damageRewards;
private static double healthRewards;
private static double defenseRewards;
private static double moneyRewards;
public boolean calculateLevelUp(){
if(xp > (STARTER_XP * level)){
xp = xp - (STARTER_XP * level) ;
level++;
return true;
}
return false;
}
public int getStarterXp() {
return STARTER_XP;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getXp() {
return xp;
}
public void setXp(int xp) {
this.xp = xp;
}
public double getDamageRewards() {
...
}
public double getHealthRewards() {
...
}
public double getDefenseRewards() {
...
}
public double getMoneyRewards() {
...
}
public Map<String, Object> serialize(){
return Map.of(
"level",level,
"xp",xp
);
}
}
a skill class for refrence:
public class Woodcutting extends Skill implements ConfigurationSerializable {
public static int STARTER_XP = 50;
private int level = 1;
private int xp = 0;
private static double damageRewards = 0;
private static double healthRewards = 1;
private static double defenseRewards = 0.1;
private static double moneyRewards = 100;
public Woodcutting deserialize(Map<String, Object> m){
return new Woodcutting(m);
}
public Woodcutting(Map<String, Object> m){
xp = (Integer) m.get("xp");
level = (Integer) m.get("level");
}
public Woodcutting(){}
}
dude
text wall
?paste
use this please
what is the problem>???????
just add it as a dependency in your dependency manager
and work with it
that website doesnt work for me
why am i dividing by zero here ```Math
oh my fucking god this does not help at all but ok that's effort
Maven
so just
Use the maven shade plugin
add it
as a
dependency
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - GitHub - discord-jda/JDA: Java wrapper for the popular chat & VOIP service: Discord https://discord.com
But you have to download the jar right?
no
Just the dependency? Maven already has it??
maven will download it to your local repository when you first prompt it
after that, this version of this dependency will stay present in your local repo until you delete it
Okay, and it will add to my jar?
no it will actually delete your system files
what
You're right
https://prnt.sc/SAxt65keGXY8 it's possible set items here with bukkit api when the player joins in the server?
you can try, slots for reference
That's the slots in the protocol
most likely slot 0 won't work
and InventoryClickEvents
1-4 probably too
Yes, there is no way to cancel the event? Or do it when the player's inventory is opened? it's just that I couldn't
on bukkit, 0-9 is hotbar
this is inventoryclickevent
second hand is 40
so armor 41-44?
armor is 36 - 39
helm is 39 pretty sure
i want set items or if a player join (i think that is impossible) or if a player open the inventory
because i use these slots too lol
This is the slot map for Inventory#setItem / Inventory#setContents
oo
41-45 is the crafting grid but it's icky
so crafting is out of the question
?
This is somewhere on the protocol
and bukkit does conversion in the middle at some point
I don't remember where
when storing to nbt they set the slot as something stupid as well
just a shitshow
mhm who the fuck wrote this
😂
?arrowcode for them
actually
even better
I'm a Never Nester and you should too.
Access to code examples, discord, song names and more at https://www.patreon.com/codeaesthetic
Correction: At 2:20 the inversion should be "less than or equal", not "less than"
Too old! (Click the link to get the exact time)
It's a fact
The log4j gonna be crazy
i used to code in 1.8.8 when i just started
me when 1.8
haven't touched 1.8 in a long while and I'm so happy
yeah it feels good to have an actually usable api
but my server has to be for 1.8 xd
i understand you and i'm sorry for you
I started with 1.16.5 but the first server I worked with was 1.12.1 so I was using that for a bit, and just recently the server I now work with updated to 1.18 very epic
Rust no longer has an audience in Minecraft, imagine if it is not 1.8 haha
I can finally use higher java versions
why arbitrarily 1.12.1? thought 1.12.2 was the standard for 1.12.* versions 😄
I have permissions Vagt but why dosent the menu open? because if i have permission * it opens fine
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can do this");
return false;
}
Player player = (Player) sender;
if(player.hasPermission("vagt")) {
if(player.getWorld().getName().equalsIgnoreCase("A")){
new VagtshopA().open(player);
} else if(player.getWorld().getName().equalsIgnoreCase("B")){
new VagtshopB().open(player);
} else if(player.getWorld().getName().equalsIgnoreCase("C")){
new VagtshopC().open(player);
}else{
sender.sendMessage("You dont have permission for this.");
}
}
return true;
}
}
indent your code correctly
wait wha
12.2 had some performance issues
That weren't there in 12.1
HypixelSkillCore-1.0.jar, MorePersistentDataTypes-2.3.1.jar define 1 overlapping resource:
- META-INF/MANIFEST.MF
maven-shade-plugin has detected that some class files are
present in two or more JARs. When this happens, only one
single version of the class is copied to the uber jar.
Usually this is not harmful and you can skip these warnings,
otherwise try to manually exclude artifacts based on
mvn dependency:tree -Ddetail=true and the above output.
See http://maven.apache.org/plugins/maven-shade-plugin/
```this doesnt break anything but its annoying me. any way to fix it?
Man its so annoying
i have person
who rejects my changes
of a product in development
because it alters the previous code
LIKE wtf
we are developing
not releasing shit yet lmao
why bother making backwards compatibility to the broken code
ffs
i just made an entire commission worth 3 Word pages without testing anything, place your bets whether it will even launch lmao
ok it didn't compile
one sec
there we go
It tells you what to do
I have permissions Vagt but why dosent the menu open? because if i have permission * it opens fine
public class VagtshopCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can do this");
return false;
}
Player player = (Player) sender;
if(player.hasPermission("vagt")) {
if(player.getWorld().getName().equalsIgnoreCase("A")){
new VagtshopA().open(player);
} else if(player.getWorld().getName().equalsIgnoreCase("B")){
new VagtshopB().open(player);
} else if(player.getWorld().getName().equalsIgnoreCase("C")){
new VagtshopC().open(player);
}else{
sender.sendMessage("You dont have permission for this.");
}
}
return true;
}
}
read above dude
I dont get any of these errors?
the errors don't have to do anything 😭
look carefully at the if-statement
very carefully
Its because your is red so i though it was errors
i am not talking about the errors
Okay sorry
You're missing a closing bracket
Or, rather, your indentation is wrong so you're failing to see that your else is on the wrong if/elseif chain
In your IDE you should be able to auto indent (in Eclipse it's Ctrl + I I believe, but there may be a Shift in there too) which would pretty easily identify the problem
choco can u help me in #help-server
Probably not. I'm not super familiar with BC
anybody knows free postgresql hostings? need one for testing
i've never done postgre before 😄
ok i think i found one question mark
https://prnt.sc/SAxt65keGXY8 it's possible set items here with bukkit api when the player open your inventory?
try with these slots
then try 36-39??
https://prnt.sc/glKHRvj6cwNa I'll try, but 41 wasn't.
https://prnt.sc/QIfvtMiY0KWB not working :/
look like it is not possible then
but it has servers with it
player.getOpenInventory().setItem(0, new ItemStack(Material.DIAMOND));
so it "works", but the code is only called if you open an inventory and then open another inventory through the open inventory.
oh my fucking god does anybody know a free postgresql hosting imma go insane soon
why not host it locally
i am using a very cheap minecraft hosting
not vps
unfortunately
i tried elephantsql but it for some reason wouldn't load, heroku wouldn't let me sign up and threw errors at me, aws doesn't support accounts from russia
what the fuck do i do
should i use pdc instead of a db?
storing a balance, discord id, skill level etc...
if you don't want to account for potential multiserver support you can use pdc
do you need to access those data if player is offline ?
oh right
oh actually yeah i forgot
tbh just use a db, cache everything you can and you should be ok
fuck it i'm hosting postgresql locally
my pc will die after i exhaust all the ram
but it's ok
stuff dies
i'm probs gonna use H2
the launch screen:
- looks good, seems pretty up to date
and then u get this ui
what the hell is this
LOL
bro it looks like im using windows 1 paint or smt
nice summary of eclipse
intellij idea launch screen:
- seems good, very professional
and then you get this
real
and what application puts the "Preferences" under "Window"
it's idling
💯
tf is that font
i dont get that anymore when i removed the mc dev plugin tho
that's cyrillic lol
Window Preferences
yo guys do u think that contabo is good for a small community server?
👹👹
there is a difference between a font and an alphabet
i don't remember
i changed it with winaero
a couple years ago
okay
oh i thought that's default one
oh yeah good idea
I'd just use oracle cloud for a small personal server
nah
i like the new look of the intellij UI tho, looks clean
I can read cyrillic so I must know that that is cyrillic lol
- the plugin i use it makes it look so much better
i mean for price
Yeah there is a free oracle cloud compute instance that's pretty capable
but hey everything is where you expect it to be
oracle cloud is pretty much free
me instantly when i download a new intellij version:
^^^ agreee
I use it for reposilite
exactly
bro when are they adding plugins to fleet??? i want that shit, looks like vs code but then i can still use my github student license
that theme sucks
but its from the website
yeah
oooo
im hyped for it
i'm interested
just once they add plugins imma use it
ayo that looks fancy
but tbh idk how they would market this
yeah fleet has no copilot
yep...
it would prob be very expensive
they market it as a vs code killer
anything without electron for me is vs code killer
it sucks rn, but plugins would make it alot better
Sublime text gang
yeah right
when correct example is
using my minecraft tshirt atm
fancy
i wear creeper shirt btw
😦
HA i now know u have a beard
gotta shave it's a bit too big
but yes I'm not a toddler anymore
I got stuff just not a sword
damn
light the tnt no balls
TRUE
he got the minecraft sky phone/tablet
xd
Only 3?
Hello, I have a spigot maven multi-modules project, how can I make a jar of the modules, including other modules ?
look like this : (alot is the where my plugin is, I want api and nms_v16 to be included in alot's jar)
https://github.com/mbax/AbstractionExamplePlugin
I think it's still useful
Contribute to mbax/AbstractionExamplePlugin development by creating an account on GitHub.
okay thanks
wow turns out debugging is actually fun when the server doesn't take 50 seconds to boot up
yeah
my servers take from 10 to 30 seconds to boot up
idk how to fix that, 1.8 booted up from 5 to 15 seconds
and HD speed
easy to say, hard to do. Especially with a laptop
disable nether and End
already
don;t keep spawn in memory
try to see what's stalling the process
I've had plugins hang startup for 3 minutes straight
optimized it a little and took maybe 3ms to load
my server has only 3 plugins and they all take like no time to load
and it's a testing server anyways
hi
hi
wat
guys who knows if it is possible to make the commands of other plugins (including vanilla commands) multi-server. That is, I wrote a command on 1 server and it was executed on all
bungee?
Yeah
how much can such a plugin cost to order, where absolutely all the commands that you want can be run for a multi-server
У меня есть рубли, что представляют собой эти 30 долларов? Что для вас якобы чашка кофе равна стоимости потребления?
I have rubles how do these 30 dollars represent? For you, what is supposedly a cup of coffee equal to the cost of consumption?
give an example of not money pls
you add the other module as dependencies to alot, then shade them in
thanks 😄
30 usd is like... money?
give an example on the amount of bread, how much bread can you buy for 30 dollars?))
Uhmm
Just use a currency converter
Idk how much bread you get for 30 usd
oh my god 2 k
this math
or not
hmm
i think this small
maybe 50 dollars
))))
depends in which country you get it from
Also depends on the type of bread, its quality, and where you buy it 
OR if you buy the ingredients yourself and make dozens of loafs of bread!
How much is a dozen? Forgot
lol
12
Yes
Bakers dozen is 6; I thaught
Just to throw a wrench in your logic, a baker's dozen is 13
.-.
What
hm
Old timey reasoning lol
A bakers dozen is 13 because they would always bake one extra to test
a dozen is 12
Man there's an echo in this Discord. Weird
Hi Choco
Ik it's a real strange phenomenon
guys, I don’t understand one person, he ordered a plugin for a horse and wants the horse to have a menu that displays the characteristics of the horse, but he wants to do it through the deluxe menu, he thinks that my plugin can be connected to his plugin through placeholders, I don’t understand what he wants to do
That, yeah, but they're probably just wanting PlaceholderAPI support
I remember having a commission like that a couple years back
but the dude was such a simp that the moment his gf tried to "prove me wrong" he just blocked me
(she was having internet issues)
can you put tab completion in the same class as the command executor?
Yes
implements TabExecutor
There's actually a convenience interface, TabExecutor, which is just both a TabCompleter and CommandExecutor
^
¯_(ツ)_/¯
look, there is a horse with properties from my plugin, for example, it can swim, etc. but he also wants a menu for the horse, but he wants to make this menu I quote - "through my placeholders" so he will link the menu from the deluxe menu to my plugin but I don't understand how he the horse itself will receive
end what he want wth
cringe
4real?
yes
sheiiit
it's just interface TabExecutor extends CommandExecutor, TabCompletor
yeah i just found it on javadocs
Well if they're using DeluxeMenus like you said above, it makes use of PlaceholderAPI. So again, they probably just want you to expose some information as placeholders. But ultimately you should be asking for clarification from the person who is commissioning you so you can do what they want you to do rather than our interpretation of what they want you to do
which version added this feature?
It's been around for a while
i just use abstract))
clas
s
2013 if you want specifics
bruh what
Oh, prior actually
2012
It came alongside tab completion as a whole, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/9fd9767a4a55c90bf488e2077123be8a55aaa982
everything before 1.8 may officially be called "was there since forever"
true
i would advise you to ask your customer for clarification
but ig placeholder api" - i dont undestand how he will bind my plugin to deluxMenu without using deluxMenu api on my end
you would be using PAPI and deluxmenu also uses PAPI
UUID uuid = player.getUniqueId();
String playerName = player.getName();
WrappedGameProfile gameProfile = new WrappedGameProfile(uuid, playerName);
gameProfile.getProperties().put("textures", new WrappedGameProfile.Property(
"textures",
"eyJ0aW1lc3RhbXAiOjE1MTMyMDI4NjkwMjIsInByb2ZpbGVJZCI6ImJmOGU0ZDFlZDU1YzRjMGE4YzYwZDhmZTg2ODlhZmM1IiwicHJvZmlsZU5hbWUiOiJBbGV4Iiwic2lnbmF0dXJlUGF0aCI6IjE0NjI4YTJjNDkzOTY2ZmJhYmU0ZThkY2JhOTU0ZDU3IiwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vMTIzNDU2Nzg5MDEyMzQ1Njc4OS5yZWZlcnJlc2guY29tL3V0aWxpdHkvdGV4dHVyZXMvZTM0MDkwMzY3ZTIyM2MxNjFjYmRjNDdjYWI2MTM0OTFkY2Q5Zjc5Mjk2MzFmMjk2ZjE3NzllZmJiOTRkODNjMyJ9fX0=",
"LdxfyGxK/x4FfFkoH3BcsurGsbI0nX3EBLOByZcT0nkgW3InJttwUJBoQelY0hyCj8AbhhTPZ5AdLlJ/K2FqEsA04wB9nggKmraN/J7wyi5wMg9J1Nj7TnF6BK+g7w2+2G1/3iavzkT2oDPQPN2cJPXVi6XJ7XnbPqxqR0jVd5eXnKlgJ0v/3zkWamXU99KdXZP66B37qQQ5eH0w/tvmyxdAb9wEgfFppldSHtUD/MTffO7rKUMVnQgXZGeBClN6izcBb+xkoo8zC5jN3m6g/YQyObuH+7b0Dw8umMrHbckYmXWx01+0hC9iNwz/wFZ3HJFgLH1rVh8sWxOMzgOaXjLgdWhnIW6xLhkvOcUAKyhuDyUqzeH/QbZJh8noLkLqz7gPip7YRzB3UEixtv20fWqZ5Q7OlT33FLd9oCK8Cx2op7rWsYp/bhYXfCZLMCHyffsOadYTVhcyLJyL+D0eUuU9h1LJW3bLs4OnLQrPGkmTF9U0QxkIfFhDItjjrXeQWYP5Wgl0eJeK8hK0pAj8lUSojdZGLnnJ+5MdIQi+grIKO79n3ZDtbdt8uU2/3RO+7lPbCWhPShRuzVBhT3W8aD3ec5DFk8DQ4InnM8xGcxr6vWxvHnA5whUPXrjNTsxvKuLxZ6X5Pi9ITs1M+3iBmVY="
));
get errorProperty! Cannot resolve symbol 'Property'
lowercase p
WrappedGameProfile.property get error
actually does it even need the WrappedGameProfile?
I thought it just took two strings
its difficult
idk if skript is open source but thats probably close to what you want
wdym by with a command
well thats easy
just make a custom command
Does someone here got some time to investigate my StackOverflowError? It is happening since these commits, while calling InventoryOpenEvent: https://github.com/EternalCodeTeam/ParcelLockers/compare/2708eef33381...a452622764e2#diff-c27e476fd91b78b98afcdf420453fb2be4b444a5227dc1be60aa7d23dc3d64d5R38
Ur probably opening an inventory in InventoryOpenEvent which opens an Inventory in InventoryOpenEvent and so on thus stack overflow nd shit
make config value a boolean and check if else 🙂
Makes sense
[22:12:31] [Server thread/INFO]: xX_Laya_Xx issued server command: /skt
[22:12:31] [Server thread/ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'skt' in plugin HypixelSkillCore v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:790) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.util.thread.IAsyncTaskHandler.executeAll(SourceFile:110) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1124) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3284a-Spigot-3892929-0ab8487]
at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because the return value of "java.util.TreeMap.floorKey(Object)" is null
at com.amirparsa.hypixelskillcore.Utils.RomanNumber.toRoman(RomanNumber.java:31) ~[?:?]
at com.amirparsa.hypixelskillcore.Commands.SkillsTextCommand.onCommand(SkillsTextCommand.java:21) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:3284a-Spigot-3892929-0ab8487]
... 19 more
[22:13:11] [Server thread/WARN]: Can't keep up! Is the server overloaded? Running 5172ms or 103 ticks behind
any pieces of code that is needed to fix this will be provided
Yea, a null check.
it worked before i made my skill classes extend an abstract class Skill
?whereami
tf

retrooper confirmed propaganda spreader
I am using Spigot API actually, the testing environment is just paper
but Y2K_ helped me already with this issue
but can someone please take a look at this?
Provide SkillsTextCommand code
it is disgustin but ok
public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
if(!(sender instanceof Player)) return true;
HypixelPlayer playerAccount = HypixelSkillCore.getInstance().getPlayer(((Player) sender).getUniqueId());
sender.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "Farming " + ChatColor.AQUA + RomanNumber.toRoman(playerAccount.getFarming().getLevel()) + ChatColor.DARK_GRAY + " " + playerAccount.getFarming().getXp() + "/" + (playerAccount.getFarming().getStarterXp() * playerAccount.getFarming().getLevel()));
sender.sendMessage(ChatColor.GRAY + "" + ChatColor.BOLD + "Mining " + ChatColor.AQUA + RomanNumber.toRoman(playerAccount.getMining().getLevel()) + ChatColor.DARK_GRAY + " " + playerAccount.getMining().getXp() + "/" + (playerAccount.getMining().getStarterXp() * playerAccount.getMining().getLevel()));
sender.sendMessage(ChatColor.DARK_RED + "" + ChatColor.BOLD + "Woodcutting " + ChatColor.AQUA + RomanNumber.toRoman(playerAccount.getWoodcutting().getLevel()) + ChatColor.DARK_GRAY + " " + playerAccount.getWoodcutting().getXp() + "/" + (playerAccount.getWoodcutting().getStarterXp() * playerAccount.getWoodcutting().getLevel()));
sender.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Combat " + ChatColor.AQUA + RomanNumber.toRoman(playerAccount.getCombat().getLevel()) + ChatColor.DARK_GRAY + " " + playerAccount.getCombat().getXp() + "/" + (playerAccount.getCombat().getStarterXp() * playerAccount.getCombat().getLevel()));
//sender.sendMessage(ChatColor.BLUE + "" + ChatColor.BOLD + "Fishing " + ChatColor.AQUA + RomanNumber.toRoman(playerAccount.getFishing().getLevel()) + ChatColor.DARK_GRAY + " " + playerAccount.getFishing().getXp() + "/" + (playerAccount.getFishing().getStarterXp() * playerAccount.getFishing().getLevel()));
return true;
}
Can you show the RomanNumber#toRoman stuff?
/*
Copied from Stackoverflow
*/
public class RomanNumber {
private final static TreeMap<Integer, String> map = new TreeMap<Integer, String>();
static {
map.put(1000, "M");
map.put(900, "CM");
map.put(500, "D");
map.put(400, "CD");
map.put(100, "C");
map.put(90, "XC");
map.put(50, "L");
map.put(40, "XL");
map.put(10, "X");
map.put(9, "IX");
map.put(5, "V");
map.put(4, "IV");
map.put(1, "I");
}
public static String toRoman(int number) {
int l = map.floorKey(number);
if ( number == l ) {
return map.get(number);
}
return map.get(l) + toRoman(number-l);
}
}
general-2 first visitor in last 2 years
why
what's this
show your project structure and full error log
yo gamers, is there an event for "on player swap hand out of inventory"
it converts a number to roman numbers eg: 2001 -> MMI
big brain
this is the real problem
its copy and pasted from stackoverflow
yes
/*
Copied from Stackoverflow
*/
yes thats why i said it
it's possible that you are passing 0 to the floorKey method
recursion guy
cuz floorKey