├── gun.yml
├── plugin.yml
├── .project
├── .gitattributes
├── .classpath
├── config.yml
├── .gitignore
└── src
└── com
└── pzg
└── www
└── swweapons
└── main
├── PluginMain.java
├── objects
└── Gun.java
└── CreateItem.java
/gun.yml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/plugin.yml:
--------------------------------------------------------------------------------
1 | name: Weapons
2 | author: TJPlaysNow
3 | main: com.pzg.www.swweapons.main.PluginMain
4 | version: 1.0
5 | depend: [ConfigAPI]
6 | commands:
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | StarWarsWeapons
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/config.yml:
--------------------------------------------------------------------------------
1 | # The config for great weapons!
2 | Weapon:
3 | # This section is just for guns.
4 | Gun:
5 | # This must be set to the number of guns you expect to have!!
6 | Ammount: 1
7 | # These numbers go on and on, it won't load if the 'Ammount' variable is not big enough!
8 | # Just put "gunName" .yml is not needed and will break it!
9 | 1: "gun"
10 | # This section is just for swords
11 | Swords:
12 | # This must be set to the number of guns you expect to have!!
13 | Ammount: 1
14 | # These numbers go on and on, it won't load if the 'Ammount' variable is not big enough!
15 | # Just put "swordName" .yml is not needed and will break it!
16 | 1: "sword"
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 | /bin/
49 |
--------------------------------------------------------------------------------
/src/com/pzg/www/swweapons/main/PluginMain.java:
--------------------------------------------------------------------------------
1 | package com.pzg.www.swweapons.main;
2 |
3 | import org.bukkit.Material;
4 | import org.bukkit.plugin.Plugin;
5 | import org.bukkit.plugin.java.JavaPlugin;
6 |
7 | import com.pzg.www.api.config.Config;
8 |
9 | public class PluginMain extends JavaPlugin {
10 |
11 | public static Plugin plugin;
12 |
13 | public static Config config;
14 |
15 | boolean created = true;
16 |
17 | @SuppressWarnings("deprecation")
18 | @Override
19 | public void onEnable() {
20 | plugin = this;
21 |
22 | config = new Config("plugins/weapons", "config.yml", "config.yml", plugin);
23 | config.saveConfig();
24 |
25 | Config gun = new Config("plugins/weapons/guns", "gun.yml", plugin);
26 | gun.getConfig().set("Gun.Damage", 100);
27 | gun.getConfig().set("Gun.Name", "gun");
28 | gun.getConfig().set("Gun.Lore.1", "Lore 1");
29 | gun.getConfig().set("Gun.Lore.2", "Lore 2");
30 | gun.getConfig().set("Gun.Lore.3", "Lore 3");
31 | gun.getConfig().set("Gun.Lore.4", "Lore 4");
32 | gun.getConfig().set("Gun.Material", Material.IRON_HOE);
33 | gun.getConfig().set("Gun.Material.DamageValue", 1);
34 | gun.getConfig().set("Gun.Ammo.PerClip", 30);
35 | gun.getConfig().set("Gun.Ammo.Name", "ammo");
36 | gun.getConfig().set("Gun.Ammo.Lore.1", "Lore 1");
37 | gun.getConfig().set("Gun.Ammo.Lore.2", "Lore 2");
38 | gun.getConfig().set("Gun.Ammo.Lore.3", "Lore 3");
39 | gun.getConfig().set("Gun.Ammo.Lore.4", "Lore 4");
40 | gun.getConfig().set("Gun.Ammo.Material", Material.ARROW.getId());
41 | gun.getConfig().set("Gun.Ammo.DamageValue", 0);
42 | gun.saveConfig();
43 | }
44 |
45 | @Override
46 | public void onDisable() {
47 |
48 | }
49 | }
--------------------------------------------------------------------------------
/src/com/pzg/www/swweapons/main/objects/Gun.java:
--------------------------------------------------------------------------------
1 | package com.pzg.www.swweapons.main.objects;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.bukkit.Material;
7 | import org.bukkit.inventory.ItemStack;
8 |
9 | import com.pzg.www.api.config.Config;
10 | import com.pzg.www.swweapons.main.CreateItem;
11 |
12 | public class Gun {
13 |
14 | protected Config config;
15 |
16 | protected int damage;
17 |
18 | protected String name;
19 | protected List lore;
20 | protected Material itemMaterial;
21 | protected int damageValue;
22 |
23 | protected ItemStack item;
24 |
25 | protected int ammoAmmount;
26 |
27 | protected String ammoName;
28 | protected List ammoLore;
29 | protected Material ammoMaterial;
30 | protected int ammoDamageValue;
31 |
32 | protected ItemStack ammo;
33 |
34 | public Gun(Config config) {
35 | int damage = config.getConfig().getInt("Gun.Damage");
36 | this.damage = damage;
37 |
38 | String name = config.getConfig().getString("Gun.Name");
39 | this.name = name;
40 |
41 | String lore1 = config.getConfig().getString("Gun.Lore.1");
42 | String lore2 = config.getConfig().getString("Gun.Lore.2");
43 | String lore3 = config.getConfig().getString("Gun.Lore.3");
44 | String lore4 = config.getConfig().getString("Gun.Lore.4");
45 | List lore = new ArrayList();
46 | lore.add(lore1);
47 | lore.add(lore2);
48 | lore.add(lore3);
49 | lore.add(lore4);
50 | this.lore = lore;
51 |
52 | Material itemMaterial = (Material) config.getConfig().get("Gun.Material");
53 | this.itemMaterial = itemMaterial;
54 |
55 | int damageValue = config.getConfig().getInt("Gun.Material.DamageValue");
56 | this.damageValue = damageValue;
57 |
58 | ItemStack item = CreateItem.createItem(itemMaterial, damageValue, name, lore);
59 | this.item = item;
60 |
61 | int ammoAmmount = config.getConfig().getInt("Gun.Ammo.PerClip");
62 | this.ammoAmmount = ammoAmmount;
63 |
64 | String ammoName = config.getConfig().getString("Gun.Ammo.Name");
65 | this.ammoName = ammoName;
66 |
67 | String ammoLore1 = config.getConfig().getString("Gun.Ammo.Lore.1");
68 | String ammoLore2 = config.getConfig().getString("Gun.Ammo.Lore.2");
69 | String ammoLore3 = config.getConfig().getString("Gun.Ammo.Lore.3");
70 | String ammoLore4 = config.getConfig().getString("Gun.Ammo.Lore.4");
71 | List ammoLore = new ArrayList();
72 | ammoLore.add(ammoLore1);
73 | ammoLore.add(ammoLore2);
74 | ammoLore.add(ammoLore3);
75 | ammoLore.add(ammoLore4);
76 | this.ammoLore = ammoLore;
77 |
78 | Material ammoMaterial = (Material) config.getConfig().get("Gun.Ammo.Material");;
79 | this.ammoMaterial = ammoMaterial;
80 |
81 | int ammoDamageValue = config.getConfig().getInt("Gun.Ammo.DamageValue");
82 | this.ammoDamageValue = ammoDamageValue;
83 |
84 | ItemStack ammo = CreateItem.createItem(ammoMaterial, ammoDamageValue, ammoName, ammoLore);
85 | this.item = ammo;
86 | }
87 |
88 | public ItemStack getWeapon() {
89 | return item;
90 | }
91 |
92 | public ItemStack getAmmo() {
93 | return ammo;
94 | }
95 |
96 | public int getDamage() {
97 | return damage;
98 | }
99 |
100 | public int getReloadAmmonut() {
101 | return ammoAmmount;
102 | }
103 | }
--------------------------------------------------------------------------------
/src/com/pzg/www/swweapons/main/CreateItem.java:
--------------------------------------------------------------------------------
1 | package com.pzg.www.swweapons.main;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.bukkit.Material;
7 | import org.bukkit.inventory.ItemStack;
8 | import org.bukkit.inventory.meta.ItemMeta;
9 |
10 | public class CreateItem {
11 |
12 | public static ItemStack createItem(Material material, String name, String loreOne, String loreTwo, String loreThree, String loreFour) {
13 | ItemStack item = new ItemStack(material);
14 | ItemMeta itemMeta = item.getItemMeta();
15 | itemMeta.setDisplayName(name);
16 | List newLore = new ArrayList();
17 | newLore.add(loreOne);
18 | newLore.add(loreTwo);
19 | newLore.add(loreThree);
20 | newLore.add(loreFour);
21 | itemMeta.setLore(newLore);
22 | item.setItemMeta(itemMeta);
23 | return item;
24 | }
25 |
26 | public static ItemStack createItem(Material material, String name, String loreOne, String loreTwo, String loreThree) {
27 | ItemStack item = new ItemStack(material);
28 | ItemMeta itemMeta = item.getItemMeta();
29 | itemMeta.setDisplayName(name);
30 | List newLore = new ArrayList();
31 | newLore.add(loreOne);
32 | newLore.add(loreTwo);
33 | newLore.add(loreThree);
34 | itemMeta.setLore(newLore);
35 | item.setItemMeta(itemMeta);
36 | return item;
37 | }
38 |
39 | public static ItemStack createItem(Material material, String name, String loreOne, String loreTwo) {
40 | ItemStack item = new ItemStack(material);
41 | ItemMeta itemMeta = item.getItemMeta();
42 | itemMeta.setDisplayName(name);
43 | List newLore = new ArrayList();
44 | newLore.add(loreOne);
45 | newLore.add(loreTwo);
46 | itemMeta.setLore(newLore);
47 | item.setItemMeta(itemMeta);
48 | return item;
49 | }
50 |
51 | public static ItemStack createItem(Material material, String name, String loreOne) {
52 | ItemStack item = new ItemStack(material);
53 | ItemMeta itemMeta = item.getItemMeta();
54 | itemMeta.setDisplayName(name);
55 | List newLore = new ArrayList();
56 | newLore.add(loreOne);
57 | itemMeta.setLore(newLore);
58 | item.setItemMeta(itemMeta);
59 | return item;
60 | }
61 |
62 | public static ItemStack createItem(Material material, String name, String[] lore) {
63 | ItemStack item = new ItemStack(material);
64 | ItemMeta itemMeta = item.getItemMeta();
65 | itemMeta.setDisplayName(name);
66 | List newLore = new ArrayList();
67 | newLore.add(lore[0]);
68 | newLore.add(lore[1]);
69 | newLore.add(lore[2]);
70 | newLore.add(lore[3]);
71 | itemMeta.setLore(newLore);
72 | item.setItemMeta(itemMeta);
73 | return item;
74 | }
75 |
76 | public static ItemStack createItem(Material material, String name, List lore) {
77 | ItemStack item = new ItemStack(material);
78 | ItemMeta itemMeta = item.getItemMeta();
79 | itemMeta.setDisplayName(name);
80 | itemMeta.setLore(lore);
81 | item.setItemMeta(itemMeta);
82 | return item;
83 | }
84 |
85 | public static ItemStack createItem(Material material, String name) {
86 | ItemStack item = new ItemStack(material);
87 | ItemMeta itemMeta = item.getItemMeta();
88 | itemMeta.setDisplayName(name);
89 | item.setItemMeta(itemMeta);
90 | return item;
91 | }
92 |
93 | public static ItemStack createItem(Material material) {
94 | ItemStack item = new ItemStack(material);
95 | return item;
96 | }
97 |
98 | public static ItemStack createItem(Material material, int damageValue) {
99 | ItemStack item = new ItemStack(Material.WOOD_HOE, 1, (short)1);
100 | ItemMeta itemMeta = item.getItemMeta();
101 | itemMeta.setUnbreakable(true);
102 | item.setItemMeta(itemMeta);
103 | return item;
104 | }
105 |
106 | public static ItemStack createItem(Material material, int damageValue, String name) {
107 | ItemStack item = new ItemStack(Material.WOOD_HOE, 1, (short)1);
108 | ItemMeta itemMeta = item.getItemMeta();
109 | itemMeta.setDisplayName(name);
110 | itemMeta.setUnbreakable(true);
111 | item.setItemMeta(itemMeta);
112 | return item;
113 | }
114 |
115 | public static ItemStack createItem(Material material, int damageValue, String name, List lore) {
116 | ItemStack item = new ItemStack(Material.WOOD_HOE, 1, (short)1);
117 | ItemMeta itemMeta = item.getItemMeta();
118 | itemMeta.setDisplayName(name);
119 | itemMeta.setLore(lore);
120 | itemMeta.setUnbreakable(true);
121 | item.setItemMeta(itemMeta);
122 | return item;
123 | }
124 | }
--------------------------------------------------------------------------------