First Commit

This commit is contained in:
Frank Baumann 2012-09-24 16:34:45 +02:00
commit b5d4efae67
40 changed files with 4475 additions and 0 deletions

9
DungeonsXL/.classpath Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="D:/Benutzerdateien/Admin/Java Libs/Vault.jar"/>
<classpathentry kind="lib" path="D:/Benutzerdateien/Admin/Java Libs/craftbukkit.jar"/>
<classpathentry kind="lib" path="D:/Benutzerdateien/Admin/Java Libs/bukkit-1.3.1-R1.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
DungeonsXL/.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DungeonsXL</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,12 @@
#Tue Apr 24 15:20:11 CEST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

9
DungeonsXL/plugin.yml Normal file
View File

@ -0,0 +1,9 @@
name: DungeonsXL
version: 2.8.5
main: com.dre.dungeonsxl.DungeonsXL
authors: [Frank Baumann]
softdepend: [Vault]
commands:
dungeonsxl:
description: Reference command for DungeonsXL.
aliases: [dxl,dungeon]

View File

@ -0,0 +1,189 @@
package com.dre.dungeonsxl;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
public class ConfigReader {
public static DungeonsXL p=DungeonsXL.p;
public File file;
private CopyOnWriteArrayList<DClass> dclasses=new CopyOnWriteArrayList<DClass>();
public CopyOnWriteArrayList<String> invitedPlayer = new CopyOnWriteArrayList<String>();
public Map<Integer,String> msgs=new HashMap<Integer,String>();
public CopyOnWriteArrayList<Material> secureobjects=new CopyOnWriteArrayList<Material>();
public boolean isLobbyDisabled=false;
public int timeToNextPlay=0;
public ConfigReader(File file){
this.file=file;
FileConfiguration configFile = YamlConfiguration.loadConfiguration(file);
//Read Classes
int id=0;
String preString;
do{
id++;
preString="classes."+id+".";
if(configFile.contains(preString)){
String name=configFile.getString(preString+".name");
boolean hasDog=configFile.getBoolean(preString+".hasdog");
@SuppressWarnings("unchecked")
List<String> items=(List<String>) configFile.getList(preString+".items");
CopyOnWriteArrayList<ItemStack> istacks=new CopyOnWriteArrayList<ItemStack>();
for(String item:items){
String[] itemsplit=item.split(",");
if(itemsplit.length>0){
int itemId=0,itemData=0,itemSize=1,itemLvlEnchantment=1;
Enchantment itemEnchantment=null;
//Check Id & Data
String[] idAndData=itemsplit[0].split("/");
itemId=Integer.parseInt(idAndData[0]);
if(idAndData.length>1){
itemData=Integer.parseInt(idAndData[1]);
}
//Size
if(itemsplit.length>1){
itemSize=Integer.parseInt(itemsplit[1]);
}
//Enchantment
if(itemsplit.length>2){
String[] enchantmentSplit=itemsplit[2].split("/");
itemEnchantment=Enchantment.getByName(enchantmentSplit[0]);
if(enchantmentSplit.length>1){
itemLvlEnchantment=Integer.parseInt(enchantmentSplit[1]);
}
}
//Add Item to Stacks
ItemStack istack=new ItemStack(itemId,itemSize,(short) itemData);
if(itemEnchantment!=null){
istack.addEnchantment(itemEnchantment, itemLvlEnchantment);
}
istacks.add(istack);
}
}
dclasses.add(new DClass(name,istacks,hasDog));
}
}while(configFile.contains(preString));
//Read Messages
id=0;
do{
id++;
preString="message."+id;
if(configFile.contains(preString)){
this.msgs.put(id,configFile.getString(preString));
}
}while(configFile.contains(preString));
//Read Secure Objects
if(configFile.contains("secureobjects")){
@SuppressWarnings("unchecked")
List<Integer> secureobjectlist=(List<Integer>) configFile.getList("secureobjects");
for(int i:secureobjectlist){
this.secureobjects.add(Material.getMaterial(i));
}
}
//Read Invited Player
if(configFile.contains("invitedplayers")){
@SuppressWarnings("unchecked")
List<String> invitedplayers=(List<String>) configFile.getList("invitedplayers");
for(String i:invitedplayers){
this.invitedPlayer.add(i);
}
}
//Read Tutorial-Mode
if(configFile.contains("tutorialdungeon")){
p.tutorialDungeon=configFile.getString("tutorialdungeon");
p.tutorialStartGroup=configFile.getString("tutorialstartgroup");
p.tutorialEndGroup=configFile.getString("tutorialendgroup");
}
//Read Lobby disabled
if(configFile.contains("islobbydisabled")){
isLobbyDisabled=configFile.getBoolean("islobbydisabled");
}
if(configFile.contains("timetonextplay")){
timeToNextPlay=configFile.getInt("timetonextplay");
}
}
public String getMsg(int id){
return this.msgs.get(id);
}
//Save
public void save(){
FileConfiguration configFile = YamlConfiguration.loadConfiguration(this.file);
//Classes don't save
//Messages
for(Integer msgs:this.msgs.keySet()){
configFile.set("message."+msgs, this.msgs.get(msgs));
}
//Secure Objects
CopyOnWriteArrayList<Integer> secureobjectsids=new CopyOnWriteArrayList<Integer>();
for(Material mat:this.secureobjects){
secureobjectsids.add(mat.getId());
}
configFile.set("secureobjects", secureobjectsids);
//Invited Players
configFile.set("invitedplayers", this.invitedPlayer);
try {
p.log("SAVE"+this.file);
configFile.save(this.file);
} catch (IOException e) {
e.printStackTrace();
}
}
//Classes
public CopyOnWriteArrayList<DClass> getClasses(){
return dclasses;
}
public DClass getClass(String name){
for(DClass dclass:dclasses){
if(dclass.name.equals(name)){
return dclass;
}
}
return null;
}
}

View File

@ -0,0 +1,25 @@
package com.dre.dungeonsxl;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.inventory.ItemStack;
public class DClass {
//Variables
public CopyOnWriteArrayList<ItemStack> items=new CopyOnWriteArrayList<ItemStack>();
public String name;
public boolean hasDog;
public DClass(String name,CopyOnWriteArrayList<ItemStack> items,boolean hasDog){
this.items=items;
this.name=name;
this.hasDog=hasDog;
}
}

View File

@ -0,0 +1,341 @@
package com.dre.dungeonsxl;
import java.io.File;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.game.GameWorld;
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;
public int maxPlayersPerGroup;
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();
subsign.setLine(0, "");subsign.setLine(1, "");subsign.setLine(2, "");subsign.setLine(3, "");
subsign.update();
yy--;
}
//Set Signs
if(dgroup!=null){
if(dgroup.isPlaying){
sign.setLine(0, strIsPlaying);
}else if(dgroup.players.size()>=this.maxPlayersPerGroup){
sign.setLine(0, strFull);
}else{
sign.setLine(0, strJoinGrp);
}
int j=1;
Sign rowSign=sign;
for(Player player:dgroup.players){
if(j>3){
j=0;
rowSign=(Sign) sign.getBlock().getRelative(0, -1, 0).getState();
}
if(rowSign!=null){
rowSign.setLine(j,player.getName());
}
j++;
rowSign.update();
}
}else{
sign.setLine(0, strNewGrp);
}
sign.update();
}
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:
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;
}
if(block.getRelative(0, 0, 1).getTypeId()==0){
return null;
}
changeBlocks.add(block);
}
}
break;
case 3:
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;
}
if(block.getRelative(0, 0, -1).getTypeId()==0){
return null;
}
changeBlocks.add(block);
}
}
break;
case 4:
xx=x;
for(yy=y;yy>y-verticalSigns;yy--){
for(zz=z;zz<z+maxGroups;zz++){
Block block=world.getBlockAt(xx,yy,zz);
if(block.getTypeId()!=0 && block.getTypeId()!=68){
return null;
}
if(block.getRelative(1, 0, 0).getTypeId()==0){
return null;
}
changeBlocks.add(block);
}
}
break;
case 5:
xx=x;
for(yy=y;yy>y-verticalSigns;yy--){
for(zz=z;zz>z-maxGroups;zz--){
Block block=world.getBlockAt(xx,yy,zz);
if(block.getTypeId()!=0 && block.getTypeId()!=68){
return null;
}
if(block.getRelative(-1, 0, 0).getTypeId()==0){
return null;
}
changeBlocks.add(block);
}
}
break;
}
for(Block block:changeBlocks){
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){
if(x==-1 && dgsign.startSign.getData()==4) return true;
if(x==1 && dgsign.startSign.getData()==5) return true;
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();
for(DGSign dgsign:dgsigns){
int sx1=dgsign.startSign.getX(),sy1=dgsign.startSign.getY(),sz1=dgsign.startSign.getZ();
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)){
if(DGroup.get(player)==null){
dgsign.dgroups[column]=new DGroup(player, dgsign.dungeonName);
dgsign.update();
}
}else if(topSign.getLine(0).equals(strJoinGrp)){
if(DGroup.get(player)==null){
if(!dgsign.dgroups[column].players.contains(player)){
dgsign.dgroups[column].players.add(player);
dgsign.update();
}
}
}
}
}
else{
File file=new File(DungeonsXL.p.getDataFolder()+"/dungeons/"+dgsign.dungeonName, "config.yml");
if(file!=null){
ConfigReader confReader=new ConfigReader(file);
if(confReader!=null){
DungeonsXL.p.msg(player, ChatColor.RED+"Du kannst den Dungeon nur alle "+ChatColor.GOLD+confReader.timeToNextPlay+ChatColor.RED+" Stunden betreten!");
}
}
}
return true;
}
return false;
}
public static void updatePerGroup(DGroup dgroupsearch){
for(DGSign dgsign:dgsigns){
int i=0;
for(DGroup dgroup:dgsign.dgroups){
if(dgroup!=null){
if(dgroup==dgroupsearch){
if(dgroupsearch.isEmpty()) dgsign.dgroups[i]=null;
dgsign.update();
}
}
i++;
}
}
}
public static int[] getDirection(byte data){
int[] direction=new int[2];
switch(data){
case 2:
direction[0]=-1;
break;
case 3:
direction[0]=1;
break;
case 4:
direction[1]=1;
break;
case 5:
direction[1]=-1;
break;
}
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);
}
}
public static void load(FileConfiguration configFile) {
for(World world:DungeonsXL.p.getServer().getWorlds()){
if(configFile.contains("groupsign."+world.getName())){
int id=0;
String preString;
do{
id++;
preString="groupsign."+world.getName()+"."+id+".";
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));
}
}
}
}

View File

@ -0,0 +1,78 @@
package com.dre.dungeonsxl;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.game.GameWorld;
public class DGroup {
public static CopyOnWriteArrayList<DGroup> dgroups=new CopyOnWriteArrayList<DGroup>();
//Variables
public CopyOnWriteArrayList<Player> players=new CopyOnWriteArrayList<Player>();
public String dungeonname;
public GameWorld gworld;
public boolean isPlaying;
public DGroup(Player player, String dungeonname){
dgroups.add(this);
this.players.add(player);
this.isPlaying=false;
this.dungeonname=dungeonname;
}
public void removePlayer(Player player) {
this.players.remove(player);
DGSign.updatePerGroup(this);
}
public boolean isEmpty() {
return this.players.isEmpty();
}
public void remove() {
dgroups.remove(this);
DGSign.updatePerGroup(this);
}
public void startGame(){
this.isPlaying=true;
gworld.startGame();
for(Player player:players){
DPlayer dplayer=DPlayer.get(player);
dplayer.respawn();
}
DGSign.updatePerGroup(this);
}
//Statics
public static DGroup get(Player player){
for(DGroup dgroup:dgroups){
if(dgroup.players.contains(player)){
return dgroup;
}
}
return null;
}
public static DGroup get(GameWorld gworld){
for(DGroup dgroup:dgroups){
if(dgroup.gworld==gworld){
return dgroup;
}
}
return null;
}
public static void leaveGroup(Player player){
for(DGroup dgroup:dgroups){
if(dgroup.players.contains(player)){
dgroup.players.remove(player);
}
}
}
}

View File

