Skip to content

Commit

Permalink
Redone commands and updatet for 1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Baumann committed Jan 14, 2014
1 parent 5a7dd43 commit 3ffaf46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/com/dre/managerxl/MPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Set;

import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
Expand All @@ -26,7 +27,7 @@ public class MPlayer {
private long bannedTime;
private String bannedReason;
private Location home;
private int gameMode = 0;
private GameMode gameMode = GameMode.SURVIVAL;
private long lastTeleport;

/* BroadcasterPlayer */
Expand Down Expand Up @@ -92,7 +93,7 @@ public static boolean SaveAsYml(File file) {
ymlFile.set(player.getName() + ".isMuted", player.isMuted());

/* GameMode */
ymlFile.set(player.getName() + ".GameMode", player.getGameMode());
ymlFile.set(player.getName() + ".GameMode", player.getGameMode().name());

/* Home */
if (player.getHome() != null) {
Expand Down Expand Up @@ -134,7 +135,7 @@ public static boolean LoadAsYml(File file) {
mPlayer.setMuted(ymlFile.getBoolean(name + ".isMuted"));

/* GameMode */
mPlayer.setGameMode(ymlFile.getInt(name + ".GameMode"));
mPlayer.setGameMode(GameMode.valueOf(ymlFile.getString(name + ".GameMode")));

/* Location */
if (ymlFile.contains(name + ".home")) {
Expand Down Expand Up @@ -235,18 +236,17 @@ public void setMuted(boolean isMuted) {
this.isMuted = isMuted;
}

public int getGameMode() {
public GameMode getGameMode() {
return gameMode;
}

public boolean setGameMode(int gameMode) {
org.bukkit.GameMode gm = org.bukkit.GameMode.getByValue(gameMode);
if (gm != null) {
public boolean setGameMode(GameMode gameMode) {
if (gameMode != null) {
this.gameMode = gameMode;

if (this.getPlayer() != null) {
this.getPlayer().setGameMode(gm);
P.p.msg(this.getPlayer(), P.p.getLanguageReader().get("Player_GameModeChanged", gm.name()));
this.getPlayer().setGameMode(this.gameMode);
P.p.msg(this.getPlayer(), P.p.getLanguageReader().get("Player_GameModeChanged", this.gameMode.name()));
}

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/com/dre/managerxl/util/MUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ public static Location getNearestFreePosition(Location currentPosition) {
for (int y = 0; y < 256 - block.getY(); y++) {
Block tmpBlock = block.getRelative(BlockFace.UP, y);

if (tmpBlock.getTypeId() == 0) {
if(tmpBlock.getRelative(BlockFace.UP, 1).getTypeId() == 0){
if (tmpBlock.getType() == Material.AIR) {
if(tmpBlock.getRelative(BlockFace.UP, 1).getType() == Material.AIR){
return tmpBlock.getLocation();
}
}
Expand Down

0 comments on commit 3ffaf46

Please sign in to comment.