C
CodeIT
Unregistriert
vllt. ist er neu in java, das kann jeder mal sein, du warst dies auch. Und fragen ist ja nicht schlimm.Gib zu, du hast dich nie wirklich mit Java beschäftigt.![]()
LG
vllt. ist er neu in java, das kann jeder mal sein, du warst dies auch. Und fragen ist ja nicht schlimm.Gib zu, du hast dich nie wirklich mit Java beschäftigt.![]()
trotzdem, du musst nicht so fies sein. Jeder fängt einmal an.Halbe Sekunde gegoogelt. http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#size()
Man sollte aber erst Java verstehen und dann was mit Bukkit machen. Das mit der ArrayList gehört zu den Basicstrotzdem, du musst nicht so fies sein. Jeder fängt einmal an.
LG._.
public class main extends JavaPlugin implements Listener{
ArrayList<Location> tote = new ArrayList<Location>();
ArrayList<Player> tote1 = new ArrayList<Player>();
private void setValue(String name, Object instance, Object value) {
try {
Field field = instance.getClass().getDeclaredField(name);
field.setAccessible(true);
field.set(instance, value);
} catch
(Exception exception) {
}
}
public void onEnable(){
this.getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void death(final PlayerDeathEvent e){
e.setDeathMessage(ChatColor.RED + e.getEntity().getPlayer().getName() + " ist gestorben!");
tote1.add(e.getEntity().getPlayer());
tote.add(e.getEntity().getPlayer().getLocation());
this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
public void run() {
PacketPlayOutNamedEntitySpawn npc = new PacketPlayOutNamedEntitySpawn(((CraftPlayer)tote1.get(0)).getHandle());
PacketPlayOutBed bed = new PacketPlayOutBed();
setValue("a", npc, Integer.valueOf(1337));
setValue("a", bed, Integer.valueOf(1337));
setValue("b", bed, Integer.valueOf((int)tote.get(0).getBlockX()));
setValue("c", bed, Integer.valueOf((int)tote.get(0).getBlockY()));
setValue("d", bed, Integer.valueOf((int)tote.get(0).getBlockZ()));
e.getEntity().sendMessage("Du bist gestorben !");
tote.remove(0);
tote1.remove(0);
}
}, 100L);
}
Tode ist was komisch. Du addest eine Location in eine Player listHallo bei meinem code soll eine "leiche" gespawnt werden dort wo ein player gestorben ist . Aber Es wird nichts gspawnt ;( . Fehlermeldungen gibts keine
Code:public class main extends JavaPlugin implements Listener{ ArrayList<Location> tote = new ArrayList<Location>(); ArrayList<Player> tote1 = new ArrayList<Player>(); private void setValue(String name, Object instance, Object value) { try { Field field = instance.getClass().getDeclaredField(name); field.setAccessible(true); field.set(instance, value); } catch (Exception exception) { } } public void onEnable(){ this.getServer().getPluginManager().registerEvents(this, this); } @EventHandler public void death(final PlayerDeathEvent e){ e.setDeathMessage(ChatColor.RED + e.getEntity().getPlayer().getName() + " ist gestorben!"); tote1.add(e.getEntity().getPlayer()); tote.add(e.getEntity().getPlayer().getLocation()); this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { PacketPlayOutNamedEntitySpawn npc = new PacketPlayOutNamedEntitySpawn(((CraftPlayer)tote1.get(0)).getHandle()); PacketPlayOutBed bed = new PacketPlayOutBed(); setValue("a", npc, Integer.valueOf(1337)); setValue("a", bed, Integer.valueOf(1337)); setValue("b", bed, Integer.valueOf((int)tote.get(0).getBlockX())); setValue("c", bed, Integer.valueOf((int)tote.get(0).getBlockY())); setValue("d", bed, Integer.valueOf((int)tote.get(0).getBlockZ())); e.getEntity().sendMessage("Du bist gestorben !"); tote.remove(0); tote1.remove(0); } }, 100L); }
ne das sind 2 listen eine player list und eine location listTode ist was komisch. Du addest eine Location in eine Player list
@mickedplay @DerDr4g0n Genau das meinte ich NICHT
Es muss doch möglich sein, 2 Bukkit Plugins miteinander kommunizieren lassen zu können...
Imprinzip sowie das Bungee-Plugin-Messaging bloß ohne BungeeCord, sondern mit 2 Bukkit Plugins xD
Redis PubSub@mickedplay @DerDr4g0n Genau das meinte ich NICHT
Es muss doch möglich sein, 2 Bukkit Plugins miteinander kommunizieren lassen zu können...
Imprinzip sowie das Bungee-Plugin-Messaging bloß ohne BungeeCord, sondern mit 2 Bukkit Plugins xD
Nutze MySQL oder Einer .Yml wo du in einen Int einen Code speichert und das andere empfängt. Oder das der spieler einen Cmd ausführt der vom anderen Pl kommt. Mit nem Int hinter@mickedplay @DerDr4g0n Genau das meinte ich NICHT
Es muss doch möglich sein, 2 Bukkit Plugins miteinander kommunizieren lassen zu können...
Imprinzip sowie das Bungee-Plugin-Messaging bloß ohne BungeeCord, sondern mit 2 Bukkit Plugins xD
Dann werden die Nachrichten aber nicht direkt empfangen, man müsste in regelmäßigen Abständen eine Config überprüfen (d.h. neu laden) oder auch alle paar Sekunden MYSQL Abfragen -> Result verarbeiten -> Datensatz löschen.Nutze MySQL oder Einer .Yml wo du in einen Int einen Code speichert und das andere empfängt. Oder das der spieler einen Cmd ausführt der vom anderen Pl kommt. Mit nem Int hinter
@EventHandler
public void respawn(PlayerRespawnEvent e){
Location loc = location.get(e.getPlayer());
e.getPlayer().sendMessage("Deine Leiche ist bei den Koordinaten X: " + loc.getBlockX() + " Y: " + loc.getBlockY() + " Z: " + loc.getBlockZ() );
for(Player all : Bukkit.getServer().getOnlinePlayers()){
PacketPlayOutNamedEntitySpawn npc = new PacketPlayOutNamedEntitySpawn(((CraftPlayer)e.getPlayer()).getHandle());
PacketPlayOutBed bed = new PacketPlayOutBed();
setValue("a", npc, Integer.valueOf(1337));
setValue("a", bed, Integer.valueOf(1337));
setValue("b", bed, Integer.valueOf((int)loc.getBlockX()));
setValue("c", bed, Integer.valueOf((int)loc.getBlockY()));
setValue("d", bed, Integer.valueOf((int)loc.getBlockZ()));
((CraftPlayer)all.getPlayer()).getHandle().playerConnection.sendPacket(npc);
((CraftPlayer)all.getPlayer()).getHandle().playerConnection.sendPacket(bed);
location.remove(e.getPlayer());
}
}
Ich kann auf den ersten Blick den Fehler nicht finden, frag mal @Sheigutn der kennt sich besser mit dem MC Protocol ausCode:@EventHandler public void respawn(PlayerRespawnEvent e){ Location loc = location.get(e.getPlayer()); e.getPlayer().sendMessage("Deine Leiche ist bei den Koordinaten X: " + loc.getBlockX() + " Y: " + loc.getBlockY() + " Z: " + loc.getBlockZ() ); for(Player all : Bukkit.getServer().getOnlinePlayers()){ PacketPlayOutNamedEntitySpawn npc = new PacketPlayOutNamedEntitySpawn(((CraftPlayer)e.getPlayer()).getHandle()); PacketPlayOutBed bed = new PacketPlayOutBed(); setValue("a", npc, Integer.valueOf(1337)); setValue("a", bed, Integer.valueOf(1337)); setValue("b", bed, Integer.valueOf((int)loc.getBlockX())); setValue("c", bed, Integer.valueOf((int)loc.getBlockY())); setValue("d", bed, Integer.valueOf((int)loc.getBlockZ())); ((CraftPlayer)all.getPlayer()).getHandle().playerConnection.sendPacket(npc); ((CraftPlayer)all.getPlayer()).getHandle().playerConnection.sendPacket(bed); location.remove(e.getPlayer()); } }
weiß jemand warum dies nicht funktioniert habe keine annhaltspunkte da auch keine fehler in der Console kommen?
[20:03:17 INFO]: Debug logging is disabled
[20:03:17 INFO]: Server Ping Player Sample Count: 12
[20:03:17 INFO]: Using 4 threads for Netty based IO
[20:03:17 INFO]: -------- World Settings For [world] --------
[20:03:17 INFO]: View Distance: 10
[20:03:17 INFO]: Chunks to Grow per Tick: 650
[20:03:17 INFO]: Clear tick list: false
[20:03:17 INFO]: Experience Merge Radius: 3.0
[20:03:17 INFO]: Cactus Growth Modifier: 100%
[20:03:17 INFO]: Cane Growth Modifier: 100%
[20:03:17 INFO]: Melon Growth Modifier: 100%
[20:03:17 INFO]: Mushroom Growth Modifier: 100%
[20:03:17 INFO]: Pumpkin Growth Modifier: 100%
[20:03:17 INFO]: Sapling Growth Modifier: 100%
[20:03:17 INFO]: Wheat Growth Modifier: 100%
[20:03:17 INFO]: Nerfing mobs spawned from spawners: false
[20:03:17 INFO]: Mob Spawn Range: 4
[20:03:17 INFO]: Anti X-Ray: true
[20:03:17 INFO]: Engine Mode: 1
[20:03:17 INFO]: Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74,
82, 129, 130]
[20:03:17 INFO]: Replace Blocks: [1, 5]
[20:03:17 INFO]: Arrow Despawn Rate: 1200
[20:03:17 INFO]: Item Despawn Rate: 6000
[20:03:17 INFO]: Item Merge Radius: 2.5
[20:03:17 INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
[20:03:17 INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[20:03:17 INFO]: Alternative Hopper Ticking: false
[20:03:17 INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
[20:03:17 INFO]: Random Lighting Updates: false
[20:03:17 INFO]: Structure Info Saving: true
[20:03:17 INFO]: Sending up to 5 chunks per packet
[20:03:17 INFO]: Max TNT Explosions: 100
[20:03:17 INFO]: Zombie Aggressive Towards Villager: true
[20:03:17 INFO]: Max Entity Collisions: 8
[20:03:17 INFO]: Custom Map Seeds: Village: 10387312 Feature: 14357617
[20:03:17 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[20:03:17 INFO]: -------- World Settings For [world_the_end] --------
[20:03:17 INFO]: View Distance: 10
[20:03:17 INFO]: Chunks to Grow per Tick: 650
[20:03:17 INFO]: Clear tick list: false
[20:03:17 INFO]: Experience Merge Radius: 3.0
[20:03:17 INFO]: Cactus Growth Modifier: 100%
[20:03:17 INFO]: Cane Growth Modifier: 100%
[20:03:17 INFO]: Melon Growth Modifier: 100%
[20:03:17 INFO]: Mushroom Growth Modifier: 100%
[20:03:17 INFO]: Pumpkin Growth Modifier: 100%
[20:03:17 INFO]: Sapling Growth Modifier: 100%
[20:03:17 INFO]: Wheat Growth Modifier: 100%
[20:03:17 INFO]: Nerfing mobs spawned from spawners: false
[20:03:17 INFO]: Mob Spawn Range: 4
[20:03:17 INFO]: Anti X-Ray: true
[20:03:17 INFO]: Engine Mode: 1
[20:03:17 INFO]: Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74,
82, 129, 130]
[20:03:17 INFO]: Replace Blocks: [1, 5]
[20:03:17 INFO]: Arrow Despawn Rate: 1200
[20:03:17 INFO]: Item Despawn Rate: 6000
[20:03:17 INFO]: Item Merge Radius: 2.5
[20:03:17 INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
[20:03:17 INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[20:03:17 INFO]: Alternative Hopper Ticking: false
[20:03:17 INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
[20:03:17 INFO]: Random Lighting Updates: false
[20:03:17 INFO]: Structure Info Saving: true
[20:03:17 INFO]: Sending up to 5 chunks per packet
[20:03:17 INFO]: Max TNT Explosions: 100
[20:03:17 INFO]: Zombie Aggressive Towards Villager: true
[20:03:17 INFO]: Max Entity Collisions: 8
[20:03:17 INFO]: Custom Map Seeds: Village: 10387312 Feature: 14357617
[20:03:17 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[20:03:17 INFO]: [TitleAPI] Disabling TitleAPI v1.3.1
[20:03:17 INFO]: [TitleAPI] TitleAPI has been disabled!
[20:03:17 INFO]: [Lobbysystem] Disabling Lobbysystem v1.0
[20:03:17 INFO]: [Lobbysystem] º1[LobbySystem] Plugin deaktiviert.
[20:03:17 INFO]: [Effect Library] Disabling EffectLib v2.0
[20:03:17 INFO]: SubClassFactory parent ClassLoader [org.bukkit.plugin.java.Plug
inClassLoader]
[20:03:17 INFO]: Entities enhanced[0] subclassed[0]
[20:03:17 INFO]: [PermissionsEx] Loading PermissionsEx v1.22.5
[20:03:17 WARN]: [PermissionsEx] This server is in offline mode. Unless this ser
ver is configured to integrate with a supported proxy (see http://dft.ba/-8ous),
UUIDs *may not be stable*!
[20:03:17 INFO]: [Effect Library] Loading EffectLib v2.0
[20:03:17 INFO]: [Lobbysystem] Loading Lobbysystem v1.0
[20:03:17 INFO]: [TitleAPI] Loading TitleAPI v1.3.1
[20:03:17 INFO]: [PermissionsEx] Enabling PermissionsEx v1.22.5
[20:03:17 INFO]: [PermissionsEx] Initializing file backend
[20:03:17 INFO]: [PermissionsEx] Permissions file successfully reloaded
[20:03:17 INFO]: [Effect Library] Enabling EffectLib v2.0
[20:03:17 INFO]: [Lobbysystem] Enabling Lobbysystem v1.0
[20:03:17 INFO]: [Lobbysystem] º1[LobbySystem] Plugin aktiviert.
[20:03:17 INFO]: [TitleAPI] Enabling TitleAPI v1.3.1
[20:03:17 INFO]:
[20:03:17 INFO]: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[20:03:17 INFO]:
[20:03:17 INFO]: TitleAPI
[20:03:17 INFO]: Version 1.3.1
[20:03:17 INFO]:
[20:03:17 INFO]: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[20:03:17 INFO]:
[20:03:17 INFO]: Server permissions file permissions.yml is empty, ignoring it
[20:03:17 INFO]: CONSOLE: Reload complete.
[20:03:18 WARN]: [PermissionsEx] An update to PermissionsEx version 1.23.1 is av
ailable to download from http://dev.bukkit.org/bukkit-plugins/permissionsex/. Pl
ease review the changes and update as soon as possible!
[20:03:27 INFO]: lusu007 lost connection: Disconnected
[20:03:32 INFO]: UUID of player lusu007 is a2e334fe-9e71-3f42-8dcf-438cecf0f836
[20:03:32 INFO]: lusu007[/25.90.66.201:54581] logged in with entity id 341 at ([
world] -1234.0964146397414, 38.0, 112.40690344927349)
[20:03:48 INFO]: lusu007 issued server command: /set
[20:03:50 INFO]: lusu007 issued server command: /set spawn
[20:03:50 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'set'
in plugin Lobbysystem v1.0
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spi
got.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
1) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServe
r.java:767) ~[spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerCon
nection.java:1043) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java
:880) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java
:28) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat
.java:65) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186
) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java
:81) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:7
34) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:2
89) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:5
84) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java
:490) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:6
28) [spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
Caused by: java.lang.IllegalArgumentException: EffectManager cannot be null!
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[spigot.
jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
at de.slikey.effectlib.Effect.<init>(Effect.java:92) ~[?:?]
at de.slikey.effectlib.effect.HelixEffect.<init>(HelixEffect.java:41) ~[
?:?]
at me.lusu007.lobbysystem.Methoden.NavigatorItemMethoden.SpawnLoc.setspa
wnloc(SpawnLoc.java:56) ~[?:?]
at me.lusu007.lobbysystem.Commands.Set.onCommand(Set.java:38) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spi
got.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
... 13 more
>
package me.lusu007.lobbysystem.Methoden.NavigatorItemMethoden;
import de.slikey.effectlib.effect.HelixEffect;
import me.lusu007.lobbysystem.Main.Main;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
/**
* Created by Lukas on 30.01.2015.
*/
public class SpawnLoc {
private static Main plugin;
public SpawnLoc(Main main) {
this.plugin = main;
}
public static void setspawnloc(Player p) {
File file = new File("/plugins/LobbySystem", "spawn.yml");
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
Location loc = p.getLocation();
String world = p.getWorld().getName();
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
double yaw = loc.getYaw();
double pitch = loc.getPitch();
cfg.set("spawn.spawn.world", world);
cfg.set("spawn.spawn.x", x);
cfg.set("spawn.spawn.y", y);
cfg.set("spawn.spawn.z", z);
cfg.set("spawn.spawn.yaw", yaw);
cfg.set("spawn.spawn.pitch", pitch);
try {
cfg.save(file);
} catch (IOException e) {
e.printStackTrace();
}
p.sendMessage("§3Du hast erfolgreich den §6Spawn §3gesetzt!");
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.0F, 1.0F);
HelixEffect effect1 = new HelixEffect(plugin.em);
effect1.setLocation(p.getLocation());
effect1.start();
HelixEffect effect2 = new HelixEffect(plugin.em);
effect2.setLocation(p.getEyeLocation());
effect2.start();
}
public static void teleportspawn(Player p) {
File file = new File("/plugins/LobbySystem", "spawn.yml");
FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
String world = cfg.getString("spawn.spawn.world");
double x = cfg.getDouble("spawn.spawn.x");
double y = cfg.getDouble("spawn.spawn.y");
double z = cfg.getDouble("spawn.spawn.z");
double yaw = cfg.getDouble("spawn.spawn.yaw");
double pitch = cfg.getDouble("spawn.spawn.pitch");
Location loc = new Location(Bukkit.getWorld(world), x, y, z);
loc.setYaw((float) yaw);
loc.setPitch((float) pitch);
p.teleport(loc);
}
}
Du musst den EffectManager initialisieren weil der null ist.Ich bin noch relativ neu in Java. Was muss ich denn ändern?