@ -0,0 +1,45 @@
package com.dre.dungeonsxl;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class DOfflinePlayer {
public static CopyOnWriteArrayList<DOfflinePlayer> players=new CopyOnWriteArrayList<DOfflinePlayer>();
//Variables
public String name;
public Location oldLocation;
public ItemStack[] oldInventory;
public ItemStack[] oldArmor;
public int oldLvl;
public int oldExp;
public int oldHealth;
public int oldFoodLevel;
public GameMode oldGamemode;
public DOfflinePlayer(){
players.add(this);
}
//Static
public static void check(Player player){
for(DOfflinePlayer offplayer:players){
if(offplayer.name.equalsIgnoreCase(player.getName())){
players.remove(offplayer);
player.teleport(offplayer.oldLocation);
player.getInventory().setContents(offplayer.oldInventory);
player.getInventory().setArmorContents(offplayer.oldArmor);
player.setTotalExperience(offplayer.oldExp);
player.setLevel(offplayer.oldLvl);
player.setHealth(offplayer.oldHealth);
player.setFoodLevel(offplayer.oldFoodLevel);
player.setGameMode(offplayer.oldGamemode);
}
}
}
}

View File

@ -0,0 +1,537 @@
package com.dre.dungeonsxl;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.dre.dungeonsxl.game.GameCheckpoint;
import com.dre.dungeonsxl.game.GameWorld;
public class DPlayer {
public DungeonsXL p=DungeonsXL.p;
public static CopyOnWriteArrayList<DPlayer> players=new CopyOnWriteArrayList<DPlayer>();
//Variables
public Player player;
public World world;
public DPlayer oldDPlayer=null;
public int isinTestMode=0;
public Location oldLocation;
public ItemStack[] oldInventory;
public ItemStack[] oldArmor;
public int oldLvl;
public int oldExp;
public int oldHealth;
public int oldFoodLevel;
public GameMode oldGamemode;
public boolean isEditing;
public boolean isInWorldChat=false;
public boolean isReady=false;
public boolean isFinished=false;
public DClass dclass;
public GameCheckpoint checkpoint;
public CopyOnWriteArrayList<Integer> classItems=new CopyOnWriteArrayList<Integer>();
public Wolf wolf;
public int wolfRespawnTime=30;
public int offlineTime;
public int invItemInHand;
public CopyOnWriteArrayList<ItemStack> respawnInventory=new CopyOnWriteArrayList<ItemStack>();
public Inventory treasureInv = DungeonsXL.p.getServer().createInventory(player, 45, "Belohnungen");
public DPlayer(Player player, World world, Location teleport, boolean isEditing){
players.add(this);
this.player=player;
this.world=world;
this.oldLocation=player.getLocation();
this.oldInventory=player.getInventory().getContents();
this.oldArmor=player.getInventory().getArmorContents();
this.oldExp=player.getTotalExperience();
this.oldHealth=player.getHealth();
this.oldFoodLevel=player.getFoodLevel();
this.oldGamemode=player.getGameMode();
this.oldLvl=player.getLevel();
this.player.teleport(teleport);
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
this.player.setTotalExperience(0);
this.player.setHealth(20);
this.player.setFoodLevel(20);
this.isEditing=isEditing;
if(isEditing) this.player.setGameMode(GameMode.CREATIVE); else this.player.setGameMode(GameMode.SURVIVAL);
if(!isEditing){
if(GameWorld.get(world).confReader.isLobbyDisabled){
this.ready();
}
}
}
public void goOffline(){
offlineTime=1;
}
public void leave(){
remove(this);
if(this.oldDPlayer!=null){
this.oldDPlayer.isinTestMode=0;
}
this.player.teleport(this.oldLocation);
this.player.getInventory().setContents(this.oldInventory);
this.player.getInventory().setArmorContents(this.oldArmor);
this.player.setTotalExperience(this.oldExp);
this.player.setLevel(this.oldLvl);
this.player.setHealth(oldHealth);
this.player.setFoodLevel(oldFoodLevel);
this.player.setGameMode(oldGamemode);
if(this.isEditing){
EditWorld eworld=EditWorld.get(this.world);
if(eworld!=null){
eworld.save();
}
}else{
GameWorld gworld=GameWorld.get(this.world);
DGroup dgroup=DGroup.get(this.player);
if(dgroup!=null){
dgroup.removePlayer(this.player);
if(dgroup.isEmpty()){
dgroup.remove();
}
}
//Belohnung
if(this.oldDPlayer==null&&this.isinTestMode!=2){//Nur wenn man nicht am Testen ist
if(isFinished){
this.addTreasure();
//Set Time
File file=new File(p.getDataFolder()+"/dungeons/"+gworld.dungeonname, "players.yml");
if(!file.exists()){
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
playerConfig.set(player.getName(), System.currentTimeMillis());
try {
playerConfig.save(file);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Tutorial Permissions
if(gworld.isTutorial){
p.permission.playerAddGroup(this.player, p.tutorialEndGroup);
p.permission.playerRemoveGroup(this.player, p.tutorialStartGroup);
}
}
}
//Give Secure Objects other Players
if(!dgroup.isEmpty()){
int i=0;
Player groupplayer;
do{
groupplayer=dgroup.players.get(i);
if(groupplayer!=null){
for(ItemStack istack:this.player.getInventory()){
if(istack!=null){
if(gworld.secureobjects.contains(istack.getType())){
groupplayer.getInventory().addItem(istack);
}
}
}
DungeonsXL.p.updateInventory(groupplayer);
}
i++;
}while(groupplayer==null);
}
}
DungeonsXL.p.updateInventory(this.player);
}
public void ready(){
this.isReady=true;
DGroup dgroup=DGroup.get(this.player);
if(!dgroup.isPlaying){
if(dgroup!=null){
for(Player player:dgroup.players){
DPlayer dplayer=get(player);
if(!dplayer.isReady){
return;
}
}
}
dgroup.startGame();
}else{
this.respawn();
}
}
public void respawn(){
DGroup dgroup=DGroup.get(this.player);
if(this.checkpoint==null){
this.player.teleport(dgroup.gworld.locStart);
}else{
this.player.teleport(this.checkpoint.location);
}
if(this.wolf!=null){
this.wolf.teleport(this.player);
}
//Respawn Items
for(ItemStack istack:this.respawnInventory){
if(istack!=null){
this.player.getInventory().addItem(istack);
}
}
this.respawnInventory.clear();
DungeonsXL.p.updateInventory(this.player);
}
public void finish(){
DungeonsXL.p.msg(this.player, ChatColor.YELLOW+"Du hast den Dungeon erfolgreich beendet!");
this.isFinished=true;
DGroup dgroup=DGroup.get(this.player);
if(dgroup.isPlaying){
if(dgroup!=null){
for(Player player:dgroup.players){
DPlayer dplayer=get(player);
if(!dplayer.isFinished){
DungeonsXL.p.msg(this.player, ChatColor.YELLOW+"Noch auf Mitspieler warten...");
return;
}
}
for(Player player:dgroup.players){
DPlayer dplayer=get(player);
dplayer.leave();
}
}
}
}
public void msg(String msg){
if(this.isEditing){
EditWorld eworld=EditWorld.get(this.world);
eworld.msg(msg);
for(Player player:p.chatSpyer){
if(!eworld.world.getPlayers().contains(player)){
p.msg(player, ChatColor.GREEN+"[Chatspy] "+ChatColor.WHITE+msg);
}
}
}else{
GameWorld gworld=GameWorld.get(this.world);
gworld.msg(msg);
for(Player player:p.chatSpyer){
if(!gworld.world.getPlayers().contains(player)){
p.msg(player, ChatColor.GREEN+"[Chatspy] "+ChatColor.WHITE+msg);
}
}
}
}
public void setClass(String classname) {
GameWorld gworld=GameWorld.get(this.player.getWorld());
if(gworld==null) return;
DClass dclass=gworld.confReader.getClass(classname);
if(dclass!=null){
if(this.dclass!=dclass){
this.dclass=dclass;
//Set Dog
if(this.wolf!=null){
this.wolf.remove();
this.wolf=null;
}
if(dclass.hasDog){
this.wolf=(Wolf) this.world.spawnCreature(this.player.getLocation(), EntityType.WOLF);
this.wolf.setTamed(true);
this.wolf.setOwner(this.player);
this.wolf.setHealth(this.wolf.getMaxHealth());
}
//Delete Inventory
this.classItems.clear();
this.player.getInventory().clear();
this.player.getInventory().setArmorContents(null);
player.getInventory().setItemInHand(new ItemStack(0));
DungeonsXL.p.updateInventory(this.player);
//Set Inventory
for(ItemStack istack:dclass.items){
//Leggings
if(istack.getTypeId()==300||
istack.getTypeId()==304||
istack.getTypeId()==308||
istack.getTypeId()==312||
istack.getTypeId()==316)
{
this.player.getInventory().setLeggings(istack);
}
//Helmet
else if(istack.getTypeId()==298||
istack.getTypeId()==302||
istack.getTypeId()==306||
istack.getTypeId()==310||
istack.getTypeId()==314)
{
this.player.getInventory().setHelmet(istack);
}
//Chestplate
else if(istack.getTypeId()==299||
istack.getTypeId()==303||
istack.getTypeId()==307||
istack.getTypeId()==311||
istack.getTypeId()==315)
{
this.player.getInventory().setChestplate(istack);
}
//Boots
else if(istack.getTypeId()==301||
istack.getTypeId()==305||
istack.getTypeId()==309||
istack.getTypeId()==313||
istack.getTypeId()==317)
{
this.player.getInventory().setBoots(istack);
}
else{
this.player.getInventory().addItem(istack);
}
DungeonsXL.p.updateInventory(this.player);
}
for(int i=0;i<36;i++){
ItemStack istack=this.player.getInventory().getItem(i);
if(istack!=null){
this.classItems.add(i);
}
}
DungeonsXL.p.updateInventory(this.player);
}
}
}
public void setCheckpoint(GameCheckpoint checkpoint){
this.checkpoint=checkpoint;
}
public void addTreasure(){
for(ItemStack istack:this.treasureInv.getContents()){
if(istack!=null){
this.player.getInventory().addItem(istack);
}
}
}
//Static
public static void remove(DPlayer player){
players.remove(player);
}
public static DPlayer get(Player player){
EditWorld eworld=EditWorld.get(player.getWorld());
boolean isEditing=false;
if(eworld!=null){
isEditing=true;
}
for(DPlayer dplayer:players){
if(dplayer.player.equals(player)){
if(dplayer.isEditing==isEditing){
return dplayer;
}
}
}
return null;
}
public static CopyOnWriteArrayList<DPlayer> get(World world){
CopyOnWriteArrayList<DPlayer> dplayers=new CopyOnWriteArrayList<DPlayer>();
for(DPlayer dplayer:players){
if(dplayer.world==world){
dplayers.add(dplayer);
}
}
return dplayers;
}
public static void update(boolean updateSecond){
for(DPlayer dplayer:players){
if(!updateSecond){
//Check in World
if(dplayer.isinTestMode!=1){
if(!dplayer.player.getWorld().equals(dplayer.world)){
if(dplayer.isEditing){
EditWorld eworld=EditWorld.get(dplayer.world);
if(eworld!=null){
if(eworld.lobby==null){
dplayer.player.teleport(eworld.world.getSpawnLocation());
}else{
dplayer.player.teleport(eworld.lobby);
}
}
}else{
GameWorld gworld=GameWorld.get(dplayer.world);
if(gworld!=null){
if(gworld!=null){
DGroup dgroup=DGroup.get(dplayer.player);
if(dplayer.checkpoint==null){
dplayer.player.teleport(dgroup.gworld.locStart);
if(dplayer.wolf!=null){
dplayer.wolf.teleport(dgroup.gworld.locStart);
}
}else{
dplayer.player.teleport(dplayer.checkpoint.location);
if(dplayer.wolf!=null){
dplayer.wolf.teleport(dplayer.checkpoint.location);
}
}
//Respawn Items
for(ItemStack istack:dplayer.respawnInventory){
if(istack!=null){
dplayer.player.getInventory().addItem(istack);
}
}
dplayer.respawnInventory.clear();
DungeonsXL.p.updateInventory(dplayer.player);
}
}
}
}
}
}else{
//Update Wolf
if(dplayer.wolf!=null){
if(dplayer.wolf.isDead()){
if(dplayer.wolfRespawnTime<=0){
dplayer.wolf=(Wolf) dplayer.world.spawnCreature(dplayer.player.getLocation(), EntityType.WOLF);
dplayer.wolf.setTamed(true);
dplayer.wolf.setOwner(dplayer.player);
dplayer.wolfRespawnTime=30;
}
dplayer.wolfRespawnTime--;
}
}
//Update Offline Players
if(dplayer.offlineTime>0){
dplayer.offlineTime++;
if(dplayer.offlineTime>300){
DOfflinePlayer offplayer=new DOfflinePlayer();
offplayer.name=dplayer.player.getName();
offplayer.oldLocation=dplayer.oldLocation;
offplayer.oldInventory=dplayer.oldInventory;
offplayer.oldArmor=dplayer.oldArmor;
offplayer.oldExp=dplayer.oldExp;
offplayer.oldHealth=dplayer.oldHealth;
offplayer.oldFoodLevel=dplayer.oldFoodLevel;
offplayer.oldGamemode=dplayer.oldGamemode;
offplayer.oldLvl=dplayer.oldLvl;
remove(dplayer);
if(dplayer.isEditing){
EditWorld eworld=EditWorld.get(dplayer.world);
if(eworld!=null){
eworld.save();
}
}else{
GameWorld gworld=GameWorld.get(dplayer.world);
DGroup dgroup=DGroup.get(dplayer.player);
if(dgroup!=null){
dgroup.removePlayer(dplayer.player);
if(dgroup.isEmpty()){
dgroup.remove();
gworld.delete();
}
}
}
}
}
}
//Update ClassItems
for(Integer istackplace:dplayer.classItems){
ItemStack istack=dplayer.player.getInventory().getItem(istackplace);
if(istack!=null){
if(istack.getTypeId()!=0){
if(istack.getTypeId()>255 && istack.getTypeId()<318){
istack.setDurability((short) 0);
}
}else{
dplayer.classItems.remove(istackplace);
}
}else{
dplayer.classItems.remove(istackplace);
}
}
}
}
}

View File

@ -0,0 +1,200 @@
package com.dre.dungeonsxl;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.game.GameWorld;
public class DPortal {
public static DungeonsXL p=DungeonsXL.p;
public static CopyOnWriteArrayList<DPortal> portals = new CopyOnWriteArrayList<DPortal>();
//Variables
public World world;
public Block block1,block2;
public Player player;
public boolean isActive;
public String type;
public DPortal(boolean active){
portals.add(this);
this.isActive=active;
}
public boolean fillwithportal(){
if(this.block1!=null && this.block2!=null){
int x1=block1.getX(),y1=block1.getY(),z1=block1.getZ();
int x2=block2.getX(),y2=block2.getY(),z2=block2.getZ();
int xcount=0,ycount=0,zcount=0;
if(x1>x2){xcount=-1;}else if(x1<x2){xcount=1;}
if(y1>y2){ycount=-1;}else if(y1<y2){ycount=1;}
if(z1>z2){zcount=-1;}else if(z1<z2){zcount=1;}
int xx=x1;
do{
int yy=y1;
do{
int zz=z1;
do{
int typeid=this.world.getBlockAt(xx, yy, zz).getType().getId();
if(
typeid==0||
typeid==8||
typeid==9||
typeid==10||
typeid==11||
typeid==6||
typeid==30||
typeid==31||
typeid==32||
typeid==34||
typeid==37||
typeid==38||
typeid==39||
typeid==40||
typeid==50||
typeid==51||
typeid==59||
typeid==55||
typeid==75||
typeid==78||
typeid==76
)
{
this.world.getBlockAt(xx, yy, zz).setTypeId(90);
}
zz=zz+zcount;
}while(zz!=z2+zcount);
yy=yy+ycount;
}while(yy!=y2+ycount);
xx=xx+xcount;
}while(xx!=x2+xcount);
}
return false;
}
public void teleport(Player player){
if(this.type.equals("toworld")){
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
dplayer.leave();
}
}
else if(this.type.equals("todungeon")){
DGroup dgroup=DGroup.get(player);
if(dgroup!=null){
if(dgroup.gworld==null){
dgroup.gworld=GameWorld.load(DGroup.get(player).dungeonname);
}
if(dgroup.gworld!=null){
if(dgroup.gworld.locLobby==null){
new DPlayer(player,dgroup.gworld.world,dgroup.gworld.world.getSpawnLocation(), false);
}else{
new DPlayer(player,dgroup.gworld.world,dgroup.gworld.locLobby, false);
}
}else{
p.msg(player,ChatColor.RED+"Dungeon existiert nicht!");
}
}else{
p.msg(player,ChatColor.RED+"Du musst zuerst einer Gruppe beitreten!");
}
}
}
//Statics
public static DPortal get(Location location) {
return get(location.getBlock());
}
public static DPortal get(Block block) {
for(DPortal portal:portals){
int x1=portal.block1.getX(),y1=portal.block1.getY(),z1=portal.block1.getZ();
int x2=portal.block2.getX(),y2=portal.block2.getY(),z2=portal.block2.getZ();
int x3=block.getX(),y3=block.getY(),z3=block.getZ();
if(x1>x2){
if(x3<x2 || x3>x1) continue;
}else{
if(x3>x2 || x3<x1) continue;
}
if(y1>y2){
if(y3<y2 || y3>y1) continue;
}else{
if(y3>y2 || y3<y1) continue;
}
if(z1>z2){
if(z3<z2 || z3>z1) continue;
}else{
if(z3>z2 || z3<z1) continue;
}
return portal;
}
return null;
}
//Save and Load
public static void save(FileConfiguration configFile){
int id = 0;
for(DPortal dportal:portals){
id++;
if(dportal.isActive){
String preString="portal."+dportal.world.getName()+"."+id;
//Location1
configFile.set(preString+".loc1.x",dportal.block1.getX());
configFile.set(preString+".loc1.y",dportal.block1.getY());
configFile.set(preString+".loc1.z",dportal.block1.getZ());
//Location1
configFile.set(preString+".loc2.x",dportal.block2.getX());
configFile.set(preString+".loc2.y",dportal.block2.getY());
configFile.set(preString+".loc2.z",dportal.block2.getZ());
}
}
}
public static void load(FileConfiguration configFile) {
for(World world:p.getServer().getWorlds()){
if(configFile.contains("portal."+world.getName())){
int id=0;
String preString;
do{
id++;
preString="portal."+world.getName()+"."+id+".";
if(configFile.contains(preString)){
DPortal dportal=new DPortal(true);
dportal.world=world;
dportal.block1=world.getBlockAt(configFile.getInt(preString+"loc1.x"),configFile.getInt(preString+"loc1.y"),configFile.getInt(preString+"loc1.z"));
dportal.block2=world.getBlockAt(configFile.getInt(preString+"loc2.x"),configFile.getInt(preString+"loc2.y"),configFile.getInt(preString+"loc2.z"));
dportal.type="todungeon";
dportal.fillwithportal();
}
}while(configFile.contains(preString));
}
}
}
}

View File

@ -0,0 +1,419 @@
package com.dre.dungeonsxl;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.FileChannel;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.milkbowl.vault.permission.Permission;
import net.minecraft.server.Packet103SetSlot;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import com.dre.dungeonsxl.commands.DCommandRoot;
import com.dre.dungeonsxl.game.GameCheckpoint;
import com.dre.dungeonsxl.game.GameMessage;
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.PlayerListener;
public class DungeonsXL extends JavaPlugin{
public static DungeonsXL p;
//Listener
private static Listener entitylistener;
private static Listener playerlistener;
private static Listener blocklistener;
//Main Config Reader
public ConfigReader mainConfig;
//Tutorial
public String tutorialDungeon;
public String tutorialStartGroup;
public String tutorialEndGroup;
//Chatspyer
public CopyOnWriteArrayList<Player> chatSpyer=new CopyOnWriteArrayList<Player>();
@Override
public void onEnable(){
p=this;
//Commands
getCommand("dungeonsxl").setExecutor(new CommandListener());
//MSG
this.log(this.getDescription().getName()+" enabled!");
//Init Classes
new DCommandRoot();
//InitFolders
this.initFolders();
//Setup Permissions
this.setupPermissions();
//Listener
entitylistener=new EntityListener();
playerlistener=new PlayerListener();
blocklistener=new BlockListener();
Bukkit.getServer().getPluginManager().registerEvents(entitylistener,this);
Bukkit.getServer().getPluginManager().registerEvents(playerlistener,this);
Bukkit.getServer().getPluginManager().registerEvents(blocklistener,this);
//Load All
this.loadAll();
//Load Config
mainConfig=new ConfigReader(new File(p.getDataFolder(), "config.yml"));
// -------------------------------------------- //
// Update Sheduler
// -------------------------------------------- //
p.getServer().getScheduler().scheduleSyncRepeatingTask(p, new Runnable() {
public void run() {
for(GameWorld gworld:GameWorld.gworlds){
if(gworld.world.getPlayers().isEmpty()){
if(DPlayer.get(gworld.world).isEmpty()){
gworld.delete();
}
}
}
for(EditWorld eworld:EditWorld.eworlds){
if(eworld.world.getPlayers().isEmpty()){
eworld.delete();
}
}
}
}, 0L, 1200L);
p.getServer().getScheduler().scheduleSyncRepeatingTask(p, new Runnable() {
public void run() {
MobSpawner.updateAll();
GameWorld.update();
GameMessage.updateAll();
GameCheckpoint.update();
DPlayer.update(true);
//Tutorial Mode
for(Player player:p.getServer().getOnlinePlayers()){
if(DPlayer.get(player)==null){
if(p.tutorialDungeon!=null && p.tutorialStartGroup!=null && p.tutorialEndGroup!=null){
for(String group:p.permission.getPlayerGroups(player)){
if(p.tutorialStartGroup.equalsIgnoreCase(group)){
DGroup dgroup=new DGroup(player, p.tutorialDungeon);
if(dgroup.gworld==null){
dgroup.gworld=GameWorld.load(DGroup.get(player).dungeonname);
dgroup.gworld.isTutorial=true;
}
if(dgroup.gworld!=null){
if(dgroup.gworld.locLobby==null){
new DPlayer(player,dgroup.gworld.world,dgroup.gworld.world.getSpawnLocation(), false);
}else{
new DPlayer(player,dgroup.gworld.world,dgroup.gworld.locLobby, false);
}
}else{
p.msg(player,ChatColor.RED+"Tutorial Dungeon existiert nicht!");
}
}
}
}
}
}
}
}, 0L, 20L);
p.getServer().getScheduler().scheduleSyncRepeatingTask(p, new Runnable() {
public void run() {
DPlayer.update(false);
}
}, 0L, 2L);
}
@Override
public void onDisable(){
//Save
this.saveAll();
//MSG
this.log(this.getDescription().getName()+" disabled!");
//DPlayer leaves World
for(DPlayer dplayer:DPlayer.players){
dplayer.leave();
}
//Delete all Data
DPortal.portals.clear();
DGSign.dgsigns.clear();
LeaveSign.lsigns.clear();
//Delete Worlds
GameWorld.deleteAll();
EditWorld.deleteAll();
}
//Init.
public void initFolders(){
//Check Folder
File folder = new File(this.getDataFolder()+"");
if(!folder.exists()){
folder.mkdir();
}
folder = new File(this.getDataFolder()+File.separator+"dungeons");
if(!folder.exists()){
folder.mkdir();
}
}
//Permissions
public Permission permission = null;
private Boolean setupPermissions()
{
RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
permission = permissionProvider.getProvider();
}
return (permission != null);
}
public Boolean GroupEnabled(String group){
for(String agroup:permission.getGroups()){
if(agroup.equalsIgnoreCase(group)){
return true;
}
}
return false;
}
//Save and Load
public void saveAll(){
File file = new File(this.getDataFolder(), "data.yml");
FileConfiguration configFile = new YamlConfiguration();
DPortal.save(configFile);
DGSign.save(configFile);
LeaveSign.save(configFile);
try {
configFile.save(file);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void loadAll(){
File file = new File(this.getDataFolder(), "data.yml");
FileConfiguration configFile = YamlConfiguration.loadConfiguration(file);
DPortal.load(configFile);
DGSign.load(configFile);
LeaveSign.load(configFile);
}
//File Control
public boolean removeDirectory(File directory) {
if (directory.isDirectory()) {
for (File f : directory.listFiles()) {
if (!removeDirectory(f)) return false;
}
}
return directory.delete();
}
public void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOException e) {
throw e;
} finally {
if (inChannel != null)
inChannel.close();
if (outChannel != null)
outChannel.close();
}
}
public String[] excludedFiles={"config.yml"};
public void copyDirectory(File sourceLocation, File targetLocation) {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
targetLocation.mkdir();
}
String[] children = sourceLocation.list();
for (int i = 0; i < children.length; i++) {
boolean isOk=true;
for (String excluded:excludedFiles){
if(children[i].contains(excluded)){
isOk=false;
break;
}
}
if(isOk){
copyDirectory(new File(sourceLocation, children[i]), new File(
targetLocation, children[i]));
}
}
} else {
try {
if (!targetLocation.getParentFile().exists()) {
createDirectory(targetLocation.getParentFile().getAbsolutePath());
targetLocation.createNewFile();
} else if (!targetLocation.exists()) {
targetLocation.createNewFile();
}
InputStream in = new FileInputStream(sourceLocation);
OutputStream out = new FileOutputStream(targetLocation);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
} catch (Exception e) {
if (e.getMessage().contains("Zugriff")
|| e.getMessage().contains("Access"))
DungeonsXL.p.log("Error: " + e.getMessage() + " // Access denied");
else
DungeonsXL.p.log("Error: " + e.getMessage());
}
}
}
public void createDirectory(String s) {
if (!new File(s).getParentFile().exists()) {
createDirectory(new File(s).getParent());
}
new File(s).mkdir();
}
public void deletenotusingfiles(File directory){
File[] files=directory.listFiles();
for(File file:files){
if(file.getName().equalsIgnoreCase("uid.dat")){
file.delete();
}
}
}
//Misc
public void updateInventory(Player p) {
CraftPlayer c = (CraftPlayer) p;
for (int i = 0;i < 36;i++) {
int nativeindex = i;
if (i < 9) nativeindex = i + 36;
ItemStack olditem = c.getInventory().getItem(i);
net.minecraft.server.ItemStack item = null;
if (olditem != null && olditem.getType() != Material.AIR) {
item = new net.minecraft.server.ItemStack(0, 0, 0);
item.id = olditem.getTypeId();
item.count = olditem.getAmount();
item.b = olditem.getDurability();
}
if(olditem != null){
if(olditem.getEnchantments().size()==0) {
Packet103SetSlot pack = new Packet103SetSlot(0, nativeindex, item);
c.getHandle().netServerHandler.sendPacket(pack);
}
}
}
}
//Msg
public void msg(Player player,String msg){
player.sendMessage(ChatColor.DARK_GREEN+"[DXL] "+ChatColor.WHITE+msg);
}
public void msg(Player player,String msg, boolean zusatz){
if(zusatz){
player.sendMessage(ChatColor.DARK_GREEN+"[DXL]"+ChatColor.WHITE+msg);
}else{
player.sendMessage(ChatColor.WHITE+msg);
}
}
//Misc.
public EntityType getEntitiyType(String name){
for(EntityType type:EntityType.values()){
if(name.equalsIgnoreCase(type.getName())){
return type;
}
}
return null;
}
// -------------------------------------------- //
// LOGGING
// -------------------------------------------- //
public void log(Object msg)
{
log(Level.INFO, msg);
}
public void log(Level level, Object msg)
{
Logger.getLogger("Minecraft").log(level, "["+this.getDescription().getFullName()+"] "+msg);
}
}

