mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Fleshing out the abstraction
This commit is contained in:
		@@ -5,8 +5,11 @@ plugins {
 | 
			
		||||
repositories {
 | 
			
		||||
    // Repo containing the Configurable library
 | 
			
		||||
    maven("https://repo.spongepowered.org/maven")
 | 
			
		||||
    // Flow Math
 | 
			
		||||
    maven("https://oss.sonatype.org/content/groups/public/")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
    compile("com.flowpowered", "flow-math", "1.0.4-SNAPSHOT")
 | 
			
		||||
    compile("org.spongepowered", "configurate-yaml", "3.6") // Configurable (config library from Sponge)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
package com.gmail.nossr50.core.data.blockmeta.chunkmeta;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.data.blockmeta.ChunkletStore;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.World;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.world.World;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.ObjectInputStream;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
package com.gmail.nossr50.core.datatypes;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Location;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.world.Location;
 | 
			
		||||
 | 
			
		||||
public class LimitedSizeList {
 | 
			
		||||
    private final int size;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Named;
 | 
			
		||||
 | 
			
		||||
public interface Nameable extends Named {
 | 
			
		||||
    /**
 | 
			
		||||
     * Change the name for this entity
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								core/src/main/java/com/gmail/nossr50/core/mcmmo/Unique.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								core/src/main/java/com/gmail/nossr50/core/mcmmo/Unique.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Many things in MC use UUID to be uniquely identified
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
public interface Unique {
 | 
			
		||||
    UUID getUUID();
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
 | 
			
		||||
public interface World {
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the name of this World
 | 
			
		||||
     *
 | 
			
		||||
     * @return the name of this world
 | 
			
		||||
     */
 | 
			
		||||
    String getName();
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.block;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Property;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Represents a container of properties and values for a Block
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,5 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.block;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Property;
 | 
			
		||||
import com.google.common.collect.ImmutableMap;
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.block;
 | 
			
		||||
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
 | 
			
		||||
@@ -1,21 +1,15 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.entity;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Location;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.world.Location;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Named;
 | 
			
		||||
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Unique;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.meta.MetadataHolder;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Entities can be a lot of things in MC
 | 
			
		||||
 * Entities can be monsters, animals, players, etc...
 | 
			
		||||
 */
 | 
			
		||||
public interface Entity extends Location, Named {
 | 
			
		||||
    /**
 | 
			
		||||
     * The UUID for this entity
 | 
			
		||||
     *
 | 
			
		||||
     * @return this entity's UUID
 | 
			
		||||
     */
 | 
			
		||||
    UUID getUUID();
 | 
			
		||||
public interface Entity extends Location, Named, Unique, MetadataHolder {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The Location for this entity
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,6 @@ package com.gmail.nossr50.core.mcmmo.entity;
 | 
			
		||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Nameable;
 | 
			
		||||
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Players
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.meta;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Represents custom state in the API
 | 
			
		||||
 * Mostly provided by plugins
 | 
			
		||||
 */
 | 
			
		||||
public interface Metadata {
 | 
			
		||||
    /**
 | 
			
		||||
     * The metadata key for this metadata
 | 
			
		||||
     * @return the metadata key
 | 
			
		||||
     */
 | 
			
		||||
    String getKey();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The value for this metadata key
 | 
			
		||||
     * @return the value of this metadata
 | 
			
		||||
     */
 | 
			
		||||
    Object getValue();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Replace the value in this metadata
 | 
			
		||||
     * @param newValue the replacement metadata value
 | 
			
		||||
     */
 | 
			
		||||
    void setValue(Object newValue);
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.meta;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A metadataHolder is something that can hold metadata
 | 
			
		||||
 * Both Bukkit and Sponge provide metadata APIs
 | 
			
		||||
 */
 | 
			
		||||
public interface MetadataHolder {
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the metadata for the appropriate key
 | 
			
		||||
     * @param key the key for the metadata
 | 
			
		||||
     * @return the metadata for this key
 | 
			
		||||
     */
 | 
			
		||||
    Metadata getMetadata(String key);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the metadata, will replace metadata with an existing key or add metadata if there was none
 | 
			
		||||
     * @param metadata metadata to add
 | 
			
		||||
     */
 | 
			
		||||
    void setMetadata(Metadata metadata);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.world;
 | 
			
		||||
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
 | 
			
		||||
@@ -1,4 +1,7 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.world;
 | 
			
		||||
 | 
			
		||||
import com.flowpowered.math.vector.Vector3d;
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.world.World;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This class represents a Location in MC
 | 
			
		||||
@@ -6,26 +9,32 @@ package com.gmail.nossr50.core.mcmmo;
 | 
			
		||||
 */
 | 
			
		||||
public interface Location {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The Vector3d of this location
 | 
			
		||||
     * @return this vector
 | 
			
		||||
     */
 | 
			
		||||
    Vector3d getVector();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the position of this location on the x-axis
 | 
			
		||||
     *
 | 
			
		||||
     * @return x-axis position
 | 
			
		||||
     */
 | 
			
		||||
    double getX();
 | 
			
		||||
    //double getX();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the position of this location on the y-axis
 | 
			
		||||
     *
 | 
			
		||||
     * @return y-axis position
 | 
			
		||||
     */
 | 
			
		||||
    double getY();
 | 
			
		||||
    //double getY();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the position of this location on the z-axis
 | 
			
		||||
     *
 | 
			
		||||
     * @return z-axis position
 | 
			
		||||
     */
 | 
			
		||||
    double getZ();
 | 
			
		||||
    //double getZ();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The world for this Location
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
package com.gmail.nossr50.core.mcmmo.world;
 | 
			
		||||
 | 
			
		||||
import com.gmail.nossr50.core.mcmmo.Unique;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Represents a world in MC
 | 
			
		||||
 */
 | 
			
		||||
public interface World extends Unique {
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the name of this World
 | 
			
		||||
     *
 | 
			
		||||
     * @return the name of this world
 | 
			
		||||
     */
 | 
			
		||||
    String getName();
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user