update
This commit is contained in:
parent
7f0929c379
commit
208472a1e3
|
@ -22,7 +22,7 @@ repositories {
|
|||
dependencies {
|
||||
|
||||
compileOnly "org.spigotmc:spigot:1.8-R0.1-SNAPSHOT"
|
||||
compileOnly 'me.map:ultimatekingdom:1.0.4-ALPHA'
|
||||
compileOnly 'me.map:ultimatekingdom:1.0.12-ALPHA'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,41 +5,64 @@ import me.map.example.listener.Luisteraar;
|
|||
import me.map.example.placeholder.OwnPlaceHolder;
|
||||
import me.map.ultimatekingdom.API.UltimateKingdom;
|
||||
|
||||
import me.map.ultimatekingdom.API.objects.Kingdom;
|
||||
import me.map.ultimatekingdom.API.objects.KingdomPlayer;
|
||||
import me.map.ultimatekingdom.API.settings.BooleanSetting;
|
||||
import me.map.ultimatekingdom.API.settings.SettingsType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Example extends JavaPlugin {
|
||||
|
||||
private Plugin main;
|
||||
//String unique name, String displayname, Settingstype settingstype, Boolean protected, Boolean owncommand, Boolean HidefromInfo
|
||||
public static BooleanSetting newsetting = new BooleanSetting("UniqueName","displayname", SettingsType.KINGDOM,true,false,false);
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
HandlerList.unregisterAll(this.main);
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.main = this;
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Luisteraar() ,this);
|
||||
|
||||
//fake player !!!
|
||||
Player player = Bukkit.getServer().getPlayer(UUID.randomUUID());
|
||||
|
||||
//kingdomplayer object
|
||||
KingdomPlayer kingdomPlayer = UltimateKingdom.Players().getPlayer(player);
|
||||
|
||||
//kingdom object
|
||||
Kingdom kingdom = kingdomPlayer.getKingdom();
|
||||
|
||||
//toevoegen nieuwe commando
|
||||
UltimateKingdom.getKingdomServer().Commands().register(new TestCommand(this));
|
||||
|
||||
//vertaling toevoegen
|
||||
UltimateKingdom.getKingdomServer().Message().addTranslations("test_command" ,"^&fDit is een test Commando");
|
||||
UltimateKingdom.getKingdomServer().Message().addTranslations("test_command" ,"^&adit is kingdom: &f{0} &aen player ^&f{1}");
|
||||
|
||||
//register placeholder zodat deze door de hele plugin gebruikt kan worden./
|
||||
//vertaling ophalen/gebruiken
|
||||
String string = UltimateKingdom.translate("test_command",kingdomPlayer.getDisplayName(),kingdom.getDisplayName());
|
||||
|
||||
//register placeholder zodat deze door de hele plugin gebruikt kan worden.
|
||||
UltimateKingdom.getKingdomServer().PlaceHolders().PlayerPlaceHolders().register(new OwnPlaceHolder());
|
||||
|
||||
//registeren van een true/false setting voor kingdom
|
||||
kingdom.setSetting(Example.newsetting.setValue(true));
|
||||
|
||||
//ophalen setting
|
||||
if (kingdom.hasSetting(Example.newsetting)) {
|
||||
Boolean true_false = ((BooleanSetting) kingdom.getSetting(Example.newsetting)).getValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TestCommand extends PluginCommands {
|
|||
final KingdomPlayer user = UltimateKingdom.Players().getPlayer(uuid);
|
||||
|
||||
BooleanSetting setting = KingdomSettings.kingdomplayer_is_mod;
|
||||
setting.setBoolean(Boolean.TRUE);
|
||||
setting.setValue(Boolean.TRUE);
|
||||
user.setSetting(setting);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user