View File

@ -0,0 +1,289 @@
package com.dre.dungeonsxl;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
public class EditWorld {
private static DungeonsXL p=DungeonsXL.p;
public static CopyOnWriteArrayList<EditWorld> eworlds=new CopyOnWriteArrayList<EditWorld>();
//Variables
public World world;
public String owner;
public String name;
public String dungeonname;
public int id;
public Location lobby;
public CopyOnWriteArrayList<String> invitedPlayers=new CopyOnWriteArrayList<String>();
public CopyOnWriteArrayList<Block> sign=new CopyOnWriteArrayList<Block>();
public EditWorld(){
eworlds.add(this);
//ID
this.id=-1;
int i=-1;
while(this.id==-1){
i++;
boolean exist=false;
for(EditWorld eworld:eworlds){
if(eworld.id==i){
exist=true;
break;
}
}
if(!exist) this.id=i;
}
name="DXL_Edit_"+this.id;
}
public void generate(){
WorldCreator creator=WorldCreator.name(name);
creator.type(WorldType.FLAT);
creator.generateStructures(false);
this.world=p.getServer().createWorld(creator);
}
public void save(){
this.world.save();
p.copyDirectory(new File("DXL_Edit_"+this.id),new File("plugins/DungeonsXL/dungeons/"+this.dungeonname));
p.deletenotusingfiles(new File("plugins/DungeonsXL/dungeons/"+this.dungeonname));
try {
ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream(new File("plugins/DungeonsXL/dungeons/"+this.dungeonname+"/DXLData.data")));
out.writeInt(this.sign.size());
for(Block sign:this.sign){
out.writeInt(sign.getX());
out.writeInt(sign.getY());
out.writeInt(sign.getZ());
}
out.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Check Configuration
/*File file=new File("plugins/DungeonsXL/dungeons/"+this.dungeonname+"/config.yml");
if(!file.exists()){
File copyfile=new File("plugins/DungeonsXL/config.yml");
if(copyfile.exists()){
try {
DungeonsXL.p.copyFile(copyfile,file);
} catch (IOException e) {
e.printStackTrace();
}
}else{
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}*/
}
public void checkSign(Block block){
if((block.getState() instanceof Sign)){
Sign sign = (Sign) block.getState();
String[] lines=sign.getLines();
if(lines[1].equalsIgnoreCase("lobby")){
this.lobby=block.getLocation();
}
}
}
public void delete(){
eworlds.remove(this);
for(Player player:this.world.getPlayers()){
DPlayer dplayer=DPlayer.get(player);
dplayer.leave();
}
p.getServer().unloadWorld(this.world,true);
File dir = new File("DXL_Edit_"+this.id);
p.removeDirectory(dir);
}
//Static
public static EditWorld get(World world){
for(EditWorld eworld:eworlds){
if(eworld.world.equals(world)){
return eworld;
}
}
return null;
}
public static EditWorld get(String name){
for(EditWorld eworld:eworlds){
if(eworld.name.equalsIgnoreCase(name)){
return eworld;
}
}
return null;
}
public static void deleteAll(){
for(EditWorld eworld:eworlds){
eworlds.remove(eworld);
for(Player player:eworld.world.getPlayers()){
DPlayer dplayer=DPlayer.get(player);
dplayer.leave();
}
p.getServer().unloadWorld(eworld.world,true);
File dir = new File("DXL_Edit_"+eworld.id);
p.removeDirectory(dir);
}
}
public static EditWorld load(String name){
for(EditWorld eworld:eworlds){
if(eworld.dungeonname.equalsIgnoreCase(name)){
return eworld;
}
}
File file=new File("plugins/DungeonsXL/dungeons/"+name);
if(file.exists()){
EditWorld eworld = new EditWorld();
eworld.dungeonname=name;
//World
p.copyDirectory(file,new File("DXL_Edit_"+eworld.id));
eworld.world=p.getServer().createWorld(WorldCreator.name("DXL_Edit_"+eworld.id));
try {
ObjectInputStream os=new ObjectInputStream(new FileInputStream(new File("plugins/DungeonsXL/dungeons/"+eworld.dungeonname+"/DXLData.data")));
int length=os.readInt();
for(int i=0; i<length; i++){
int x=os.readInt();
int y=os.readInt();
int z=os.readInt();
Block block=eworld.world.getBlockAt(x, y, z);
eworld.checkSign(block);
eworld.sign.add(block);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return eworld;
}
return null;
}
public static boolean exist(String name){
//Cheack Loaded EditWorlds
for(EditWorld eworld:eworlds){
if(eworld.dungeonname.equalsIgnoreCase(name)){
return true;
}
}
//Cheack Unloaded Worlds
File file=new File("plugins/DungeonsXL/dungeons/"+name);
if(file.exists()){
return true;
}
return false;
}
public void msg(String msg) {
for(DPlayer dplayer:DPlayer.get(this.world)){
p.msg(dplayer.player, msg);
}
}
//Invite
public static boolean addInvitedPlayer(String eworldname,String player){
EditWorld eworld=EditWorld.get(eworldname);
if(eworld!=null){
eworld.invitedPlayers.add(player.toLowerCase());
}else{
if(exist(eworldname)){
ConfigReader confreader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+eworldname, "config.yml"));
confreader.invitedPlayer.add(player.toLowerCase());
confreader.save();
return true;
}
}
return false;
}
public static boolean removeInvitedPlayer(String eworldname,String player){
EditWorld eworld=EditWorld.get(eworldname);
if(eworld!=null){
eworld.invitedPlayers.remove(player.toLowerCase());
}else{
if(exist(eworldname)){
ConfigReader confreader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+eworldname, "config.yml"));
confreader.invitedPlayer.remove(player.toLowerCase());
confreader.save();
return true;
}
}
return false;
}
public static boolean isInvitedPlayer(String eworldname,String player){
EditWorld eworld=EditWorld.get(eworldname);
if(eworld!=null){
return eworld.invitedPlayers.contains(player.toLowerCase());
}else{
if(exist(eworldname)){
ConfigReader confreader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+eworldname, "config.yml"));
return confreader.invitedPlayer.contains(player.toLowerCase());
}
}
return false;
}
}

