Fixed an issue for the config loading on the first startup

This commit is contained in:
Alastair 2017-06-12 14:53:27 +01:00
parent 42ac3553a2
commit 9d906e9fff
3 changed files with 8 additions and 10 deletions

View File

@ -19,6 +19,8 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
String[] packageSplit = packageName.split("\\.");
String version = packageSplit[packageSplit.length - 1];
saveDefaultConfig();
try {
this.compat = new CraftBukkit(this, version);
@ -61,8 +63,6 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
this.setEnabled(false);
}
saveDefaultConfig();
// thanks to the new config accessor code the config.saveDefaultConfig(); will now
// only copy the file if it doesnt exist!
}

View File

@ -192,7 +192,7 @@ public class Listeners implements Listener {
catch(NullPointerException e){
}*/
if (event.getItem() != null && event.getPlayer().getItemInHand().getType() == WandMaterial // was type id
if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getType() == WandMaterial // was type id
&& (!UseOnlyServerAxe || (event.getItem().getItemMeta().getDisplayName() != null && event.getItem().getItemMeta().getDisplayName().equals("\u00A7ePortal Region Selector")))) {
// This checks if the action was a left or right click and if it was directly effecting a block.
@ -226,14 +226,12 @@ public class Listeners implements Listener {
// Returns the event so no more code is executed(stops unnecessary code being executed)
}
}
else if(event.getItem() != null && event.getPlayer().getItemInHand().getItemMeta().getDisplayName().equals("\u00A75Portal Block Placer") &&
event.getAction() == Action.LEFT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.PORTAL){
} else if (event.getPlayer().getItemInHand() != null && event.getPlayer().getItemInHand().getItemMeta().getDisplayName().equals("\u00A75Portal Block Placer") &&
event.getAction() == Action.LEFT_CLICK_BLOCK && event.getClickedBlock().getType() == Material.PORTAL) {
Block block = event.getClickedBlock();
if(block.getData() == 1){
if (block.getData() == 1) {
block.setData((byte) 2);
}
else{
} else {
block.setData((byte) 1);
}
event.setCancelled(true);

View File

@ -418,7 +418,7 @@ public class Portal {
}
} else {
if (showFailMessage) {
player.sendMessage(PluginMessages.customPrefix + "\u00A7c The portal you are trying to use doesn't have a destination!");
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7c The portal you are trying to use doesn't have a destination!");
plugin.getLogger().log(Level.SEVERE, "The portal '" + portal.portalName + "' has just had a warp "
+ "attempt and either the data is corrupt or portal doesn't exist!");
throwPlayerBack(player);