Aanpassing naar 2.x
This commit is contained in:
		
							parent
							
								
									3f1cc262d9
								
							
						
					
					
						commit
						5d3f4507af
					
				
							
								
								
									
										3
									
								
								.idea/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.idea/.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -1,3 +0,0 @@ | |||
| # Default ignored files | ||||
| /shelf/ | ||||
| /workspace.xml | ||||
|  | @ -1,8 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="CompilerConfiguration"> | ||||
|     <bytecodeTargetLevel target="16"> | ||||
|       <module name="example" target="1.8" /> | ||||
|     </bytecodeTargetLevel> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,7 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="Encoding"> | ||||
|     <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> | ||||
|     <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,17 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="GradleMigrationSettings" migrationVersion="1" /> | ||||
|   <component name="GradleSettings"> | ||||
|     <option name="linkedExternalProjectsSettings"> | ||||
|       <GradleProjectSettings> | ||||
|         <option name="distributionType" value="DEFAULT_WRAPPED" /> | ||||
|         <option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||||
|         <option name="modules"> | ||||
|           <set> | ||||
|             <option value="$PROJECT_DIR$" /> | ||||
|           </set> | ||||
|         </option> | ||||
|       </GradleProjectSettings> | ||||
|     </option> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,35 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="RemoteRepositoriesConfiguration"> | ||||
|     <remote-repository> | ||||
|       <option name="id" value="central" /> | ||||
|       <option name="name" value="Central Repository" /> | ||||
|       <option name="url" value="https://repo.maven.apache.org/maven2" /> | ||||
|     </remote-repository> | ||||
|     <remote-repository> | ||||
|       <option name="id" value="spigot-repo" /> | ||||
|       <option name="name" value="spigot-repo" /> | ||||
|       <option name="url" value="https://hub.spigotmc.org/nexus/content/repositories/snapshots/" /> | ||||
|     </remote-repository> | ||||
|     <remote-repository> | ||||
|       <option name="id" value="recoreh-repo" /> | ||||
|       <option name="name" value="recoreh-repo" /> | ||||
|       <option name="url" value="https://git.recorehosting.com/maven/snapshots/" /> | ||||
|     </remote-repository> | ||||
|     <remote-repository> | ||||
|       <option name="id" value="central" /> | ||||
|       <option name="name" value="Maven Central repository" /> | ||||
|       <option name="url" value="https://repo1.maven.org/maven2" /> | ||||
|     </remote-repository> | ||||
|     <remote-repository> | ||||
|       <option name="id" value="jboss.community" /> | ||||
|       <option name="name" value="JBoss Community repository" /> | ||||
|       <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | ||||
|     </remote-repository> | ||||
|     <remote-repository> | ||||
|       <option name="id" value="MavenRepo" /> | ||||
|       <option name="name" value="MavenRepo" /> | ||||
|       <option name="url" value="https://repo.maven.apache.org/maven2/" /> | ||||
|     </remote-repository> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,20 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="EntryPointsManager"> | ||||
|     <list size="1"> | ||||
|       <item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" /> | ||||
|     </list> | ||||
|   </component> | ||||
|   <component name="ExternalStorageConfigurationManager" enabled="true" /> | ||||
|   <component name="MavenProjectsManager"> | ||||
|     <option name="originalFiles"> | ||||
|       <list> | ||||
|         <option value="$PROJECT_DIR$/pom.xml" /> | ||||
|       </list> | ||||
|     </option> | ||||
|   </component> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="openjdk-16" project-jdk-type="JavaSDK" /> | ||||
|   <component name="ProjectType"> | ||||
|     <option name="id" value="jpab" /> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,124 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="Palette2"> | ||||
|     <group name="Swing"> | ||||
|       <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> | ||||
|       </item> | ||||
|       <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> | ||||
|         <initial-values> | ||||
|           <property name="text" value="Button" /> | ||||
|         </initial-values> | ||||
|       </item> | ||||
|       <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | ||||
|         <initial-values> | ||||
|           <property name="text" value="RadioButton" /> | ||||
|         </initial-values> | ||||
|       </item> | ||||
|       <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | ||||
|         <initial-values> | ||||
|           <property name="text" value="CheckBox" /> | ||||
|         </initial-values> | ||||
|       </item> | ||||
|       <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> | ||||
|         <initial-values> | ||||
|           <property name="text" value="Label" /> | ||||
|         </initial-values> | ||||
|       </item> | ||||
|       <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | ||||
|           <preferred-size width="150" height="-1" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | ||||
|           <preferred-size width="150" height="-1" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | ||||
|           <preferred-size width="150" height="-1" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | ||||
|           <preferred-size width="150" height="50" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | ||||
|           <preferred-size width="150" height="50" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | ||||
|           <preferred-size width="150" height="50" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | ||||
|           <preferred-size width="150" height="50" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> | ||||
|           <preferred-size width="150" height="50" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | ||||
|           <preferred-size width="150" height="50" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | ||||
|           <preferred-size width="200" height="200" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | ||||
|           <preferred-size width="200" height="200" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> | ||||
|           <preferred-size width="-1" height="20" /> | ||||
|         </default-constraints> | ||||
|       </item> | ||||
|       <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> | ||||
|       </item> | ||||
|       <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | ||||
|         <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> | ||||
|       </item> | ||||
|     </group> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,6 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="VcsDirectoryMappings"> | ||||
|     <mapping directory="$PROJECT_DIR$" vcs="Git" /> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -20,8 +20,9 @@ repositories { | |||
| } | ||||
| 
 | ||||