View File

@ -0,0 +1,110 @@
package com.dre.dungeonsxl;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
public class LeaveSign{
public static CopyOnWriteArrayList<LeaveSign> lsigns=new CopyOnWriteArrayList<LeaveSign>();
public Sign sign;
public LeaveSign(Sign sign){
lsigns.add(this);
this.sign=sign;
this.setText();
}
public void setText(){
this.sign.setLine(0, ChatColor.BLUE+"############");
this.sign.setLine(1, ChatColor.DARK_GREEN+"Leave");
this.sign.setLine(2, "");
this.sign.setLine(3, ChatColor.BLUE+"############");
this.sign.update();
}
public static boolean playerInteract(Block block, Player player) {
LeaveSign lsign=getSign(block);
if(lsign!=null){
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
dplayer.leave();
return true;
}else{
DGroup dgroup=DGroup.get(player);
if(dgroup!=null){
dgroup.removePlayer(player);
DungeonsXL.p.msg(player,ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!");
return true;
}
}
}
return false;
}
public static boolean isRelativeSign(Block block,int x,int z){
LeaveSign lsign=getSign(block.getRelative(x,0,z));
if(lsign!=null){
if(x==-1 && lsign.sign.getData().getData()==4) return true;
if(x==1 && lsign.sign.getData().getData()==5) return true;
if(z==-1 && lsign.sign.getData().getData()==2) return true;
if(z==1 && lsign.sign.getData().getData()==3) return true;
}
return false;
}
public static LeaveSign getSign(Block block) {
if(block.getTypeId()==68||block.getTypeId()==63){
for(LeaveSign leavesign:lsigns){
if(block.getWorld()==leavesign.sign.getWorld()){
if(block.getLocation().distance(leavesign.sign.getBlock().getLocation())<1){
return leavesign;
}
}
}
}
return null;
}
//Save and Load
public static void save(FileConfiguration configFile){
int id = 0;
for(LeaveSign lsign:lsigns){
id++;
String preString="leavesign."+lsign.sign.getWorld().getName()+"."+id;
configFile.set(preString+".x",lsign.sign.getX());
configFile.set(preString+".y",lsign.sign.getY());
configFile.set(preString+".z",lsign.sign.getZ());
}
}
public static void load(FileConfiguration configFile) {
for(World world:DungeonsXL.p.getServer().getWorlds()){
if(configFile.contains("leavesign."+world.getName())){
int id=0;
String preString;
do{
id++;
preString="leavesign."+world.getName()+"."+id+".";
if(configFile.contains(preString)){
Block block=world.getBlockAt(configFile.getInt(preString+".x"),configFile.getInt(preString+".y"),configFile.getInt(preString+".z"));
if(block.getState() instanceof Sign){
Sign sign = (Sign) block.getState();
new LeaveSign(sign);
}
}
}while(configFile.contains(preString));
}
}
}
}

View File

@ -0,0 +1,33 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DPlayer;
public class CMDChat extends DCommand{
public CMDChat(){
this.command="chat";
this.args=0;
this.help="/dxl chat - Ändert den Chat-Modus";
}
@Override
public void onExecute(String[] args, Player player) {
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
if(dplayer.isInWorldChat) {
dplayer.isInWorldChat=false;
p.msg(player,ChatColor.YELLOW+"Du bist nun im öffentlichen Chat");
}else{
dplayer.isInWorldChat=true;
p.msg(player,ChatColor.YELLOW+"Du bist nun im Dungeon-Chat");
}
}else{
p.msg(player,ChatColor.RED+"Du bist in keinem Dungeon!");
}
}
}

View File

