#help-archived
1 messages · Page 210 of 1
Dm the author.
Oke 😉
im getting so much errors
fix it
?paste
probably a plugin messing with something like chat
how are enchantment offers calculated?
it better not be mine 😂
https://haste.devcord.xyz/ibanekiroy
Why the skin don't change on method call?
Server version?
Hello, I have a few questions :)
How can I publish a paid resource and how to delete one?
Thanks!
delete a resource by reporting it with something like "delete" in the message
and paid resource you need to meet the requirements and you just ... make it paid lol
Thanks a lot for the info, but to further query, where can I find the requirements
craftPlayer.getHandle().setHealth(0.0 F);
player.spigot().respawn();
we have some serious killer talk here
@livid spruce To notify other players about skin changing, you just need to call hidePlayer and showPlayer
why everyone are using packets for that
you literally just exploited yourself with coordinate leaking
because you broadcast these packets to all the players
ignoring entity tracker
Server version?
@sturdy oar 1.8.8
craftPlayer.getHandle().setHealth(0.0 F); player.spigot().respawn();we have some serious killer talk here
@spring arch So how should I do?
Are you running spigot?
yes
so not Paper?
No
well
That's good because we're on the Spigot Discord
that's bad because Paper has CraftPlayer#refreshPlayer()
refresh?
Yes.
just f5
funny
?
what is sendPacket method?
for (Player all : Bukkit.getOnlinePlayers())
(((CraftPlayer)all).getHandle()).playerConnection.sendPacket(packet);
}```
craftPlayer.getHandle().setHealth(0.0 F);
player.spigot().respawn();
You need to respawn the player after you send ADD_PLAYER
¯_(ツ)_/¯
In the RunTaskLater?
CraftPlayer craftPlayer = (CraftPlayer)player;
GameProfile gp = craftPlayer.getProfile();
try {
gp = GameProfileBuilder.fetch(UUIDFetcher.getUUID(SkinName));
} catch (Exception exception) {}
Collection<Property> props = gp.getProperties().get("textures");
craftPlayer.getProfile().getProperties().removeAll("textures");
craftPlayer.getProfile().getProperties().putAll("textures", props);
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(player.getEntityId());
sendPacket(destroy);
PacketPlayOutPlayerInfo tabInfoRemove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, craftPlayer.getHandle());
sendPacket(tabInfoRemove);
Bukkit.getScheduler().runTaskLater(GrieferGameSystem.getInstance(), () -> {
PacketPlayOutPlayerInfo tabInfoAdd = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, craftPlayer.getHandle());
sendPacket(tabInfoAdd);
PacketPlayOutNamedEntitySpawn spawn = PacketPlayOutNamedEntitySpawn(craftPlayer.getHandle());
craftPlayer.getHandle().setHealth(0.0F);
player.spigot().respawn();
for (Player all : Bukkit.getOnlinePlayers()) {
if (all != player) {
(((CraftPlayer)all).getHandle()).playerConnection.sendPacket(spawn);
all.hidePlayer(player);
}
}
Bukkit.getScheduler().runTaskLater(GrieferGameSystem.getInstance(), () -> {
for (Player all : Bukkit.getOnlinePlayers()) {
if (all != player)
all.showPlayer(player);
}
}, 10L);
},10L);
}```
Still not work...
are you running behind bungeecord?
not on my test server
i can't read this code
i'm talking about quality
Oh...
public void changeSkin(Plugin plugin, Player player, String skinName) {
CraftPlayer craftPlayer = (CraftPlayer)player;
GameProfile gp = craftPlayer.getProfile();
try {
gp = GameProfileBuilder.fetch(UUIDFetcher.getUUID(skinName));
} catch (Exception exception) {}
Collection<Property> props = gp.getProperties().get("textures");
GameProfile profile = craftPlayer.getProfile();
profile.getProperties().removeAll("textures");
profile.getProperties().putAll("textures", props);
for (Player ps : Bukkit.getOnlinePlayers()) {
ps.hidePlayer(plugin, player);
ps.showPlayer(plugin, player);
}
craftPlayer.refreshPlayer();
}
s a d
isnt that paper only as mentioned above
What should I use instead of craftPlayer#refreshPlayer()?
public void changeSkin(Plugin plugin, Player player, String skinName) {
CraftPlayer craftPlayer = (CraftPlayer)player;
GameProfile gp = craftPlayer.getProfile();
try {
gp = GameProfileBuilder.fetch(UUIDFetcher.getUUID(skinName));
} catch (Exception exception) {}
Collection<Property> props = gp.getProperties().get("textures");
GameProfile profile = craftPlayer.getProfile();
profile.getProperties().removeAll("textures");
profile.getProperties().putAll("textures", props);
for (Player ps : Bukkit.getOnlinePlayers()) {
ps.hidePlayer(plugin, player);
ps.showPlayer(plugin, player);
}
EntityPlayer handle = craftPlayer.getHandle();
Location loc = craftPlayer.getLocation();
PlayerConnection connection = handle.playerConnection;
craftPlayer.unregisterPlayer(handle);
craftPlayer.registerPlayer(handle);
connection.sendPacket(new PacketPlayOutRespawn(handle.dimension, handle.world.getDifficulty(), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode()));
handle.updateAbilities();
connection.sendPacket(new PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet(), 0));
MinecraftServer.getServer().getPlayerList().updateClient(handle);
if (craftPlayer.isOp()) {
craftPlayer.setOp(false);
craftPlayer.setOp(true);
}
}
edited
anyone have a func that translates the short uuid from mojang api to a regular one
?
private static final Pattern PATTERN = Pattern.compile("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})");
return UUID.fromString(PATTERN.matcher(uuid).replaceFirst("$1-$2-$3-$4-$5"));
thanks
Why I can't do this? The world can not create and will show error in console. But if I release my code comment, it will
public class EmptyWorldGenerator extends ChunkGenerator {
@Override
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
ChunkData chunkData = createChunkData(world);
for (int x = 0; x < 16; x++) {
for (int Y = 0; Y < 256; Y++) {
for (int z = 0; z < 16; z++) {
biome.setBiome(x, Y, z, Biome.PLAINS);
/*if (Y == 0 && x == 0 && z == 0) {
chunkData.setBlock(x, Y, z, Material.GRASS_BLOCK);
} else {*/
chunkData.setBlock(x, Y, z, Material.AIR);
//}
}
}
}
return chunkData;
}
}```
i don't know how these methods are called on 1.8
public void unregisterPlayer(EntityPlayer other) {
EntityTracker tracker = ((WorldServer)this.entity.world).tracker;
EntityTrackerEntry entry = (EntityTrackerEntry)tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(this.getHandle());
}
if (other.sentListPacket) {
this.getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{other}));
}
}
public void registerPlayer(EntityPlayer other) {
EntityTracker tracker = ((WorldServer)this.entity.world).tracker;
this.getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{other}));
EntityTrackerEntry entry = (EntityTrackerEntry)tracker.trackedEntities.get(other.getId());
if (entry != null && !entry.trackedPlayers.contains(this.getHandle())) {
entry.updatePlayer(this.getHandle());
}
}
you did not tell what's the error
I have next question too after that
But wait, I will copy the error
look at the constructor that exist
@spring arch, here the error https://hatebin.com/urancfhfrl
CraftPlayer craftPlayer = (CraftPlayer)player;
GameProfile gp = craftPlayer.getProfile();
try {
gp = GameProfileBuilder.fetch(UUIDFetcher.getUUID(skinName));
} catch (Exception exception) {}
Collection<Property> props = gp.getProperties().get("textures");
GameProfile profile = craftPlayer.getProfile();
profile.getProperties().removeAll("textures");
profile.getProperties().putAll("textures", props);
for (Player ps : Bukkit.getOnlinePlayers()) {
ps.hidePlayer(player);
ps.showPlayer(player);
}
EntityPlayer handle = craftPlayer.getHandle();
Location loc = craftPlayer.getLocation();
PlayerConnection connection = handle.playerConnection;
connection.sendPacket(new PacketPlayOutRespawn(handle.dimension, handle.world.getDifficulty(), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode()));
handle.updateAbilities();
connection.sendPacket(new PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet()));
MinecraftServer.getServer().getPlayerList().updateClient(handle);
if (craftPlayer.isOp()) {
craftPlayer.setOp(false);
craftPlayer.setOp(true);
}
}``` Still not work ..
Then you are doing something wrong
¯_(ツ)_/¯
GameProfileBuilder?
@lofty meadow is that the full error log
btw you use Paper
Yes
hmm how do i get a player's real uuid from an offline server? Do i have to use mojang api or can it be done through bukkit
hey err what is the event type for when a player takes damage
EntityDamageEvent
You use an outside website API for it
No idea if you can do it with internal Java stuff
damn that sucks
By that, I mean generate a v3 UUID not v4
bungee makes my life so much harder lol
if(event.getEntity()==Player){
why does it not work?
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class player_Damage_Event implements Listener {
@EventHandler
public void onDamageEvent(EntityDamageEvent event){
if(event.getEntity()==Player){
// do stuff
}
}
}
help
HELPPP
?help
https://hasteb.in/juyecapu.java
@livid spruce Dark?
because that's not how Java works, Geekazodium, and we expect a basic understanding of how the language works before writing plugins
How to stop the ender dragon from going through my barrier blocks?
I'm using fork 1.16
@subtle blade I know that, but what data type does event.getEntity() give?
Whats wrong with my skin changer method?
Oke I need some help I am updating my server to 1.16.1 but It wont start the server
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path guessing somethings up with a json file
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
public class player_Damage_Event implements Listener {
@EventHandler
public void onDamageEvent(EntityDamageEvent event){
if (event.getEntity().getType()==Player){//how do I get if the entity was a player?
//stuff
}
}
}
help
pls help
u can compare it to EntityType enum but not Player itself
for that u have to use instanceof
^ if (event.getEntity() instance of Player) { }
Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 pathguessing somethings up with a json file
@crisp zenith Were do I need to put this?
because entity.getType returns EntityType, not Player. u cant run == between two different class types i dont think
plus == compares their memory reference not the objects themselves
.equals() would be better (unless ur comparing enum values then either is fine)
@south shoal you should check your json files for errors before you try adding that line
@south shoal ```But to fix the issue, delete the generator-settings from server.properties
apparently mojang broke that.``` from: https://github.com/PaperMC/Paper/issues/3743
I have done that
hmm
if the json and properties files are okay them im not sure how else to fix. i wouldnt know how to implement the lenient mode but it doesnt sound like a clean solution either
Could SpigotMC FINALLY remove my post
as the website wasn't clear at all that when you put the url to the file, it posts it publicly
other services use that link to download the file to the server
so SpigotMC just leaked my personal IP address without me knowing about it
until a guy commented about it
and why tf doesn't the site allow me to remove my resource?
also, where is the "maximum" file size as my 27mb jar file didn't even fit.
only? that's horrible i guess
how did you even manage that
aww im just curious.... like how do i create 1.8 - 1.16 plugin?
it depends what's in the plugin
If it’s just API stuff it can probably work across versions
some stuff might work fine in both versions
Though it will complain about legacy stuff past 1.13
I use Api version 1.13
Hi there, I know how I can get the "texture" value from a player and apply it to an NPC to change its skin, but is there a way to change a PNG-image of a skin to such a texture string?
(Yes, I did google but the posts only explained the general concepts and as I'm fairly new a bit more details would be handy)
if I write a version of a plugin for 1.8 and a version for 1.16, is there a way to release both versions without making separate resources?
Yes
if I write a version of a plugin for 1.8 and a version for 1.16, is there a way to release both versions without making separate resources?
there are ways to make one plugin work with 1.8 - 1.16
I’m pretty sure you can download old files on SpigotMC right?
you can
Is any staff actually online
as i actually need urgent help...
as my resource needs to be removed
as it leaks my IP
how does it leak your ip lol
🤔
nothing on your resource has your ip
@ancient ridge his... external link is his public IP
LOL
GitHub exists too
If there are multiple plugins that require MySQL, do I need a separate database for each one?
how do you even manage to make the external link your ip
what did he expect when he typed that
😂
depends on your ISP
One of my older ISPs just basically used DHCP, with a fairly nice lease
Is it possible for one of the spigot staff to delete my spigot account? I made mine when I was like 12 and had a really bad username that revealed my personal name and I made crappy plugins, so I'd like to restart with a new account, but don't want to get banned for creating multiple accounts.
once you delete you can't go back iirc
What do you mean?
Then why isn't there a way to at least change your spigot username
you can donate $10 min. to get that ability
how do i upload a post on spigot? please mention me when you answer me
new thread button
how do i upload a post on spigot? please mention me when you answer me
?? someone?
new thread button
@patent cape
So you're not logged in
Why
@lone fog because I thought for bigger uploads I need to provide a direct link for the server to download it
You know those "from url" things
GitHub works fine
Yeah just make a GitHub and redirect it to the Release tab
Isn't the releases blocked if the repo is private and they don't have collab access?
That feels hacky so I'll just make it open source
A lot of resources do that
and it's stupid. Open source your stuff
There is no excuse not to open source anything ¯_(ツ)_/¯
Could you remove my resource?
Report your own resource and request deletion
I've seen resources do it
And I don't personally think I'm dumb (could also be xd)
😬
Why would you think your public IP is a good direct download
You know the "import from url" thing on a lot of sites
I thought for bigger uploads, I would need to specify a url for the backend server to download
As there might be a limitation in some browsers / tech stacks
how do you use createExplosion
Daniel you can use PlayerDeathEvent then use e.getDrops()
Hey, it looks like I've completed all the requirements for posting premium resources but I'm unable to select it as a category. What am I doing wrong ??
?premium
Whats your account?
You got 2fa enabled?
Yep
Ahh, within 1 hour
Did you wait and hour after the req.
@fallen escarp Btw if you want to post a premium resource it will get reviewed before approval.
If you want i can read against it and give you some tipps or at least tell you if its worth a try.
Ahh thank you, when it comes down to it that'd be really useful thanks 😄
Someone know when (in what class) the PlayerMoveEvent is fired?
It's fired when you move
sorry i fixed the sentence
can you use 0 intead of false
o
so no one know in what class the PlayerMoveEvent is fired?
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
what would have to be done to get the reason of death
Player#getLastDamageCause() or something
event#getDeathMessage
why getdeathmessage?
reason of death, so i guess
reason
e.getEntity().getKiller();
As stated before: Player#getLastDamageCause() -> EntityDamageEvent#getCause()
and is it possible to get the time when the player died
Can someone help me figure out this bug?
Could not pass event PlayerViolationEvent to AACDiscordNotifications v1.0.1
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:319) ~[server.jar:git-Spigot-9639cf7-7c03d25]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[server.jar:git-Spigot-9639cf7-7c03d25]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[server.jar:git-Spigot-9639cf7-7c03d25]
at
I was going too try and update it but i need help
wait for the author to update, but thats going to take a while
Ok
The author's in here, probably doesn't like getting pinged though
right
@tidal mica Found it.
Its fired in the net.minecraft.server.v1_16_R1.PlayerConnection.class
hi can you help me?
@tidal mica Found it.
Its fired in the net.minecraft.server.v1_16_R1.PlayerConnection.class
@grim halo oh thanks!!
how can i upload a custom skyblock map on askyblock plugin?
Did you try asking the author? 😄
Does anyone know how long it takes to receive an email back from support?
@frigid ember Between 2 hours and 1 Week
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PlayerDeathEvent.html
how would I get the time when the player died? :/
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Is the email tmp-support@spigotmc.org? Just making sure
Yes. Just make sure that you've read the FAQ first
Alright
Real world time? In game time?
game
Just get the world time you receive the event
Get the players world and then get the time
DateTime.Now I think it is
Instant.now() <- too
If that's valid code sure.
it is
and to store UUID with coords, reason, time
HashMap<UUID, String>
and toString() those or no(multiple hashmaps)?
how can i cancel putting a disc into a jukebox?
meaning when you right click the jukebox nothing happens
i'd assume PlayerInteractEvent although that isnt working currently so I mean
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().equals(Blocks.JUKEBOX)) {
event.setCancelled(true);
}
unless i'm just dumb?
maybe i shouldn't cancel it?
😛
big brain
sometimes
Blocks.JUKEBOX is an NMS block so maybe thats it tbh
but it doesnt say error or anything so i mean
tried Material.JUKEBOX?
aight ill test that out
well i never registered the event, but now that i did i tried it with both Blocks.JUKEBOX and Material.JUKEBOX and the CD still plays 🤔
print something out when interacting
check if it printed
make sure the event runs
just in the interact event
not in a statement
the event itself runs but the if statement does not
Block.getType == material.JUKEBOX
event.getClickedBlock().getType() == material.JUKEBOX then i guess
and to store UUID with coords, reason, time
Make a custom class that takes the time coords and reason
I've just made my own API and have added it as an external library in my plugin. are there any extra steps i should do? importing a static method works fine when both are in the plugins folder
And then store that in the map
can i store an object in an nbt tag?
if you can serialize it, why not
how do
You have to implement serializable or something
Or use the persistent data API
Implement your own PersistentDataType to serialize to and from a primitive data type
Is there a way to set another role as the default with luckperms?
The luckperms discord would probably be a better place to ask that question
i had a look on the internet but couldnt find anything :/
An insanely cool website^^^
does anyone see something wrong with the code in this dev api and the code in the plugin
the bottom one is the dev api
idk what im looking at
don't use stout for logging
im trying too fix a plugin
uh... 🤔
Sure but you've linked to unrelated classes
but i dont really know how too code lol
HookAAC isn't at all referenced in your AACDiscordModifications class
so i need too add the public class line with hookaac into the plugin?
but i dont really know how too code lol
@paper forge 🤨
I really need too get this too work so can anyone fix this pls
Can I cast an object to PotionEffectType 🤔
sure you can
depending on whether that object is a PotionEffectType, it might blow up in your face, though
lol. You can cast anything to anything if you really want to
lmao okay just wanted to make sure and didnt want it to explode
Well if you're certain it's of that type, sure
Though if I do (PotionEffectType) "Hello!", runtime will hate me
yeah
can someone fix this plugin for me since i cant get a program too do it myself :((
https://hastebin.com/najumucuqu.java - main class
https://hastebin.com/pepahayite.css - error
i tried Plugin.getDataFolder# before and it didnt work

basically i’m just trying to store PotionEffectType either in an NBT tag or the PersistentDataContainer thing, so I’m trying to basically convert it to a string then unconvert it, which I assume is serialization? is that all possible?
@lapis plinth did you try removing the “/“ before config.yml?
if that doesn’t work I’ll get on my computer and show you what I did
I'd opt to store the id instead. I know that sounds stupid but potion effects aren't registerable yet
So store the integer id
@balmy sentinel yeah
File customYml = new File(this.getDataFolder(), "config.yml");
I changed it to this
and it stille rrors
@subtle blade wait... PotionEffectType’s got ids? smh i’m challenged
Once they become keyed, then I'd say store the namespaced key. Though they're not, so integer would be better
Eh, maybe the name would be better so it's at least readable
PotionEffectType.getName() and PotionEffectType.getByName()
ahhhh i see
@lapis plinth https://youtu.be/-ZrIjYXOkn0 check this guy out he’s pretty good at explaining things.
Custom config files! Woo, save that data!
P.S I always pronounce "parser" wrong :(
------ Links ------
Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-developers
Download Spigot: https://getbukkit.org/download/spigot
Build S...
thank you! will try that out when i get back home
kk
hey thevipershow
@tranquil edge I don't know you tho
Im one of the most active member of this discord
i need some help
the cloudskywars plugin is not working
i do /swe
/sw*
and it says
an error occurced
Contact author
alr
don't use bad plugins
are you implying whatever that is is not bad
sky* plugins are generally pretty horrible
There's only around 150 or something plugins on there
imagine using skript
mhm
there are people who sell skripts
i probably can't send links here
look at this shit
found this guy advertising his "skripting services" on the pebblehost discord the other day
oh that guy, I know him
This is worse, https://skriptify.xyz/
Trent is in their Discord btw
and somehow supports it 😐
He's in a Gaming League too, don't know why he bought it
Should've just continued on updating FactionsUUID smh
He updated it because it's features was out of date smh
Is there a way to check if there is space for x amount more items with item stacking taken into account or do I have to make that myself?
A skript anticheat is getting a Java adaptation
but I don't think the guy knows much about anticheats
yeah, that's the one getting a Java adaptation
How to learn java in 5hours
I don't think he has a Spigot account 🤔
He's probably selling it on mcmarket
I wonder why the resource isn't removed yet
alright finally imported. Was an error in the Git integration for some reason
oh
btw, Better Bubble isn't compatible with Spigot
Somehow still not removed yet
smh
what am i looking at
MinecraftServer#recentTps[] smh
can someone fix something for me
does anybody kow the permissions for essentials command /blocks?
i've looked up and down, left and right and i can't seem to find it
n v m it's supposedly condense lol anyways take care spigot
ok
i need someone too fix the public class issue in the code here
the bottom one is the dev api and the top is the plugin code
implement that
https://essinfo.xeya.me/permissions.html @neat orbit
I'm too slow on Mobile
whyyouask
fork it i fucking dare you
Whats the method to broadcast a title to a specific player? 1.12 api btw
guys what your structure would look like for mysql statistic stored for different intervals ie monthly weekly all time 🤔
ive been learning the spigot API for a few days (using my knowledge of c# and just winging it with java honestly) and it seems fairly intuitive, but i tried saving data to a yaml and every tutorial i found on the topic seems unnecessarily complicated, is there any simpler way to save data?
It's simple
Is there any way to prevent custom items from being used successfully in regular recipes? For instance, I don't want my iron ingot renamed Steel Ingot to be able to be used to create an iron sword.
Would I need to use the Prepare Craft Item Event for this?
Load the file with YamlConfiguration then you can useYamlConfiguration#set(path, value) to set values
also, YamlConfiguration#save() will remove comments and spaces
watch out for that
path being the "name" or "key" of the value?
okay, i think ive got it
"test.test", 1
test:
test: 1
etc
Is there any way to prevent custom items from being used successfully in regular recipes?
It seems you'll have to listen to the Craft event and check the items
😬
hey guys, so i have this plugin where if you do /targets player1 player2 then all compasses will point to player1 and will alternate between the two whenever you right click holding a compass, and every right click will point to the latest position of the player
but for some reason the /targets command doesnt show up as an option
i made a similar one for one like /target player where the compass only points to one person and it works perfectly
is it in your plugin.yml
yes
weird
should i send a code block of it
sure
name: manhuntMC2P version: 1.0 author: Atin main: me.atin.manh.First2 commands: targets: aliases: [focusons]
dont think you need '' in yaml
yeah I couldn't decide lol, try with and without
so like
name: manhuntMC2P version: 1.0 author: Atin main: me.atin.manh.First2 commands: targets: aliases: [focusons] usage: '/targets <user1> <user2>' ?
yeah
ok
oh okay
the second line is getting an error, i have no idea what the correct way to use loadConfiguration() is
YamlConfiguration homes = loadConfiguration(homesyml);```
The method loadConfiguration(file) is undefined for the type main
@left plover hold up when i was starting the server i saw this:
the one with 2 compasses isnt being enabled
oh?
yeah
any errors
nope dpesnt show
i checked onEnable()
looks okay to me
do i have to manually enable it?
wdym
Do spigot take a cut on paid plugins
No
oh sweet
Does anyone here know if you can change the output directory of the build task with Gradle?
yes
task copyJar(type: Copy) {
from shadowJar // copies output of file produced from jar task (if your using shadowjar)
into '' // insert directory
}
build.finalizedBy copyJar
Mhh
One message removed from a suspended account.
You probably haven't set a restart script
Not 3.2
ok but idk i did some testing and i got up to 3.2
I don't think that's possible
and i was counting from the center of the player's head so
thats why i gotta put 3.2
Maybe if there's lag yeah
Alright so I need some help.
I get an error that crashes my server, as shown here: https://hastebin.com/eyuregasuz.apache
This is the code that the error is sent on, which crashes my server:
https://hastebin.com/ojuzuvakug.cs
Although, I get through all 9 checkpoints that are shown in that code. What have I done to so utterly break Minecraft?
@sturdy oar so there is no way to fix the other problems?
One second I'm reading
One message removed from a suspended account.
Keep in mind this error doesn't always happen, even after doing the exact same thing to cause it
also TheViperShow im hosting this server from my computer, could it just be a lag problem and would hosting it on something like server.pro help?
One message removed from a suspended account.
One message removed from a suspended account.
This is how it's done here @spring coyote
https://github.com/TheViperShow/Frequency/blob/master/src/main/java/xyz/elevated/frequency/check/impl/killaura/
Also keep in mind that the method is called at the last line of an event, meaning nothing is after it so it is the thing causing the error
@tiny pebble If all 9 checkpoints are reached then the assertion error cant be thrown in there.
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
Action action = event.getAction();
Player player = event.getPlayer();
if (!(action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK))) return;
if (!player.getInventory().getItemInMainHand().equals(enchantedSyringe)) return;
if (player.getActivePotionEffects().size() != 1) return;
Collection<PotionEffect> effects = player.getActivePotionEffects();
for (PotionEffect effect : effects) {
potionEffect = effect;
}
fillSyringe(player, potionEffect);
}
This is the PlayerInteractEvent. fillSyringe is the last line, meaning it's also reached.
so...
Compare action with ==
And when I get back in the server every line of code did pass as I intended it to so
Alright
potionEffect = effect;
}
fillSyringe(player, potionEffect);``` Did you want that in the loop?
Because that will only fill it with the last potion effect
@tiny pebble This is the method that throws the assertion error.
So it looks like some item that is created with a null constructor?
The goal is to have it only work with one potion effect
hmm
when I load the server back up it does seem to have still given me the item though, which is what confuses me
@sturdy oar Does your killaura checker get the delay that the server has when sending packets and estimates what the player sees the hitbox as instead of basing it on the server?
It's not mine btw
At least not the kill aura
And yes lag is taken into consideration
Because packets aren't always sent every 50ms
I feel like that may have been the problem @grim halo , the class file I was calling from had an entirely empty constructor that I was going to use then forgot about. Would that do it 😅
(the class holds the method for the item)
@tiny pebble You should probably not use player.getInventory().remove(player.getInventory().getItemInMainHand())
If you want to delete the item in the players main hand you should probably do: player.getInventory().setItemInMainHand(null);
or player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
I want it to just subtract one item
so if it's a stack of 64 i want it to just take it down 63, as like using a bottle and filling it with water
You will remove every itemstack that matches your hand item
how would I just remove one?
public void decrementHandItem(final Player player) {
final PlayerInventory inv = player.getInventory();
final int handSlot = inv.getHeldItemSlot();
final ItemStack handItem = inv.getItem(handSlot);
if (handItem == null || handItem.getType() == Material.AIR) {
return;
}
final int amount = handItem.getAmount();
if (amount == 1) {
inv.setItem(handSlot, null);
} else {
handItem.setAmount(amount - 1);
}
}
@tiny pebble
Didnt test but this should do the trick
ah sweet, i'll try it out
still trying to solve the main error
oddly, i just tested it and it worked fine at first, then i did the same thing and it crashed again
Weird
i do believe it has to do with the item it's giving me though, maybe i did something wonky there
inv.setItem(handSlot, null);
} else {
handItem.setAmount(amount - 1);
}``` You don't need to do the == 1 check in modern versions
Are we finally there?
mhm
good to know
I am trying to use Luckperms and MySQL Inventory Bridge. Can I use the same database for both?
Okay thanks
I think it has something to do with this...? https://hastebin.com/ijedehibar.cs
I'm not sure what though, but probably something I did that was dumb
I am making a mine plugin and I want the server owner to be able to create new mines with the config but I dont know how to make it so It resets every certain amount of time specified by the player, basically I dont know how to have an unspecified amount of mines all with different reset times, they will also all have warnings for when it resets the mine
i think i figured out why 😅
@sage summit You can do two things: poll or schedule
how do i check what mine is reseting?
create a Mine class that has an area and a timestamp.
Then create a MineManager class that manages all mines and polls them periodically to check if they should reset.
can someone help me with maven spigot?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
@sage summit So the MineManager holds a data structure like List<Mine>
Then every 20 ticks or so you just call a forEach on that List and check if any mine should reset
ok ill try that
Alright, I added three commands to my plugin all at once and now when I try to use any, I only get what I labeled as their usage (in plugin.yml) in the chat. Help?
Main file:```java
public static Map<String, String> passwords = new HashMap<>();
public static Map<String, String[]> helpingBuild = new HashMap<>();
@Override
public void onEnable() {
passwords.replaceAll(null);
SmmCommands smmCommands = new SmmCommands();
getServer().getPluginManager().registerEvents(new LevelEvents(), this);
getCommand("hub").setExecutor(smmCommands);
getCommand("openchest").setExecutor(smmCommands);
getCommand("unsign").setExecutor(smmCommands);
getCommand("password").setExecutor(smmCommands);
getCommand("joinbuild").setExecutor(smmCommands);
getCommand("leavebuild").setExecutor(smmCommands);
}```Plugin.yml:```yaml
name: RevivePlugin
version: 1.0.0
author: TheGamerAdmin
main: com.thegameradmin.reviveplugin.RevivePlugin
api-version: 1.16
commands:
hub:
description: Teleports you to the hub.
usage: /<command>
aliases: spawn
permission: reviveplugin.hub
Is this the whole plugin.yml?
No, I had to cut it off so I wouldn't exceed the character limit.
Need me to send the whole thing?
?paste
And also send the SmmCommands class pls.
Btw it is generally discouraged to have one CommandExecutor for multiple commands.
yeah sorry, i just did it because its a private plugin
Dont check cmd.getName(). Just use the label. Thats what its for,
Ah, ok. By the way, it was working before I added the final three commands in the SmmCommands
No errors in the console, either.
e.getEntity().getLastDamageCause() in PlayerDeathEvent returns org.bukkit.event.entity.EntityDamageByBlockEvent@xxxx
is there a way to make it look better
like that -> killed himself
Wait, do I have to put a return true; at the end of every command?
I just realized I forgot one at the bottom command.
@frigid ember The EntityDamageEvent has a getCause() method
what happens?
does it just say the command in chat @golden geyser ?
than that'll be the fix
e.getEntity().getLastDamageCause().getCause()
@golden geyser The last return is always true. So this shouldnt make any difference.
@golden geyser use the label to compare.
FALL
@frigid ember yeah
@frigid ember Then write a Map<DamageCause, String> and fill it with whatever suits you.
cant it get the regular mc death message
@golden geyser And it will not be fixed if you just add a return true;
Compare the label !!
@frigid ember PlayerDeathEvent#getDeathMessage()
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
@grim halo i did... still fails and gives me the command name
Create a debug message before and after your Player instance check and at the end of the command (before the return)
isn't the label of a command affected by the alias
How would I put an item into an entityplayer's hand?
Parameters:
sender - Source of the command
command - Command which was executed
label - Alias of the command which was used
args - Passed command arguments
don't use label in a switch block or use equalsignorecase on it
it's affected by the alias
You are right. So command.getName() was the better method to compare
ideally you would have an executor for each
ideally you wouldnt use spigots command system...
But yes i also would create one CommandExecutor per registered command.
ideally you wouldnt use spigots command system...
ACF >:D
i keep recommending acf to everyone and they just shoot it down with "that's overkill"
long timeMillis = System.currentTimeMillis();
players.compute((Player) e.getEntity(), (key, value) -> new Data(e.getEntity().getLocation(), e.getDeathMessage(), TimeUnit.MILLISECONDS.toSeconds(timeMillis)));```
it's not converted to seconds?
@pastel nacelle depending on what someone is trying to do, it can be overkill to use acf lol
I'm still using it even for 1 command
could just divide it by 1000
ohh I will do that, thanks
personal preference which I am not saying you shouldn't use it
I am just saying, it can be overkill if what you are doing is relatively simple to begin with lol
acf saves me SO much time. I can just create a command in 5min with command completion permissions etc.
I think it gets unreplacable if you get used to it.
Even in a simple project. I can just copy paste acf in my pom in the same time i would have taken for tinkering with my plugin.yml
yes
that should work.
players.compute((Player) e.getEntity(), (key, value) -> new Data(e.getEntity().getLocation(), e.getDeathMessage(), System.currentTimeMillis()/1000));```
System.currentTimeMillis will be very high though
acf saves me SO much time. I can just create a command in 5min with command completion permissions etc.
I think it gets unreplacable if you get used to it.
@grim halo yes although I think it's also important to sometimes also try to experiment and learn how to do it the vanilla way
With the TabExecutors etc...
How would I spawn an entityplayer holding a diamond sword?
Well, I am not always a fan of using reflection @grim halo like I said, personal preference you can say 😛
still gives me this high amount
system.currentTimeMills is the milliseconds since January 1st 1970
Yes
So you have the seconds since January 1st 1970
Use LocalDateTime
If you want formatted dates use LocalDateTime
sure, thanks
You can also write your own formatter
it should be noted that is Unix Epoch
@keen compass You dont need to use reflections urself. And doing some reflections at the start of a program does not matter at all.
unless the reflective stuff is in a super hot loop it's almost certainly a nonfactor
Windows uses 1 january 1601 for its start of the time
sure, a reflective field get and method invocation takes moer than twice as long as a regular get/invocation
Just fyi if you want to take into account windows is different for time stuff 😛
but the % of the time the jvm spends on the invocation/get part itself is negligible
Yeah because windows was invented in 1600 and UNIX in 1900
Ive seen something about JIT and reflections in java 11 recently. I was baffled on how much it improved since Java 8
Java 1.8 should work for 1.15.2, right?
Yes
It's required
But use 11 if you can
java 1.8 is the minimum required
It has faster fps for PvP
@sage summit You can do two things: poll or schedule
@grim halo wait whats a poll?
Yeah because I'm getting Cannot find main class errors for no reason
"It has faster fps for PvP" i dont even...
I mean it probably does run better
It does
But I would think that applies outside of PvP too
java 11 runs better then java 8 and java 14 runs better then java 11 😉
not always the case that higher versions run better, but those 2 versions specifically optimized some things
And I'm a nub using a shared host so I can't pick which one :p
Yeah because I'm getting Cannot find main class errors for no reason
So either your plugins aren't properly defined or you've somehow gotten a server jar not from BuildTools
@sage summit polling is something you normally want to avoid.
If you ask a thread "are you done?" -> "are you done?" -> "are you done?" every tick then you are polling.
most shared hosts let you open a ticket or something to change your java version
Might want to look into that
ok thanks
It lets me choose Java 11 if I upload a custom Jar
But I really don't want to deal with that
and what host, pray tell, might you be using
@subtle blade I'm using the jar from --rev 1.15.2
Meloncube Is great
It's a pretty saturated market
I recommend MelonCube to everyone ^^^^
oh it's definitely profitable if you oversell
@sturdy oar whats the name of your hosting
but it's saturated to all fuck and back
@sturdy oar whats the name of your hosting
@opal heron Meloncube
sounds like they use multicraft
BEEZ MELONCUBE
They do
any shared host using multicraft is automatically bad in my books
But it's really well configured
I tried benchmarks
And checked for overselling
With my advanced software
your gonna start a company?
i don't know but multicraft is cancer
minehut is a grave
tired of writing ?i in my timings link every time
I can't start a shared company because I don't have the budget to start one
But I'd do it if I had the money
?I ?
E
multicraft removes any ? character and the character that follows the ? character from the console feedback
that sounds stressful
so your timings?id=shithere turns into timingsd=shithere
? Since when
since ever
Lol just looked at MelonCube... for the price of their 16GB VPS i can get two 32GB dedicated I7 server...
see it all around
more like multibad
How would I set the item an npc is holding
are you perchance related to jan tuck
@spring coyote /npc equip
he has a paper bag for a head as well
Lol just looked at MelonCube... for the price of their 16GB VPS i can get two 32GB dedicated I7 server...
@grim halo vps are more expensive than dedi
if youre using citizens
you are like siblings
That's like that in all hosts
Im not using citizens
then what
nms
Huh it does
vps is worse than a dedi
I never use the console for timings links anyway
no reason to pay more for less
NMS
Why should a VPS be more expensive than a dedicated one?
hm
Why should a VPS be more expensive than a dedicated one?
@grim halo it's always like that
Go check on DigitalOcean
a 16GB standard vps
Is 80$ x month
org.bukkit.plugin.InvalidPluginException: Cannot find main class org.spigotmc.spigotplugins That's not the class I have in main ?
virtual private server
what's stopping you from setting up a vps on your better dedi that you got for cheaper
that just doesn't hold water
No one
Yes but the issue is that that's not what I have in my main in plugin.yml
But it's not meloncube that is overcharging or something
Literally everyone has high vps prices
more like badcube
cocomelon
LocalDateTime.now(ZoneOffset.UTC).toLocalTime()
this already removed the data
but I also want to remove seconds, nanoseconds
Okay stupid question incoming, but does anyone know a good practice for defining a one to one relationship?
Should I use the constructor to define the reference on the parent or child object?
there is .format()
not sure what you're looking for here
but how would I only choose hours, minutes
are you talking about a pair of inseparable objects or something? not really sure what this question is looking for
@wwho
?
the stupid question guy
Use node
Well @pastel nacelle , very specific, I got a class named "Postman" and another class named "Delivery" . A delivery will always have a postman, and a postman will always have a delivery
the tightest possible coupling would be to have delivery be an inner class of postman
and postman hold a public final field holding a delivery
initialized in the constructor or in the field declaration
Or just throw the postman in a map with the delivery
Well, the purpose is that I can retrieve the delivery from the postman, and from the postman retrieve the delivery
alternatively, make the ctor of delivery private, and make both of the classes hold a public final ref to the other, initialized in their respective ctors
You could have biMap I guess
have delivery extend postman, implement delivery in a class named package 😉
there is no need to bind this into a collection if you don't need a collection
and you will always have both 😛
if they are so tightly coupled, why aren't they the same class to begin with
or can the delivery of a postman change?
Because it's not the same
Anyways object inheritance is what is needed here
solves the problem and no collections needed
maybe... i'm still not quite sure what's happening here
Inheritance would be good, but they are not sharing the same properties
they are
can the delivery of a postman change?
Maybe dont go for hard references?
Have a PostmanManager that manages a Map<UUID, PostMan> and just have
a postmanID field in your Delivery and vise versa
It's the opposit. Delivery would be the parent of the postman
o.O
pepega
doesn't make sense in doing it that way, but doesn't really matter which comes first I suppose
doesn't answer the question either lol
The postman of a delivery will never change
I'm starting to think I should indeed merge everything into one class
I personally would pair the 2 objects with public final fields holding refs if one class isn't a possibility, but i guess inheritance could be used as well
But it doesn't sound right :/ It's 2 totally different things
Well you haven't gave us much to work with really, but I do agree you are probably over thinking this as well lol
well, this is what inner classes are for
Okay, so the full idea
@peak marten Inheritance doesn't make them both the same, just that they are linked together
with inheritance you should be able to get one from the other
A delivery is created and at the same time a postman will be created and assigned to the delivery
Then
if the concept and existence of a class depends fundamentally on another class so that there can not be an instance of class A without a class B associated with it, then A should be an inner class of B
think map and map.entry
I believe inner class is the thing I'm looking for here , still not sure though :/
And the thing is, I'm far from a beginner, so I'm most likely overthinking ...
to reinforce the one to one rule, the parent class should also hold a final ref to the "canonical" instance of the inner class, since there can be multiple instances of it
Okay @pastel nacelle , I believe the nested class is what I need
Is it really recommended to use an inner class? Even if the use case is sound most linters will raise warnings over using them
obviously there is multiple ways to go about this
not really recommended i suppose, leads to spaghetti pretty quick
but what @pastel nacelle I agree is the best of the multiple ways to do this
no real need to use one either, beyond just semantics
Nothing wrong with nested classes
personally i would just have 2 top level classes linked with final refs but an inner class would be the "right" way of doing it on some level
@pastel nacelle , could you show an example usage pls? I'm a bit confused
class A holds a final ref to class B
You could also just write a wrapper class that holds both instances and manages them.
class B holds a final ref to class A
That is what I was thinking of as well
but
How can i do that? If the constructor requires an instance of each other?
whichever is the top dog will instantiate the bottom dog in the field declaration and pass this to the ctor of the bottom dog
which will then set its final ref in its ctor
I mean then you can just put them both in one class... this doesnt sound clean to me. Two instances just holding a reference to each other.
should be careful to not do some kind of weird recursion btw
@grim halo , the wrapper doesn't sound bad either, but then I would need to think of a name that would combine both xd
public class TopDog {
public final BottomDog BOTTOM = new BottomDog(this);
}
public class BottomDog {
public final TopDog TOP;
BottomDog(@NotNull TopDog top) {
this.TOP = top;
}
}
