Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Starting 1.3
Browse files Browse the repository at this point in the history
Adding Guide to work with the project
Fixing NPE on utilities
Formatting the code
  • Loading branch information
nightw0lv committed Apr 6, 2021
1 parent aa2d159 commit e024e5c
Show file tree
Hide file tree
Showing 967 changed files with 99,246 additions and 99,583 deletions.
11 changes: 11 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Guide/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Guide/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions Guide/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
How to make your own sources and use them
1) Download and install intellij
2) Make a folder called iTopZ-Java
3) Download the sources like in image below
![https://prnt.sc/w6zkpg](0.png)
4) Open the folder with the extracted items
![https://prnt.sc/w6zkpg](1.png)
5) The files should look now like this
![https://prnt.sc/w6zkpg](2.png)
6) Select project and in top menu select Build and then Build artifacts
![https://prnt.sc/w6zkpg](3.png)
7) A new menu will open you can either build all or select the one you want
![https://prnt.sc/w6zkpg](4.png)
8) Finally, you can find the build jar inside "out" folder
9) Copy it on your sources usually on lib or libs folder inside eclipse
10) Right click on it -> add to class path
11) Go in your GameServer.java and somewhere call it as VDSystemManager.getInstance();
12) press ctrl+shift+o to import it and build your server

Notes
1) You can replace jars of any project with newer or older and try to apply the project on that jar
2) The VDSystem isn't require any project source only a l2jserver.jar file
3) A successful build look like this
![https://prnt.sc/w6zkpg](5.png)
4) Here you can see the installed modules
![https://prnt.sc/w6zkpg](6.png)
5) Here you can edit the l2jserver jar libraries
![https://prnt.sc/w6zkpg](7.png)
6) Here are the artifacts that consist the build function
![https://prnt.sc/w6zkpg](8.png)
7) Here you can see and verify the installed JDK versions or point out the already installed paths
![https://prnt.sc/w6zkpg](9.png)
8) You need to have installed and set on project the following JDK versions 1.7, 1.8, 11, 14, 15
![https://prnt.sc/w6zkpg](10.png)
9) Here are the vendors that you can download the JDK versions
![https://prnt.sc/w6zkpg](11.png)
That's it, you now can have your own build remove unnecessary projects.

Wanna help maintain and keep the project alive donate [here](https://paypal.me/top100) or
<a href="https://www.buymeacoffee.com/night" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
885 changes: 442 additions & 443 deletions HighFive/FandC/src/itopz/com/Configurations.java

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions HighFive/FandC/src/itopz/com/VDSystemManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
* iToPz Discord: https://discord.gg/KkPms6B5aE
* @Author Rationale
* Base structure credits goes on Rationale Discord: Rationale#7773
*
* <p>
* Vote Donation System
* Script website: https://itopz.com/
* Script version: 1.2
* Pack Support: FandC H5
*
* <p>
* Personal Donate Panels: https://www.denart-designs.com/
* Free Donate panel: https://itopz.com/
*/
Expand Down
12 changes: 6 additions & 6 deletions HighFive/FandC/src/itopz/com/command/VoteCMD.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
* iToPz Discord: https://discord.gg/KkPms6B5aE
* @Author Rationale
* Base structure credits goes on Rationale Discord: Rationale#7773
*
* <p>
* Vote Donation System
* Script website: https://itopz.com/
* Script version: 1.2
* Pack Support: FandC H5
*
* <p>
* Personal Donate Panels: https://www.denart-designs.com/
* Free Donate panel: https://itopz.com/
*/
Expand All @@ -67,7 +67,7 @@ public class VoteCMD implements IVoicedCommandHandler
// commands
public final static String[] COMMANDS =
{
"itopz", "hopzone", "l2jbrasil", "l2network", "l2topgameserver", "l2topservers", "l2votes"
"itopz", "hopzone", "l2jbrasil", "l2network", "l2topgameserver", "l2topservers", "l2votes"
};

@Override
Expand Down Expand Up @@ -105,7 +105,7 @@ public boolean useVoicedCommand(String command, Player player, String s1)
/**
* Validate user
*
* @param player object
* @param player object
* @param TOPSITE string
* @return boolean
*/
Expand Down Expand Up @@ -149,7 +149,7 @@ private boolean playerChecksFail(final Player player, final String TOPSITE)
/**
* Execute individual response and reward player on success
*
* @param player object
* @param player object
* @param TOPSITE string
*/
private void Execute(final Player player, final String TOPSITE)
Expand Down Expand Up @@ -266,7 +266,7 @@ private void reward(final Player player, final String TOPSITE)
* Send message to player
*
* @param player object
* @param s string
* @param s string
*/
private void sendMsg(final Player player, final String s)
{
Expand Down
146 changes: 72 additions & 74 deletions HighFive/FandC/src/itopz/com/donate/DonateTaskManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,95 +43,93 @@
* iToPz Discord: https://discord.gg/KkPms6B5aE
* @Author Rationale
* Base structure credits goes on Rationale Discord: Rationale#7773
*
* <p>
* Vote Donation System
* Script website: https://itopz.com/
* Script version: 1.2
* Pack Support: FandC H5
*
* <p>
* Personal Donate Panels: https://www.denart-designs.com/
* Free Donate panel: https://itopz.com/
*/
public class DonateTaskManager implements Runnable
{
// logger
private static final Logs _log = new Logs(DonateTaskManager.class.getSimpleName());
// logger
private static final Logs _log = new Logs(DonateTaskManager.class.getSimpleName());

private final String DELETE = "DELETE FROM donate_holder WHERE no=? LIMIT 1";
private final String SELECT = "SELECT no, id, count, playername FROM donate_holder";
private final String DELETE = "DELETE FROM donate_holder WHERE no=? LIMIT 1";
private final String SELECT = "SELECT no, id, count, playername FROM donate_holder";

@Override
public void run()
{
start();
}
@Override
public void run()
{
start();
}

/**
* reward player if donation is received
*/
private void start()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement(SELECT);
ResultSet rset = statement.executeQuery())
{
while (rset.next())
{
final Player player = GameObjectsStorage.getPlayer(rset.getString("playername"));
final int no = rset.getInt("no");
final int id = rset.getInt("id");
final int count = rset.getInt("count");
/**
* reward player if donation is received
*/
private void start()
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement(SELECT);
ResultSet rset = statement.executeQuery())
{
while (rset.next())
{
final Player player = GameObjectsStorage.getPlayer(rset.getString("playername"));
final int no = rset.getInt("no");
final int id = rset.getInt("id");
final int count = rset.getInt("count");

Optional.ofNullable(player).ifPresent(s->
{
if (removeDonation(no))
{
final ItemTemplate item = ItemHolder.getInstance().getTemplate(id);
Optional.ofNullable(player).ifPresent(s ->
{
if (removeDonation(no))
{
final ItemTemplate item = ItemHolder.getInstance().getTemplate(id);

if (Objects.nonNull(item))
{
Gui.getInstance().ConsoleWrite("Donation: " + player.getName() + " received " + count + "x " + item.getName());
Functions.addItem(player, id, count, true, "Donation");
player.sendActionFailed();
}
}
});
}
}
catch (final Exception e)
{
String error = e.getMessage();
_log.warn("Check donate items failed. " + error);
if (Objects.nonNull(item))
{
Gui.getInstance().ConsoleWrite("Donation: " + player.getName() + " received " + count + "x " + item.getName());
Functions.addItem(player, id, count, true, "Donation");
player.sendActionFailed();
}
}
});
}
} catch (final Exception e)
{
String error = e.getMessage();
_log.warn("Check donate items failed. " + error);

if (error.contains("doesn't exist") && error.contains("donate_holder"))
{
Utilities.deleteTable(Utilities.DELETE_DONATE_TABLE, "Donate");
Utilities.createTable(Utilities.CREATE_DONATE_TABLE, "Donate");
}
}
}
if (error.contains("doesn't exist") && error.contains("donate_holder"))
{
Utilities.deleteTable(Utilities.DELETE_DONATE_TABLE, "Donate");
Utilities.createTable(Utilities.CREATE_DONATE_TABLE, "Donate");
}
}
}

