mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fixed: Little language bug
This commit is contained in:
parent
53c58b574f
commit
84dfb069e6
@ -12,15 +12,15 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.dre.dungeonsxl.game.GameWorld;
|
||||
|
||||
public class DGSign {
|
||||
public class DGSign {
|
||||
public static CopyOnWriteArrayList<DGSign> dgsigns=new CopyOnWriteArrayList<DGSign>();
|
||||
|
||||
|
||||
//Sign Labels
|
||||
public static String strIsPlaying=ChatColor.DARK_RED + "Is Playing";
|
||||
public static String strFull=ChatColor.DARK_RED + "Full";
|
||||
public static String strJoinGrp=ChatColor.DARK_GREEN + "Join Group";
|
||||
public static String strNewGrp=ChatColor.DARK_GREEN + "New Group";
|
||||
|
||||
|
||||
//Variables
|
||||
public DGroup[] dgroups;
|
||||
public String dungeonName;
|
||||
@ -28,32 +28,32 @@ public class DGSign {
|
||||
public Block startSign;
|
||||
public int directionX=0,directionZ=0;
|
||||
public int verticalSigns;
|
||||
|
||||
|
||||
public DGSign(Block startSign,String dungeonName, int maxGroups, int maxPlayersPerGroup){
|
||||
dgsigns.add(this);
|
||||
|
||||
|
||||
this.startSign=startSign;
|
||||
this.dungeonName=dungeonName;
|
||||
this.dgroups=new DGroup[maxGroups];
|
||||
this.maxPlayersPerGroup=maxPlayersPerGroup;
|
||||
this.verticalSigns=(int)Math.ceil((float)(1+maxPlayersPerGroup)/4);
|
||||
|
||||
|
||||
int[] direction=getDirection(this.startSign.getData());
|
||||
this.directionX=direction[0];
|
||||
this.directionZ=direction[1];
|
||||
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
|
||||
public void update(){
|
||||
int i = 0;
|
||||
for(DGroup dgroup:this.dgroups){
|
||||
if((this.startSign.getRelative(i*directionX, 0, i*directionZ).getState() instanceof Sign)){
|
||||
Sign sign = (Sign) this.startSign.getRelative(i*directionX, 0, i*directionZ).getState();
|
||||
|
||||
|
||||
//Reset Signs
|
||||
sign.setLine(0, "");sign.setLine(1, "");sign.setLine(2, "");sign.setLine(3, "");
|
||||
|
||||
|
||||
int yy=-1;
|
||||
while(sign.getBlock().getRelative(0, yy, 0).getState() instanceof Sign){
|
||||
Sign subsign=(Sign)sign.getBlock().getRelative(0, yy, 0).getState();
|
||||
@ -61,7 +61,7 @@ public class DGSign {
|
||||
subsign.update();
|
||||
yy--;
|
||||
}
|
||||
|
||||
|
||||
//Set Signs
|
||||
if(dgroup!=null){
|
||||
if(dgroup.isPlaying){
|
||||
@ -92,19 +92,19 @@ public class DGSign {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Static
|
||||
|
||||
|
||||
public static DGSign tryToCreate(Block startSign,String dungeonName, int maxGroups, int maxPlayersPerGroup){
|
||||
World world=startSign.getWorld();
|
||||
int direction=startSign.getData();
|
||||
int x=startSign.getX(),y=startSign.getY(),z=startSign.getZ();
|
||||
|
||||
|
||||
int verticalSigns=(int)Math.ceil((float)(1+maxPlayersPerGroup)/4);
|
||||
|
||||
|
||||
CopyOnWriteArrayList<Block> changeBlocks=new CopyOnWriteArrayList<Block>();
|
||||
|
||||
|
||||
int xx,yy,zz;
|
||||
switch(direction){
|
||||
case 2:
|
||||
@ -126,7 +126,7 @@ public class DGSign {
|
||||
zz=z;
|
||||
for(yy=y;yy>y-verticalSigns;yy--){
|
||||
for(xx=x;xx<x+maxGroups;xx++){
|
||||
|
||||
|
||||
Block block=world.getBlockAt(xx,yy,zz);
|
||||
if(block.getTypeId()!=0 && block.getTypeId()!=68){
|
||||
return null;
|
||||
@ -174,10 +174,10 @@ public class DGSign {
|
||||
block.setTypeIdAndData(68, startSign.getData(), true);
|
||||
}
|
||||
DGSign sign=new DGSign(startSign,dungeonName,maxGroups,maxPlayersPerGroup);
|
||||
|
||||
|
||||
return sign;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isRelativeSign(Block block,int x,int z){
|
||||
DGSign dgsign=getSign(block.getRelative(x,0,z));
|
||||
if(dgsign!=null){
|
||||
@ -186,10 +186,10 @@ public class DGSign {
|
||||
if(z==-1 && dgsign.startSign.getData()==2) return true;
|
||||
if(z==1 && dgsign.startSign.getData()==3) return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static DGSign getSign(Block block){
|
||||
if(block.getTypeId()==68){
|
||||
int x=block.getX(),y=block.getY(),z=block.getZ();
|
||||
@ -198,33 +198,33 @@ public class DGSign {
|
||||
int sx2=sx1+(dgsign.dgroups.length-1)*dgsign.directionX;
|
||||
int sy2=sy1-dgsign.verticalSigns+1;
|
||||
int sz2=sz1+(dgsign.dgroups.length-1)*dgsign.directionZ;
|
||||
|
||||
|
||||
if(sx1>sx2){if(x<sx2 || x>sx1) continue;}else if(sx1<sx2){if(x>sx2 || x<sx1) continue;}else{if(x!=sx1) continue;}
|
||||
if(sy1>sy2){if(y<sy2 || y>sy1) continue;}else{if(y!=sy1) continue;}
|
||||
if(sz1>sz2){if(z<sz2 || z>sz1) continue;}else if(sz1<sz2){if(z>sz2 || z<sz1) continue;}else{if(z!=sz1) continue;}
|
||||
|
||||
|
||||
return dgsign;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static boolean playerInteract(Block block,Player player){
|
||||
int x=block.getX(),y=block.getY(),z=block.getZ();
|
||||
DGSign dgsign=getSign(block);
|
||||
if(dgsign!=null){
|
||||
if(GameWorld.canPlayDungeon(dgsign.dungeonName, player)){
|
||||
int sx1=dgsign.startSign.getX(),sy1=dgsign.startSign.getY(),sz1=dgsign.startSign.getZ();
|
||||
|
||||
|
||||
Block topBlock=block.getRelative(0, sy1-y, 0);
|
||||
|
||||
|
||||
int column;
|
||||
if(dgsign.directionX!=0){
|
||||
column=Math.abs(x-sx1);
|
||||
}else{
|
||||
column=Math.abs(z-sz1);
|
||||
}
|
||||
|
||||
|
||||
if((topBlock.getState() instanceof Sign)){
|
||||
Sign topSign=(Sign)topBlock.getState();
|
||||
if(topSign.getLine(0).equals(strNewGrp)){
|
||||
@ -240,7 +240,7 @@ public class DGSign {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -248,19 +248,19 @@ public class DGSign {
|
||||
if(file!=null){
|
||||
ConfigReader confReader=new ConfigReader(file);
|
||||
if(confReader!=null){
|
||||
P.p.msg(player, P.p.language.get("player_join_error"));
|
||||
P.p.msg(player, P.p.language.get("player_join_error",""+confReader.timeToNextPlay));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void updatePerGroup(DGroup dgroupsearch){
|
||||
|
||||
|
||||
for(DGSign dgsign:dgsigns){
|
||||
int i=0;
|
||||
for(DGroup dgroup:dgsign.dgroups){
|
||||
@ -274,7 +274,7 @@ public class DGSign {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int[] getDirection(byte data){
|
||||
int[] direction=new int[2];
|
||||
switch(data){
|
||||
@ -293,25 +293,25 @@ public class DGSign {
|
||||
}
|
||||
return direction;
|
||||
}
|
||||
|
||||
|
||||
//Save and Load
|
||||
public static void save(FileConfiguration configFile){
|
||||
int id = 0;
|
||||
|
||||
|
||||
for(DGSign dgsign:dgsigns){
|
||||
id++;
|
||||
String preString="groupsign."+dgsign.startSign.getWorld().getName()+"."+id;
|
||||
|
||||
|
||||
//Location
|
||||
configFile.set(preString+".x",dgsign.startSign.getX());
|
||||
configFile.set(preString+".y",dgsign.startSign.getY());
|
||||
configFile.set(preString+".z",dgsign.startSign.getZ());
|
||||
|
||||
|
||||
//Etc.
|
||||
configFile.set(preString+".dungeon",dgsign.dungeonName);
|
||||
configFile.set(preString+".maxGroups",dgsign.dgroups.length);
|
||||
configFile.set(preString+".maxPlayersPerGroup",dgsign.maxPlayersPerGroup);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,19 +323,19 @@ public class DGSign {
|
||||
do{
|
||||
id++;
|
||||
preString="groupsign."+world.getName()+"."+id+".";
|
||||
if(configFile.contains(preString)){
|
||||
if(configFile.contains(preString)){
|
||||
String dungeonName=configFile.getString(preString+".dungeon");
|
||||
int maxGroups=configFile.getInt(preString+".maxGroups");
|
||||
int maxPlayersPerGroup=configFile.getInt(preString+".maxPlayersPerGroup");
|
||||
Block startSign=world.getBlockAt(configFile.getInt(preString+".x"),configFile.getInt(preString+".y"),configFile.getInt(preString+".z"));
|
||||
|
||||
|
||||
new DGSign(startSign, dungeonName, maxGroups, maxPlayersPerGroup);
|
||||
}
|
||||
}while(configFile.contains(preString));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user