mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 18:14:38 +02:00
Gamemode sign, standard sign permissions.
This commit is contained in:
@@ -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()),
|
||||||
|
Reference in New Issue
Block a user