Skip to content

Commit 4922c5d

Browse files
committed
First Commit
0 parents  commit 4922c5d

File tree

15 files changed

+661
-0
lines changed

15 files changed

+661
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
ServerNPC API.iml

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ServerNPC-API
2+
3+
### Add this to your pom
4+
5+
Repository
6+
```
7+
<repository>
8+
<id>jitpack.io</id>
9+
<url>https://jitpack.io</url>
10+
</repository>
11+
```
12+
13+
Dependency
14+
```
15+
<dependency>
16+
<groupId>com.github.SnakeStudios</groupId>
17+
<artifactId>ServerNPC-API</artifactId>
18+
<version>v1.0.1</version>
19+
</dependency>
20+
```

pom.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>com.isnakebuzz</groupId>
8+
<artifactId>ServerNPC</artifactId>
9+
<version>1.0.0</version>
10+
<build>
11+
<plugins>
12+
<plugin>
13+
<groupId>org.apache.maven.plugins</groupId>
14+
<artifactId>maven-compiler-plugin</artifactId>
15+
<configuration>
16+
<source>8</source>
17+
<target>8</target>
18+
</configuration>
19+
</plugin>
20+
</plugins>
21+
</build>
22+
23+
24+
<distributionManagement>
25+
<repository>
26+
<id>github</id>
27+
<name>GitHub SnakeStudios Apache Maven Packages</name>
28+
<url>https://maven.pkg.github.com/SnakeStudios/ServerNPC-API</url>
29+
</repository>
30+
</distributionManagement>
31+
32+
33+
<dependencies>
34+
<!--Spigot-API-->
35+
<dependency>
36+
<groupId>org.spigotmc</groupId>
37+
<artifactId>spigot</artifactId>
38+
<version>1.16.1</version>
39+
<scope>system</scope>
40+
<systemPath>${project.basedir}/Lib/spigot-1.16.1.jar</systemPath>
41+
</dependency>
42+
43+
<!--UTILS-->
44+
<dependency>
45+
<groupId>org.projectlombok</groupId>
46+
<artifactId>lombok</artifactId>
47+
<version>1.18.12</version>
48+
<scope>provided</scope>
49+
</dependency>
50+
</dependencies>
51+
52+
</project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.isnakebuzz.servernpc.API;
2+
3+
import com.isnakebuzz.servernpc.Holograms.SnakeHologram;
4+
import com.isnakebuzz.servernpc.NPC.SnakeNPC;
5+
import com.isnakebuzz.servernpc.NPC.Utilities.NPCSettings;
6+
import com.isnakebuzz.servernpc.Skins.SkinData;
7+
import org.bukkit.Location;
8+
9+
import java.util.UUID;
10+
11+
public interface ServerNPCAPI {
12+
13+
/**
14+
* Create a NPC with skin data
15+
*
16+
* @param name Name for the NPC
17+
* @param uuid UUID for the NPC
18+
* @param npcSettings Settings for the NPC
19+
* @param skinData NPC Skin data
20+
* @param location Locations for the NPC
21+
* @param hologram Hologram if has created
22+
* @return SnakeNPC
23+
* @throws Exception
24+
*/
25+
SnakeNPC createNPC(String name, UUID uuid, NPCSettings npcSettings, SkinData skinData, Location location, SnakeHologram hologram) throws Exception;
26+
27+
/**
28+
* Create a NPC with names
29+
*
30+
* @param name Name of the NPC
31+
* @param uuid UUID of the NPC
32+
* @param npcSettings Settings for the NPC
33+
* @param skinName PlayerName or the SkinName
34+
* @param location Locations of the NPC
35+
* @param hologram Hologram if has created.
36+
* @return SnakeNPC
37+
* @throws Exception
38+
*/
39+
SnakeNPC createNPC(String name, UUID uuid, NPCSettings npcSettings, String skinName, Location location, SnakeHologram hologram) throws Exception;
40+
41+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.isnakebuzz.servernpc.Events;
2+
3+
import com.isnakebuzz.servernpc.NPC.SnakeNPC;
4+
import org.bukkit.entity.Player;
5+
import org.bukkit.event.Event;
6+
7+
public abstract class NPCEvent extends Event {
8+
9+
private Player player;
10+
private SnakeNPC npc;
11+
12+
public NPCEvent(Player player, SnakeNPC npc) {
13+
this.player = player;
14+
this.npc = npc;
15+
}
16+
17+
public Player getPlayer() {
18+
return this.player;
19+
}
20+
21+
public SnakeNPC getSnakeNPC() {
22+
return npc;
23+
}
24+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.isnakebuzz.servernpc.Events;
2+
3+
import com.isnakebuzz.servernpc.NPC.SnakeNPC;
4+
import org.bukkit.entity.Player;
5+
import org.bukkit.event.Cancellable;
6+
import org.bukkit.event.HandlerList;
7+
8+
public class NPCInteractEvent extends NPCEvent implements Cancellable {
9+
10+
private static final HandlerList handlers = new HandlerList();
11+
private final Player player;
12+
private final ClickType clickType;
13+
private final SnakeNPC npc;
14+
private boolean cancelled;
15+
16+
public NPCInteractEvent(Player player, ClickType clickType, SnakeNPC npc) {
17+
super(player, npc);
18+
this.player = player;
19+
this.clickType = clickType;
20+
this.npc = npc;
21+
}
22+
23+
public static HandlerList getHandlerList() {
24+
return handlers;
25+
}
26+
27+
public Player getWhoClicked() {
28+
return this.player;
29+
}
30+
31+
public ClickType getClickType() {
32+
return this.clickType;
33+
}
34+
35+
public SnakeNPC getSnakeNPC() {
36+
return this.npc;
37+
}
38+
39+
public HandlerList getHandlers() {
40+
return handlers;
41+
}
42+
43+
@Override
44+
public boolean isCancelled() {
45+
return cancelled;
46+
}
47+
48+
@Override
49+
public void setCancelled(boolean b) {
50+
this.cancelled = b;
51+
}
52+
53+
public enum ClickType {
54+
LEFT_CLICK, RIGHT_CLICK
55+
}
56+
57+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.isnakebuzz.servernpc.Events;
2+
3+
import org.bukkit.event.Event;
4+
import org.bukkit.event.HandlerList;
5+
6+
public class NPCLoadEvent extends Event {
7+
8+
private static final HandlerList handlers = new HandlerList();
9+
10+
public static HandlerList getHandlerList() {
11+
return handlers;
12+
}
13+
14+
public HandlerList getHandlers() {
15+
return handlers;
16+
}
17+
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.isnakebuzz.servernpc.Events;
2+
3+
import org.bukkit.event.Event;
4+
import org.bukkit.event.HandlerList;
5+
6+
public class NPCUnloadEvent extends Event {
7+
8+
private static final HandlerList handlers = new HandlerList();
9+
10+
public static HandlerList getHandlerList() {
11+
return handlers;
12+
}
13+
14+
public HandlerList getHandlers() {
15+
return handlers;
16+
}
17+
18+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package com.isnakebuzz.servernpc.Holograms;
2+
3+
import org.bukkit.Location;
4+
5+
import java.util.List;
6+
7+
public interface SnakeHologram extends Cloneable {
8+
9+
/**
10+
* Spawn hologram to all entities
11+
*/
12+
void spawn();
13+
14+
/**
15+
* Get location of hologram
16+
*
17+
* @return Location of Hologram
18+
*/
19+
Location getLocation();
20+
21+
/**
22+
* Set location of hologram
23+
*
24+
* @param location is the new Location to Hologram
25+
*/
26+
void setLocation(Location location);
27+
28+
/**
29+
* Get lines of hologram
30+
*
31+
* @return lines of hologram
32+
*/
33+
List<String> getLines();
34+
35+
/**
36+
* Set new lines for the Hologram
37+
*
38+
* @param lines of the hologram
39+
*/
40+
void setLines(List<String> lines);
41+
42+
/**
43+
* Get height of hologram
44+
*
45+
* @return height of hologram
46+
*/
47+
double getHeight();
48+
49+
/**
50+
* Set height of hologram
51+
*
52+
* @param height of hologram
53+
*/
54+
void setHeight(double height);
55+
56+
/**
57+
* Recreate hologram
58+
*/
59+
void reload();
60+
61+
/**
62+
* Clone Hologram
63+
*/
64+
SnakeHologram clone();
65+
66+
/**
67+
* Delete hologram
68+
*/
69+
void delete();
70+
71+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.isnakebuzz.servernpc;
2+
3+
import com.isnakebuzz.servernpc.API.ServerNPCAPI;
4+
import com.isnakebuzz.servernpc.Holograms.SnakeHologram;
5+
import com.isnakebuzz.servernpc.NPC.SnakeNPC;
6+
import com.isnakebuzz.servernpc.NPC.Utilities.NPCSettings;
7+
import com.isnakebuzz.servernpc.Skins.SkinData;
8+
import org.bukkit.Location;
9+
10+
import java.util.UUID;
11+
12+
public interface Main {
13+
14+
/**
15+
* Get the API
16+
*
17+
* @return ServerNPCAPI
18+
*/
19+
static ServerNPCAPI getAPI() {
20+
return new ServerNPCAPI() {
21+
@Override
22+
public SnakeNPC createNPC(String name, UUID uuid, NPCSettings npcSettings, SkinData skinData, Location location, SnakeHologram hologram) throws Exception {
23+
return null;
24+
}
25+
26+
@Override
27+
public SnakeNPC createNPC(String name, UUID uuid, NPCSettings npcSettings, String skinName, Location location, SnakeHologram hologram) throws Exception {
28+
return null;
29+
}
30+
};
31+
}
32+
33+
34+
}

0 commit comments

Comments
 (0)