Solved Can't find EnumParticle,PacketPlayOutWorldParticles and CraftPlayer | Problem with MAVEN dependencie

Discussion in 'Plugin Development' started by GRayzerG, Oct 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    GRayzerG

    Hi i need help :(, Can't find EnumParticle,PacketPlayOutWorldParticles and CraftPlayer in script:
    Thanks!
    Code:
    package com.aztecacraft.API;
    
    import static com.avaje.ebeaninternal.server.cluster.socket.SocketClusterMessage.packet;
    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    
    public class Particle {
       
        EnumParticle particletype;
        boolean longdistance;
        Location location;
        float offsetx;
        float offsety;
        float offsetz;
        float speed;
        int ammount;
       
       
       
        public Particle(EnumParticle particletype, boolean longdisantce, Location location, float offsetx, float offsety, float offsetz, float speed, int ammount) {
           
            this.particletype = particletype;
            this.location = location;
            this.longdistance = longdistance;
            this.offsetx = offsetx;
            this.offsety = offsety;
            this.offsetz = offsetz;
            this.speed = speed;
            this.ammount = ammount;
        }
        public void sendAll(){
            PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(this.particletype, this.longdistance, (float)this.location.getX(), (float)this.location.getY(), (float)this.location.getZ(), this.offsetx, this.offsety, this.offsetz, this.speed, this.ammount, 0);
           
            for(Player player : Bukkit.getOnlinePlayers()){
                ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
            }
        }
       
        public void sendPlayer(Player player){
            PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(this.particletype, this.longdistance, (float)this.location.getX(), (float)this.location.getY(), (float)this.location.getZ(), this.offsetx, this.offsety, this.offsetz, this.speed, this.ammount, 0);
            ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
        }
       
        public void sendParticle(Player player){
            PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(this.particletype, this.longdistance, (float)this.location.getX(), (float)this.location.getY(), (float)this.location.getZ(), this.offsetx, this.offsety, this.offsetz, this.speed, this.ammount, 0);
            ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
        }
    }
    Pom.xml

    HTML:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.skinny</groupId>
        <artifactId>AztecaCraft</artifactId>
        <version>1.0</version>
        <packaging>jar</packaging>
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <maven.compiler.source>1.7</maven.compiler.source>
            <maven.compiler.target>1.7</maven.compiler.target>
        </properties>
        <build>
            <sourceDirectory>src</sourceDirectory>
            <resources>
                <resource>
                    <targetPath>.</targetPath>
                    <filtering>true</filtering>
                    <directory>src</directory>
                    <includes>
                        <include>*.yml</include>
                    </includes>
                </resource>
            </resources>
            <finalName>AztecaCraft</finalName>
        </build>
        <repositories>
            <repository>
                <id>spigot-repo</id>
                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
            </repository>
        </repositories>
        <dependencies>
            <dependency>
               <groupId>org.spigotmc</groupId>
               <artifactId>spigot-api</artifactId>
               <version>1.8.8-R0.1-SNAPSHOT</version>
               <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.bukkit</groupId>
                <artifactId>bukkit</artifactId>
                <version>1.8.8-R0.1-SNAPSHOT</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </project>
     
  2. Offline

    mine-care

    I am a maven noob, used it 2 times in my entire life. The thing is, i cant see any improrts from the nms packet where the packet, EntityPlayer, PlayerConnection belongs in, nor can i see any from the craftbukkit package where CraftPlayer belongs in.

    why exacly do you need a static import here?
    Docs state:
    Source: https://docs.oracle.com/javase/1.5.0/docs/guide/language/static-import.html

    I cant see any method being used so frequently that you cant avoid this.
    Lastly encapsulate please!
     
  3. Offline

    Hawktasard

    @GRayzerG
    You added the bukkit dependency and the spigot-api dependency but you don't have one for craftbukkit or spigot (the actual server software). This is where NMS and OBC code is stored. As there is no legal way to get your craftbukkit/spigot jar you have to add it to your local repository (try googling "Maven add jar to local repository").
     
    GRayzerG likes this.
  4. In addition to what @Hawktasard said, you could download BuildTools and install it (In case you haven't already) and use the extracted server file as depency.
     
    GRayzerG likes this.
  5. Offline

    GRayzerG

    Hawktasard likes this.
Thread Status:
Not open for further replies.

Share This Page