#help-development
1 messages · Page 2007 of 1
It's just invisible 🙄
no way
try in survival mode
not needed
ItemStack foundItem = Items.getItem(item);
System.out.println(">> BEFORE");
System.out.println(Arrays.toString(p.getInventory().getContents()));
p.getInventory().addItem(foundItem);
System.out.println(">> AFTER");
System.out.println(Arrays.toString(p.getInventory().getContents()));
tf is the isue then?
have you tried it in survival mode instead of creative?
the creative inventory is weird
That shouldn't matter tho
sometimes it does though :/
When I click on a villager, the trade gui doesn't show up as designed but I don't get the player name nor do I get the gui pop up on my screen. If you happen to know why I might not be getting the player information I would appreciate it!
@EventHandler
public void OpenGUi(TradeSelectEvent event) {
Player plr = (Player) event.getWhoClicked();
System.out.println(plr.getName());
event.setCancelled(true);
openNewGUI(plr);
}
Let's settle one thing first
creative inventory is really weird sometimes in enwer versions
What weird version is this
I've yet to encounter issues with addItem
In this case it should make no difference
@lost matrix
10.03 21:30:54 [Server] Server thread/INFO >> BEFORE
10.03 21:30:54 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
10.03 21:30:54 [Server] Server thread/INFO >> AFTER
10.03 21:30:54 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
All null
Hm, I've never had an issue with creative but it's worth a shot ig
Btw, my version is 1.18.1
can't hurt to go to survival for one second
OH, and I also tested in survival
can u post your item class?
ok
And no workie
Well
i made the command, registered it to the main and plugin yml but not working
At least it isn't SuperDuperSpigot 1.8
*items
?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.
package me.emerald.emeraldsplugin;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.*;
public class Items {
public static ItemStack getItem(String item){
HashMap<String, ItemStack> itemList = new HashMap<>();
itemList.put("BasicKey", BasicKey());
if(itemList.get(item) != null){
return itemList.get(item);
}else{
return null;
}
}
private static ItemStack BasicKey(){
ItemStack item = new ItemStack(Material.TRIPWIRE, 1);
ItemMeta iMeta = item.getItemMeta();
iMeta.setDisplayName(ChatColor.GREEN + "Basic Key");
iMeta.addEnchant(Enchantment.DURABILITY, 1, true);
ArrayList<String> iLore = new ArrayList<>();
iLore.add(ChatColor.GOLD + "A key! can open a basic crate.");
iMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
iMeta.setLore(iLore);
item.setItemMeta(iMeta);
return item;
}
}
command is not working
?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.
Try this pls
ItemStack foundItem = Items.getItem(item);
System.out.println(">> BEFORE");
System.out.println(Arrays.toString(player.getInventory().getContents()));
System.out.println("Adding: " + foundItem);
System.out.println("Returns: " + p.getInventory().addItem(foundItem));
System.out.println(">> AFTER");
System.out.println(Arrays.toString(player.getInventory().getContents()));
in game im trying to execute it but there is no command
do you have permission to your command? did you get any error in the log?
Yes I do
No error
I was talking to @kindred valley
i have, but it says "user issued server command"
What command are you typing?
@lost matrix
>> BEFORE
10.03 21:33:43 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
10.03 21:33:43 [Server] Server thread/INFO >> AFTER
10.03 21:33:43 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
public static ItemStack getItem(String item){
if(item.equals("BasicKey")){
return BasicKey();
}else{
return null;
}
}
It might just be that your null check is messing with things
this does essentially the same with less extra steps
There are messages missing
Its not cause Its returning properly.
10.03 21:33:43 [Server] Server thread/INFO AnEmerald issued server command: /specialgive BasicKey
10.03 21:33:43 [Server] Server thread/INFO >> BEFORE
10.03 21:33:43 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
10.03 21:33:43 [Server] Server thread/INFO >> AFTER
10.03 21:33:43 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
Please use the code ive sent you
DriverManager.getConnection("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.database,
this.username, this.password));
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "MYSQL CONNECTED");
String query = "SELECT * FROM testkeys";
Statement st = getConnection().createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next())
{
String key = rs.getString("keeeeyysss");
if(key == getConfig().getString("klucz")) {
System.out.print("Zgadza sie!");
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}``` **Why I have no answer, my String is correct and in table**
10.03 21:35:21 [Server] Server thread/INFO AnEmerald issued server command: /specialgive BasicKey
10.03 21:35:21 [Server] Server thread/INFO >> BEFORE
10.03 21:35:21 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
10.03 21:35:21 [Server] Server thread/INFO Adding: ItemStack{TRIPWIRE x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"green","text":"Basic Key"}],"text":""}, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gold","text":"A key! can open a basic crate."}],"text":""}], enchants={DURABILITY=1}, ItemFlags=[HIDE_ENCHANTS]}}
10.03 21:35:21 [Server] Server thread/INFO Returns: {}
10.03 21:35:21 [Server] Server thread/INFO >> AFTER
10.03 21:35:21 [Server] Server thread/INFO [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]
``` @lost matrix
Wait... TRIPWIRE.
The fk
?
Why did i only read it now
thats a block
when I do /heal it says internal server error but I said when the args is 0 it will do something else```
String playerName = String.valueOf(args[0]);
Player target = Bukkit.getPlayer(playerName);
if(Bukkit.getPlayer(playerName) == null){
sender.sendMessage(ChatColor.RED+"Player is not online.");
} else if(Bukkit.getOnlinePlayers().contains(target)){
target.setHealth(20);
sender.sendMessage(ChatColor.YELLOW+target.getName()+ChatColor.AQUA+" has successfully been healed!");
} else {
sender.sendMessage(ChatColor.RED+"Player is not online.");
}
if(playerName.length() == 0){
Player player = (Player) sender;
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(aDouble);
sender.sendMessage("You have successfully been healed!");
return true;
}```
STRING
mhm
bc valueOf still causes a NPE if args[] is empty
Im so sorry lol
do args.length() == 0
instead of playerName.length?
@lost matrix It gives it now
LMAO
Thank you guys so much
Sorry for the waste of time
oh lol
I feel like some kind of exception should be thrown there
^^^
considering im unsure what your issue is
i cant say forsure
I could show u in a screenshare
it's trying to get a non existing value from a Enum, which is null but not a exception
Whats sad is the fact that I completely missed that
just dm me a screenshot
Maybe make ItemStack throw an IAE if the material is not isItem
Or maybe have addItem throw it instead
idk
alr
It's not non existent, TIPEWIRE is a valid material enum entry
When I click on a villager, the trade gui doesn't show up as designed but I don't get the player name nor do I get the gui pop up on my screen. If you happen to know why I might not be getting the player information I would appreciate it!
@EventHandler
public void OpenGUi(TradeSelectEvent event) {
Player plr = (Player) event.getWhoClicked();
System.out.println(plr.getName());
event.setCancelled(true);
openNewGUI(plr);
}
Question: How do I make it so that the tripwire cant be placed?
Do I just make it so that CanBePlacedOn is none
theres a block place event iir
Kay Kay
???
Also, how do I make so that if a player were to name an item the same, it still wouldnt work as that named item?
ping
And its actually a really important event...
Is there like a NBT tag system I can use
itemmeta
I mean it feels rude to just replace their PR
But the changes were requested 6 months ago and they haven't been active on the stash since 2018 it seems
so...
lore
you can color lore?
yup
And you can remove the italics
You can color any text
255^3 available colors
it's not gin if it only has 10 vol%
ooh how
Watered down swill
(Bungee chatcolor, not the bukkit one)
it's more like piss
k thx
so like this??
NamespacedKey key = new NamespacedKey(EmeraldsPlugin.jp,"crateKey");
iMeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, "basicCrate");
I could add brewing to my plugin, since I plan to add grapes, that could be fun
which plugin?
But making a reasonable drunk effect in mc is hard
Looks good to me
@tender shard
looks like it adds some kind of temperature system into the game right?
Make them blind if too much Ethanol/Ethyl/Propanol alcohol is present XD
something MUST happen when you run your comand
- you get an error
- it says comand not found
- you get a message printing out your comand's help or the command name
2
That's a part of it, yes
then you must have gotten an error while registering it
nausea+poison+wither+blindess+idk
I know a plugin for alcohol that took control of your movement
Which was the most obnoxious thing ever
ethanol is the good one
getCommand("healme").setExecutor(new healme());
show your plugin.yml
and don't call your executor "healme"
lol
Your PlayerTickRunnable needs some good old even workload distribution
callit HealMeCommand or similar
name: DiePlugin
version: '1.0'
commands:
healme:
description: healme
usage: /<command>```
if only you could do something like invert the players controls ;d
aint lore pink
You probably could
by default, yes
that should work. do you get any console errors? during startup?
ur aware that this is a 'fix it' server and not a code design class
Alcohol may make you a bit wibbly wobbly
But it does not make you get stuck to a wall
I'd just tell the player to get drunk in RL lol
well
Genius
stonks
have you seen the video of david hasselhoff trying to eat a burger?
that would be really effective
There's a video of me trying to play a harmonica
?
It went well
lol
oh there's too many from me in that situation too lol
getMeta?
Eh... MetaData is not persistent. So a restart will vanish everything.
Metadata and pdc are not the same
getData*
do items have PDC?
Yes
wait
Items, Entities, TileEntites, Chunks, and Worlds
how tf do chests store their items
NBT
ah
Chests are tile entities
hm let's imagine I create a scheduled task in my discord bot - should I just do java while(true) sleep to keep the program alive?
blocks dont have any PDC which can be annoying at times
TileState blocks have PDCs
Blocks themselves don't have PDC, but some weird German guy has a wrapper for that
that'll never stop sleeping
how do i increase a value everytime the code is ran?
value++;
or value += n; if you want a number other than 1
value -= -1;
NO
💀
i dont, i will try to rewrite pluginyml because sometimes intellij gets dummy
value *= (n=1)
Figured it out
TileState state = (TileState) block.getState();
PersistentDataContainer cont = state.getPersistentDataContainer();
value += queryVeryImportantNumberDatabase(1)
++value - 1
yes did it by resetupping pluginyml.
x -= ++x - --x;
value=n+1
wasnt meant to be reply
value+1-1+1-1+1-1+1-1
int next = x + 1;
while (x != next) {
x = ThreadLocalRandom.current().nextInt();
}
that would be a random number, not value+1?
Yes it would result in x exactly being x + 1 after that
oo
?paste
wow, thanks il use this in my next project to do mathfs
https://paste.md-5.net/emohisavah.java I have this. I want console to execute a command "/heal", but the consol is not executing it. What can be the cause?
i hate that
jeez
probably add a space between heal and the player name
yes just thought
The random one is literally my favourite. I always crack up when i see it.
I like the PI one
Oh god yes. Reminds me that i havent visited /r programmerhumor for a while...
still not working
error?
-?
jda question: anyone know how to get a MessageChannel regardless of whether it's a news channel, text channel, or any other similar channel type?
private MessageChannel getChannel() {
TextChannel textChannel = jda.getTextChannelById(channelId);
if(textChannel != null) return textChannel;
NewsChannel newsChannel = jda.getNewsChannelById(channelId);
if(newsChannel != null) return newsChannel;
return null;
}
unless you have multiple commands on the same executor
doesnt seem to work tho
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.block.CraftBlockState cannot be cast to class org.bukkit.block.TileState (org.bukkit.craftbukkit.v1_18_R1.block.CraftBlockState and org.bukkit.block.TileState are in unnamed module of loader java.net.URLClassLoader @2e5d6d97)
help?
What block is it
the block in question is probably not a tileentity
^
Its a Tripwire
That is not a tile entity
public void run(){
degree %= 360;
Player player = Bukkit.getPlayer(playerID);
if (player == null) {
this.cancel();
return;
}
double radians = Math.toRadians(degree);
double x = Math.cos(radians) * radius;
double y = Math.sin(radians * waves) * height;
double z = Math.sin(radians) * radius;
Location particleLoc = player.getLocation().add(x, y, z);
player.getWorld().spawnParticle(Particle.END_ROD, particleLoc, 0);
particleLoc.subtract(x, y, z);
degree += 5;
}
should draw wave circle thing
It's a normal block that cannot hold PDC
How would I get a PersistantDataContainer from a block then?
tile entities are blocks like a furnace, dispenser
I got a lib for that
How does it work?
wait this is urs?
like this but over time
add that lib, then you can new CustomBlockData(...) to get a PDC for a specific block location
yes
i use this too haha
Holy
ty
np
thanks for making that. really usefull
no, oraxen should pay me 1% of their sales for using it lol
then you can get 1% of those 1%
I had the idea for that in a dream
lol
Weird dream
I dream about coding way too often
yea, you code in your dreams?
sometimes
How do I access the player that clicked on a merchant to trade? No matter what I do I can't get the player who clicked
Imma try that
whats even the dif between PlayerInteractAtEntityEvent & PlayerInteractEntityEvent
you can get the InventoryView's viewer
IIRC only one person can have the trading window open
anything on this?
THANK YOU SO MUCH
This took way too long to figure out smh, I have used PlayerInteravtEntityEvent before also
This is embarrassing
are you not using maven or gradle?
gradle
learnjava comming
well then just add my repository and the dependency name to your build.gradle file
?learnjava
like you did with spigot-api
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.
but use maven
maven 🛐
maven 💯
I didnt do that cause IntelJ has a plugin for minecraft
So it was a fast setyp
:/
maven=log4j issue
I don't know the gradle syntax but you basically have to check your build.gradle file, see how it added spigot, then do the same with my repository and the CustoBlockData dependency
I have no idea how it works in gradle
doesnt jitpack shows how to put it?
plugins {
id 'java'
}
group = 'me.emerald'
version = '1.0.0'
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
Yea idk how it does it
I don't use jitpack
this is my build.gradle file
when I do /heal without args it gives internal error but I made it so if the args isnt 0 it would do something else
String playerName = String.valueOf(args[0]);
if(playerName.length() != 0){
Player target = Bukkit.getPlayer(args[0]);
if(Bukkit.getPlayer(playerName) == null){
sender.sendMessage(ChatColor.RED+"Player is not online.");
} else if(Bukkit.getOnlinePlayers().contains(playerName)){
target.setFoodLevel(20);
target.setSaturation(20);
sender.sendMessage(ChatColor.YELLOW+target.getName()+" has successfully been fed!");
} else {
sender.sendMessage(ChatColor.RED+"Player is not online.");
}
} else if(sender instanceof Player){
Player player = (Player) sender;
player.setFoodLevel(20);
player.setSaturation(20);
sender.sendMessage("You have successfully been fed!");
return true;
} else{
sender.sendMessage("You can't heal the console!");
}
implementation 'com.jeff_media:CustomBlockData:1.0.5@jar'
and add y repo siilar to how you did with the spigotc-repo
just paste that in there?
or
in dependancys
it belongs into dependencnes { ...
one sec
maven {
name = 'jeff-media-public'
url = 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/'
}
anyone wanna help me
the @jar part is probably not needed
you access args[0] before checking whether it's set
obviously you FIRST have to check if the length is > 0 BEFORE accessing anything from the array
wait @tender shard so if i appied it to an item, like a holding item
how would I retrieve it from the placed block?
how can I do that
dno't use args[0] before checking if args.length != 0
you have to manually add your data to the block
like in blockplace, get the data of the item and put it into the block
Is this the extent nms is deobfuscated or did I import the wrong jar or smth?
oh k
so I put String playerName = String.valueOf(args[0]); within the if statement?
that's the obfuscated code obviously 😛
yes, basically
Yeah I'm not an expert in obfuscation I only know how to use java 👀
Obfuscation is Java
in fact I'm clueless in obfuscation lfmao
Lmao
I have a tutorial on how to use mojang mappings if you're using maven: https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
I link that to people all the time lol
It was funny, someone asked how to do it so I googled it
it's # 2 on gnoogle lol
And then the other day I was like “oh that’s his”
but then playerName doesnt have a definition and the if statement won't know what playerName is
alex is just clutch
yeah of course, that's how coding works
if you don't define it, it's not defined
how should java know what the playername is supposed to be?
The problem with this is I lose classes like IChatBaseComponent, do I just import both the deobfuscated and the obfuscated jar?
no, never do that
those classes are still there
they just have different names
you will have to rename everything once, then you're set for future versions without major problems though
you can basically use the exact same code for all future versions
well then how is it gonna know what playerName's length is before knowing what playerName is
?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.
you don't
if noone enters a playername, you have no playername
@pliant oyster
you should make it check for no arguments first, and if so, then operate on sender first
Ah I see, I was just confused because some parameters just turn into type of Component and I was completely clueless
The names of the classes change to what they’re actually called before they get obfuscated
hello, i can't verify because discord change _
yeah many things have now different names, e.g. EntityPlayer is ServerPlayer
anyone know how to fix this?
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.woolmc.lifestealcore.LifeStealCore.getCommand(String)" is null
this.getCommand("heartset").setExecutor(new HeartSetCommand());```
the command thats causing issues
and heres the commands class
you didn't define "heartset" in your plugin.yml
it is defined
Is there any documentation out there that would help me figure out which class is which?
hadoken
not really, since NMS is not part of spigot
you can just look through the packages to find your stuff
how to use event in another event
most of the time, the mojang names are pretty obvious
what do you mean?
Alrighty, thanks!
if you're looking for a specific class, let me know, maybe I remember it
wdym
i have PlayerDeathEvent, i want to block the jumping when player dies. I need to use move event but i cant use it in another event
why do you want to block jumping when the player dies?
street fighter
You need to save the player into a collection or put a flag on the player or something similar so that you can identify them in future events
You can’t reference the PlayerDeathEvent from later movement
well one could just store every player's last death event, but what do you even mean with "the jumping when player dies"?
They have this custom setup going on where players don’t actually die
oooh
you could cancel the death event and store a variable in a map then when the player tries to move but they are marked as dead then cancel the movement
oh right
They need to store the player or flag the player somehow though yes
I don’t think they’re quite experienced enough with Java to figure out how though
Which is going to continue to be a problem
i wouldnt recommend using hashmaps for a lot of stuff
but you might be able to get away with it here
well... Player<>Event
or UUID<>Event
or are we talking about something else meanwhile?
HashSet<Player> p = new HashSet<>();like this?
They don’t need the actual event
ah ok
They just wanted to be able to get the player from the event in their next event
Which is an xy problem
Pretty much
weird fact: ArrayList.contains is faster than HashSet.contains
I always thought a set would be faster
wut
wait now I just also read that Set.contains is faster
which is what I also always said
someone sent a link some weeks ago that said the opposite
Depends on the complexity of .equals and .hashCode
in runTaskTimer(), the longs are ticks right?
But in most cases ArrayLists are a tiny bit faster at the beginning
yes
im still confused as to why it says its returning null
Fox maximum speed just have hashCode always return 1
it's not like it'd ever matter when just storing a few players or UUIDs, thank god lol
Forgot to add it to your plugin.yml
That doesn't looked indented right
exactly
yea
it must be
commands:
heartset:
@brave sparrow
Actually. I want to jmh ArrayList<UUID>/ArrayList<String> vs HashSet<UUID>/HashSet<String> now and see when they diverge
?learnjava @kindred valley
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.
?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.
a Player is not a HashSet
Lol
Why not
Mismatched types
because md5 wasn't durnk when he made the API
Dont generalize it like that. Maybe they forked spigot and made Player extend Set

