mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-10-14 23:47:46 +02:00
Added new sign structure
Signed-off-by: Grafe <flingelfrank@hotmail.com>
This commit is contained in:
parent
c96225bf57
commit
e9bad81bb5
@ -39,6 +39,7 @@ import com.dre.dungeonsxl.listener.EntityListener;
|
|||||||
import com.dre.dungeonsxl.listener.HangingListener;
|
import com.dre.dungeonsxl.listener.HangingListener;
|
||||||
import com.dre.dungeonsxl.listener.PlayerListener;
|
import com.dre.dungeonsxl.listener.PlayerListener;
|
||||||
import com.dre.dungeonsxl.listener.WorldListener;
|
import com.dre.dungeonsxl.listener.WorldListener;
|
||||||
|
import com.dre.dungeonsxl.signs.DSignTypeRoot;
|
||||||
|
|
||||||
public class P extends JavaPlugin{
|
public class P extends JavaPlugin{
|
||||||
public static P p;
|
public static P p;
|
||||||
@ -80,6 +81,9 @@ public class P extends JavaPlugin{
|
|||||||
|
|
||||||
//Init Commands
|
//Init Commands
|
||||||
new DCommandRoot();
|
new DCommandRoot();
|
||||||
|
|
||||||
|
//Init Signtypes
|
||||||
|
DSignTypeRoot.init();;
|
||||||
|
|
||||||
//InitFolders
|
//InitFolders
|
||||||
this.initFolders();
|
this.initFolders();
|
||||||
|
@ -46,6 +46,4 @@ public class DCommandRoot {
|
|||||||
this.commands.add(cmdHelp);
|
this.commands.add(cmdHelp);
|
||||||
this.commands.add(cmdReload);
|
this.commands.add(cmdReload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package com.dre.dungeonsxl.game;
|
|
||||||
|
|
||||||
public class DSign {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package com.dre.dungeonsxl.game;
|
|
||||||
|
|
||||||
public class DSignType {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,7 +7,6 @@ import java.io.IOException;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -23,11 +22,11 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Spider;
|
import org.bukkit.entity.Spider;
|
||||||
|
|
||||||
import com.dre.dungeonsxl.DClass;
|
|
||||||
import com.dre.dungeonsxl.DConfig;
|
import com.dre.dungeonsxl.DConfig;
|
||||||
import com.dre.dungeonsxl.DGSign;
|
|
||||||
import com.dre.dungeonsxl.DPlayer;
|
import com.dre.dungeonsxl.DPlayer;
|
||||||
import com.dre.dungeonsxl.P;
|
import com.dre.dungeonsxl.P;
|
||||||
|
import com.dre.dungeonsxl.signs.DSignType;
|
||||||
|
import com.dre.dungeonsxl.signs.DSignTypeRoot;
|
||||||
|
|
||||||
public class GameWorld {
|
public class GameWorld {
|
||||||
private static P p=P.p;
|
private static P p=P.p;
|
||||||
@ -79,160 +78,9 @@ public class GameWorld {
|
|||||||
Sign sign = (Sign) block.getState();
|
Sign sign = (Sign) block.getState();
|
||||||
String[] lines=sign.getLines();
|
String[] lines=sign.getLines();
|
||||||
|
|
||||||
if(!isPlaying){
|
for(DSignType signType : DSignTypeRoot.get()){
|
||||||
if (lines[1].equalsIgnoreCase("lobby")) {
|
if(lines[0].equalsIgnoreCase("["+signType.name+"]")){
|
||||||
this.locLobby=block.getLocation();
|
signType.onDungeonInit(sign, this);
|
||||||
block.setTypeId(0);
|
|
||||||
} else if (lines[1].equalsIgnoreCase("ready")) {
|
|
||||||
this.blocksReady.add(block);
|
|
||||||
sign.setLine(0, ChatColor.BLUE+"############");
|
|
||||||
sign.setLine(1, ChatColor.DARK_GREEN+"Ready");
|
|
||||||
sign.setLine(2, "");
|
|
||||||
sign.setLine(3, ChatColor.BLUE+"############");
|
|
||||||
sign.update();
|
|
||||||
} else if (lines[1].equalsIgnoreCase("leave")){
|
|
||||||
this.blocksLeave.add(block);
|
|
||||||
sign.setLine(0, ChatColor.BLUE+"############");
|
|
||||||
sign.setLine(1, ChatColor.DARK_GREEN+"Leave");
|
|
||||||
sign.setLine(2, "");
|
|
||||||
sign.setLine(3, ChatColor.BLUE+"############");
|
|
||||||
sign.update();
|
|
||||||
} else if (lines[1].equalsIgnoreCase("start")){
|
|
||||||
this.locStart=block.getLocation();
|
|
||||||
block.setTypeId(0);
|
|
||||||
} else if (lines[1].equalsIgnoreCase("end")){
|
|
||||||
this.blocksEnd.add(block);
|
|
||||||
sign.setLine(0, ChatColor.DARK_BLUE+"############");
|
|
||||||
sign.setLine(1, ChatColor.DARK_GREEN+"End");
|
|
||||||
sign.setLine(2, "");
|
|
||||||
sign.setLine(3, ChatColor.DARK_BLUE+"############");
|
|
||||||
sign.update();
|
|
||||||
} else if (lines[1].equalsIgnoreCase("classes")){
|
|
||||||
if(!config.isLobbyDisabled()){
|
|
||||||
int[] direction=DGSign.getDirection(block.getData());
|
|
||||||
int directionX=direction[0];
|
|
||||||
int directionZ=direction[1];
|
|
||||||
|
|
||||||
int xx=0,zz=0;
|
|
||||||
for(DClass dclass:this.config.getClasses()){
|
|
||||||
|
|
||||||
//Check existing signs
|
|
||||||
boolean isContinued=true;
|
|
||||||
for(Sign isusedsign:this.signClass){
|
|
||||||
if(dclass.name.equalsIgnoreCase(ChatColor.stripColor(isusedsign.getLine(1)))){
|
|
||||||
isContinued=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isContinued){
|
|
||||||
Block classBlock=block.getRelative(xx,0,zz);
|
|
||||||
|
|
||||||
if(classBlock.getData()==sign.getData().getData()&&classBlock.getTypeId()==68&&(classBlock.getState() instanceof Sign)){
|
|
||||||
Sign classSign = (Sign) classBlock.getState();
|
|
||||||
|
|
||||||
classSign.setLine(0, ChatColor.DARK_BLUE+"############");
|
|
||||||
classSign.setLine(1, ChatColor.DARK_GREEN+dclass.name);
|
|
||||||
classSign.setLine(2, "");
|
|
||||||
classSign.setLine(3, ChatColor.DARK_BLUE+"############");
|
|
||||||
classSign.update();
|
|
||||||
this.signClass.add(classSign);
|
|
||||||
}else{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
xx=xx+directionX;
|
|
||||||
zz=zz+directionZ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (lines[1].equalsIgnoreCase("chunkupdater")){
|
|
||||||
Chunk chunk = this.world.getChunkAt(block);
|
|
||||||
if(!lines[2].equals("")){
|
|
||||||
Integer radius = p.parseInt(lines[2]);
|
|
||||||
for(int x = -radius; x<radius; x++){
|
|
||||||
for(int z = -radius; z<radius; z++){
|
|
||||||
Chunk chunk1 = this.world.getChunkAt(chunk.getX()-x,chunk.getZ()-z);
|
|
||||||
chunk1.load();
|
|
||||||
this.loadedChunks.add(chunk1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
chunk.load();
|
|
||||||
this.loadedChunks.add(chunk);
|
|
||||||
}
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
if(lines[1].equalsIgnoreCase("mob")){
|
|
||||||
if(lines[2]!=""&&lines[3]!=""){
|
|
||||||
String mob=lines[2];
|
|
||||||
if(mob!=null){
|
|
||||||
String[] atributes=lines[3].split(",");
|
|
||||||
if(atributes.length==3){
|
|
||||||
new MobSpawner(block, mob, p.parseInt(atributes[0]), p.parseInt(atributes[1]), p.parseInt(atributes[2]),0);
|
|
||||||
}
|
|
||||||
if(atributes.length==4){
|
|
||||||
new MobSpawner(block, mob, p.parseInt(atributes[0]), p.parseInt(atributes[1]), p.parseInt(atributes[2]),p.parseInt(atributes[3]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
if(lines[1].equalsIgnoreCase("place")){
|
|
||||||
placeableBlocks.add(new GamePlaceableBlock(block, lines[2], lines[3]) );
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
if(lines[1].equalsIgnoreCase("msg")){
|
|
||||||
if(lines[2]!=""&&lines[3]!=""){
|
|
||||||
String msg = config.getMsg(p.parseInt(lines[2]),true);
|
|
||||||
if(msg!=null){
|
|
||||||
messages.add(new GameMessage(block.getLocation(),msg,p.parseInt(lines[3]),false));
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(lines[1].equalsIgnoreCase("soundmsg")){
|
|
||||||
if(lines[2]!=""&&lines[3]!=""){
|
|
||||||
String msg = config.getMsg(p.parseInt(lines[2]),true);
|
|
||||||
if(msg!=null){
|
|
||||||
messages.add(new GameMessage(block.getLocation(),msg,p.parseInt(lines[3]),true));
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(lines[1].equalsIgnoreCase("checkpoint")){
|
|
||||||
int radius=0;
|
|
||||||
|
|
||||||
|
|
||||||
if(lines[2]!=null ){
|
|
||||||
if(lines[2].length()>0){
|
|
||||||
radius=p.parseInt(lines[2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new GameCheckpoint(this,block.getLocation(),radius);
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
|
||||||
if(lines[1].equalsIgnoreCase("chest")){
|
|
||||||
if(sign.getTypeId()==63){
|
|
||||||
for(int x=-1;x<=1;x++){
|
|
||||||
if(sign.getBlock().getRelative(x, 0, 0).getTypeId()==54){
|
|
||||||
new GameChest(sign.getBlock().getRelative(x, 0, 0),this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int z=-1;z<=1;z++){
|
|
||||||
if(sign.getBlock().getRelative(0, 0, z).getTypeId()==54){
|
|
||||||
if(sign.getBlock().getRelative(0, 0, z)!=null){
|
|
||||||
new GameChest(sign.getBlock().getRelative(0, 0, z),this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
block.setTypeId(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/com/dre/dungeonsxl/signs/DSignType.java
Normal file
18
src/com/dre/dungeonsxl/signs/DSignType.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.P;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public abstract class DSignType {
|
||||||
|
public static P p = P.p;
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
public String permissions;
|
||||||
|
public boolean onInit;
|
||||||
|
|
||||||
|
public abstract boolean check(Sign sign);
|
||||||
|
public abstract void onDungeonInit(Sign sign, GameWorld gworld);
|
||||||
|
public abstract void onTrigger(Sign sign, GameWorld gworld);
|
||||||
|
}
|
43
src/com/dre/dungeonsxl/signs/DSignTypeRoot.java
Normal file
43
src/com/dre/dungeonsxl/signs/DSignTypeRoot.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
public class DSignTypeRoot {
|
||||||
|
private static CopyOnWriteArrayList<DSignType> signTypes = new CopyOnWriteArrayList<DSignType>();
|
||||||
|
|
||||||
|
//SignTypes
|
||||||
|
private static SIGNCheckpoint signCheckpoint = new SIGNCheckpoint();
|
||||||
|
private static SIGNChest signChest = new SIGNChest();
|
||||||
|
private static SIGNChunkUpdater signChunkUpdater = new SIGNChunkUpdater();
|
||||||
|
private static SIGNClasses signClasses = new SIGNClasses();
|
||||||
|
private static SIGNEnd signEnd = new SIGNEnd();
|
||||||
|
private static SIGNLeave signLeave = new SIGNLeave();
|
||||||
|
private static SIGNLobby signLobby = new SIGNLobby();
|
||||||
|
private static SIGNMob signMob = new SIGNMob();
|
||||||
|
private static SIGNMsg signMsg = new SIGNMsg();
|
||||||
|
private static SIGNPlace signPlace = new SIGNPlace();
|
||||||
|
private static SIGNReady signReady = new SIGNReady();
|
||||||
|
private static SIGNSoundMsg signSoundMsg = new SIGNSoundMsg();
|
||||||
|
private static SIGNStart signStart = new SIGNStart();
|
||||||
|
|
||||||
|
//Methods
|
||||||
|
public static void init(){
|
||||||
|
signTypes.add(signCheckpoint);
|
||||||
|
signTypes.add(signChest);
|
||||||
|
signTypes.add(signChunkUpdater);
|
||||||
|
signTypes.add(signClasses);
|
||||||
|
signTypes.add(signEnd);
|
||||||
|
signTypes.add(signLeave);
|
||||||
|
signTypes.add(signLobby);
|
||||||
|
signTypes.add(signMob);
|
||||||
|
signTypes.add(signMsg);
|
||||||
|
signTypes.add(signPlace);
|
||||||
|
signTypes.add(signReady);
|
||||||
|
signTypes.add(signSoundMsg);
|
||||||
|
signTypes.add(signStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CopyOnWriteArrayList<DSignType> get(){
|
||||||
|
return signTypes;
|
||||||
|
}
|
||||||
|
}
|
37
src/com/dre/dungeonsxl/signs/SIGNCheckpoint.java
Normal file
37
src/com/dre/dungeonsxl/signs/SIGNCheckpoint.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.game.GameCheckpoint;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNCheckpoint extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
String lines[] = sign.getLines();
|
||||||
|
int radius = 0;
|
||||||
|
|
||||||
|
if(lines[2] != null ){
|
||||||
|
if(lines[2].length() > 0){
|
||||||
|
radius = p.parseInt(lines[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new GameCheckpoint(gworld, sign.getLocation(), radius);
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
43
src/com/dre/dungeonsxl/signs/SIGNChest.java
Normal file
43
src/com/dre/dungeonsxl/signs/SIGNChest.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.game.GameChest;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNChest extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
if(sign.getTypeId()==63){
|
||||||
|
for(int x=-1;x<=1;x++){
|
||||||
|
if(sign.getBlock().getRelative(x, 0, 0).getTypeId()==54){
|
||||||
|
new GameChest(sign.getBlock().getRelative(x, 0, 0), gworld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int z=-1;z<=1;z++){
|
||||||
|
if(sign.getBlock().getRelative(0, 0, z).getTypeId()==54){
|
||||||
|
if(sign.getBlock().getRelative(0, 0, z)!=null){
|
||||||
|
new GameChest(sign.getBlock().getRelative(0, 0, z), gworld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
41
src/com/dre/dungeonsxl/signs/SIGNChunkUpdater.java
Normal file
41
src/com/dre/dungeonsxl/signs/SIGNChunkUpdater.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNChunkUpdater extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
String lines[] = sign.getLines();
|
||||||
|
Chunk chunk = gworld.world.getChunkAt(sign.getBlock());
|
||||||
|
if(!lines[2].equals("")){
|
||||||
|
Integer radius = p.parseInt(lines[2]);
|
||||||
|
for(int x = -radius; x<radius; x++){
|
||||||
|
for(int z = -radius; z<radius; z++){
|
||||||
|
Chunk chunk1 = gworld.world.getChunkAt(chunk.getX()-x,chunk.getZ()-z);
|
||||||
|
chunk1.load();
|
||||||
|
gworld.loadedChunks.add(chunk1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
chunk.load();
|
||||||
|
gworld.loadedChunks.add(chunk);
|
||||||
|
}
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
67
src/com/dre/dungeonsxl/signs/SIGNClasses.java
Normal file
67
src/com/dre/dungeonsxl/signs/SIGNClasses.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.DClass;
|
||||||
|
import com.dre.dungeonsxl.DGSign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNClasses extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
if(!gworld.config.isLobbyDisabled()){
|
||||||
|
int[] direction=DGSign.getDirection(sign.getBlock().getData());
|
||||||
|
int directionX=direction[0];
|
||||||
|
int directionZ=direction[1];
|
||||||
|
|
||||||
|
int xx=0,zz=0;
|
||||||
|
for(DClass dclass:gworld.config.getClasses()){
|
||||||
|
|
||||||
|
//Check existing signs
|
||||||
|
boolean isContinued=true;
|
||||||
|
for(Sign isusedsign:gworld.signClass){
|
||||||
|
if(dclass.name.equalsIgnoreCase(ChatColor.stripColor(isusedsign.getLine(1)))){
|
||||||
|
isContinued=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isContinued){
|
||||||
|
Block classBlock=sign.getBlock().getRelative(xx,0,zz);
|
||||||
|
|
||||||
|
if(classBlock.getData()==sign.getData().getData()&&classBlock.getTypeId()==68&&(classBlock.getState() instanceof Sign)){
|
||||||
|
Sign classSign = (Sign) classBlock.getState();
|
||||||
|
|
||||||
|
classSign.setLine(0, ChatColor.DARK_BLUE+"############");
|
||||||
|
classSign.setLine(1, ChatColor.DARK_GREEN+dclass.name);
|
||||||
|
classSign.setLine(2, "");
|
||||||
|
classSign.setLine(3, ChatColor.DARK_BLUE+"############");
|
||||||
|
classSign.update();
|
||||||
|
gworld.signClass.add(classSign);
|
||||||
|
}else{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
xx=xx+directionX;
|
||||||
|
zz=zz+directionZ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
30
src/com/dre/dungeonsxl/signs/SIGNEnd.java
Normal file
30
src/com/dre/dungeonsxl/signs/SIGNEnd.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNEnd extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
gworld.blocksEnd.add(sign.getBlock());
|
||||||
|
sign.setLine(0, ChatColor.DARK_BLUE+"############");
|
||||||
|
sign.setLine(1, ChatColor.DARK_GREEN+"End");
|
||||||
|
sign.setLine(2, "");
|
||||||
|
sign.setLine(3, ChatColor.DARK_BLUE+"############");
|
||||||
|
sign.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
30
src/com/dre/dungeonsxl/signs/SIGNLeave.java
Normal file
30
src/com/dre/dungeonsxl/signs/SIGNLeave.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNLeave extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
gworld.blocksLeave.add(sign.getBlock());
|
||||||
|
sign.setLine(0, ChatColor.BLUE+"############");
|
||||||
|
sign.setLine(1, ChatColor.DARK_GREEN+"Leave");
|
||||||
|
sign.setLine(2, "");
|
||||||
|
sign.setLine(3, ChatColor.BLUE+"############");
|
||||||
|
sign.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
25
src/com/dre/dungeonsxl/signs/SIGNLobby.java
Normal file
25
src/com/dre/dungeonsxl/signs/SIGNLobby.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNLobby extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
gworld.locLobby = sign.getLocation();
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
39
src/com/dre/dungeonsxl/signs/SIGNMob.java
Normal file
39
src/com/dre/dungeonsxl/signs/SIGNMob.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
import com.dre.dungeonsxl.game.MobSpawner;
|
||||||
|
|
||||||
|
public class SIGNMob extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
String lines[] = sign.getLines();
|
||||||
|
if(lines[2]!=""&&lines[3]!=""){
|
||||||
|
String mob=lines[2];
|
||||||
|
if(mob!=null){
|
||||||
|
String[] atributes=lines[3].split(",");
|
||||||
|
if(atributes.length==3){
|
||||||
|
new MobSpawner(sign.getBlock(), mob, p.parseInt(atributes[0]), p.parseInt(atributes[1]), p.parseInt(atributes[2]),0);
|
||||||
|
}
|
||||||
|
if(atributes.length==4){
|
||||||
|
new MobSpawner(sign.getBlock(), mob, p.parseInt(atributes[0]), p.parseInt(atributes[1]), p.parseInt(atributes[2]),p.parseInt(atributes[3]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
35
src/com/dre/dungeonsxl/signs/SIGNMsg.java
Normal file
35
src/com/dre/dungeonsxl/signs/SIGNMsg.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.game.GameMessage;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNMsg extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
String lines[] = sign.getLines();
|
||||||
|
|
||||||
|
if(lines[2]!=""&&lines[3]!=""){
|
||||||
|
String msg = gworld.config.getMsg(p.parseInt(lines[2]),true);
|
||||||
|
if(msg!=null){
|
||||||
|
gworld.messages.add(new GameMessage(sign.getBlock().getLocation(), msg,p.parseInt(lines[3]), false));
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
29
src/com/dre/dungeonsxl/signs/SIGNPlace.java
Normal file
29
src/com/dre/dungeonsxl/signs/SIGNPlace.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.game.GamePlaceableBlock;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNPlace extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
String lines[] = sign.getLines();
|
||||||
|
gworld.placeableBlocks.add(new GamePlaceableBlock(sign.getBlock(), lines[2], lines[3]) );
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
30
src/com/dre/dungeonsxl/signs/SIGNReady.java
Normal file
30
src/com/dre/dungeonsxl/signs/SIGNReady.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNReady extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
gworld.blocksReady.add(sign.getBlock());
|
||||||
|
sign.setLine(0, ChatColor.BLUE+"############");
|
||||||
|
sign.setLine(1, ChatColor.DARK_GREEN+"Ready");
|
||||||
|
sign.setLine(2, "");
|
||||||
|
sign.setLine(3, ChatColor.BLUE+"############");
|
||||||
|
sign.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
35
src/com/dre/dungeonsxl/signs/SIGNSoundMsg.java
Normal file
35
src/com/dre/dungeonsxl/signs/SIGNSoundMsg.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
|
||||||
|
import com.dre.dungeonsxl.game.GameMessage;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNSoundMsg extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
String lines[] = sign.getLines();
|
||||||
|
|
||||||
|
if(lines[2]!=""&&lines[3]!=""){
|
||||||
|
String msg = gworld.config.getMsg(p.parseInt(lines[2]),true);
|
||||||
|
if(msg!=null){
|
||||||
|
gworld.messages.add(new GameMessage(sign.getBlock().getLocation(), msg,p.parseInt(lines[3]), true));
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
26
src/com/dre/dungeonsxl/signs/SIGNStart.java
Normal file
26
src/com/dre/dungeonsxl/signs/SIGNStart.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.dre.dungeonsxl.signs;
|
||||||
|
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import com.dre.dungeonsxl.game.GameWorld;
|
||||||
|
|
||||||
|
public class SIGNStart extends DSignType{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(Sign sign) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDungeonInit(Sign sign, GameWorld gworld) {
|
||||||
|
gworld.locStart = sign.getLocation();
|
||||||
|
sign.setTypeId(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTrigger(Sign sign, GameWorld gworld) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user