@ -0,0 +1,26 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class CMDChatSpy extends DCommand{
public CMDChatSpy(){
this.command="chatspy";
this.args=0;
this.help="/dxl chatspy - Spionier den DXL-Chat";
this.permissions="dxl.chatspy";
}
@Override
public void onExecute(String[] args, Player player) {
if(p.chatSpyer.contains(player)){
p.chatSpyer.remove(player);
p.msg(player, ChatColor.GOLD+"Du hast aufgehört den DXL-Chat auszuspähen!");
}
else{
p.chatSpyer.add(player);
p.msg(player, ChatColor.GOLD+"Du hast begonnen den DXL-Chat auszuspähen!");
}
}
}

View File

@ -0,0 +1,53 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.EditWorld;
public class CMDCreate extends DCommand {
public CMDCreate(){
this.args=1;
this.command="create";
this.help="/dxl create <name> - Create a new Dungeon";
this.permissions="dxl.create";
}
@Override
public void onExecute(String[] args, Player player) {
String name=args[1];
if(DPlayer.get(player)==null){
if(name.length()<=15){
//Msg create
p.log("New Dungeon: "+name);
p.log("Generate new world...");
//Create World
EditWorld eworld=new EditWorld();
eworld.generate();
eworld.dungeonname=name;
//MSG Done
p.log("World generation finished!");
//Tp Player
if(eworld.lobby==null){
new DPlayer(player,eworld.world,eworld.world.getSpawnLocation(), true);
}else{
new DPlayer(player,eworld.world,eworld.lobby, true);
}
}else{
p.msg(player, ChatColor.RED+"Der Name darf nicht länger sein als 15 Zeichen!");
}
}else{
p.msg(player, ChatColor.RED+"Du musst zuerst aus dem aktuellen Dungeon raus!");
}
}
}

View File

@ -0,0 +1,51 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DGroup;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.EditWorld;
public class CMDEdit extends DCommand{
public CMDEdit(){
this.command="edit";
this.args=1;
this.help="/dxl edit <name> - Edit a existing dungeon";
}
@Override
public void onExecute(String[] args, Player player) {
String dungeonname=args[1];
EditWorld eworld=EditWorld.load(dungeonname);
DGroup dgroup=DGroup.get(player);
DPlayer dplayer=DPlayer.get(player);
if(EditWorld.isInvitedPlayer(dungeonname,player.getName())||p.permission.has(player, "dxl.edit")||player.isOp()){
if(dplayer==null){
if(dgroup==null){
if(eworld!=null){
if(eworld.lobby==null){
new DPlayer(player,eworld.world,eworld.world.getSpawnLocation(), true);
}else{
new DPlayer(player,eworld.world,eworld.lobby, true);
}
}else{
p.msg(player,ChatColor.RED+"Dungeon existiert nicht!");
}
}else{
p.msg(player,ChatColor.RED+"Du musst zuerst deine Gruppe verlassen!");
}
}else{
p.msg(player,ChatColor.RED+"Du musst zuerst den aktuellen Dungeon verlassen!");
}
}
}
}

View File

@ -0,0 +1,49 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class CMDHelp extends DCommand{
public CMDHelp(){
this.command="help";
this.args=-1;
this.help="/dxl help - Displays the Help-Page";
}
@Override
public void onExecute(String[] args, Player player) {
int page=1;
int pages=(int)(DCommandRoot.root.commands.size()/6);
if(args.length>1){
try{
page=Integer.parseInt(args[1]);
}catch(NumberFormatException e){
page=1;
}
if(page<1) page=1;
if(page>pages) page=pages;
}
p.msg(player, ChatColor.GREEN+"============[ "+ChatColor.GOLD+"Help DungeonsXL - "+page+"/"+pages+ChatColor.GREEN+" ]============",false);
int i=0;
int ipage=1;
for(DCommand command:DCommandRoot.root.commands){
i++;
if(i>6){
i=0;
ipage++;
}
if(ipage==page){
p.msg(player, ChatColor.YELLOW+command.help,false);
}
}
p.msg(player, ChatColor.GREEN+"==============[ "+ChatColor.GOLD+"By Frank Baumann"+ChatColor.GREEN+" ]==============",false);
}
}

View File

@ -0,0 +1,25 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.EditWorld;
public class CMDInvite extends DCommand{
public CMDInvite(){
this.args=2;
this.command="invite";
this.help="/dxl invite <player> <dungeon> - Invites a Player to edit a Dungeon";
this.permissions="dxl.invite";
}
@Override
public void onExecute(String[] args, Player player) {
if(EditWorld.addInvitedPlayer(args[2], args[1])){
p.msg(player, ChatColor.GREEN+"Spieler "+ChatColor.GOLD+args[1]+ChatColor.GREEN+" wurde erfolgreich eingeladen am Dungeon "+ChatColor.GOLD+args[2]+ChatColor.GREEN+" zu arbeiten!");
}else{
p.msg(player, ChatColor.RED+"Spieler "+ChatColor.GOLD+args[1]+ChatColor.RED+" konnte nicht eingeladen werden. Existiert der Dungeon?");
}
}
}

View File

@ -0,0 +1,42 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DGroup;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.game.GameWorld;
public class CMDLeave extends DCommand {
public CMDLeave(){
this.command="leave";
this.args=0;
this.help="/dxl leave - leaves the current dungeon.";
}
@Override
public void onExecute(String[] args, Player player) {
DPlayer dplayer=DPlayer.get(player);
if(GameWorld.get(player.getWorld())!=null){
if(GameWorld.get(player.getWorld()).isTutorial){
p.msg(player,ChatColor.RED+"Du kannst diesen Befehl nicht in einem Tutorial benutzen!");
return;
}
}
if(dplayer!=null){
dplayer.leave();
return;
}else{
DGroup dgroup=DGroup.get(player);
if(dgroup!=null){
dgroup.removePlayer(player);
p.msg(player,ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!");
return;
}
p.msg(player,ChatColor.RED+"You aren't in a dungeon!");
}
}
}

View File

@ -0,0 +1,30 @@
package com.dre.dungeonsxl.commands;
import java.io.File;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class CMDList extends DCommand{
public CMDList(){
this.command="list";
this.args=0;
this.help="/dxl list - Zeigt alle Dungeons an";
}
@Override
public void onExecute(String[] args, Player player) {
File dungeonsfolder=new File(p.getDataFolder()+"/dungeons");
if(dungeonsfolder.exists()){
p.msg(player, ChatColor.DARK_GREEN+"-----[ "+ChatColor.GOLD+"Dungeons "+ChatColor.RED+dungeonsfolder.list().length+ChatColor.DARK_GREEN+"]-----");
for(String dungeon:dungeonsfolder.list()){
p.msg(player, dungeon);
}
}
}
}

View File

@ -0,0 +1,78 @@
package com.dre.dungeonsxl.commands;
import java.io.File;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.ConfigReader;
import com.dre.dungeonsxl.EditWorld;
public class CMDMsg extends DCommand{
public CMDMsg(){
this.args=-1;
this.command="msg";
this.help="/dxl msg <id> '[msg]' - Display the msg or change the msg";
this.permissions="dxl.msg";
}
@Override
public void onExecute(String[] args, Player player) {
EditWorld eworld=EditWorld.get(player.getWorld());
if(eworld!=null){
if(args.length>1){
try{
int id=Integer.parseInt(args[1]);
ConfigReader confreader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+eworld.dungeonname, "config.yml"));
if(args.length==2){
String msg=confreader.msgs.get(id);
if(msg!=null){
p.msg(player, ChatColor.GOLD+"Msg("+id+"):"+ChatColor.WHITE+msg);
}else{
p.msg(player, ChatColor.RED+"Nachricht mit der Id "+ChatColor.GOLD+id+ChatColor.RED+" existiert nicht!");
}
}else{
String msg="";
int i=0;
for(String arg:args){
i++;
if(i>2){
msg=msg+" "+arg;
}
}
String[] splitMsg=msg.split("'");
if(splitMsg.length>1){
msg=splitMsg[1];
String old=confreader.msgs.get(id);
if(old==null){
p.msg(player, ChatColor.GREEN+"Neue Nachricht ("+ChatColor.GOLD+id+ChatColor.GREEN+") hinzugefügt!");
}else{
p.msg(player, ChatColor.GREEN+"Nachricht ("+ChatColor.GOLD+id+ChatColor.GREEN+") aktualisiert!");
}
confreader.msgs.put(id, msg);
confreader.save();
}else{
p.msg(player, ChatColor.RED+"Du musst die Nachricht zwischen ' einfügen!");
}
}
}catch(NumberFormatException e){
p.msg(player, ChatColor.RED+"Parameter <id> muss eine Zahl beinhalten!");
}
}else{
this.displayhelp(player);
}
}else{
p.msg(player, ChatColor.RED+"Du musst einen Dungeon bearbeiten um diesen Befehl zu benutzen!");
}
}
}

View File

@ -0,0 +1,39 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DPortal;
public class CMDPortal extends DCommand{
public CMDPortal(){
this.command="portal";
this.args=0;
this.help="/dxl portal - Create a portal that goes in a dungeon or out a dungeon";
this.permissions="dxl.portal";
}
@Override
public void onExecute(String[] args, Player player) {
DPortal dportal=new DPortal(false);
dportal.player=player;
dportal.world=player.getWorld();
player.getInventory().setItemInHand(new ItemStack(268));
//Check Destination
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){ //Is player in EditWorld
dportal.type="toworld";
}else{ //Is player in normal World
dportal.type="todungeon";
}
}
}

View File

@ -0,0 +1,30 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.EditWorld;
public class CMDSave extends DCommand{
public CMDSave(){
this.command="save";
this.args=0;
this.help="/dxl save - Save the current dungeon.";
this.permissions="dxl.save";
}
@Override
public void onExecute(String[] args, Player player) {
EditWorld eworld=EditWorld.get(player.getWorld());
if(eworld!=null){
eworld.save();
p.msg(player,ChatColor.GOLD+"Dungeon erfolgreich gespeichert!");
}else{
p.msg(player,ChatColor.RED+"Du musst einen Dungeon editieren, um ihn zu speichern!");
}
}
}

View File

@ -0,0 +1,85 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DGroup;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.EditWorld;
import com.dre.dungeonsxl.game.GameWorld;
public class CMDTest extends DCommand {
public CMDTest(){
this.command="test";
this.args=-1;
this.help="/dxl test [dungeon] - Test a Dungeon";
this.permissions="dxl.test";
}
@Override
public void onExecute(String[] args, Player player) {
DPlayer dplayer=DPlayer.get(player);
String dungeonname;
if(dplayer==null){
if(args.length>1){
dungeonname=args[1];
if(EditWorld.exist(dungeonname)){
DGroup dgroup=new DGroup(player, dungeonname);
if(dgroup!=null){
if(dgroup.gworld==null){
dgroup.gworld=GameWorld.load(DGroup.get(player).dungeonname);
}
DPlayer newDPlayer;
if(dgroup.gworld.locLobby==null){
newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.world.getSpawnLocation(), false);
}else{
newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.locLobby, false);
}
newDPlayer.isinTestMode=2;
}
}else{
p.msg(player, ChatColor.RED+"Dungeon "+ChatColor.GOLD+dungeonname+ChatColor.RED+" existiert nicht!");
}
}else{
this.displayhelp(player);
}
}else if(dplayer.isEditing){
if(args.length>1){
dungeonname=args[1];
}else{
dungeonname=EditWorld.get(dplayer.world).dungeonname;
}
DGroup dgroup=new DGroup(player, dungeonname);
if(dgroup!=null){
if(dgroup.gworld==null){
dgroup.gworld=GameWorld.load(DGroup.get(player).dungeonname);
}
DPlayer newDPlayer;
if(dgroup.gworld.locLobby==null){
newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.world.getSpawnLocation(), false);
}else{
newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.locLobby, false);
}
newDPlayer.oldDPlayer=dplayer;
dplayer.isinTestMode=1;
}
}else{
p.msg(player, ChatColor.RED+"Du must zuerst den aktuellen Dungeon verlassen!");
}
}
}

View File

