Skip to content

Commit 9944946

Browse files
author
MrTwiggy
committed
Fixed method names to fit with Java Style Guidelines.
1 parent 69dc688 commit 9944946

13 files changed

+155
-163
lines changed
125 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-38 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/com/github/MrTwiggy/OreGin/OreGin.java

+70-70
Large diffs are not rendered by default.

src/com/github/MrTwiggy/OreGin/OreGinListener.java

+26-26
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public OreGinListener(OreGinManager oreGinMan)
4343
* Checks to see if an OreGin can be created
4444
*/
4545
@EventHandler
46-
public void OreGinInteraction(PlayerInteractEvent event)
46+
public void oreGinInteraction(PlayerInteractEvent event)
4747
{
4848
Block clicked = event.getClickedBlock();
4949
Player creator = event.getPlayer();
@@ -56,29 +56,29 @@ public void OreGinInteraction(PlayerInteractEvent event)
5656
if (creator.getItemInHand().getType().equals(OreGinPlugin.OREGIN_UPGRADE_WAND))
5757
{
5858

59-
if (oreGinMan.OreGinExistsAt(clicked.getLocation()))
59+
if (oreGinMan.oreGinExistsAt(clicked.getLocation()))
6060
{
61-
OreGin oreGin = oreGinMan.GetOreGin(clicked.getLocation());
61+
OreGin oreGin = oreGinMan.getOreGin(clicked.getLocation());
6262
creator.sendMessage(oreGin.upgrade());
6363
}
6464
else
6565
{
66-
creator.sendMessage(oreGinMan.CreateOreGin(clicked.getLocation()));
66+
creator.sendMessage(oreGinMan.createOreGin(clicked.getLocation()));
6767
}
6868
} //Activate or de-activate OreGin
6969
else if (creator.getItemInHand().getType().equals(OreGinPlugin.OREGIN_ACTIVATION_WAND))
7070
{
71-
if (oreGinMan.OreGinExistsAt(clicked.getLocation()))
71+
if (oreGinMan.oreGinExistsAt(clicked.getLocation()))
7272
{
73-
OreGin oreGin = oreGinMan.GetOreGin(clicked.getLocation());
73+
OreGin oreGin = oreGinMan.getOreGin(clicked.getLocation());
7474
creator.sendMessage(oreGin.togglePower());
7575
}
7676
} //Repair OreGin
7777
else if (creator.getItemInHand().getType().equals(OreGinPlugin.OREGIN_REPAIR_WAND))
7878
{
79-
if (oreGinMan.OreGinExistsAt(clicked.getLocation()))
79+
if (oreGinMan.oreGinExistsAt(clicked.getLocation()))
8080
{
81-
OreGin oreGin = oreGinMan.GetOreGin(clicked.getLocation());
81+
OreGin oreGin = oreGinMan.getOreGin(clicked.getLocation());
8282
creator.sendMessage(oreGin.repair());
8383
}
8484
}
@@ -92,18 +92,18 @@ else if (creator.getItemInHand().getType().equals(OreGinPlugin.OREGIN_REPAIR_WAN
9292
* Checks to see if an OreGin (dispenser or light) is being destroyed (block broken)
9393
*/
9494
@EventHandler
95-
public void OreGinBroken(BlockBreakEvent event)
95+
public void oreGinBroken(BlockBreakEvent event)
9696
{
9797
Block destroyed = event.getBlock();
9898

9999
if ((destroyed.getState() instanceof Dispenser) || destroyed.getType().equals(OreGinPlugin.LIGHT_ON)
100100
|| destroyed.getType().equals(OreGinPlugin.LIGHT_OFF))
101101
{
102-
if (oreGinMan.OreGinExistsAt(destroyed.getLocation()) || oreGinMan.OreGinLightExistsAt(destroyed.getLocation()))
102+
if (oreGinMan.oreGinExistsAt(destroyed.getLocation()) || oreGinMan.oreGinLightExistsAt(destroyed.getLocation()))
103103
{
104-
OreGin oreGin = oreGinMan.GetOreGin(destroyed.getLocation());
105-
if (oreGinMan.OreGinLightExistsAt(destroyed.getLocation()))
106-
oreGin = oreGinMan.GetOreGin(destroyed.getRelative(BlockFace.DOWN).getLocation());
104+
OreGin oreGin = oreGinMan.getOreGin(destroyed.getLocation());
105+
if (oreGinMan.oreGinLightExistsAt(destroyed.getLocation()))
106+
oreGin = oreGinMan.getOreGin(destroyed.getRelative(BlockFace.DOWN).getLocation());
107107

108108
if (!isReinforced(oreGin.getLocation().getBlock()) &&
109109
!isReinforced(oreGin.getLocation().getBlock().getRelative(BlockFace.UP)))
@@ -126,22 +126,22 @@ else if (isReinforced(oreGin.getLocation().getBlock()) ||
126126
* Checks to see if an OreGin has been placed
127127
*/
128128
@EventHandler
129-
public void OreGinPlaced(BlockPlaceEvent event)
129+
public void oreGinPlaced(BlockPlaceEvent event)
130130
{
131131
Block placed = event.getBlock();
132132

133-
if (oreGinMan.IsOreGin(event.getItemInHand()))
133+
if (oreGinMan.isOreGin(event.getItemInHand()))
134134
{
135-
if (OreGin.validOreGinCreationLocation(placed.getLocation()))
135+
if (OreGin.isValidOreGinCreationLocation(placed.getLocation()))
136136
{
137137
OreGin oreGin = new OreGin(placed.getLocation(), OreGin.getTierLevel(event.getItemInHand().getItemMeta().getDisplayName()),
138138
OreGin.getBlockBreaksFromLore(event.getItemInHand().getItemMeta().getLore()), oreGinMan);
139-
oreGinMan.AddOreGin(oreGin);
139+
oreGinMan.addOreGin(oreGin);
140140
event.getPlayer().sendMessage(ChatColor.GREEN + "An OreGin of tier level " + oreGin.getTierLevel() + " was placed!");
141141
}
142142
else
143143
{
144-
OreGinSoundCollection.ErrorSound().playSound(placed.getLocation());
144+
OreGinSoundCollection.getErrorSound().playSound(placed.getLocation());
145145
event.getPlayer().sendMessage(ChatColor.RED + "Space above OreGin must be empty!");
146146
event.setCancelled(true);
147147
}
@@ -153,7 +153,7 @@ public void OreGinPlaced(BlockPlaceEvent event)
153153
* Helps with organizing inventory
154154
*/
155155
@EventHandler
156-
public void MovedOreGin(InventoryClickEvent event)
156+
public void movedOreGin(InventoryClickEvent event)
157157
{
158158
ItemStack cursorItem = event.getCursor();
159159
ItemStack slotItem = event.getCurrentItem();
@@ -162,7 +162,7 @@ public void MovedOreGin(InventoryClickEvent event)
162162
{
163163
if (slotItem.getType() == Material.DISPENSER)
164164
{
165-
if (oreGinMan.IsOreGin(cursorItem) || oreGinMan.IsOreGin(slotItem))
165+
if (oreGinMan.isOreGin(cursorItem) || oreGinMan.isOreGin(slotItem))
166166
{
167167
if ((cursorItem.getItemMeta().getDisplayName() != slotItem.getItemMeta().getDisplayName())
168168
|| cursorItem.getItemMeta().getLore() != slotItem.getItemMeta().getLore())
@@ -180,17 +180,17 @@ public void MovedOreGin(InventoryClickEvent event)
180180
* Maintains the OreGin lights stable
181181
*/
182182
@EventHandler
183-
public void KeepLightsStable(BlockRedstoneEvent event)
183+
public void keepLightsStable(BlockRedstoneEvent event)
184184
{
185185
if (event.getBlock().getType().equals(OreGinPlugin.LIGHT_ON) || event.getBlock().getType().equals(OreGinPlugin.LIGHT_OFF))
186186
{
187-
if (oreGinMan.OreGinLightExistsAt(event.getBlock().getLocation()))
187+
if (oreGinMan.oreGinLightExistsAt(event.getBlock().getLocation()))
188188
{
189-
if (oreGinMan.GetOreGin(event.getBlock().getRelative(BlockFace.DOWN).getLocation()).getMining())
189+
if (oreGinMan.getOreGin(event.getBlock().getRelative(BlockFace.DOWN).getLocation()).getMining())
190190
{
191191
event.setNewCurrent(1);
192192
}
193-
else if (!oreGinMan.GetOreGin(event.getBlock().getRelative(BlockFace.DOWN).getLocation()).getBroken())
193+
else if (!oreGinMan.getOreGin(event.getBlock().getRelative(BlockFace.DOWN).getLocation()).getBroken())
194194
{
195195
event.setNewCurrent(0);
196196
}
@@ -202,9 +202,9 @@ else if (!oreGinMan.GetOreGin(event.getBlock().getRelative(BlockFace.DOWN).getLo
202202
* Stops OreGins from dispensing fuel or materials
203203
*/
204204
@EventHandler
205-
public void OreGinDispense(BlockDispenseEvent event)
205+
public void oreGinDispense(BlockDispenseEvent event)
206206
{
207-
event.setCancelled(oreGinMan.OreGinExistsAt(event.getBlock().getLocation()));
207+
event.setCancelled(oreGinMan.oreGinExistsAt(event.getBlock().getLocation()));
208208
}
209209

210210

src/com/github/MrTwiggy/OreGin/OreGinManager.java

+22-30
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ public void updateOreGins()
5656
public void run()
5757
{
5858
blockBreaksDuringCycle = 0;
59-
UpdateOreGins();
59+
for (OreGin oreGin : oreGins)
60+
{
61+
oreGin.update();
62+
}
6063
}
6164
}, 0L, OreGinPlugin.UPDATE_CYCLE);
6265
}
@@ -100,7 +103,7 @@ public void load(File file) throws IOException
100103
boolean broken = Boolean.parseBoolean(parts[8]);
101104

102105
OreGin oreGin = new OreGin(blockBreaks, tierLevel, mining, broken, miningDistance, oreGinLocation, this);
103-
AddOreGin(oreGin);
106+
addOreGin(oreGin);
104107
}
105108

106109
OreGinPlugin.sendConsoleMessage("Successfully loaded " + oreGins.size() + " Ore Gins!");
@@ -144,56 +147,45 @@ public void save(File file) throws IOException {
144147
bufferedWriter.flush();
145148
fileOutputStream.close();
146149
}
147-
148-
/**
149-
* Updates all the OreGins
150-
*/
151-
public void UpdateOreGins()
152-
{
153-
for (OreGin oreGin : oreGins)
154-
{
155-
oreGin.update();
156-
}
157-
}
158-
150+
159151
/**
160152
* Attempts to create an OreGin at the location and returns result message
161153
*/
162-
public String CreateOreGin(Location machineLocation)
154+
public String createOreGin(Location machineLocation)
163155
{
164156
OreGinProperties desiredTierProperties = OreGinPlugin.Ore_Gin_Properties.get(1);
165-
Material upgradeMaterial = desiredTierProperties.GetUpgradeMaterial();
157+
Material upgradeMaterial = desiredTierProperties.getUpgradeMaterial();
166158

167-
if (OreGin.validOreGinCreationLocation(machineLocation))
159+
if (OreGin.isValidOreGinCreationLocation(machineLocation))
168160
{
169-
if (!OreGinExistsAt(machineLocation) && OreGin.validUpgrade(machineLocation, 1))
161+
if (!oreGinExistsAt(machineLocation) && OreGin.isValidUpgrade(machineLocation, 1))
170162
{
171163
OreGin oreGin = new OreGin(machineLocation, this);
172-
AddOreGin(oreGin);
164+
addOreGin(oreGin);
173165
oreGin.removeUpgradeMaterial(1);
174166
plugin.getLogger().info("New OreGin created!");
175167
return ChatColor.GREEN + "Successfully created OreGin!";
176168
}
177169
else
178170
{
179-
OreGinSoundCollection.ErrorSound().playSound(machineLocation);
180-
return ChatColor.RED + "Missing creation materials! " + OreGin.requiredAvailableMaterials(desiredTierProperties.GetUpgradeAmount(),
171+
OreGinSoundCollection.getErrorSound().playSound(machineLocation);
172+
return ChatColor.RED + "Missing creation materials! " + OreGin.getRequiredAvailableMaterials(desiredTierProperties.getUpgradeAmount(),
181173
upgradeMaterial, machineLocation);
182174
}
183175
}
184176
else
185177
{
186-
OreGinSoundCollection.ErrorSound().playSound(machineLocation);
178+
OreGinSoundCollection.getErrorSound().playSound(machineLocation);
187179
return ChatColor.RED + "Space above OreGin must be empty!";
188180
}
189181
}
190182

191183
/**
192184
* Attempts to create an OreGin of given OreGin data
193185
*/
194-
public boolean AddOreGin(OreGin oreGin)
186+
public boolean addOreGin(OreGin oreGin)
195187
{
196-
if(oreGin.getLocation().getBlock().getType().equals(Material.DISPENSER) && !OreGinExistsAt(oreGin.getLocation()))
188+
if(oreGin.getLocation().getBlock().getType().equals(Material.DISPENSER) && !oreGinExistsAt(oreGin.getLocation()))
197189
{
198190
oreGins.add(oreGin);
199191
return true;
@@ -207,7 +199,7 @@ public boolean AddOreGin(OreGin oreGin)
207199
/**
208200
* Returns the OreGin with a matching Location, if any
209201
*/
210-
public OreGin GetOreGin(Location machineLocation)
202+
public OreGin getOreGin(Location machineLocation)
211203
{
212204
for (OreGin oreGin : oreGins)
213205
{
@@ -229,15 +221,15 @@ public void removeOreGin(OreGin oreGin)
229221
/**
230222
* Returns whether an OreGin exists at the given Location
231223
*/
232-
public boolean OreGinExistsAt(Location machineLocation)
224+
public boolean oreGinExistsAt(Location machineLocation)
233225
{
234-
return (GetOreGin(machineLocation) != null);
226+
return (getOreGin(machineLocation) != null);
235227
}
236228

237229
/**
238230
* Returns whether item is an OreGin
239231
*/
240-
public boolean IsOreGin(ItemStack item)
232+
public boolean isOreGin(ItemStack item)
241233
{
242234
boolean result = false;
243235

@@ -259,9 +251,9 @@ public boolean IsOreGin(ItemStack item)
259251
/**
260252
* Returns whether location contains an OreGin light
261253
*/
262-
public boolean OreGinLightExistsAt(Location lightLocation)
254+
public boolean oreGinLightExistsAt(Location lightLocation)
263255
{
264-
return (OreGinExistsAt(lightLocation.getBlock().getRelative(BlockFace.DOWN).getLocation())
256+
return (oreGinExistsAt(lightLocation.getBlock().getRelative(BlockFace.DOWN).getLocation())
265257
&& (lightLocation.getBlock().getType().equals(OreGinPlugin.LIGHT_OFF)
266258
|| lightLocation.getBlock().getType().equals(OreGinPlugin.LIGHT_ON)));
267259
}

src/com/github/MrTwiggy/OreGin/OreGinPlugin.java

+15-15
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void onEnable()
5656

5757
getConfig().options().copyDefaults(true);
5858
Ore_Gin_Properties = new HashMap<Integer,OreGinProperties>();
59-
InitializeOreGinProperties();
59+
initializeOreGinProperties();
6060

6161
oreGinMan = new OreGinManager(this);
6262
oreGinListener = new OreGinListener(oreGinMan);
@@ -83,7 +83,7 @@ public void onDisable()
8383
* Initializes the default OreGinProperties from config
8484
*/
8585
@SuppressWarnings("unchecked")
86-
public void InitializeOreGinProperties()
86+
public void initializeOreGinProperties()
8787
{
8888
//Load general config values
8989
OreGinPlugin.UPDATE_CYCLE = getConfig().getInt("general.update_cycle");
@@ -137,18 +137,18 @@ public void InitializeOreGinProperties()
137137
//Load OreGin tier properties
138138
for (int i = 1; i <= OreGinPlugin.MAX_TIERS; i++)
139139
{
140-
int max_mining_distance = getConfig().getInt(OreGinPropertiesPathStart(i) + "max_mining_distance");
141-
int max_block_breaks= getConfig().getInt(OreGinPropertiesPathStart(i) + "max_block_breaks");
142-
int mining_delay= getConfig().getInt(OreGinPropertiesPathStart(i) + "mining_delay");
143-
boolean retrieve_valuables = getConfig().getBoolean(OreGinPropertiesPathStart(i) + "retrieve_valuables");
144-
Material fuel_type = Material.valueOf(getConfig().getString(OreGinPropertiesPathStart(i) + "fuel_type"));
145-
int fuel_amount= getConfig().getInt(OreGinPropertiesPathStart(i) + "fuel_amount");
146-
Material upgrade_material = Material.valueOf(getConfig().getString(OreGinPropertiesPathStart(i) + "upgrade_material"));
147-
int upgrade_amount = getConfig().getInt(OreGinPropertiesPathStart(i) + "upgrade_amount");
148-
Material repair_material = Material.valueOf(getConfig().getString(OreGinPropertiesPathStart(i) + "repair_material"));
149-
int repair_amount = getConfig().getInt(OreGinPropertiesPathStart(i) + "repair_amount");
150-
int shaft_width = getConfig().getInt(OreGinPropertiesPathStart(i) + "shaft_width");
151-
int shaft_height = getConfig().getInt(OreGinPropertiesPathStart(i) + "shaft_height");
140+
int max_mining_distance = getConfig().getInt(getOreGinPropertiesPathStart(i) + "max_mining_distance");
141+
int max_block_breaks= getConfig().getInt(getOreGinPropertiesPathStart(i) + "max_block_breaks");
142+
int mining_delay= getConfig().getInt(getOreGinPropertiesPathStart(i) + "mining_delay");
143+
boolean retrieve_valuables = getConfig().getBoolean(getOreGinPropertiesPathStart(i) + "retrieve_valuables");
144+
Material fuel_type = Material.valueOf(getConfig().getString(getOreGinPropertiesPathStart(i) + "fuel_type"));
145+
int fuel_amount= getConfig().getInt(getOreGinPropertiesPathStart(i) + "fuel_amount");
146+
Material upgrade_material = Material.valueOf(getConfig().getString(getOreGinPropertiesPathStart(i) + "upgrade_material"));
147+
int upgrade_amount = getConfig().getInt(getOreGinPropertiesPathStart(i) + "upgrade_amount");
148+
Material repair_material = Material.valueOf(getConfig().getString(getOreGinPropertiesPathStart(i) + "repair_material"));
149+
int repair_amount = getConfig().getInt(getOreGinPropertiesPathStart(i) + "repair_amount");
150+
int shaft_width = getConfig().getInt(getOreGinPropertiesPathStart(i) + "shaft_width");
151+
int shaft_height = getConfig().getInt(getOreGinPropertiesPathStart(i) + "shaft_height");
152152

153153
Ore_Gin_Properties.put(i, new OreGinProperties(max_mining_distance, max_block_breaks,
154154
mining_delay, retrieve_valuables, fuel_amount, fuel_type, shaft_width, shaft_height,
@@ -162,7 +162,7 @@ public void InitializeOreGinProperties()
162162
/**
163163
* Returns the path for tier level starts
164164
*/
165-
public String OreGinPropertiesPathStart(int tierLevel)
165+
public String getOreGinPropertiesPathStart(int tierLevel)
166166
{
167167
return "oregin_tier_properties.tier" + tierLevel + ".";
168168
}

0 commit comments

Comments
 (0)