Initial commit
This commit is contained in:
3
Plugins/Old/SkyFarms/.idea/.gitignore
generated
vendored
Normal file
3
Plugins/Old/SkyFarms/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
9
Plugins/Old/SkyFarms/.idea/artifacts/SkyFarms.xml
generated
Normal file
9
Plugins/Old/SkyFarms/.idea/artifacts/SkyFarms.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="SkyFarms">
|
||||
<output-path>Z:/mc/testserver/plugins</output-path>
|
||||
<root id="archive" name="SkyFarms.jar">
|
||||
<element id="module-output" name="SkyFarms" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/plugin.yml" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
7
Plugins/Old/SkyFarms/.idea/dictionaries/leon.xml
generated
Normal file
7
Plugins/Old/SkyFarms/.idea/dictionaries/leon.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="leon">
|
||||
<words>
|
||||
<w>citem</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
7
Plugins/Old/SkyFarms/.idea/discord.xml
generated
Normal file
7
Plugins/Old/SkyFarms/.idea/discord.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="DISABLE" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
9
Plugins/Old/SkyFarms/.idea/libraries/EconomyAPI.xml
generated
Normal file
9
Plugins/Old/SkyFarms/.idea/libraries/EconomyAPI.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="EconomyAPI">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../Exports/EconomyAPI.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
11
Plugins/Old/SkyFarms/.idea/libraries/spigot_1_15_2.xml
generated
Normal file
11
Plugins/Old/SkyFarms/.idea/libraries/spigot_1_15_2.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="spigot-1.15.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../Spigot Versions/spigot-1.15.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../Spigot Versions/spigot-1.15.2.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
11
Plugins/Old/SkyFarms/.idea/misc.xml
generated
Normal file
11
Plugins/Old/SkyFarms/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
Plugins/Old/SkyFarms/.idea/modules.xml
generated
Normal file
8
Plugins/Old/SkyFarms/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/SkyFarms.iml" filepath="$PROJECT_DIR$/SkyFarms.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
10
Plugins/Old/SkyFarms/.idea/runConfigurations.xml
generated
Normal file
10
Plugins/Old/SkyFarms/.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
124
Plugins/Old/SkyFarms/.idea/uiDesigner.xml
generated
Normal file
124
Plugins/Old/SkyFarms/.idea/uiDesigner.xml
generated
Normal file
@@ -0,0 +1,124 @@
|
||||
<?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>
|
||||
23
Plugins/Old/SkyFarms/SkyFarms.iml
Normal file
23
Plugins/Old/SkyFarms/SkyFarms.iml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="minecraft" name="Minecraft">
|
||||
<configuration>
|
||||
<autoDetectTypes>
|
||||
<platformType>SPIGOT</platformType>
|
||||
</autoDetectTypes>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Exports" level="project" />
|
||||
<orderEntry type="library" name="Spigot Versions" level="project" />
|
||||
<orderEntry type="library" name="spigot-1.15.2" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
Plugins/Old/SkyFarms/plugin.yml
Normal file
7
Plugins/Old/SkyFarms/plugin.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
name: SkyFarms
|
||||
version: 1.15.2
|
||||
main: de.craftix.skyfarms.general.Main
|
||||
api-version: 1.15
|
||||
|
||||
commands:
|
||||
shop:
|
||||
@@ -0,0 +1,41 @@
|
||||
package de.craftix.skyfarms.general;
|
||||
|
||||
import de.craftix.skyfarms.shop.CreateInvs;
|
||||
import de.craftix.skyfarms.shop.MainShop;
|
||||
import de.craftix.skyfarms.shop.baumaterialien.Baumaterialien;
|
||||
import de.craftix.skyfarms.shop.pflanzliches.Pflanzliches;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
private static Main plugin;
|
||||
|
||||
public void onEnable(){
|
||||
plugin = this;
|
||||
MainShop shop = new MainShop();
|
||||
CreateInvs.Create();
|
||||
|
||||
//Commands
|
||||
getCommand("shop").setExecutor(shop);
|
||||
|
||||
//Listeners
|
||||
PluginManager pm = Bukkit.getPluginManager();
|
||||
pm.registerEvents(shop, this);
|
||||
pm.registerEvents(new Baumaterialien(), this);
|
||||
pm.registerEvents(new Pflanzliches(), this);
|
||||
}
|
||||
|
||||
public void onDisable(){
|
||||
for (Player all : Bukkit.getOnlinePlayers()){
|
||||
all.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
public static Main getPlugin(){
|
||||
return plugin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package de.craftix.skyfarms.general;
|
||||
|
||||
public class Messages {
|
||||
|
||||
public static final String prefix = "§7[§6SkyFarms§7] §r";
|
||||
public static final String onlyPlayer = prefix + "§cDieser Command kann nur als Spieler ausgeführt werden!";
|
||||
public static final String noPermission = prefix + "§cDu hast keine Rechte, diesen Befehl auszuführen!";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package de.craftix.skyfarms.general;
|
||||
|
||||
public class Permissions {
|
||||
|
||||
public static final String shopcmd = "skyfarms.command.shop";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package de.craftix.skyfarms.shop;
|
||||
|
||||
import de.craftix.skyfarms.shop.baumaterialien.Baumaterialien;
|
||||
import de.craftix.skyfarms.shop.pflanzliches.Pflanzliches;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class CreateInvs {
|
||||
|
||||
public static Inventory mainShop;
|
||||
public static Inventory blockShop;
|
||||
public static Inventory flowerShop;
|
||||
|
||||
public static void Create(){
|
||||
mainShop = MainShop.createInv();
|
||||
blockShop = Baumaterialien.createInv();
|
||||
flowerShop = Pflanzliches.createInv();
|
||||
}
|
||||
|
||||
}
|
||||
131
Plugins/Old/SkyFarms/src/de/craftix/skyfarms/shop/MainShop.java
Normal file
131
Plugins/Old/SkyFarms/src/de/craftix/skyfarms/shop/MainShop.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package de.craftix.skyfarms.shop;
|
||||
|
||||
import de.craftix.skyfarms.general.Messages;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class MainShop implements CommandExecutor, Listener {
|
||||
private static final String GUI_NAME = "§b§lShop";
|
||||
private static final int SIZE = 3*9;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender instanceof Player){
|
||||
Player p = (Player)sender;
|
||||
openGUI(p);
|
||||
}else {
|
||||
sender.sendMessage(Messages.onlyPlayer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void openGUI(Player p){
|
||||
p.openInventory(CreateInvs.mainShop);
|
||||
}
|
||||
|
||||
public static Inventory createInv(){
|
||||
Inventory inv = Bukkit.createInventory(null, SIZE, GUI_NAME);
|
||||
|
||||
ItemStack empty = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
|
||||
ItemMeta emptyMeta = empty.getItemMeta();
|
||||
emptyMeta.setDisplayName(" ");
|
||||
empty.setItemMeta(emptyMeta);
|
||||
|
||||
//Items
|
||||
ItemStack blocks = new ItemStack(Material.BRICKS);
|
||||
ItemMeta blockMeta = blocks.getItemMeta();
|
||||
blockMeta.setDisplayName("§eBaumaterialien");
|
||||
blocks.setItemMeta(blockMeta);
|
||||
|
||||
ItemStack flowers = new ItemStack(Material.PEONY);
|
||||
ItemMeta flowersMeta = flowers.getItemMeta();
|
||||
flowersMeta.setDisplayName("§ePflanzliches");
|
||||
flowers.setItemMeta(flowersMeta);
|
||||
|
||||
ItemStack farm = new ItemStack(Material.WHEAT);
|
||||
ItemMeta farmMeta = farm.getItemMeta();
|
||||
farmMeta.setDisplayName("§eLandwirtschaft");
|
||||
farm.setItemMeta(farmMeta);
|
||||
|
||||
ItemStack eggs = new ItemStack(Material.FOX_SPAWN_EGG);
|
||||
ItemMeta eggMeta = eggs.getItemMeta();
|
||||
eggMeta.setDisplayName("§eSpawneier");
|
||||
eggs.setItemMeta(eggMeta);
|
||||
|
||||
ItemStack erze = new ItemStack(Material.DIAMOND);
|
||||
ItemMeta erzMeta = erze.getItemMeta();
|
||||
erzMeta.setDisplayName("§eErze");
|
||||
erze.setItemMeta(erzMeta);
|
||||
|
||||
ItemStack special = new ItemStack(Material.HEART_OF_THE_SEA);
|
||||
ItemMeta sMeta = special.getItemMeta();
|
||||
sMeta.setDisplayName("§eSeltenes");
|
||||
special.setItemMeta(sMeta);
|
||||
|
||||
ItemStack rstone = new ItemStack(Material.REDSTONE);
|
||||
ItemMeta rsMeta = rstone.getItemMeta();
|
||||
rsMeta.setDisplayName("§eRedstone");
|
||||
rstone.setItemMeta(rsMeta);
|
||||
|
||||
ItemStack food = new ItemStack(Material.APPLE);
|
||||
ItemMeta foodMeta = food.getItemMeta();
|
||||
foodMeta.setDisplayName("§eNahrung");
|
||||
food.setItemMeta(foodMeta);
|
||||
|
||||
ItemStack mobs = new ItemStack(Material.SKELETON_SKULL);
|
||||
ItemMeta mobMeta = mobs.getItemMeta();
|
||||
mobMeta.setDisplayName("§eMobdrops");
|
||||
mobs.setItemMeta(mobMeta);
|
||||
|
||||
inv.setItem(1, blocks);
|
||||
inv.setItem(4, farm);
|
||||
inv.setItem(7, flowers);
|
||||
inv.setItem(11, eggs);
|
||||
inv.setItem(13, erze);
|
||||
inv.setItem(15, special);
|
||||
inv.setItem(19, rstone);
|
||||
inv.setItem(22, food);
|
||||
inv.setItem(25, mobs);
|
||||
|
||||
int count = 0;
|
||||
for (ItemStack all : inv){
|
||||
if (all == null){
|
||||
inv.setItem(count, empty);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return inv;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKlick(InventoryClickEvent event){
|
||||
if (!event.getClickedInventory().equals(CreateInvs.mainShop)) return;
|
||||
event.setCancelled(true);
|
||||
Player p = (Player)event.getWhoClicked();
|
||||
switch (event.getSlot()){
|
||||
case 1:
|
||||
openGUI(p, CreateInvs.blockShop);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
openGUI(p, CreateInvs.flowerShop);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void openGUI(Player p, Inventory inv){
|
||||
p.openInventory(inv);
|
||||
}
|
||||
}
|
||||
120
Plugins/Old/SkyFarms/src/de/craftix/skyfarms/shop/Pimmel.java
Normal file
120
Plugins/Old/SkyFarms/src/de/craftix/skyfarms/shop/Pimmel.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package de.craftix.skyfarms.shop;
|
||||
|
||||
import de.craftix.skyfarms.general.Messages;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Pimmel implements Listener{
|
||||
|
||||
private static ArrayList<ShopItem> items = new ArrayList<>();
|
||||
private static final String GUI_NAME = "§b§lBlöcke:";
|
||||
private static final int SIZE = 3*9;
|
||||
|
||||
public static void openGUI(Player p){
|
||||
p.openInventory(CreateInvs.blockShop);
|
||||
}
|
||||
|
||||
public static Inventory createInv(){
|
||||
Inventory inv = Bukkit.createInventory(null, SIZE, GUI_NAME);
|
||||
|
||||
//Items
|
||||
items.add(new ShopItem(100, 10, Material.DIRT, "§6Test", 4));
|
||||
ShopItem grass = new ShopItem(30, Material.GRASS_BLOCK, "§6Tolles GRASS", 8);
|
||||
grass.amount = 10;
|
||||
items.add(grass);
|
||||
|
||||
ItemStack back = new ItemStack(Material.BARRIER);
|
||||
ItemMeta backMeta = back.getItemMeta();
|
||||
backMeta.setDisplayName("§cZurück");
|
||||
back.setItemMeta(backMeta);
|
||||
|
||||
//Set Items
|
||||
for (ShopItem sitems : items){
|
||||
inv.setItem(sitems.slot, sitems.item);
|
||||
}
|
||||
inv.setItem(18, back);
|
||||
for (int i = 19; i <= 26; i++){
|
||||
ItemStack glass = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
|
||||
ItemMeta glassMeta = glass.getItemMeta();
|
||||
glassMeta.setDisplayName(" ");
|
||||
glass.setItemMeta(glassMeta);
|
||||
inv.setItem(i, glass);
|
||||
}
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void guiClick(InventoryClickEvent event){
|
||||
if (!event.getClickedInventory().equals(CreateInvs.blockShop)) return;
|
||||
event.setCancelled(true);
|
||||
// Right or Left Click
|
||||
boolean isLeft = false;
|
||||
if (event.getAction().equals(InventoryAction.PICKUP_ALL)) isLeft = true;
|
||||
Player p = (Player) event.getWhoClicked();
|
||||
switch (event.getSlot()){
|
||||
case 4:
|
||||
handleClick(getItem(4), p, isLeft);
|
||||
break;
|
||||
case 8:
|
||||
handleClick(getItem(8), p, isLeft);
|
||||
break;
|
||||
case 18:
|
||||
p.openInventory(CreateInvs.mainShop);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static ShopItem getItem(int slot){
|
||||
for (ShopItem i : items){
|
||||
if (i.slot == slot){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void handleClick(ShopItem item, Player p, boolean left){
|
||||
if (!item.sellable && !left){
|
||||
p.sendMessage(Messages.prefix + "§cDieses Item kann man nicht verkaufen!");
|
||||
return;
|
||||
}else if (!left) {
|
||||
ItemStack currItem = new ItemStack(item.mat, item.amount, item.subID);
|
||||
boolean hasItem = false;
|
||||
if (p.getInventory().contains(item.mat)){
|
||||
for (int i = item.amount; i <= 64; i++){
|
||||
ItemStack testItem = new ItemStack(item.mat, i, item.subID);
|
||||
if (p.getInventory().contains(testItem)){
|
||||
hasItem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasItem){
|
||||
|
||||
p.getInventory().removeItem(currItem);
|
||||
p.sendMessage("§8[§6Konto§8] §a§l+ §r§6" + item.sell);
|
||||
|
||||
}else {
|
||||
p.sendMessage(Messages.prefix + "§cDu hast nicht genügend Items!");
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
p.sendMessage(Messages.prefix + "§cDu hast nicht genügend Items!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package de.craftix.skyfarms.shop;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ShopItem {
|
||||
|
||||
public int coast;
|
||||
public int sell;
|
||||
public int slot;
|
||||
public Material mat;
|
||||
public String name;
|
||||
public boolean sellable;
|
||||
public ItemStack item;
|
||||
public int amount = 1;
|
||||
public short subID = 0;
|
||||
|
||||
public ShopItem (int coast, Material mat, String name, int slot){
|
||||
sellable = false;
|
||||
this.coast = coast;
|
||||
this.slot = slot;
|
||||
this.mat = mat;
|
||||
this.name = name;
|
||||
create();
|
||||
}
|
||||
|
||||
public ShopItem (int coast, int sell, Material mat, String name, int slot){
|
||||
sellable = true;
|
||||
this.coast = coast;
|
||||
this.slot = slot;
|
||||
this.sell = sell;
|
||||
this.mat = mat;
|
||||
this.name = name;
|
||||
create();
|
||||
}
|
||||
|
||||
private void create(){
|
||||
ItemStack is = new ItemStack(mat, amount, subID);
|
||||
ItemMeta im = is.getItemMeta();
|
||||
im.setDisplayName(name);
|
||||
im.setLore(setLore());
|
||||
is.setItemMeta(im);
|
||||
item = is;
|
||||
}
|
||||
|
||||
private ArrayList<String> setLore(){
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
if (sellable){
|
||||
lore.add("§7--------------");
|
||||
lore.add("§bPreis: §6" + coast);
|
||||
lore.add("§bVerkaufen: §6" + sell);
|
||||
lore.add("§7--------------");
|
||||
}else {
|
||||
lore.add("§7-------------------------------------");
|
||||
lore.add("§bPreis: §6" + coast);
|
||||
lore.add("§cDieses Item kann man nicht verkaufen!");
|
||||
lore.add("§7-------------------------------------");
|
||||
}
|
||||
return lore;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package de.craftix.skyfarms.shop.baumaterialien;
|
||||
|
||||
import de.craftix.skyfarms.shop.CreateInvs;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class Baumaterialien implements Listener {
|
||||
|
||||
private static final String GUI_TITLE = "§6Baumaterialien";
|
||||
private static final int SIZE = 9*4;
|
||||
|
||||
public static Inventory createInv(){
|
||||
Inventory inv = Bukkit.createInventory(null, SIZE, GUI_TITLE);
|
||||
|
||||
ItemStack empty = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
|
||||
ItemMeta emptyMeta = empty.getItemMeta();
|
||||
emptyMeta.setDisplayName(" ");
|
||||
empty.setItemMeta(emptyMeta);
|
||||
|
||||
ItemStack back = new ItemStack(Material.BARRIER);
|
||||
ItemMeta backMeta = back.getItemMeta();
|
||||
backMeta.setDisplayName("§cZurück");
|
||||
back.setItemMeta(backMeta);
|
||||
|
||||
ItemStack stein = new ItemStack(Material.STONE);
|
||||
ItemMeta steinMeta = stein.getItemMeta();
|
||||
steinMeta.setDisplayName("§eStein");
|
||||
stein.setItemMeta(steinMeta);
|
||||
|
||||
ItemStack erde = new ItemStack(Material.GRASS_BLOCK);
|
||||
ItemMeta erdeMeta = erde.getItemMeta();
|
||||
erdeMeta.setDisplayName("§eErdliches");
|
||||
erde.setItemMeta(erdeMeta);
|
||||
|
||||
ItemStack holz = new ItemStack(Material.OAK_WOOD);
|
||||
ItemMeta holzMeta = holz.getItemMeta();
|
||||
holzMeta.setDisplayName("§eHolz");
|
||||
holz.setItemMeta(holzMeta);
|
||||
|
||||
ItemStack wolle = new ItemStack(Material.MAGENTA_WOOL);
|
||||
ItemMeta wolleMeta = wolle.getItemMeta();
|
||||
wolleMeta.setDisplayName("§eWolle");
|
||||
wolle.setItemMeta(wolleMeta);
|
||||
|
||||
ItemStack ton = new ItemStack(Material.TERRACOTTA);
|
||||
ItemMeta tonMeta = ton.getItemMeta();
|
||||
tonMeta.setDisplayName("§eTon");
|
||||
ton.setItemMeta(tonMeta);
|
||||
|
||||
ItemStack beton = new ItemStack(Material.BLACK_TERRACOTTA);
|
||||
ItemMeta betonMeta = beton.getItemMeta();
|
||||
betonMeta.setDisplayName("§eBeton");
|
||||
beton.setItemMeta(betonMeta);
|
||||
|
||||
ItemStack glass = new ItemStack(Material.WHITE_STAINED_GLASS);
|
||||
ItemMeta glassMeta = glass.getItemMeta();
|
||||
glassMeta.setDisplayName("§eGlass");
|
||||
glass.setItemMeta(glassMeta);
|
||||
|
||||
ItemStack other = new ItemStack(Material.BRICKS);
|
||||
ItemMeta otherMeta = other.getItemMeta();
|
||||
otherMeta.setDisplayName("§eAndere Blöcke");
|
||||
other.setItemMeta(otherMeta);
|
||||
|
||||
inv.setItem(1, stein);
|
||||
inv.setItem(3, erde);
|
||||
inv.setItem(5, holz);
|
||||
inv.setItem(21, wolle);
|
||||
inv.setItem(23, ton);
|
||||
inv.setItem(25, beton);
|
||||
inv.setItem(19, glass);
|
||||
inv.setItem(7, other);
|
||||
inv.setItem(27, back);
|
||||
|
||||
int count = 0;
|
||||
for (ItemStack all : inv){
|
||||
if (all == null){
|
||||
inv.setItem(count, empty);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKlick(InventoryClickEvent event){
|
||||
if (!event.getClickedInventory().equals(CreateInvs.blockShop)) return;
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package de.craftix.skyfarms.shop.pflanzliches;
|
||||
|
||||
import de.craftix.skyfarms.shop.CreateInvs;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class Pflanzliches implements Listener {
|
||||
|
||||
private static final String GUI_NAME = "§6Pflanzliches";
|
||||
private static final int SIZE = 9*4;
|
||||
|
||||
public static Inventory createInv(){
|
||||
Inventory inv = Bukkit.createInventory(null, SIZE, GUI_NAME);
|
||||
|
||||
ItemStack empty = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
|
||||
ItemMeta emptyMeta = empty.getItemMeta();
|
||||
emptyMeta.setDisplayName(" ");
|
||||
empty.setItemMeta(emptyMeta);
|
||||
|
||||
ItemStack back = new ItemStack(Material.BARRIER);
|
||||
ItemMeta backMeta = back.getItemMeta();
|
||||
backMeta.setDisplayName("§cZurück");
|
||||
back.setItemMeta(backMeta);
|
||||
|
||||
ItemStack blumen = new ItemStack(Material.ROSE_BUSH);
|
||||
ItemMeta blumenMeta = blumen.getItemMeta();
|
||||
blumenMeta.setDisplayName("§eBlumen");
|
||||
blumen.setItemMeta(blumenMeta);
|
||||
|
||||
ItemStack setzlinge = new ItemStack(Material.OAK_SAPLING);
|
||||
ItemMeta setzlingeMeta = setzlinge.getItemMeta();
|
||||
setzlingeMeta.setDisplayName("§eSetzlinge");
|
||||
setzlinge.setItemMeta(setzlingeMeta);
|
||||
|
||||
ItemStack laub = new ItemStack(Material.OAK_LEAVES);
|
||||
ItemMeta laubMeta = laub.getItemMeta();
|
||||
laubMeta.setDisplayName("§eLaub");
|
||||
laub.setItemMeta(laubMeta);
|
||||
|
||||
ItemStack other = new ItemStack(Material.VINE);
|
||||
ItemMeta otherMeta = other.getItemMeta();
|
||||
otherMeta.setDisplayName("§eAndere Pflanzen");
|
||||
other.setItemMeta(otherMeta);
|
||||
|
||||
inv.setItem(10, blumen);
|
||||
inv.setItem(12, setzlinge);
|
||||
inv.setItem(14, laub);
|
||||
inv.setItem(16, other);
|
||||
inv.setItem(27, back);
|
||||
|
||||
int count = 0;
|
||||
for (ItemStack all : inv){
|
||||
if (all == null){
|
||||
inv.setItem(count, empty);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onKlick(InventoryClickEvent event){
|
||||
if (!event.getClickedInventory().equals(CreateInvs.flowerShop)) return;
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user