mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-12-01 06:53:26 +01:00
Moved the tutorial check from scheduler to PlayerJoinEvent
This commit is contained in:
parent
0b1b582d33
commit
53c356165c
@ -194,34 +194,6 @@ public class P extends JavaPlugin{
|
|||||||
GameWorld.update();
|
GameWorld.update();
|
||||||
GameCheckpoint.update();
|
GameCheckpoint.update();
|
||||||
DPlayer.update(true);
|
DPlayer.update(true);
|
||||||
|
|
||||||
//Tutorial Mode
|
|
||||||
if(p.mainConfig.tutorialActivated){
|
|
||||||
for(Player player:p.getServer().getOnlinePlayers()){
|
|
||||||
if(DPlayer.get(player)==null){
|
|
||||||
if(p.mainConfig.tutorialDungeon!=null && p.mainConfig.tutorialStartGroup!=null && p.mainConfig.tutorialEndGroup!=null){
|
|
||||||
for(String group:p.permission.getPlayerGroups(player)){
|
|
||||||
if(p.mainConfig.tutorialStartGroup.equalsIgnoreCase(group)){
|
|
||||||
DGroup dgroup=new DGroup(player, p.mainConfig.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,p.language.get("Error_TutorialNotExist"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 0L, 20L);
|
}, 0L, 20L);
|
||||||
|
|
||||||
@ -255,7 +227,6 @@ public class P extends JavaPlugin{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Save and Load
|
//Save and Load
|
||||||
public void saveData(){
|
public void saveData(){
|
||||||
File file = new File(this.getDataFolder(), "data.yml");
|
File file = new File(this.getDataFolder(), "data.yml");
|
||||||
@ -268,14 +239,11 @@ public class P extends JavaPlugin{
|
|||||||
try {
|
try {
|
||||||
configFile.save(file);
|
configFile.save(file);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadAll(){
|
public void loadAll(){
|
||||||
|
|
||||||
//Load world data
|
//Load world data
|
||||||
File file = new File(this.getDataFolder(), "data.yml");
|
File file = new File(this.getDataFolder(), "data.yml");
|
||||||
FileConfiguration configFile = YamlConfiguration.loadConfiguration(file);
|
FileConfiguration configFile = YamlConfiguration.loadConfiguration(file);
|
||||||
@ -291,7 +259,6 @@ public class P extends JavaPlugin{
|
|||||||
DSavePlayer.load();
|
DSavePlayer.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//File Control
|
//File Control
|
||||||
public boolean removeDirectory(File directory) {
|
public boolean removeDirectory(File directory) {
|
||||||
if (directory.isDirectory()) {
|
if (directory.isDirectory()) {
|
||||||
|
@ -288,10 +288,41 @@ public class PlayerListener implements Listener{
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onPlayerJoin(PlayerJoinEvent event){
|
public void onPlayerJoin(PlayerJoinEvent event){
|
||||||
DPlayer dplayer=DPlayer.get(event.getPlayer().getName());
|
Player player = event.getPlayer();
|
||||||
if(dplayer!=null){
|
|
||||||
|
//Check dplayers
|
||||||
|
DPlayer dplayer = DPlayer.get(event.getPlayer().getName());
|
||||||
|
if(dplayer != null){
|
||||||
dplayer.player = event.getPlayer();
|
dplayer.player = event.getPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Tutorial Mode
|
||||||
|
if(p.mainConfig.tutorialActivated){
|
||||||
|
if(DPlayer.get(player) == null){
|
||||||
|
if(p.mainConfig.tutorialDungeon != null && p.mainConfig.tutorialStartGroup != null && p.mainConfig.tutorialEndGroup != null){
|
||||||
|
for(String group:p.permission.getPlayerGroups(player)){
|
||||||
|
if(p.mainConfig.tutorialStartGroup.equalsIgnoreCase(group)){
|
||||||
|
DGroup dgroup = new DGroup(player, p.mainConfig.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,p.language.get("Error_TutorialNotExist"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
Loading…
Reference in New Issue
Block a user