mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-17 05:31:23 +01:00
Gamemode sign, standard sign permissions.
This commit is contained in:
parent
e4c3f7b115
commit
c0d046841f
@ -38,7 +38,6 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||||
//TODO: add this to messages?
|
|
||||||
sender.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
|
sender.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.earth2me.essentials.signs;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.Trade;
|
||||||
|
import com.earth2me.essentials.ChargeException;
|
||||||
|
import com.earth2me.essentials.IEssentials;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.Util;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
|
||||||
|
|
||||||
|
public class SignGameMode extends EssentialsSign
|
||||||
|
{
|
||||||
|
public SignGameMode()
|
||||||
|
{
|
||||||
|
super("GameMode");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
|
||||||
|
{
|
||||||
|
validateTrade(sign, 1, ess);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
|
||||||
|
{
|
||||||
|
final Trade charge = getTrade(sign, 1, ess);
|
||||||
|
charge.isAffordableFor(player);
|
||||||
|
|
||||||
|
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||||
|
player.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
|
||||||
|
charge.charge(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ public enum Signs
|
|||||||
BUY(new SignBuy()),
|
BUY(new SignBuy()),
|
||||||
DISPOSAL(new SignDisposal()),
|
DISPOSAL(new SignDisposal()),
|
||||||
FREE(new SignFree()),
|
FREE(new SignFree()),
|
||||||
|
GAMEMODE(new SignGameMode()),
|
||||||
HEAL(new SignHeal()),
|
HEAL(new SignHeal()),
|
||||||
MAIL(new SignMail()),
|
MAIL(new SignMail()),
|
||||||
PROTECTION(new SignProtection()),
|
PROTECTION(new SignProtection()),
|
||||||
|
Loading…
Reference in New Issue
Block a user