all of the things here should be correct
You're trying to set a type of HashSet to an object that it a type of Player
all the other commands work
How do I get the item that was used to place a block ,in BlockPlaceEvent
getItemInHand()
ty
😂
well of course O(n) is possible, but generally any HashMap will presuppose the general hashCode and equals contract thus O(n) really never occurs altho its practically a case
ArrayList#contains is O(n), HashSet#contains is amortized O(1)
But for a small enough n that amortized O(1) may still be slower
So technically
yeah, time complexity does not denote actual time it takes so ye
That’s why for example when sorting large amounts of data with a radix sort the smallest divisions of the data should be sorted with insertion sort because for small amounts of data it’s faster
but yeah setting the initial capacity of HashMap might change the time it takes for a small group of elements
Yes, potentially
Man now I gotta redo my material sets :p
I mean it probably doesn’t matter, but still
Yes
But
MD said you should avoid them
But also said they shouldn’t break after the change
So idk
Is he planning to make Materials not an enum?
yes
Yes
Ew
been a plan for long time
why is PlayerChatEvent deprecated?
AsyncPlayerChatEvent
AsyncPlayerChatEvebt
check the docs
hehe can still run sync
it's literally a huge banner in the docs
You can run sync
hashmap? i cant store per player variables
wow SnakeYaml is really picky
What’s the advantage to doing that
They are becoming extendable?
Biome already is
Enums are not designed for that
In fact you can’t get the namespaced key of a custom biome without NMS
Very sad
No
I mean the best part is that the change reflects mojangs code more accurately
so i cant do runTaskTimer(this, 3L, 3.5L)
is there another way to have 3.5 ticks cd?
?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.
Registries are the future
Just like
Uhh
NFTs
lol ye
There’s custom biomes now?
It seems unlikely that materials will go the same route though no?
is making custom world generation hard?
im not going to make it, just wanted to know
Is that confirmed or just hypothesis
Making world generation isn't super hard.
Making good world gen on the other hand...
then rip
barely make 1+1 :p
Hypothesis
Because they are designed for that?
Gotcha
Well I guess I’ll watch the 1.19 PRs to see if there’s any custom materials lol
Easier, yes
^
it is not more efficient
It’s not even comparably efficient
Databases are good at storing large amounts of data in compact form
does anyone know spiget's rate limits? I haven't found anything on their website
plus if something happened and the server got deleted or corrupted
And support fancy queries
is there a way to make a runnable run for x ticks then wait another ticks to run again?
except for runTaskTimer, isnt too cool for what im doing rn
bruh
Maintenance?
my guy you literally used price
I just don’t think you understand the scale of data we use databases for
JSON files would not work
json is highly impractical for large data amounts
But no one wants to store all of hypixels data in json
Even though they kinda sorta do that
hehe parties
this. might not seem like a lot but all this data can add up after a while. you dont want all that on one json file plus its going to take forever just to search and load that file
true
why the heck does IntelliJ's console show INFO log entries in red? o0 that's... confusing at best
my other admin strongly advised i dont use json for data reasons
Because InteliJ sucks
cause its intellij
intellij good
my guess is that intellij is interpreting the text being sent to console as red
yall use ides?
I use lotus notes
i use paper, fear me
i use notepad
I use a really small tool to flip the switches on a hard drive manually
uh
I use parchment and inked feather
Anyone know how to overwrite vanilla structures?
I wonder how long it would take to make a hello world program this way
Datapack
Well, for some
For others you’d have to basically replace the world generator
Actually in 1.18.2 you could just disable them and add your own with the new datapack features
is there a better way to draw things with particles than using this 55344 chars long code https://paste.md-5.net/ixaqajuxar.java
you technically can set the bits manually, just will take you forever to do this physically is all XD
oh my god
it couldve be bigger if i didnt do degree+=5
When i do it with datapacks or i overwrite the generator have i do create a algorithm for placement to (when and where they got placed)
you can physically inspect a rom for their data
thats a giant staircase
by looking at the bits that are set 🙂
No, datapacks can handle the placement stuff for you
haha, like the rest of your life
Are you asking this facetiously?
That code belongs in a museum
Thanks, btw only structures or trees too xd?
Structures
wdym
You can do semi custom trees with datapacks
But you don’t have full freedom
Take a took at terralith and incendium
'-'
They do some great stuff with just datapacks
Thanks :)!
is there a way or no?
Yes
hm anyone knows how I can attach a custom formatter to java.util.logging.Logger?
How do i detect if I right click an object?
It’s called math and loops
I forgot how to do that and don't find anything
What
idk if there is one
No that is not an event
PlayerInteractEvent
PlayerInteractEvent
i have been making slimefun addons for too long
Fuck you Alex
better answer my logger question
No die
there is PlayerRightClickEvent
Oh god slimefun
wha
Coll did you ever see that video of that nested runnable in SlimeFun?
No
only cargo's code that used to took 40% of tick
funny slime
fun
funk
I can’t find it
I mean I would actually love to work on a project like that
But oh god would it be a big project
for loops made the shape instantly
whiles too
wat?
?scheduling
no learnjava
Essentially using a repeating task as a delayed for loop
?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.
Heh
by this i meant
for(int degree=0;degree<360;degree+=5){
particle
}
that made the shape instantly
my Tower of Babel's staircase is cool ngl
PlayerInteractEvent
Even on a grass block?
Even on a grass block
Pogger
even on probably anything
There is another event for entities
ye
Nah right clicking a block with no item can be detected
entities like your mother
WebKit please just let me watch a WebM
Just not air
So this would work?
event.getAction().equals(Action.RIGHT_CLICK_BLOCK)
For a detection?
true
Because the client doesn’t send a packet for right clicking air with no item
Which is fair, I mean why would it
on enable
for(int counter=0; counter<360; counter++) {
if (counter <= 100) {
new CustomArmorTask().runTaskTimer(this, 2L, 1L);
}else{
continue;
}
}
armor thing is the stair
mhm yea nvm that just crashed the server
@ivory sleet Was curious. So those are the results for up to 250 elements. Which is not surprising.
But even if the collections had <5 elements the hashset outperformed the arraylist
Yes jmh
Interesting
With the exception of literally only one single element in the arraylist and also only if it hits
I should add: For UUIDs
CraftServer 🙂
i wanted to see what would be the size if i did degree++
https://paste.md-5.net/yoyineteti.java
so big that pastebin had to split it
Oo that’s interesting
Did you set initial capacity for both?
How would the initial capacity have an impact on contains?
Hm?
The number of buckets controls the number of LinkedLists with hash collisions
So if you had a really fast hashCode method and the right capacity to minimize collisions, you’d have a very fast contains
I see... But when this gets relevant the arraylist is long over the moon
Actually. I would like to see how the length of a String affects the performance of contains
brb
See, another great idea from me
Genius..
Any predictions?
I predict its indeed gonna affect performance
Myeah pretty much
Did you can send links for source this benchmarks?
Benchmark (elementCount) (stringLength) Mode Cnt Score Error Units
StringContains.arrayListContainsHit 10 1 avgt 4 15,469 ± 0,648 ns/op
StringContains.arrayListContainsHit 10 2 avgt 4 15,473 ± 0,750 ns/op
StringContains.arrayListContainsHit 10 3 avgt 4 17,110 ± 3,105 ns/op
StringContains.arrayListContainsHit 10 4 avgt 4 16,662 ± 1,236 ns/op
StringContains.arrayListContainsHit 10 5 avgt 4 16,893 ± 0,373 ns/op
StringContains.arrayListContainsHit 10 10 avgt 4 16,509 ± 1,320 ns/op
StringContains.arrayListContainsHit 10 20 avgt 4 16,581 ± 1,523 ns/op
StringContains.arrayListContainsHit 10 30 avgt 4 16,257 ± 0,449 ns/op
StringContains.arrayListContainsHit 10 40 avgt 4 16,632 ± 0,066 ns/op
StringContains.arrayListContainsHit 10 50 avgt 4 16,668 ± 0,384 ns/op
StringContains.arrayListContainsMiss 10 1 avgt 4 30,813 ± 0,451 ns/op
StringContains.arrayListContainsMiss 10 2 avgt 4 30,712 ± 0,761 ns/op
StringContains.arrayListContainsMiss 10 3 avgt 4 38,276 ± 0,282 ns/op
StringContains.arrayListContainsMiss 10 4 avgt 4 31,320 ± 0,650 ns/op
StringContains.arrayListContainsMiss 10 5 avgt 4 31,575 ± 0,302 ns/op
StringContains.arrayListContainsMiss 10 10 avgt 4 31,524 ± 0,513 ns/op
StringContains.arrayListContainsMiss 10 20 avgt 4 31,652 ± 0,526 ns/op
StringContains.arrayListContainsMiss 10 30 avgt 4 30,462 ± 0,123 ns/op
StringContains.arrayListContainsMiss 10 40 avgt 4 33,719 ± 0,426 ns/op
StringContains.arrayListContainsMiss 10 50 avgt 4 33,437 ± 0,614 ns/op
Not as big of a difference as i thought.
Benchmark (elementCount) (stringLength) Mode Cnt Score Error Units
StringContains.hashSetContainsHit 10 1 avgt 4 1,997 ± 0,008 ns/op
StringContains.hashSetContainsHit 10 2 avgt 4 2,845 ± 0,005 ns/op
StringContains.hashSetContainsHit 10 3 avgt 4 3,522 ± 0,107 ns/op
StringContains.hashSetContainsHit 10 4 avgt 4 2,022 ± 0,034 ns/op
StringContains.hashSetContainsHit 10 5 avgt 4 2,873 ± 0,158 ns/op
StringContains.hashSetContainsHit 10 10 avgt 4 2,874 ± 0,203 ns/op
StringContains.hashSetContainsHit 10 20 avgt 4 3,557 ± 0,070 ns/op
StringContains.hashSetContainsHit 10 30 avgt 4 2,854 ± 0,067 ns/op
StringContains.hashSetContainsHit 10 40 avgt 4 2,845 ± 0,006 ns/op
StringContains.hashSetContainsHit 10 50 avgt 4 3,502 ± 0,006 ns/op
StringContains.hashSetContainsMiss 10 1 avgt 4 2,188 ± 0,003 ns/op
StringContains.hashSetContainsMiss 10 2 avgt 4 2,189 ± 0,007 ns/op
StringContains.hashSetContainsMiss 10 3 avgt 4 2,188 ± 0,009 ns/op
StringContains.hashSetContainsMiss 10 4 avgt 4 2,407 ± 0,005 ns/op
StringContains.hashSetContainsMiss 10 5 avgt 4 2,406 ± 0,005 ns/op
StringContains.hashSetContainsMiss 10 10 avgt 4 2,188 ± 0,005 ns/op
StringContains.hashSetContainsMiss 10 20 avgt 4 1,970 ± 0,002 ns/op
StringContains.hashSetContainsMiss 10 30 avgt 4 3,064 ± 0,002 ns/op
StringContains.hashSetContainsMiss 10 40 avgt 4 1,612 ± 0,007 ns/op
StringContains.hashSetContainsMiss 10 50 avgt 4 2,188 ± 0,005 ns/op
And hashsets are more or less constant too
Although there is a weird dip at 40...
Maybe i should regen the Strings per invocation
Meh. I would prefer not to. Also ive overwritten the UUIDContains class already XD
avgt?
Mode.AverageTime
doesnt make sense
avg -> Average
t -> Time
Or does the concept of average time not make sense to you?
Is the dragon immune against velocity?
Vector direction = passenger.getLocation().getDirection();
dragon.setVelocity(direction.multiply(1.5));
Because the dragon just stays put...
Ooof 😅
Its possible to make them go to a certain point though, if you spawn an armorstand and make them target it.
Oh, thanks
Doesn't really seem to be working...
That's unfortunate to hear, I've been thinking of writing a plugin that completely reconstructs the dragon fight
sounds like I'll have to dig deeper into nms than I really wanted to
There is some API for it
Probably not near enough coverage for what I want to do
does the ender dragon even follow traditional pathfinding?
like, do they have pathfinder goals
getOpenInventory
I cant compare that to null
It’s never null afaik
I think it returns the player inventory if they have nothing open
Perfect thanks
Yeah, that's why I didn't even think of going through that rabbit hole 😅
my first public discord bot, let me know what you think about the code and or the idea in general 🙂
https://github.com/JEFF-Media-GbR/DiscordSpigotUpdateBot
still unsolved. the command is listed in plugin.yml too
and yes i have been trying for a long time to get it to work
I believe they have and it looks fine
o
Look at the one inside your jar, make sure it’s the right one
?paste your full latest.log pls
pomf.cat, catbox.moe, share.riseup.net, etc
just a side note this is kind of a confidential plugin
then open your .jar with winrar, and check if the included plugin.yml actually is the one you sent a screenshot of
7zip supremacy
i know
i just would rather it doesnt get leaked cause someone finding an exploit with leaked source code scares me
what line does the error message show
just make sure there are no exploits 😎
Nicely done!
a lot easier said than done
[22:19:04 INFO]: [LifeStealCore] Registering Commands
[22:19:04 ERROR]: Error occurred while enabling LifeStealCore v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.woolmc.lifestealcore.LifeStealCore.getCommand(String)" is null
at com.woolmc.lifestealcore.LifeStealCore.onEnable(LifeStealCore.java:35) ~[LifeStealCore-1.0.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[purpur-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[purpur-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:501) ~[purpur-api-1.18.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugin(CraftServer.java:562) ~[purpur-1.18.1.jar:git-Purpur-1564]
at org.bukkit.craftbukkit.v1_18_R1.CraftServer.enablePlugins(CraftServer.java:476) ~[purpur-1.18.1.jar:git-Purpur-1564]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:741) ~[purpur-1.18.1.jar:git-Purpur-1564]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:508) ~[purpur-1.18.1.jar:git-Purpur-1564]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:349) ~[purpur-1.18.1.jar:git-Purpur-1564]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1227) ~[purpur-1.18.1.jar:git-Purpur-1564]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:322) ~[purpur-1.18.1.jar:git-Purpur-1564]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[22:19:04 INFO]: [LifeStealCore] Disabling LifeStealCore v1.0```
wait did you mean the stacktrace or no
LifeStealCore.java:35
thats this line
this.getCommand("heartset").setExecutor(new HeartSetCommand());```
purpur moment make sure the plugin.yml from the jar in the server matches the one in ur development env
That error indicates the config is busted inn some capacity
This is why you go open source
line 35 is the testdatabase command
Make other people fix your exploits
at least in the .jar you sent to me
in my editor it shows that its heartset
and if i remove the heartset executor it starts fine
I love it when people open PRs to fix issues that you gave up on.
true
Hehe
cant go off of decompiled output for STs tbh
True
public class HeartSetCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(args.length == 0)) {
try {
OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(args[0]);
try {
int hearts = Integer.parseInt(args[1]);
if (hearts >= LifeStealCore.config.getInt("values.maxheartcount")) {
sender.sendMessage("§aSet " + oPlayer + "'s heartcount to " + hearts);
LifeStealCore.data.setHearts(oPlayer.getUniqueId(), hearts * 2);
} else {
sender.sendMessage("§cOver max heartcount");
}
} catch (NumberFormatException e) {
sender.sendMessage("§cMust be a number");
}
} catch (NullPointerException e) {
sender.sendMessage("§cMust be a player");
}
}
return true;
}
}```
heres the code for the command itself
has nothing to do with the command class methinks
hmm
just double check your plugin.yml in the exported jar
odd. the only config value its using is values.maxheartcount
and that is set correctly
the plugin.yml file
plugin.yml is the config in question. If every other command works except this one rewrite the portion of the config for it just in case. Then compile check the compiled jar
hmm
hidden character 🕵️
It makes the messages look very weird
What fixed it
poggers
When in doubt rewrite it out. 50% of the time works every time
the plugin.yml is correct
Have you tried turning it off and on again
Does anyone know what units minecraft uses for potion effect duration?
Ticks
Ok that makes a lot more sense
i thought it would be miliseconds for some reason lmfao
that is odd
now he has access to all ur personal files 😎
when the database is not hard coded
meant the other way around
all that there is in that plugin is just about 500 lines of mistakes
lmfao
same
i just dropped a powdered donut on my desk and now theres sugar powder everywhere
it is
i just overcomplicated the hell out of it
I have no idea what lifesteal is
with databases and unnecessary stuff
im guessing its i hit u i take ur hearts
if you die you loose your heart
if you kill a person you gain one
litterally all it is basically
oh like mario kart balloon battle
Ah the smp stuff
mhm
Yeah it’s a new fad
Kms
on paper its pretty simple
when u actually get to coding this
oh boy was that a bumpy ride
well obviously
storing hearts, making sure it doesnt bug out
detections
etc
yeah
On paper as in a real piece of paper
it gets a bit crazy
for whatever reason minecraft hearts are very wonky
You don’t really even need to store anything
i ran into issue after issue cause of how weirdly broken mcjava hearts are
Minecraft remembers what attributes a player has
technically yes but my admin told me that i should be extra safe and double check stuff with a database
Meh
plus i want to have stats on the website so i kinda needed a database
I guess
what, how did you make a database?
did the website cost you money or
Magic
just wondering as id like to make my own database for my own plugin at 1 point
my host has free mysql databases