@ -0,0 +1,25 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.EditWorld;
public class CMDUninvite extends DCommand{
public CMDUninvite(){
this.args=2;
this.command="uninvite";
this.help="/dxl uninvite <player> <dungeon> - Uninvites a Player to edit a Dungeon";
this.permissions="dxl.uninvite";
}
@Override
public void onExecute(String[] args, Player player) {
if(EditWorld.removeInvitedPlayer(args[2], args[1])){
p.msg(player, ChatColor.GREEN+"Spieler "+ChatColor.GOLD+args[1]+ChatColor.GREEN+" wurde erfolgreich ausgeladen am Dungeon "+ChatColor.GOLD+args[2]+ChatColor.GREEN+" zu arbeiten!");
}else{
p.msg(player, ChatColor.RED+"Spieler "+ChatColor.GOLD+args[1]+ChatColor.GOLD+" konnte nicht ausgeladen werden. Existiert der Dungeon?");
}
}
}

View File

@ -0,0 +1,43 @@
package com.dre.dungeonsxl.commands;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DungeonsXL;
public abstract class DCommand {
public DungeonsXL p=DungeonsXL.p;
public Player player;
public boolean costsMoney;
public String command;
public int args;
public String help;
public String permissions;
// TODO : Add Aliases
public DCommand(){
costsMoney = false;
}
public void displayhelp(Player player){
p.msg(player,ChatColor.RED+this.help);
}
public boolean playerHasPermissions(Player player){
if(this.permissions==null){
return true;
}
if(DungeonsXL.p.permission.has(player, this.permissions)||player.isOp()){
return true;
}
return false;
}
//Abstracts
public abstract void onExecute(String[] args, Player player);
}

View File

@ -0,0 +1,46 @@
package com.dre.dungeonsxl.commands;
import java.util.concurrent.CopyOnWriteArrayList;
public class DCommandRoot {
//Variables
public static DCommandRoot root;
public CopyOnWriteArrayList<DCommand> commands=new CopyOnWriteArrayList<DCommand>();
//Commands
public CMDCreate cmdCreate=new CMDCreate();
public CMDSave cmdSave=new CMDSave();
public CMDLeave cmdLeave=new CMDLeave();
public CMDEdit cmdEdit=new CMDEdit();
public CMDPortal cmdPortal=new CMDPortal();
public CMDChat cmdChat=new CMDChat();
public CMDChatSpy cmdChatSpy=new CMDChatSpy();
public CMDList cmdList=new CMDList();
public CMDUninvite cmdUninvite=new CMDUninvite();
public CMDInvite cmdInvite=new CMDInvite();
public CMDMsg cmdMsg=new CMDMsg();
public CMDTest cmdTest=new CMDTest();
public CMDHelp cmdHelp=new CMDHelp();
//Methods
public DCommandRoot(){
root=this;
//Add Commands
this.commands.add(cmdCreate);
this.commands.add(cmdSave);
this.commands.add(cmdLeave);
this.commands.add(cmdEdit);
this.commands.add(cmdPortal);
this.commands.add(cmdChat);
this.commands.add(cmdChatSpy);
this.commands.add(cmdList);
this.commands.add(cmdUninvite);
this.commands.add(cmdInvite);
this.commands.add(cmdMsg);
this.commands.add(cmdTest);
this.commands.add(cmdHelp);
}
}

View File

@ -0,0 +1,54 @@
package com.dre.dungeonsxl.game;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
public class DMob {
//Variables
public LivingEntity entity;
public int live;
public DMob(LivingEntity entity, int live, GameWorld gworld){
gworld.dmobs.add(this);
this.entity=entity;
this.live=live;
}
//Statics
public static void onDamage(EntityDamageEvent event){
if(event.getEntity() instanceof LivingEntity){
LivingEntity victim=(LivingEntity) event.getEntity();
GameWorld gworld=GameWorld.get(victim.getWorld());
if(gworld!=null){
for(DMob dmob:gworld.dmobs){
if(dmob.entity==victim){
dmob.live=dmob.live-event.getDamage();
dmob.entity.damage(1);
dmob.entity.setHealth(dmob.entity.getMaxHealth());
if(event instanceof EntityDamageByEntityEvent){
EntityDamageByEntityEvent eByEEvent=(EntityDamageByEntityEvent) event;
if(dmob.entity instanceof Monster && eByEEvent.getDamager() instanceof LivingEntity){
Monster mob=(Monster)dmob.entity;
mob.setTarget((LivingEntity) eByEEvent.getDamager());
}
}
if(dmob.live<=0){
dmob.entity.damage(dmob.entity.getMaxHealth());
gworld.dmobs.remove(dmob);
}
event.setCancelled(true);
}
}
}
}
}
}

View File

@ -0,0 +1,50 @@
package com.dre.dungeonsxl.game;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DungeonsXL;
public class GameCheckpoint {
public static CopyOnWriteArrayList<GameCheckpoint> gcheckpoints=new CopyOnWriteArrayList<GameCheckpoint>();
//Variables
public GameWorld gworld;
public Location location;
public int radius;
public CopyOnWriteArrayList<DPlayer> dplayerHasUsed=new CopyOnWriteArrayList<DPlayer>();
public GameCheckpoint(GameWorld gworld, Location location, int radius){
gcheckpoints.add(this);
this.location=location;
this.radius=radius;
if(this.radius==0){
this.radius=5;
}
this.gworld=gworld;
}
//Statics
public static void update(){
for(GameCheckpoint gpoint:gcheckpoints){
for(DPlayer dplayer:DPlayer.get(gpoint.gworld.world)){
if(!gpoint.dplayerHasUsed.contains(dplayer)){
if(dplayer.player.getLocation().distance(gpoint.location)<=gpoint.radius){
dplayer.setCheckpoint(gpoint);
DungeonsXL.p.msg(dplayer.player, ChatColor.GOLD+"Checkpoint erreicht!");
gpoint.dplayerHasUsed.add(dplayer);
}
}
}
}
}
}

View File

@ -0,0 +1,82 @@
package com.dre.dungeonsxl.game;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import com.dre.dungeonsxl.DGroup;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DungeonsXL;
public class GameChest {
//Variables
public boolean isUsed=false;
public Chest chest;
public GameWorld gworld;
public GameChest(Block chest, GameWorld gworld){
if(chest.getState() instanceof Chest ){
this.chest=(Chest)chest.getState();
this.gworld=gworld;
gworld.gchests.add(this);
}
}
public void addTreasure(DGroup dgroup){
if(dgroup!=null){
for(Player player:dgroup.players){
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
String msg=ChatColor.GOLD+"Deinem Belohnungsinventar sind";
for(ItemStack istack:this.chest.getInventory().getContents()){
if(istack!=null){
dplayer.treasureInv.addItem(istack);
msg=msg+ChatColor.RED+" "+istack.getAmount()+" "+istack.getType().name()+ChatColor.GOLD+",";
}
}
msg=msg.substring(0,msg.length()-1);
msg=msg+" hinzugefügt worden!";
DungeonsXL.p.msg(player, msg);
}
}
}
}
//Statics
public static void onOpenInventory(InventoryOpenEvent event){
InventoryView inventory=event.getView();
GameWorld gworld=GameWorld.get(event.getPlayer().getWorld());
if(gworld!=null){
if(inventory.getTopInventory().getHolder() instanceof Chest){
Chest chest=(Chest) inventory.getTopInventory().getHolder();
for(GameChest gchest:gworld.gchests){
if(gchest.chest.equals(chest)){
if(!gchest.isUsed){
if(gchest.chest.getLocation().distance(chest.getLocation())<1){
gchest.addTreasure(DGroup.get(gworld));
gchest.isUsed=true;
event.setCancelled(true);
}
}else{
DungeonsXL.p.msg(DungeonsXL.p.getServer().getPlayer(event.getPlayer().getName()), ChatColor.RED+"Diese Kiste wurde schon geöffnet!");
event.setCancelled(true);
}
}
}
}
}
}
}

View File

@ -0,0 +1,49 @@
package com.dre.dungeonsxl.game;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.block.Block;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DungeonsXL;
public class GameMessage {
public static CopyOnWriteArrayList<GameMessage> gmessages=new CopyOnWriteArrayList<GameMessage>();
//Variables
public CopyOnWriteArrayList<DPlayer> playerDone=new CopyOnWriteArrayList<DPlayer>();
public Block block;
public String msg;
public GameWorld gworld;
public int radius;
public GameMessage(Block block, int msgid,GameWorld gworld,int radius){
this.block=block;
this.msg=gworld.confReader.getMsg(msgid);
this.gworld=gworld;
this.radius=radius;
if(this.msg!=null){
gmessages.add(this);
}
}
//Static
public static void updateAll(){
for(GameMessage gmessage:gmessages){
for(DPlayer dplayer:DPlayer.get(gmessage.gworld.world)){
if(!gmessage.playerDone.contains(dplayer)){
if(dplayer.player.getLocation().distance(gmessage.block.getLocation())<gmessage.radius+1){
DungeonsXL.p.msg(dplayer.player, gmessage.msg);
gmessage.playerDone.add(dplayer);
}
}
}
}
}
}

View File