/**
* Remove donation from database
*
* @param id int
* @return boolean
*/
private boolean removeDonation(int id)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement(DELETE))
{
statement.setInt(1, id);
statement.execute();
return true;
}
catch (SQLException e)
{
_log.warn("Failed to remove donation from database of donation id: " + id);
_log.warn(e.getMessage());
}
/**
* Remove donation from database
*
* @param id int
* @return boolean
*/
private boolean removeDonation(int id)
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement(DELETE))
{
statement.setInt(1, id);
statement.execute();
return true;
} catch (SQLException e)
{
_log.warn("Failed to remove donation from database of donation id: " + id);
_log.warn(e.getMessage());
}

return false;
}
return false;
}
}
11 changes: 5 additions & 6 deletions HighFive/FandC/src/itopz/com/global/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
* iToPz Discord: https://discord.gg/KkPms6B5aE
* @Author Rationale
* Base structure credits goes on Rationale Discord: Rationale#7773
*
* <p>
* Vote Donation System
* Script website: https://itopz.com/
* Script version: 1.2
* Pack Support: FandC H5
*
* <p>
* Personal Donate Panels: https://www.denart-designs.com/
* Free Donate panel: https://itopz.com/
*/
Expand Down Expand Up @@ -310,8 +310,7 @@ private void reward(String TOPSITE)
try
{
key = Objects.requireNonNull(player.getIP(), player.getName());
}
catch(Exception e)
} catch (Exception e)
{
e.getMessage();
continue;
Expand Down Expand Up @@ -356,11 +355,11 @@ private void reward(String TOPSITE)
FINGERPRINT.clear();

// announce the reward
Utilities.announce(TOPSITE,"Thanks for voting! Players rewarded!");
Utilities.announce(TOPSITE, "Thanks for voting! Players rewarded!");
// save votes
Utilities.saveGlobalVar(TOPSITE, "votes", serverVotes);
// write on console
Gui.getInstance().ConsoleWrite(TOPSITE + ": Players rewarded!");
Gui.getInstance().ConsoleWrite(TOPSITE + ": Players rewarded!");
}

public static Global getInstance()
Expand Down
Loading

0 comments on commit e024e5c

Please sign in to comment.