| dependencies { | ||||
|     implementation 'org.projectlombok:lombok:1.18.28' | ||||
|     compileOnly "org.spigotmc:spigot:1.8-R0.1-SNAPSHOT" | ||||
|     compileOnly 'me.map:ultimatekingdom:1.10.0-BETA' | ||||
|     compileOnly 'me.map:ultimatekingdom:2.4.0.0-BETA' | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										11
									
								
								src/main/java/me/map/example/Demo.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/main/java/me/map/example/Demo.java
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| package me.map.example; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Data | ||||
| public class Demo { | ||||
| 
 | ||||
|     private String name; | ||||
|     private String food; | ||||
| 
 | ||||
| } | ||||
|  | @ -1,22 +1,21 @@ | |||
| package me.map.example; | ||||
| 
 | ||||
| import jdk.incubator.vector.VectorOperators; | ||||
| import me.map.example.command.TestCommand; | ||||
| 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.objects.MapBuilder; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.bukkit.event.HandlerList; | ||||
| 
 | ||||
| import org.bukkit.plugin.java.JavaPlugin; | ||||
| 
 | ||||
| import java.util.UUID; | ||||
| 
 | ||||
| import static me.map.example.nl_lang.Lang.eat_food; | ||||
| 
 | ||||
| public class Example extends JavaPlugin  { | ||||
| 
 | ||||
| 
 | ||||
|  | @ -26,29 +25,30 @@ public class Example extends JavaPlugin  { | |||
| 
 | ||||
|     @Override | ||||
|     public void onEnable() { | ||||
| 
 | ||||
|         Bukkit.getServer().getPluginManager().registerEvents(new Luisteraar() ,this); | ||||
| 
 | ||||
|         //fake player !!! | ||||
|         Player player = Bukkit.getServer().getPlayer(UUID.randomUUID()); | ||||
| 
 | ||||
|         //kingdomplayer object | ||||
|         KingdomPlayer kingdomPlayer = UltimateKingdom.Players().getPlayer(player); | ||||
|         UltimateKingdom.getKingdomServer().Messages().I18n().registerLocaleConfig(new nl_lang()); //toevoegen teksten in een bepaalde taal.// . | ||||
| 
 | ||||
|         UltimateKingdom.getKingdomServer().Messages().getPlaceHolders().registerPlaceholders(new OwnPlaceHolderPack()); //eigen placeholder toevoegen. | ||||
| 
 | ||||
|         //kingdom object | ||||
|         Kingdom kingdom = kingdomPlayer.getKingdom(); | ||||
| 
 | ||||
|         //toevoegen nieuwe commando | ||||
|         new TestCommand();  // of als er geen register() in commando is -> new TestCommand().register(); | ||||
| 
 | ||||
|         //vertaling toevoegen | ||||
|         UltimateKingdom.getKingdomServer().Messages().addTranslations("test_command" ,"^&adit is kingdom: &f{0} &aen player ^&f{1}"); | ||||
|         KingdomPlayer player = KingdomPlayer.get(UUID.randomUUID()); | ||||
| 
 | ||||
|         //vertaling ophalen/gebruiken | ||||
|         String string = UltimateKingdom.translate("test_command",kingdom.getDisplayName(),kingdomPlayer.getName()); | ||||
| 
 | ||||
|         //register placeholder zodat deze door de hele plugin gebruikt kan worden. | ||||
|         UltimateKingdom.getKingdomServer().PlaceHolders().PlayerPlaceHolders().register(new OwnPlaceHolder()); | ||||
|         //Zie ownPlaceholderPack | ||||
|         Demo demo = new Demo(); | ||||
|         demo.setFood("pizza"); | ||||
|         demo.setName("Jan"); | ||||
| 
 | ||||
|         player.send(false,eat_food,new MapBuilder() | ||||
|                 .put("kingdomplayer",player) | ||||
|                 .put("demo",demo) | ||||
|                 .build() | ||||
|         ); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  |  | |||
							
								
								
									
										13
									
								
								src/main/java/me/map/example/OwnPlaceHolderPack.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/main/java/me/map/example/OwnPlaceHolderPack.java
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| package me.map.example; | ||||
| 
 | ||||
| import me.map.ultimatekingdom.libs.eu.okaeri.placeholders.PlaceholderPack; | ||||
| import me.map.ultimatekingdom.libs.eu.okaeri.placeholders.Placeholders; | ||||
| 
 | ||||
| public class OwnPlaceHolderPack implements PlaceholderPack { | ||||
|     @Override | ||||
|     public void register(Placeholders placeholders) { | ||||
| 
 | ||||
|         placeholders.registerPlaceholder(Demo.class ,"name",(e, p, o) -> e.getName()); | ||||
|         placeholders.registerPlaceholder(Demo.class ,"food",(e, p, o) -> e.getFood()); | ||||
|     } | ||||
| } | ||||
|  | @ -1,8 +1,7 @@ | |||
| package me.map.example.command; | ||||
| 
 | ||||
| 
 | ||||
| import me.map.mojangbrigadier.Command; | ||||
| import me.map.mojangbrigadier.context.CommandContext; | ||||
| 
 | ||||
| import me.map.ultimatekingdom.API.UltimateKingdom; | ||||
| import me.map.ultimatekingdom.API.cmd.AbstractCommand; | ||||
| 
 | ||||
|  | @ -10,16 +9,19 @@ import me.map.ultimatekingdom.API.cmd.CommandSource; | |||
| import me.map.ultimatekingdom.API.cmd.KingdomCommand; | ||||
| import me.map.ultimatekingdom.API.cmd.args.plugin.KingdomPlayerArgumentType; | ||||
| import me.map.ultimatekingdom.API.objects.KingdomPlayer; | ||||
| import me.map.ultimatekingdom.API.objects.MapBuilder; | ||||
| import me.map.ultimatekingdom.libs.com.mojang.brigadier.Command; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import static me.map.example.nl_lang.Lang.*; | ||||
| 
 | ||||
| public class TestCommand extends AbstractCommand { | ||||
| 
 | ||||
| 
 | ||||
|     public TestCommand() { | ||||
|         super("testcommand"); | ||||
|         setDescription(UltimateKingdom.translate(false, "test_command")); | ||||
|         setPermission("kingdom.admin");  //optional | ||||
|         setDescription(demo_description); | ||||
|         setExtendedDescription(demo_extendedDescription); //Enum ivm vertalingen | ||||
|         setShowUsageOnFail(true); //optional | ||||
|         setPlayerOnly(true); //optional | ||||
|         register(); //optional | ||||
|  | @ -27,25 +29,20 @@ public class TestCommand extends AbstractCommand { | |||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     protected void createCommand(KingdomCommand command) { | ||||
|     public void createCommand(KingdomCommand command) { | ||||
|                 command | ||||
|                         .then(argument("player", KingdomPlayerArgumentType.kingdomplayer()) | ||||
|                                 .executes(c -> { | ||||
|                                     final KingdomPlayer kingdomPlayer = c.getArgument("player",KingdomPlayer.class); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|                                     Map<String,Object> fields = new MapBuilder() | ||||
|                                             .put("kingdomplayer",kingdomPlayer) | ||||
|                                                     .build(); | ||||
|                                     c.getSource().send(false,stupid_command,fields); | ||||
| 
 | ||||
|                                     return Command.SINGLE_SUCCESS; | ||||
|                                 }) | ||||
| 
 | ||||
|                         ); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onCommandComplete(CommandContext<CommandSource> commandContext, boolean b, int i) { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -1,17 +1,29 @@ | |||
| package me.map.example.listener; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import me.map.ultimatekingdom.API.UltimateKingdom; | ||||
| import me.map.ultimatekingdom.API.objects.KingdomPlayer; | ||||
| import me.map.ultimatekingdom.API.objects.MapBuilder; | ||||
| import me.map.ultimatekingdom.gameplay.events.actions.KingdomBuildEvent; | ||||
| import org.bukkit.event.EventHandler; | ||||
| import org.bukkit.event.EventPriority; | ||||
| import org.bukkit.event.Listener; | ||||
| import org.go.libs.U; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import static me.map.example.nl_lang.Lang.break_block; | ||||
| 
 | ||||
| public class Luisteraar implements Listener { | ||||
| 
 | ||||
|     @EventHandler(priority = EventPriority.LOWEST) | ||||
|     public void onJoin(KingdomBuildEvent event) { | ||||
| 
 | ||||
|     } | ||||
|         KingdomPlayer player = KingdomPlayer.get(event.getPlayer()); | ||||
| 
 | ||||
|         UltimateKingdom.Messages().send(player,break_block,new MapBuilder() | ||||
|                 .put("kingdomplayer",player) | ||||
|                 .put("block",event.getBlock()) | ||||
|                 .build()); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| package me.map.example; | ||||
| import me.map.ultimatekingdom.API.metadata.*; | ||||
| import me.map.ultimatekingdom.API.objects.Kingdom; | ||||
| import me.map.ultimatekingdom.API.objects.metadata.*; | ||||
| 
 | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
|  | @ -17,7 +18,7 @@ public class metadata { | |||
|         //check for existing data | ||||
|         if (kingdom.hasMeta("customMetaName")) { | ||||
| 
 | ||||
|             MetaData<?> data = kingdom.getMetaData("customMetaName"); | ||||
|             MetaData<?> data = kingdom.getMeta("customMetaName"); | ||||
| 
 | ||||
|             //get value (List) | ||||
|             metaArrayList = (List<String>) data.getValue(); | ||||
|  | @ -26,7 +27,7 @@ public class metadata { | |||
|             String label = data.getLabel(); | ||||
| 
 | ||||
|             //or just use this one | ||||
|             metaArrayList = (List<String>) kingdom.getMetaData("customMetaName").getValue(); | ||||
|             metaArrayList = (List<String>) kingdom.getMeta("customMetaName").getValue(); | ||||
|         } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -39,7 +40,7 @@ public class metadata { | |||
|         MetaData<?>  myMetaData2 = new ListField("customMetaName", metaArrayList,"ExtraLabel" ); | ||||
|         //savedata | ||||
| 
 | ||||
|         kingdom.addMetaData(myMetaData,(result) -> { | ||||
|         kingdom.addMeta(myMetaData,(result,kingdom1) -> { | ||||
|             if (result.isOk()) { | ||||
|                 //do something | ||||
|             } else { | ||||
|  | @ -54,7 +55,7 @@ public class metadata { | |||
|         List<String> metaArrayList = new ArrayList<>(); | ||||
| 
 | ||||
|         if (kingdom.hasMeta("customMetaName")) { | ||||
|             metaArrayList = (List<String>)   kingdom.getMetaData("customMetaName").getValue(); | ||||
|             metaArrayList = (List<String>)   kingdom.getMeta("customMetaName").getValue(); | ||||
|         } | ||||
| 
 | ||||
|         //remove value | ||||
|  | @ -67,7 +68,7 @@ public class metadata { | |||
|         MetaData<?>  myMetaData2 = new ListField("customMetaName", metaArrayList,"ExtraLabel" ); | ||||
| 
 | ||||
| 
 | ||||
|         kingdom.addMetaData(myMetaData, (result) ->{ | ||||
|         kingdom.addMeta(myMetaData, (result,kingdom1) ->{ | ||||
|             if (result.isOk()) { | ||||
|                 //do somehting | ||||
|             } else { | ||||
|  | @ -79,7 +80,7 @@ public class metadata { | |||
| 
 | ||||
| 
 | ||||
|         //remove  all values | ||||
|         kingdom.removeMetaData(myMetaData,(result) ->{ | ||||
|         kingdom.deleteMeta(myMetaData,(result,kingdom1) ->{ | ||||
|             if (result.isOk()) { | ||||
|                 //do somehting | ||||
|             } else { | ||||
|  |  | |||
							
								
								
									
										104
									
								
								src/main/java/me/map/example/nl_lang.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								src/main/java/me/map/example/nl_lang.java
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,104 @@ | |||
| package me.map.example; | ||||
| 
 | ||||
| import me.map.ultimatekingdom.API.languages.LanguageManager; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.configuration.file.YamlConfiguration; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
| 
 | ||||
| import java.io.File; | ||||
| import java.util.Locale; | ||||
| import java.util.Map; | ||||
| import java.util.concurrent.ConcurrentHashMap; | ||||
| 
 | ||||
| 
 | ||||
| public class nl_lang implements LanguageManager { | ||||
| 
 | ||||
|     private final String fileName = "NL.yml"; | ||||
|     private final String version = "1"; | ||||
|     private final Locale locale = Locale.forLanguageTag("nl"); | ||||
| 
 | ||||
|     /** | ||||
|      * Load the configuration file and check for missing keys | ||||
|      * | ||||
|      * @param file   to load | ||||
|      * @param silent keep it silent | ||||
|      * @return return YamlConfiguration object | ||||
|      */ | ||||
|     @Override | ||||
|     public YamlConfiguration getYamlConfiguration(@NotNull File file, boolean silent) { | ||||
|         final YamlConfiguration conf = YamlConfiguration.loadConfiguration(file); | ||||
| 
 | ||||
|         for (final Lang item : Lang.values()) { | ||||
|             if (conf.getString(item.toString()) == null) { | ||||
|                 conf.set(item.toString(), item.getValue()); | ||||
| 
 | ||||
|                 if (!silent) { | ||||
|                     Bukkit.getServer().getConsoleSender().sendMessage( | ||||
|                             "[UltimateKingdom] Add Missing Key: " + item); | ||||
|                 } | ||||
|             } | ||||
|             // always set version | ||||
|             conf.set("version", this.version); | ||||
|         } | ||||
| 
 | ||||
|         return conf; | ||||
|     } | ||||
| 
 | ||||
|     public Locale getLocale() { | ||||
|         return locale; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Get a map with all values | ||||
|      * | ||||
|      * @return HashMap with strings,strings | ||||
|      */ | ||||
|     @Override | ||||
|     public Map<String, String> getMapWithValues() { | ||||
|         Map<String, String> tmp = new ConcurrentHashMap(); | ||||
|         for (final Lang item : Lang.values()) { | ||||
|             tmp.put(item.name(), item.getValue()); | ||||
|         } | ||||
|         return tmp; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Getter for filename | ||||
|      * | ||||
|      * @return filename | ||||
|      */ | ||||
|     @Override | ||||
|     public String getFileName() { | ||||
|         return this.fileName; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Translations | ||||
|      */ | ||||
|     public enum Lang { | ||||
| 
 | ||||
|         demo_description("Dit is een demo command"), | ||||
|         demo_extendedDescription("dit is een demo commando, en doet verder niets"), | ||||
|         break_block("{green}{kingdomplayer.displayname} doet iets met block : {block.type.name}"), | ||||
|         stupid_command("{green}hehhh...{white}{kingdomplayer.displayname} is lid van {red} {kingdomplayer.kingdom.displayname|niets}"), | ||||
|         eat_food("{kingdomplayer.displayname} heeft de {demo.food} van  {demo.name}  opgegeten"); | ||||
| 
 | ||||
|         private final String def; | ||||
| 
 | ||||
|         /** | ||||
|          * @param def set def | ||||
|          */ | ||||
|         Lang(String def) { | ||||
|             this.def = def; | ||||
|         } | ||||
| 
 | ||||
|         /** | ||||
|          * Get the Stringt value of the path. | ||||
|          * | ||||
|          * @return The default value of the path. | ||||
|          */ | ||||
|         public String getValue() { | ||||
|             return this.def; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -1,37 +0,0 @@ | |||
| package me.map.example.placeholder; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| import me.map.ultimatekingdom.API.objects.KingdomPlayer; | ||||
| import me.map.ultimatekingdom.API.placeholders.PlayerPlaceHolderExpansion; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
| 
 | ||||
| public class OwnPlaceHolder extends PlayerPlaceHolderExpansion { | ||||
| 
 | ||||
|     @Override | ||||
|     public @NotNull | ||||
|     String getIdentifier() { | ||||
|         return "kingdomplayer"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public @NotNull | ||||
|     String getAuthor() { | ||||
|         return "recorehosting"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public @NotNull | ||||
|     String getVersion() { | ||||
|         return "1.0"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String onRequest(KingdomPlayer user, String params) { | ||||
| 
 | ||||
|         if (params.equalsIgnoreCase("test")) { | ||||
|             return "test"; | ||||
|         } | ||||
|         return ""; | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user