@ -0,0 +1,397 @@
package com.dre.dungeonsxl.game;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Spider;
import com.dre.dungeonsxl.ConfigReader;
import com.dre.dungeonsxl.DClass;
import com.dre.dungeonsxl.DGSign;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DungeonsXL;
public class GameWorld {
private static DungeonsXL p=DungeonsXL.p;
public static CopyOnWriteArrayList<GameWorld> gworlds=new CopyOnWriteArrayList<GameWorld>();
//Variables placeable
public boolean isTutorial;
public CopyOnWriteArrayList<Block> placeableBlocks=new CopyOnWriteArrayList<Block>();
public World world;
public String dungeonname;
public Location locLobby;
public Location locStart;
public CopyOnWriteArrayList<Block> blocksEnd=new CopyOnWriteArrayList<Block>();
public CopyOnWriteArrayList<Block> blocksReady=new CopyOnWriteArrayList<Block>();
public CopyOnWriteArrayList<Block> blocksLeave=new CopyOnWriteArrayList<Block>();
public boolean isPlaying=false;
public int id;
public CopyOnWriteArrayList<Material> secureobjects = new CopyOnWriteArrayList<Material>();
public CopyOnWriteArrayList<Sign> signClass=new CopyOnWriteArrayList<Sign>();
public CopyOnWriteArrayList<DMob> dmobs = new CopyOnWriteArrayList<DMob>();
public CopyOnWriteArrayList<GameChest> gchests = new CopyOnWriteArrayList<GameChest>();
public ConfigReader confReader;
public GameWorld(){
gworlds.add(this);
//ID
this.id=-1;
int i=-1;
while(this.id==-1){
i++;
boolean exist=false;
for(GameWorld gworld:gworlds){
if(gworld.id==i){
exist=true;
break;
}
}
if(!exist) this.id=i;
}
}
public void checkSign(Block block){
if((block.getState() instanceof Sign)){
Sign sign = (Sign) block.getState();
String[] lines=sign.getLines();
if(!isPlaying){
if(lines[1].equalsIgnoreCase("lobby")){
this.locLobby=block.getLocation();
block.setTypeId(0);
}
if(lines[1].equalsIgnoreCase("ready")){
this.blocksReady.add(block);
sign.setLine(0, ChatColor.BLUE+"############");
sign.setLine(1, ChatColor.DARK_GREEN+"Bereit");
sign.setLine(2, "");
sign.setLine(3, ChatColor.BLUE+"############");
sign.update();
}
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();
}
if(lines[1].equalsIgnoreCase("start")){
this.locStart=block.getLocation();
block.setTypeId(0);
}
if(lines[1].equalsIgnoreCase("end")){
this.blocksEnd.add(block);
sign.setLine(0, ChatColor.DARK_BLUE+"############");
sign.setLine(1, ChatColor.DARK_GREEN+"Ende");
sign.setLine(2, "");
sign.setLine(3, ChatColor.DARK_BLUE+"############");
sign.update();
}
if(lines[1].equalsIgnoreCase("classes")){
if(!confReader.isLobbyDisabled){
int[] direction=DGSign.getDirection(block.getData());
int directionX=direction[0];
int directionZ=direction[1];
int xx=0,zz=0;
for(DClass dclass:this.confReader.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("mob")){
if(lines[2]!=""&&lines[3]!=""){
EntityType mob=p.getEntitiyType(lines[2]);
if(mob!=null){
String[] atributes=lines[3].split(",");
if(atributes.length==3){
new MobSpawner(block, mob, Integer.parseInt(atributes[0]), Integer.parseInt(atributes[1]), Integer.parseInt(atributes[2]),0);
}
if(atributes.length==4){
new MobSpawner(block, mob, Integer.parseInt(atributes[0]), Integer.parseInt(atributes[1]), Integer.parseInt(atributes[2]),Integer.parseInt(atributes[3]));
}
}
}
block.setTypeId(0);
}
if(lines[1].equalsIgnoreCase("place")){
placeableBlocks.add(block);
block.setTypeId(0);
}
if(lines[1].equalsIgnoreCase("msg")){
if(lines[2]!=""&&lines[3]!=""){
new GameMessage(block,Integer.parseInt(lines[2]),this,Integer.parseInt(lines[3]));
block.setTypeId(0);
}
}
if(lines[1].equalsIgnoreCase("checkpoint")){
int radius=0;
if(lines[2]!=null ){
if(lines[2].length()>0){
radius=Integer.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);
}
}
}
}
public void startGame() {
this.isPlaying=true;
ObjectInputStream os;
try {
os = new ObjectInputStream(new FileInputStream(new File("DXL_Game_"+this.id+"/DXLData.data")));
int length=os.readInt();
for(int i=0; i<length; i++){
int x=os.readInt();
int y=os.readInt();
int z=os.readInt();
Block block=this.world.getBlockAt(x, y, z);
this.checkSign(block);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public boolean canBuild(Block block){
for(Block placeableBlock:placeableBlocks){
if(placeableBlock.getLocation().distance(block.getLocation())<1){
return true;
}
}
return false;
}
public void msg(String msg) {
for(DPlayer dplayer:DPlayer.get(this.world)){
p.msg(dplayer.player, msg);
}
}
//Static
public static GameWorld get(World world){
for(GameWorld gworld:gworlds){
if(gworld.world.equals(world)){
return gworld;
}
}
return null;
}
public static void deleteAll(){
for(GameWorld gworld:gworlds){
gworlds.remove(gworld);
p.getServer().unloadWorld(gworld.world,true);
File dir = new File("DXL_Game_"+gworld.id);
p.removeDirectory(dir);
}
}
public static boolean canPlayDungeon(String dungeon, Player player){
if(p.permission.has(player, "dungeonsxl.ignoretimelimit")||player.isOp()){
return true;
}
File dungeonFolder=new File(p.getDataFolder()+"/dungeons/"+dungeon);
if(dungeonFolder.isDirectory()){
ConfigReader confReader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+dungeon, "config.yml"));
if(confReader.timeToNextPlay!=0){
//read PlayerConfig
File file=new File(p.getDataFolder()+"/dungeons/"+dungeon, "players.yml");
if(!file.exists()){
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
FileConfiguration playerConfig = YamlConfiguration.loadConfiguration(file);
if(playerConfig.contains(player.getName())){
Long time=playerConfig.getLong(player.getName());
if(time+(confReader.timeToNextPlay*1000*60*60)>System.currentTimeMillis()){
return false;
}
}
}
}else{
return false;
}
return true;
}
public void delete(){
//for(GameWorld gworld:gworlds){
gworlds.remove(this);
p.getServer().unloadWorld(this.world,true);
File dir = new File("DXL_Game_"+this.id);
p.removeDirectory(dir);
//}
}
public static GameWorld load(String name){
File file=new File("plugins/DungeonsXL/dungeons/"+name);
if(file.exists()){
GameWorld gworld = new GameWorld();
gworld.dungeonname=name;
//Config einlesen
gworld.confReader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+gworld.dungeonname, "config.yml"));
//Secure Objects
gworld.secureobjects=gworld.confReader.secureobjects;
//World
p.copyDirectory(file,new File("DXL_Game_"+gworld.id));
gworld.world=p.getServer().createWorld(WorldCreator.name("DXL_Game_"+gworld.id));
ObjectInputStream os;
try {
os = new ObjectInputStream(new FileInputStream(new File("DXL_Game_"+gworld.id+"/DXLData.data")));
int length=os.readInt();
for(int i=0; i<length; i++){
int x=os.readInt();
int y=os.readInt();
int z=os.readInt();
Block block=gworld.world.getBlockAt(x, y, z);
gworld.checkSign(block);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//if(gworld.confReader.isLobbyDisabled){
// gworld.startGame();
//}
return gworld;
}
return null;
}
public static void update(){
for(GameWorld gworld:gworlds){
//Update Spiders
for(LivingEntity mob:gworld.world.getLivingEntities()){
if(mob.getType()==EntityType.SPIDER){
Spider spider=(Spider) mob;
if(spider.getTarget()!=null){
if(spider.getTarget().getType()==EntityType.PLAYER){
continue;
}
}
for(Entity player:spider.getNearbyEntities(10,10,10)){
if(player.getType()==EntityType.PLAYER){
spider.setTarget((LivingEntity) player);
}
}
}
}
}
}
}

View File

@ -0,0 +1,69 @@
package com.dre.dungeonsxl.game;
import java.util.concurrent.CopyOnWriteArrayList;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class MobSpawner {
public static CopyOnWriteArrayList<MobSpawner> mobspawners=new CopyOnWriteArrayList<MobSpawner>();
//Variables
public EntityType mob;
public Block block;
public int maxinterval;
public int interval=0;
public int ammount;
public int radius;
private int live;
public MobSpawner(Block block, EntityType mob, int interval, int ammount, int radius, int live){
mobspawners.add(this);
this.block=block;
this.mob=mob;
this.maxinterval=interval;
this.ammount=ammount;
this.radius=radius;
this.live=live;
}
public void update(){
World world=this.block.getWorld();
for(Player player:world.getPlayers()){
if(player.getLocation().distance(this.block.getLocation())<this.radius){
if(this.interval<=0){
LivingEntity mob=world.spawnCreature(this.block.getLocation(), this.mob);
if(this.live>0){
new DMob(mob,live,GameWorld.get(world));
}
if(ammount!=-1){
if(ammount>1){
ammount--;
}else{
mobspawners.remove(this);
}
}
this.interval=this.maxinterval;
}
this.interval--;
return;
}
}
}
//Static
public static void updateAll(){
for(MobSpawner spawner:mobspawners){
spawner.update();
}
}
}

View File

@ -0,0 +1,174 @@
package com.dre.dungeonsxl.listener;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.SignChangeEvent;
import com.dre.dungeonsxl.DGSign;
import com.dre.dungeonsxl.DPortal;
import com.dre.dungeonsxl.DungeonsXL;
import com.dre.dungeonsxl.EditWorld;
import com.dre.dungeonsxl.LeaveSign;
import com.dre.dungeonsxl.game.GameWorld;
public class BlockListener implements Listener {
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPhysics(BlockPhysicsEvent event){
if(event.getBlock().getTypeId()==90){
if(DPortal.get(event.getBlock())!=null){
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onBlockBreak(BlockBreakEvent event){
Block block=event.getBlock();
//Deny DPortal destroying
if(block.getTypeId()==90){
if(DPortal.get(event.getBlock())!=null){
event.setCancelled(true);
}
}
//Deny DGSignblocks destroying
if(DGSign.isRelativeSign(block,1, 0)||
DGSign.isRelativeSign(block,-1, 0)||
DGSign.isRelativeSign(block,0, 1)||
DGSign.isRelativeSign(block,0, -1)
)
{
event.setCancelled(true);
}
//DGSign destroying
if(DGSign.getSign(block)!=null){
DGSign.dgsigns.remove(DGSign.getSign(block));
}
//Deny LeaveSignblocks destroying
if(LeaveSign.isRelativeSign(block,1, 0)||
LeaveSign.isRelativeSign(block,-1, 0)||
LeaveSign.isRelativeSign(block,0, 1)||
LeaveSign.isRelativeSign(block,0, -1)
)
{
event.setCancelled(true);
}
//LeaveSign destroying
if(LeaveSign.getSign(block)!=null){
event.setCancelled(true);
//LeaveSign.lsigns.remove(LeaveSign.getSign(block));
}
//Editworld Signs
EditWorld eworld=EditWorld.get(block.getWorld());
if(eworld!=null){
eworld.sign.remove(event.getBlock());
}
//Deny GameWorld Blocks
GameWorld gworld=GameWorld.get(block.getWorld());
if(gworld!=null){
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent event){
Block block=event.getBlock();
//Deny GameWorld Blocks
GameWorld gworld=GameWorld.get(block.getWorld());
if(gworld!=null){
if(!gworld.canBuild(block)){
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onSignChange(SignChangeEvent event){
Player player=event.getPlayer();
Block block=event.getBlock();
String[] lines=event.getLines();
EditWorld eworld=EditWorld.get(player.getWorld());
//Group Signs
if(eworld==null){
if(player.isOp() || DungeonsXL.p.permission.has(player, "dxl.sign")){
if(lines[0].equalsIgnoreCase("[DXL]")){
if(lines[1].equalsIgnoreCase("Group")){
String dungeonName=lines[2];
String[] data = lines[3].split("\\,");
if(data.length==2){
int maxGroups=Integer.parseInt(data[0]);
int maxPlayersPerGroup=Integer.parseInt(data[1]);
if(maxGroups>0 && maxPlayersPerGroup>0){
if(DGSign.tryToCreate(event.getBlock(), dungeonName, maxGroups, maxPlayersPerGroup)!=null){
event.setCancelled(true);
}
}
}
}
if(lines[1].equalsIgnoreCase("Leave")){
if(block.getState() instanceof Sign){
Sign sign = (Sign) block.getState();
new LeaveSign(sign);
}
event.setCancelled(true);
}
}
}
}
//Editworld Signs
else{
if(lines[0].equalsIgnoreCase("[DXL]")){
eworld.checkSign(event.getBlock());
eworld.sign.add(event.getBlock());
}else{
eworld.sign.remove(event.getBlock());
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockSpread(BlockSpreadEvent event){
Block block=event.getBlock();
//Block the Spread off Vines
if(block.getTypeId()==106){
//Check GameWorlds
GameWorld gworld=GameWorld.get(event.getBlock().getWorld());
if(gworld!=null){
event.setCancelled(true);
}
//Check EditWorlds
EditWorld eworld=EditWorld.get(event.getBlock().getWorld());
if(eworld!=null){
event.setCancelled(true);
}
}
}
}

View File

@ -0,0 +1,51 @@
package com.dre.dungeonsxl.listener;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.dre.dungeonsxl.DungeonsXL;
import com.dre.dungeonsxl.commands.DCommand;
import com.dre.dungeonsxl.commands.DCommandRoot;
public class CommandListener implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd_notused, String arg, String[] args) {
//Only Playercommands
if(sender instanceof Player){
Player player = (Player) sender;
if(args.length > 0){
String cmd = args[0];
for(DCommand command:DCommandRoot.root.commands){
if(cmd.equals(command.command)){
if(command.playerHasPermissions(player)){
if(command.args==args.length-1||command.args==-1){
command.onExecute(args,player);
}else{
command.displayhelp(player);
}
}
else{
DungeonsXL.p.msg(player, ChatColor.RED+"Du hast keine Permissions dazu!");
}
return true;
}
}
DungeonsXL.p.msg(player, ChatColor.RED+"Befehl "+ChatColor.GOLD+cmd+ChatColor.RED+" existiert nicht!");
DungeonsXL.p.msg(player, ChatColor.RED+"Bitte gib "+ChatColor.GOLD+"/dxl help"+ChatColor.RED+" für Hilfe ein!");
}else{
DCommandRoot.root.cmdHelp.onExecute(args,player);
}
}
return false;
}
}

View File

@ -0,0 +1,221 @@
package com.dre.dungeonsxl.listener;
import java.util.List;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import com.dre.dungeonsxl.DGSign;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DPortal;
import com.dre.dungeonsxl.EditWorld;
import com.dre.dungeonsxl.game.DMob;
import com.dre.dungeonsxl.game.GameWorld;
public class EntityListener implements Listener{
@EventHandler(priority = EventPriority.HIGH)
public void onCreatureSpawn(CreatureSpawnEvent event){
World world=event.getLocation().getWorld();
EditWorld eworld=EditWorld.get(world);
if(eworld!=null){
if(
event.getSpawnReason()==SpawnReason.CHUNK_GEN||
event.getSpawnReason()==SpawnReason.BREEDING||
event.getSpawnReason()==SpawnReason.NATURAL){
event.setCancelled(true);
}
}
GameWorld gworld=GameWorld.get(world);
if(gworld!=null){
if(
event.getSpawnReason()==SpawnReason.CHUNK_GEN||
event.getSpawnReason()==SpawnReason.BREEDING||
event.getSpawnReason()==SpawnReason.NATURAL){
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onEntityDeath(EntityDeathEvent event){
World world=event.getEntity().getWorld();
//Deny all drops from mobs
if (event.getEntity() instanceof LivingEntity)
{
LivingEntity entity = (LivingEntity) event.getEntity();
GameWorld gworld=GameWorld.get(world);
if(gworld!=null){
if(gworld.isPlaying){
if(entity.getType()!=EntityType.PLAYER){
event.getDrops().clear();
}
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onEntityDamage(EntityDamageEvent event){
World world=event.getEntity().getWorld();
GameWorld gworld=GameWorld.get(world);
if(gworld!=null){
//Deny all Damage in Lobby
if(!gworld.isPlaying){
event.setCancelled(true);
}
//Deny all Damage from Players to Players
if (event instanceof EntityDamageByEntityEvent)
{
EntityDamageByEntityEvent sub = (EntityDamageByEntityEvent)event;
DMob.onDamage(sub);
Entity entity = sub.getDamager();
Entity entity2 = sub.getEntity();
if(entity instanceof Projectile)
{
entity = ((Projectile) entity).getShooter();
}
if(entity instanceof Player && entity2 instanceof Player)
{
event.setCancelled(true);
}
if(entity instanceof LivingEntity && entity2 instanceof LivingEntity){
if(!(entity instanceof Player) && !(entity2 instanceof Player)){
event.setCancelled(true);
}
//Check Dogs
if(entity instanceof Player || entity2 instanceof Player){
for(DPlayer dplayer:DPlayer.get(gworld.world)){
if(dplayer.wolf!=null){
if(entity==dplayer.wolf || entity2==dplayer.wolf){
event.setCancelled(true);
return;
}
}
}
}
for(DPlayer dplayer:DPlayer.get(gworld.world)){
if(dplayer.wolf!=null){
if(entity instanceof Player || entity2 instanceof Player){
if(entity==dplayer.wolf || entity2==dplayer.wolf){
event.setCancelled(true);
return;
}
}else{
if(entity==dplayer.wolf || entity2==dplayer.wolf){
event.setCancelled(false);
return;
}
}
}
}
}
}
}
}
//Deny food in Lobby
@EventHandler(priority = EventPriority.HIGH)
public void onFoodLevelChange(FoodLevelChangeEvent event){
World world=event.getEntity().getWorld();
GameWorld gworld=GameWorld.get(world);
if(gworld!=null){
if(!gworld.isPlaying){
event.setCancelled(true);
}
}
}
// Zombie/skeleton combustion from the sun.
@EventHandler(priority = EventPriority.HIGH)
public void onEntityCombust(EntityCombustEvent event)
{
GameWorld gworld = GameWorld.get(event.getEntity().getWorld());
if(gworld != null)
{
event.setCancelled(true);
}
}
//Allow Other combustion
@EventHandler(priority = EventPriority.HIGH)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event){
GameWorld gworld=GameWorld.get(event.getEntity().getWorld());
if(gworld!=null){
if(event.isCancelled()){
event.setCancelled(false);
}
}
}
//Explosions
@EventHandler
public void onEntityExplode(EntityExplodeEvent event)
{
GameWorld gworld=GameWorld.get(event.getEntity().getWorld());
if(gworld!=null){
if(event.getEntity() instanceof LivingEntity){
//Disable Creeper explosions in gameworlds
event.setCancelled(true);
return;
}else{
//Disable drops from TNT
event.setYield(0);
}
}
//Prevent Portal and Sign Destroying
List<Block> blocklist=event.blockList ();
for(Block block:blocklist){
//Portals
if(block.getTypeId()==90){
if(DPortal.get(block)!=null){
event.setCancelled(true);
return;
}
}
//Signs
if(block.getTypeId()==68 || block.getTypeId()==63){
if(DGSign.getSign(block)!=null){
event.setCancelled(true);
return;
}
}
}
}
}

View File

@ -0,0 +1,337 @@
package com.dre.dungeonsxl.listener;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack;
import com.dre.dungeonsxl.DGSign;
import com.dre.dungeonsxl.DGroup;
import com.dre.dungeonsxl.DPlayer;
import com.dre.dungeonsxl.DPortal;
import com.dre.dungeonsxl.DungeonsXL;
import com.dre.dungeonsxl.EditWorld;
import com.dre.dungeonsxl.LeaveSign;
import com.dre.dungeonsxl.game.GameChest;
import com.dre.dungeonsxl.game.GameWorld;
public class PlayerListener implements Listener{
public DungeonsXL p=DungeonsXL.p;
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event){
Player player = event.getPlayer();
Block clickedBlock=event.getClickedBlock();
//Check Portals
if(event.getItem()!=null){
if(event.getItem().getType()==Material.WOOD_SWORD){
if(clickedBlock!=null){
for(DPortal dportal:DPortal.portals){
if(!dportal.isActive){
if(dportal.player==player){
if(dportal.block1==null){
dportal.block1=event.getClickedBlock();
}else if(dportal.block2==null){
dportal.block2=event.getClickedBlock();
dportal.isActive=true;
dportal.fillwithportal();
}
event.setCancelled(true);
}
}
}
}
}
}
//Check Signs
if(clickedBlock!=null){
if(clickedBlock.getTypeId()==68 || clickedBlock.getTypeId()==63){
//Check Group Signs
if(DGSign.playerInteract(event.getClickedBlock(), player)){
event.setCancelled(true);
}
//Leave Sign
if(LeaveSign.playerInteract(event.getClickedBlock(), player)){
event.setCancelled(true);
}
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
//Check GameWorld Signs
GameWorld gworld=GameWorld.get(player.getWorld());
if(gworld!=null){
//Ready Sign
for(Block blockReady:gworld.blocksReady){
if(blockReady.getLocation().distance(clickedBlock.getLocation())<1){
if(!dplayer.isReady){
if(gworld.signClass.isEmpty() || dplayer.dclass!=null){
dplayer.ready();
p.msg(player,ChatColor.GOLD+"Du bist nun bereit für den Dungeon!");
return;
}else{
p.msg(player,ChatColor.RED+"Wähle zuerst eine Klasse!");
}
}
}
}
//End Sign
for(Block blockEnd:gworld.blocksEnd){
if(blockEnd.getLocation().distance(clickedBlock.getLocation())<1){
if(!dplayer.isFinished){
dplayer.finish();
return;
}
}
}
//Leave Sign
for(Block blockLeave:gworld.blocksLeave){
if(blockLeave.getLocation().distance(clickedBlock.getLocation())<1){
dplayer.leave();
}
}
//Class Signs
for(Sign classSign:gworld.signClass){
if(classSign!=null){
if(classSign.getLocation().distance(clickedBlock.getLocation())<1){
if(event.getAction()==Action.LEFT_CLICK_BLOCK){
dplayer.setClass(ChatColor.stripColor(classSign.getLine(1)));
}else{
p.msg(player,ChatColor.RED+"Du musst die Klasse mit Links-klick auswählen!");
}
return;
}
}
}
}
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDropItem(PlayerDropItemEvent event){
Player player=event.getPlayer();
//Deny dropping things at the lobby
DGroup dgroup=DGroup.get(player);
if(dgroup!=null){
if(!dgroup.isPlaying){
event.setCancelled(true);
return;
}
if(!DPlayer.get(player).isReady){
event.setCancelled(true);
return;
}
DPlayer dplayer=DPlayer.get(player);
GameWorld gworld=GameWorld.get(dplayer.world);
if(dplayer!=null){
for(Material material:gworld.confReader.secureobjects){
if(material==event.getItemDrop().getItemStack().getType()){
event.setCancelled(true);
p.msg(player,ChatColor.RED+"Du kannst keine sicheren Objekte droppen");
return;
}
}
/*if(dplayer.invItemInHand==event.getItemDrop().getItemStack().getTypeId()){
dplayer.invItemInHand=0;
}else{
p.msg(player,ChatColor.RED+"Du kannst keine sicheren Objekte droppen");
event.setCancelled(true);
return;
}*/
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerRespawn(PlayerRespawnEvent event){
Player player=event.getPlayer();
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
if(dplayer.isEditing){
EditWorld eworld=EditWorld.get(dplayer.world);
if(eworld!=null){
if(eworld.lobby==null){
event.setRespawnLocation(eworld.world.getSpawnLocation());
}else{
event.setRespawnLocation(eworld.lobby);
}
}
}else{
GameWorld gworld=GameWorld.get(dplayer.world);
if(gworld!=null){
DGroup dgroup=DGroup.get(dplayer.player);
if(dplayer.checkpoint==null){
event.setRespawnLocation(dgroup.gworld.locStart);
if(dplayer.wolf!=null){
dplayer.wolf.teleport(dgroup.gworld.locStart);
}
}else{
event.setRespawnLocation(dplayer.checkpoint.location);
if(dplayer.wolf!=null){
dplayer.wolf.teleport(dplayer.checkpoint.location);
}
}
//Respawn Items
for(ItemStack istack:dplayer.respawnInventory){
if(istack!=null){
dplayer.player.getInventory().addItem(istack);
}
}
dplayer.respawnInventory.clear();
DungeonsXL.p.updateInventory(dplayer.player);
/*if(gworld.locLobby==null){
event.setRespawnLocation(gworld.world.getSpawnLocation());
}else{
event.setRespawnLocation(gworld.locLobby);
}
dplayer.isReady=false;*/
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerPortalEvent(PlayerPortalEvent event){
Player player=event.getPlayer();
Location location=event.getFrom();
DPortal dportal=DPortal.get(location);
if(dportal!=null){
event.setCancelled(true);
dportal.teleport(player);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerTeleport(PlayerTeleportEvent event){
Player player=event.getPlayer();
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
if(dplayer.world!=event.getTo().getWorld()){
if(!player.isOp()){
event.setCancelled(true);
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerChat(AsyncPlayerChatEvent event){
Player player=event.getPlayer();
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
if(dplayer.isInWorldChat){
dplayer.msg(player.getDisplayName()+": "+event.getMessage());
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerChat(PlayerChatEvent event){
Player player=event.getPlayer();
DPlayer dplayer=DPlayer.get(player);
if(dplayer!=null){
if(dplayer.isInWorldChat){
event.setCancelled(true);
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerQuit(PlayerQuitEvent event){
DPlayer dplayer=DPlayer.get(event.getPlayer());
if(dplayer!=null){
//dplayer.goOffline();
dplayer.leave();
dplayer.player.kickPlayer("You have left the game!");
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerJoin(PlayerJoinEvent event){
//DOfflinePlayer.check(event.getPlayer());
}
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDeath(PlayerDeathEvent event){
DPlayer dplayer=DPlayer.get(event.getEntity());
if(dplayer!=null){
dplayer.respawnInventory.addAll(event.getDrops());
//Delete all drops
for(ItemStack istack:event.getDrops()){
istack.setTypeId(0);
}
}
}
//Deny Player Cmds
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerCommand(PlayerCommandPreprocessEvent event){
if(DungeonsXL.p.permission.has(event.getPlayer(), "dungeonsxl.cmd")||event.getPlayer().isOp()){
return;
}
DPlayer dplayer=DPlayer.get(event.getPlayer());
if(dplayer!=null){
if(!dplayer.isEditing){
String[] splittedCmd=event.getMessage().split(" ");
if(!splittedCmd[0].equalsIgnoreCase("/dungeon") && !splittedCmd[0].equalsIgnoreCase("/dungeonsxl") && !splittedCmd[0].equalsIgnoreCase("/dxl")){
p.msg(event.getPlayer(), ChatColor.RED+"Befehle sind während des Dungeons nicht erlaubt");
event.setCancelled(true);
}
}
}
}
//Inventory Events
@EventHandler(priority = EventPriority.HIGH)
public void onInventoryOpen(InventoryOpenEvent event){
GameChest.onOpenInventory(event);
}
}

View File

@ -0,0 +1,56 @@
classes:
1:
name: Krieger
items:
- 276,1
- 302,1
- 303,1
- 304,1
- 305,1
- 364,1
hasdog: false
2:
name: Tank
items:
- 279,1
- 310,1
- 307,1
- 308,1
- 309,1
- 364,3
hasdog: false
3:
name: Jäger
items:
- 261,1
- 262,128
- 268,1
- 298,1
- 299,1
- 300,1
- 301,1
- 364,3
- 363,10
hasdog: true
4:
name: Bogenschütze
items:
- 261,1
- 262,128
- 272,1
- 302,1
- 299,1
- 300,1
- 301,1
- 364,3
5:
name: Magier
items:
- 298, 1
- 315, 1
- 373,16385,3
- 373,16389,3
- 373,16387,2
- 373,16387,2
- 373,16394,3
- 364,8