Moved MobSpawner to SIGNMob

Changed the DSign logic

Signed-off-by: Grafe <flingelfrank@hotmail.com>
This commit is contained in:
Grafe 2013-03-26 13:28:28 +01:00
parent 44b20fce67
commit 7846ecdc74
20 changed files with 293 additions and 273 deletions

View File

@ -92,8 +92,14 @@ public class DMobType {
}
}
/* Set Health */
if(maxHealth > 0){
entity.setMaxHealth(maxHealth);
entity.setHealth(maxHealth);
}
/* Spawn Mob */
new DMob(entity, maxHealth, gWorld, this);
new DMob(entity, gWorld, this);
}
}

View File

@ -32,14 +32,12 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.dre.dungeonsxl.commands.DCommandRoot;
import com.dre.dungeonsxl.game.GameCheckpoint;
import com.dre.dungeonsxl.game.GameWorld;
import com.dre.dungeonsxl.game.MobSpawner;
import com.dre.dungeonsxl.listener.BlockListener;
import com.dre.dungeonsxl.listener.CommandListener;
import com.dre.dungeonsxl.listener.EntityListener;
import com.dre.dungeonsxl.listener.HangingListener;
import com.dre.dungeonsxl.listener.PlayerListener;
import com.dre.dungeonsxl.listener.WorldListener;
import com.dre.dungeonsxl.signs.DSignRoot;
public class P extends JavaPlugin{
public static P p;
@ -81,9 +79,6 @@ public class P extends JavaPlugin{
//Init Commands
new DCommandRoot();
//Init Signtypes
DSignRoot.init();;
//InitFolders
this.initFolders();
@ -145,7 +140,6 @@ public class P extends JavaPlugin{
LeaveSign.lsigns.clear();
DCommandRoot.root.commands.clear();
GameCheckpoint.gcheckpoints.clear();
MobSpawner.mobspawners.clear();
//Delete Worlds
GameWorld.deleteAll();
@ -195,7 +189,6 @@ public class P extends JavaPlugin{
p.getServer().getScheduler().scheduleSyncRepeatingTask(p, new Runnable() {
public void run() {
MobSpawner.updateAll();
GameWorld.update();
GameCheckpoint.update();
DPlayer.update(true);

View File

@ -14,7 +14,7 @@ public class DMob {
public LivingEntity entity;
public DMobType type;
public DMob(LivingEntity entity, int live, GameWorld gworld, DMobType type){
public DMob(LivingEntity entity, GameWorld gworld, DMobType type){
gworld.dmobs.add(this);
this.entity = entity;
@ -26,12 +26,6 @@ public class DMob {
this.entity.getEquipment().setLeggingsDropChance(0);
this.entity.getEquipment().setBootsDropChance(0);
this.entity.getEquipment().setItemInHandDropChance(0);
/* Max Health */
if(live>0){
this.entity.setMaxHealth(live);
this.entity.setHealth(live);
}
}
//Statics

View File

@ -26,7 +26,6 @@ import com.dre.dungeonsxl.DConfig;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.P;
import com.dre.dungeonsxl.signs.DSign;
import com.dre.dungeonsxl.signs.DSignRoot;
public class GameWorld {
private static P p=P.p;
@ -76,13 +75,7 @@ public class GameWorld {
public void checkSign(Block block){
if((block.getState() instanceof Sign)){
Sign sign = (Sign) block.getState();
String[] lines=sign.getLines();
for(DSign signType : DSignRoot.get()){
if(lines[0].equalsIgnoreCase("["+signType.name+"]")){
signType.onDungeonInit(sign, this);
}
}
DSign.create(sign, this);
}
}

View File

@ -1,98 +0,0 @@
package com.dre.dungeonsxl.game;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import com.dre.dungeonsxl.DMobType;
public class MobSpawner {
public static CopyOnWriteArrayList<MobSpawner> mobspawners=new CopyOnWriteArrayList<MobSpawner>();
//Variables
private String mob;
private Block block;
private int maxinterval;
private int interval=0;
private int amount;
private int radius;
private int live;
public MobSpawner(Block block, String mob, int interval, int amount, int radius, int live){
mobspawners.add(this);
this.block=block;
this.mob=mob;
this.maxinterval=interval;
this.amount=amount;
this.radius=radius;
this.live=live;
}
public void update(){
World world=this.block.getWorld();
GameWorld gworld = GameWorld.get(world);
if(gworld != null){
for(Player player:world.getPlayers()){
if(player.getWorld()==world){
if(player.getLocation().distance(this.block.getLocation())<this.radius){
if(this.interval<=0){
//Check normal mobs
if(EntityType.fromName(this.mob)!=null){
if(EntityType.fromName(this.mob).isAlive()){
LivingEntity entity=(LivingEntity)world.spawnEntity(this.block.getLocation(), EntityType.fromName(this.mob));
//Add Bow to normal Skeletons
if(entity.getType() == EntityType.SKELETON){
Skeleton skeleton = (Skeleton) entity;
if(skeleton.getSkeletonType()==SkeletonType.NORMAL){
skeleton.getEquipment().setItemInHand(new ItemStack(Material.BOW));
}
}
new DMob(entity,this.live,GameWorld.get(world),null);
}
}
//Check custom mobs
DMobType mobType = DMobType.get(this.mob, gworld.config.getMobTypes());
if(mobType!=null){
mobType.spawn(GameWorld.get(world), this.block.getLocation());
}
//Set the amount
if(amount!=-1){
if(amount>1){
amount--;
}else{
mobspawners.remove(this);
}
}
this.interval=this.maxinterval;
}
this.interval--;
return;
}
}
}
}
}
//Static
public static void updateAll(){
for(MobSpawner spawner:mobspawners){
spawner.update();
}
}
}

View File

@ -6,13 +6,62 @@ import com.dre.dungeonsxl.P;
import com.dre.dungeonsxl.game.GameWorld;
public abstract class DSign {
public static P p = P.p;
protected static P p = P.p;
public String name;
public String permissions;
public boolean onInit;
public static String name = "";
public static String buildPermissions = "";
public static boolean onDungeonInit = false;
protected Sign sign;
protected GameWorld gworld;
public DSign(Sign sign, GameWorld gworld){
this.sign = sign;
this.gworld = gworld;
}
public abstract boolean check(Sign sign);
public abstract void onDungeonInit(Sign sign, GameWorld gworld);
public abstract void onTrigger(Sign sign, GameWorld gworld);
public void onInit(){
}
public void onTrigger(){
}
public static DSign create(Sign sign, GameWorld gworld){
String[] lines = sign.getLines();
DSign dSign = null;
if(lines[0].equalsIgnoreCase("["+SIGNCheckpoint.name+"]")) {
dSign = new SIGNCheckpoint(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNChest.name+"]")) {
dSign = new SIGNChest(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNChunkUpdater.name+"]")) {
dSign = new SIGNChunkUpdater(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNClasses.name+"]")) {
dSign = new SIGNClasses(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNEnd.name+"]")) {
dSign = new SIGNEnd(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNLeave.name+"]")) {
dSign = new SIGNLeave(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNLobby.name+"]")) {
dSign = new SIGNLobby(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNMob.name+"]")) {
dSign = new SIGNMob(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNMsg.name+"]")) {
dSign = new SIGNMsg(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNPlace.name+"]")) {
dSign = new SIGNPlace(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNReady.name+"]")) {
dSign = new SIGNReady(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNSoundMsg.name+"]")) {
dSign = new SIGNSoundMsg(sign, gworld);
} else if (lines[0].equalsIgnoreCase("["+SIGNStart.name+"]")) {
dSign = new SIGNStart(sign, gworld);
}
return dSign;
}
}

View File

@ -1,43 +0,0 @@
package com.dre.dungeonsxl.signs;
import java.util.concurrent.CopyOnWriteArrayList;
public class DSignRoot {
private static CopyOnWriteArrayList<DSign> signTypes = new CopyOnWriteArrayList<DSign>();
//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<DSign> get(){
return signTypes;
}
}

View File

@ -6,7 +6,16 @@ import com.dre.dungeonsxl.game.GameCheckpoint;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNCheckpoint extends DSign{
public static String name = "Checkpoint";
public static String buildPermissions = "dxl.sign.checkpoint";
public static boolean onDungeonInit = false;
public SIGNCheckpoint(Sign sign, GameWorld gworld) {
super(sign, gworld);
// TODO Auto-generated constructor stub
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -15,13 +24,13 @@ public class SIGNCheckpoint extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
String lines[] = sign.getLines();
int radius = 0;
if(lines[2] != null ){
if(lines[2].length() > 0){
radius = p.parseInt(lines[2]);
if(lines[1] != null ){
if(lines[1].length() > 0){
radius = p.parseInt(lines[1]);
}
}
@ -30,7 +39,7 @@ public class SIGNCheckpoint extends DSign{
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
public void onTrigger() {
// TODO Auto-generated method stub
}

View File

@ -6,7 +6,15 @@ import com.dre.dungeonsxl.game.GameChest;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNChest extends DSign{
public static String name = "Chest";
public static String buildPermissions = "dxl.sign.chest";
public static boolean onDungeonInit = false;
public SIGNChest(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -15,7 +23,7 @@ public class SIGNChest extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
if(sign.getTypeId()==63){
for(int x=-1;x<=1;x++){
if(sign.getBlock().getRelative(x, 0, 0).getTypeId()==54){
@ -34,10 +42,4 @@ public class SIGNChest extends DSign{
sign.setTypeId(0);
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
// TODO Auto-generated method stub
}
}

View File

@ -5,7 +5,16 @@ import org.bukkit.block.Sign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNChunkUpdater extends DSign{
public static String name = "ChunkUpdater";
public static String buildPermissions = "dxl.sign.chunkupdater";
public static boolean onDungeonInit = true;
public SIGNChunkUpdater(Sign sign, GameWorld gworld) {
super(sign, gworld);
// TODO Auto-generated constructor stub
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -14,11 +23,11 @@ public class SIGNChunkUpdater extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
String lines[] = sign.getLines();
Chunk chunk = gworld.world.getChunkAt(sign.getBlock());
if(!lines[2].equals("")){
Integer radius = p.parseInt(lines[2]);
if(!lines[1].equals("")){
Integer radius = p.parseInt(lines[1]);
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);
@ -32,10 +41,4 @@ public class SIGNChunkUpdater extends DSign{
}
sign.setTypeId(0);
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
// TODO Auto-generated method stub
}
}

View File

@ -9,7 +9,16 @@ import com.dre.dungeonsxl.DGSign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNClasses extends DSign{
public static String name = "Classes";
public static String buildPermissions = "dxl.sign.classes";
public static boolean onDungeonInit = true;
public SIGNClasses(Sign sign, GameWorld gworld) {
super(sign, gworld);
// TODO Auto-generated constructor stub
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -18,7 +27,7 @@ public class SIGNClasses extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
if(!gworld.config.isLobbyDisabled()){
int[] direction=DGSign.getDirection(sign.getBlock().getData());
int directionX=direction[0];
@ -58,10 +67,4 @@ public class SIGNClasses extends DSign{
sign.setTypeId(0);
}
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
// TODO Auto-generated method stub
}
}

View File

@ -5,7 +5,15 @@ import org.bukkit.block.Sign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNEnd extends DSign{
public static String name = "End";
public static String buildPermissions = "dxl.sign.end";
public static boolean onDungeonInit = false;
public SIGNEnd(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -14,7 +22,7 @@ public class SIGNEnd extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
gworld.blocksEnd.add(sign.getBlock());
sign.setLine(0, ChatColor.DARK_BLUE+"############");
sign.setLine(1, ChatColor.DARK_GREEN+"End");
@ -22,9 +30,4 @@ public class SIGNEnd extends DSign{
sign.setLine(3, ChatColor.DARK_BLUE+"############");
sign.update();
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
}
}

View File

@ -5,7 +5,15 @@ import org.bukkit.block.Sign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNLeave extends DSign{
public static String name = "Leave";
public static String buildPermissions = "dxl.sign.leave";
public static boolean onDungeonInit = true;
public SIGNLeave(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -14,7 +22,7 @@ public class SIGNLeave extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
gworld.blocksLeave.add(sign.getBlock());
sign.setLine(0, ChatColor.BLUE+"############");
sign.setLine(1, ChatColor.DARK_GREEN+"Leave");
@ -22,9 +30,4 @@ public class SIGNLeave extends DSign{
sign.setLine(3, ChatColor.BLUE+"############");
sign.update();
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
}
}

View File

@ -4,7 +4,15 @@ import org.bukkit.block.Sign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNLobby extends DSign{
public static String name = "Lobby";
public static String buildPermissions = "dxl.sign.lobby";
public static boolean onDungeonInit = true;
public SIGNLobby(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -13,13 +21,8 @@ public class SIGNLobby extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
gworld.locLobby = sign.getLocation();
sign.setTypeId(0);
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
}
}

View File

@ -1,11 +1,35 @@
package com.dre.dungeonsxl.signs;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Sign;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import com.dre.dungeonsxl.DMobType;
import com.dre.dungeonsxl.game.DMob;
import com.dre.dungeonsxl.game.GameWorld;
import com.dre.dungeonsxl.game.MobSpawner;
public class SIGNMob extends DSign{
public static String name = "Mob";
public static String buildPermissions = "dxl.sign.mob";
public static boolean onDungeonInit = false;
//Variables
private String mob;
private int maxinterval = 1;
private int interval = 0;
private int amount = 1;
public SIGNMob(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -14,17 +38,16 @@ public class SIGNMob extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
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]));
if(lines[1] != "" && lines[2] != ""){
String mob=lines[1];
if(mob != null){
String[] atributes = lines[2].split(",");
if(atributes.length == 2){
this.mob = mob;
this.maxinterval = p.parseInt(atributes[0]);
this.amount = p.parseInt(atributes[1]);
}
}
}
@ -32,8 +55,62 @@ public class SIGNMob extends DSign{
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
// TODO Auto-generated method stub
public void onTrigger() {
MobSpawnScheduler scheduler = new MobSpawnScheduler(this);
int id = p.getServer().getScheduler().scheduleSyncRepeatingTask(p, scheduler, 0L, 20L);
scheduler.id = id;
}
public class MobSpawnScheduler implements Runnable{
private SIGNMob sign;
public int id;
public MobSpawnScheduler(SIGNMob sign){
this.sign = sign;
}
@Override
public void run() {
if(sign.interval<=0){
World world = sign.sign.getWorld();
//Check normal mobs
if(EntityType.fromName(sign.mob)!=null){
if(EntityType.fromName(sign.mob).isAlive()){
LivingEntity entity=(LivingEntity)world.spawnEntity(sign.sign.getLocation(), EntityType.fromName(sign.mob));
//Add Bow to normal Skeletons
if(entity.getType() == EntityType.SKELETON){
Skeleton skeleton = (Skeleton) entity;
if(skeleton.getSkeletonType()==SkeletonType.NORMAL){
skeleton.getEquipment().setItemInHand(new ItemStack(Material.BOW));
}
}
new DMob(entity, sign.gworld, null);
}
}
//Check custom mobs
DMobType mobType = DMobType.get(sign.mob, gworld.config.getMobTypes());
if(mobType!=null){
mobType.spawn(GameWorld.get(world), sign.sign.getLocation());
}
//Set the amount
if(amount!=-1){
if(amount>1){
amount--;
}else{
p.getServer().getScheduler().cancelTask(this.id);
}
}
sign.interval = sign.maxinterval;
}
sign.interval--;
}
}
}

View File

@ -6,7 +6,15 @@ import com.dre.dungeonsxl.game.GameMessage;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNMsg extends DSign{
public static String name = "Msg";
public static String buildPermissions = "dxl.sign.msg";
public static boolean onDungeonInit = false;
public SIGNMsg(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -15,20 +23,20 @@ public class SIGNMsg extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
String lines[] = sign.getLines();
if(lines[2]!=""&&lines[3]!=""){
String msg = gworld.config.getMsg(p.parseInt(lines[2]),true);
if(lines[1]!=""&&lines[2]!=""){
String msg = gworld.config.getMsg(p.parseInt(lines[1]),true);
if(msg!=null){
gworld.messages.add(new GameMessage(sign.getBlock().getLocation(), msg,p.parseInt(lines[3]), false));
gworld.messages.add(new GameMessage(sign.getBlock().getLocation(), msg,p.parseInt(lines[2]), false));
sign.setTypeId(0);
}
}
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
public void onTrigger() {
// TODO Auto-generated method stub
}

View File

@ -6,7 +6,15 @@ import com.dre.dungeonsxl.game.GamePlaceableBlock;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNPlace extends DSign{
public static String name = "Place";
public static String buildPermissions = "dxl.sign.place";
public static boolean onDungeonInit = false;
public SIGNPlace(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -15,15 +23,9 @@ public class SIGNPlace extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
String lines[] = sign.getLines();
gworld.placeableBlocks.add(new GamePlaceableBlock(sign.getBlock(), lines[2], lines[3]) );
gworld.placeableBlocks.add(new GamePlaceableBlock(sign.getBlock(), lines[1], lines[2]) );
sign.setTypeId(0);
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
// TODO Auto-generated method stub
}
}

View File

@ -5,7 +5,15 @@ import org.bukkit.block.Sign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNReady extends DSign{
public static String name = "Ready";
public static String buildPermissions = "dxl.sign.ready";
public static boolean onDungeonInit = true;
public SIGNReady(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -14,7 +22,7 @@ public class SIGNReady extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
gworld.blocksReady.add(sign.getBlock());
sign.setLine(0, ChatColor.BLUE+"############");
sign.setLine(1, ChatColor.DARK_GREEN+"Ready");
@ -22,9 +30,4 @@ public class SIGNReady extends DSign{
sign.setLine(3, ChatColor.BLUE+"############");
sign.update();
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
}
}

View File

@ -6,7 +6,15 @@ import com.dre.dungeonsxl.game.GameMessage;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNSoundMsg extends DSign{
public static String name = "SoundMsg";
public static String buildPermissions = "dxl.sign.soundmsg";
public static boolean onDungeonInit = false;
public SIGNSoundMsg(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -15,20 +23,20 @@ public class SIGNSoundMsg extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
String lines[] = sign.getLines();
if(lines[2]!=""&&lines[3]!=""){
String msg = gworld.config.getMsg(p.parseInt(lines[2]),true);
if(lines[1]!=""&&lines[2]!=""){
String msg = gworld.config.getMsg(p.parseInt(lines[1]),true);
if(msg!=null){
gworld.messages.add(new GameMessage(sign.getBlock().getLocation(), msg,p.parseInt(lines[3]), true));
gworld.messages.add(new GameMessage(sign.getBlock().getLocation(), msg,p.parseInt(lines[2]), true));
sign.setTypeId(0);
}
}
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
public void onTrigger() {
// TODO Auto-generated method stub
}

View File

@ -4,7 +4,15 @@ import org.bukkit.block.Sign;
import com.dre.dungeonsxl.game.GameWorld;
public class SIGNStart extends DSign{
public static String name = "Start";
public static String buildPermissions = "dxl.sign.start";
public static boolean onDungeonInit = true;
public SIGNStart(Sign sign, GameWorld gworld) {
super(sign, gworld);
}
@Override
public boolean check(Sign sign) {
// TODO Auto-generated method stub
@ -13,14 +21,8 @@ public class SIGNStart extends DSign{
}
@Override
public void onDungeonInit(Sign sign, GameWorld gworld) {
public void onInit() {
gworld.locStart = sign.getLocation();
sign.setTypeId(0);
}
@Override
public void onTrigger(Sign sign, GameWorld gworld) {
// TODO Auto-generated method stub
}
}