krzysek 73 Opublikowano 3 lutego 2019 Udostępnij Opublikowano 3 lutego 2019 (edytowane) PropertyGuildsSystem gildii na serwer Minecraft 1.13.2(nie jest to finalna forma PropertyGuilds, jej ostateczna forma może znacznie odbiegać od aktualnej) Wymagane pluginy: NameManager (https://www.spigotmc.org/resources/namemanager.5147/) Inne wymagania: MySQL Uprawnienia: propertyguilds.default - podstawowy dostęp propertyguilds.reload - dostęp do komendy /guilds reload Komendy: /guilds - pomoc PropertyGuilds /guilds items - gui z przedmiotami potrzebnymi do utworzenia gildii /guilds create [tag] [nazwa] - tworzenie gildii /guilds invite [nick] - zaprasza gracza do gildii /guilds accept [tag] - akceptuje zaproszenie do gildii /guilds decline [tag] - odrzuca zaproszenie do gildii /guilds kick [nick] - wyrzuca gracza z gildii /guilds ally invite [tag] - zaprasza gildię do sojuszu /guilds ally accept [tag] - akceptuje zaproszenie do sojuszu gildii /guilds ally decline [tag] - odrzuca zaproszenie do sojuszu gildii /guilds ally remove [tag] - zrywa sojusz z gildią /guilds leave - opuszcza gildię /guilds delete [tag] - usuwa gildię /guilds info [tag*] - pokazuje informacje o gildii (podanie [tag]'u gildii nie jest wymagane) /guilds base - teleportuje to bazy gildii /guilds chat [global/guild/ally] - przełącza pomiędzy chatem (globalnym, gildii, sojuszników) /guilds top - pokazuje top 10 gildii /guilds reload - przeładowywuje pliki konfiguracyjne PropertyGuilds Plik konfiguracyjny (config.yml): # PropertyGuilds plugin # version: 0.1 # core: 1.13.2 # © loonypl (/deew, mc: krzysek) # Permissions: propertyguilds.default, propertyguilds.reload # MySQL configuration # host - MySQL server address # port - MySQL server port # user - MySQL server user # password - MySQL server password # database - the database must be create before plugin installation mysql: host: 'localhost' port: '3306' user: 'root' password: '123' database: 'PropertyGuilds_plugin' # chat: # Enable chat formatting (color messages - propertyguilds.chatcolor) enable: true # Chat format # %guild-tag%, %guild-name%, %guild-points%, %name%, %kills%, %deaths%, %points%, %world%, %message% format: '&8[&c&f%guild-tag%&8] &8[&6%points%&8] &r%name% &6> &r%message%' guild-chat: # Guild chat format # %guild-tag%, %guild-name%, %guild-points%, %name%, %kills%, %deaths%, %points%, %world%, %message% format: '&c&l%guild-tag% &r%name% &6> &r&o%message%' ally-chat: # Ally chat format # %guild-tag%, %guild-name%, %guild-points%, %name%, %kills%, %deaths%, %points%, %world%, %message% format: '&a&l%guild-tag% &r%name% &6> &r&o%message%' create-require-items: # Need items for creating guild enable: true # Gui size gui-size: 9 # Items needed for creating guild (creating-require-items: true) list: - '16@DIAMOND' - '32@OBSIDIAN' guild: # Tag lengths tag: # Min tag length min: 3 # Max tag length max: 6 # Name lengths name: # Min name length min: 3 # Max name length max: 16 # Property property: # Property radius radius: 10 # World's spawn protection radius spawn-radius: 500 # Points points: # Amount of guild points that guild starts with default: 0 # Actions after successfully creating guild create: # Broadcast opts broadcast: # Send broadcast message enable: true # Private opts private: # Send private message enable: false # Actions after successfully deleting guild delete: # Broadcast opts broadcast: # Send broadcast message enable: true # Private opts private: # Send private message enable: false # Blocks options blocks: # Chests chests: # Allow chests opening allow-open: false # Cooldowns cooldowns: # Base teleportation cooldown base-teleport: 5 # Damage damage: # Allow to deal damage between guild members friendly-fire: enable: false # Allow to deal damage between alliances alliances: enable: false # Points points: # Points for kill kill: # Points for killing player without guild player-without-guild: 5 # Points for killing player with guild player-with-guild: 10 # Points for kill that goes to player's guild [is he has] to-guild: 5 # Points for death death: # Points for death (player without guild) player-without-guild: -5 # Points for death (player with guild) player-with-guild: -10 # Points for death that goes to player's guild [if he has] to-guild: -5 Plik konfiguracyjny (lang.yml): # PropertyGuilds plugin # version: 0.1 # core: 1.13.2 # © loonypl (/deew, mc: krzysek) # Permissions: propertyguilds.default, propertyguilds.reload console-execute: 'You cannot execute this command from console state' no-permission: '&cYou do not have access to this command' wrong-syntax: '&cWrong syntax ! &f/guilds' plugin-reload: '&aPlugin has been reloaded' guilds-help: - '&e/guilds &7- &fGuilds help' - '&e/guilds items &7- &fItems needed for creating guild' - '&e/guilds create [tag] [name] &7- &fCreate guild' - '&e/guilds invite [nick] &7- &fInvite player to guild' - '&e/guilds accept [tag] &7- &fAccept guild invite' - '&e/guilds decline [tag] &7- &fDecline guild invite' - '&e/guilds ally invite [tag] &7- &fSent ally invite to guild' - '&e/guilds ally accept [tag] &7- &fAccept guild ally invite' - '&e/guilds ally decline [tag] &7- &fDecline guild ally invite' - '&e/guilds ally remove [tag] &7- &fRemove guild ally' - '&e/guilds leave &7- &fLeave guild' - '&e/guilds kick [nick] &7- &fKick guild member' - '&e/guilds delete [tag] &7- &fDelete guild' - '&e/guilds info [tag] &7- &fGuild info' - '&e/guilds base &7- &fTeleport to guild base' - '&e/guilds chat [global/guild/ally] &7- &fSwitch between chats' - '&e/guilds top &7- &fTop 10 guilds' - '&e/guilds reload &7- &fReload plugin' none-create-require-items: '&cYou do not need any items for creating guild' create-require-items-gui-name: '&a&lRequired items' has-guild: '&cYou are already in guild' has-not-guild: '&cYou do not belong to any guild' guild-not-exists: '&cGuild %tag% does not exists' cannot-break: '&cThis block belongs to guild property' guild: tag: length: '&cTag length must be &f>= %min% &cand &f<= %max%' exists: '&cGiven tag is already in-use' name: length: '&cName length must be &f>= %min% &cand &f<= %max%' exists: '&cGiven name is already in-use' property: exists: '&cYou can not create guild on property of another one' too-close: '&cYou are too close to property of another guild. You have to be at least &f%distance% &cblocks away from there' too-close-spawn: '&cYou are too close to spawn. You have to be at least &f%distance% &cblocks away from spawn' entered: '&cYou entered &7%tag% &cguild property' left: '&aYou left &7%tag% &aguild property' items: not-enough: '&cYou dont have enough items to create guild &f/guilds items' create: broadcast: message: '&8[&f%tag%&8] &f%name% &aguild has been created by &f%leader% &a!' private: enable: true message: '&8[&f%tag%&8] &f%name% &aguild has been created by &f%leader% &a!' delete: not-leader: '&cYou are not leader of this guild' broadcast: message: '&8[&f%tag%&8] &f%name% &cguild has been deleted by &f%leader% &c!' private: enable: true message: '&8[&f%tag%&8] &f%name% &cguild has been deleted by &f%leader% &c!' blocks: chests: cannot-open: '&cYou can not open chests that belongs to other guilds' teleport: base: remaining: '&aYou will be teleported to guild base in &f%time% seconds&a. Do not move' abort: '&cBase teleportation has been aborted' done: '&aYou have been teleported to your guild base' already: '&aWait for teleport. Do not move' chat: global-toggle: '&aToggled to global chat' guild-toggle: '&aToggled to guild chat' ally-toggle: '&aToggled to ally chat' invite: not-leader: '&cYou are not leader of your guild' offline: '&cThere is no online player with this nickname' has-guild: '&cThis player already has guild' already: '&cThis player is already invited' sent: '&aYou have invited &f%invited% &ato guild' recieved: '&aYou have been invited to &f%guild% &aguild' already-member: '&cYou are already in guild' guild-not-exists: '&cGuild with this tag does not exists' not-invited: '&cYou have not been invited to this guild' accepted: '&f%invited% &aaccepted invitation to guild' success-accepted: '&aYou have accepted &f%guild% &aguild invite' declined: '&f%invited% &cdeclined invitation to guild' success-declined: '&cYou have declined &f%guild% &cguild invite' leave: leader: '&cYou can not leave a guild while being its leader' left: '&cYou have left &f%guild% &cguild' broadcast: enable: true left: '&f%player% &cleft &f%guild% &cguild' kick: leader: '&cYou are not guild leader' has-not-guild: '&cThis player has not guild' not-belong: '&cThis player do not belong to your guild' leader-given: '&cYou can not kick leader' kicked: '&f%player% &chas been kicked from your guild' kick-recieve: '&cYou have been kicked from &f%guild% &cguild' damage: friendly-fire: message: '&cYou can not hurt guild members' alliances: message: '&cYou can not hurt alliances of your guild' ally: leader: '&cYou are not guild leader' guild-not-exists: '&cGuild with this tag does not exists' already-allied: '&cYour guild is already allied with this guild' already-sent: '&cYour guild have already sent ally invite to this guild' leader-not-online: '&cLeader of &f%guild% &cguild is not online' own-guild: '&cYou can not sent ally invite to your own guild' sent: '&aAlly invitation has been sent to &f%guild% &aguild' ally-recieve: '&f%guild% &ahas sent your guild ally invitation' not-recieved: '&cYour guild has not recieved ally invitation from this guild' declined: '&cYour guild has declined ally invitation from &f%guild% &cguild' accepted: '&aYour guild has accepted ally invitation form &f%guild% &aguild' accepted-recieve: '&f%guild% &aguild has accepted your guild ally invitation' not-allied: '&cYour guild has not allied with &f%guild% &cguild' remove: removed-ally: '&cYour guild has removed guild ally &f%guild%' broadcast: enable: true message: '&f%remover% &cguild has removed guild ally with &f%ally% &cguild' guild-info: tag: 'Tag' name: 'Name' leader: 'Leader' members-list: 'Members list' alliances-list: 'Alliances list' members: 'Members' alliances: 'Alliances' points: 'Points' Mediafire: http://www.mediafire.com/file/4g78tc9tnqg2y1l/PropertyGuilds.jar/file Skan linku: https://www.virustotal.com/pl/url/cdd3182abbd323471b752848907ca8bc511904ae6261862423e94e1919d8282c/analysis/1549231392/ Skan .jar: https://www.virustotal.com/pl/file/c790f60f3f43731f02d3ad16218f6daa6e4eb59a5ba0d287ad81932801413d42/analysis/1549231352/ Masz jakieś pomysły, problemy, uwagi ? Podziel się nimi: https://github.com/loonypl/PropertyGuilds/issues Zanim coś napiszesz, sprawdź zakładkę https://github.com/loonypl/PropertyGuilds/issues Edytowane 10 lutego 2019 przez krzysek update 0.1.1 Wariat33 1 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/ Udostępnij na innych stronach Więcej opcji udostępniania...
kerpson 551 Opublikowano 4 lutego 2019 Udostępnij Opublikowano 4 lutego 2019 Ogólnie plugin dosyć fajny ale brakuje mi tu smaczka jak EventPriority w listenerach krzysek 1 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205071 Udostępnij na innych stronach Więcej opcji udostępniania...
krzysek 73 Opublikowano 4 lutego 2019 Autor Udostępnij Opublikowano 4 lutego 2019 4 godziny temu, HotAngel2K17 napisał: Ogólnie plugin dosyć fajny ale brakuje mi tu smaczka jak EventPriority w listenerach dodano kerpson 1 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205078 Udostępnij na innych stronach Więcej opcji udostępniania...
Ixidi 719 Opublikowano 4 lutego 2019 Udostępnij Opublikowano 4 lutego 2019 Robisz operacje na bazie danych w głównym wątku serwera, nie jest to dobry pomysł :V krzysek i yooniks 1 1 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205079 Udostępnij na innych stronach Więcej opcji udostępniania...
yooniks 347 Opublikowano 5 lutego 2019 Udostępnij Opublikowano 5 lutego 2019 (edytowane) W dniu 4.02.2019 o 09:10, HotAngel2K17 napisał: Ogólnie plugin dosyć fajny ale brakuje mi tu smaczka jak EventPriority w listenerach po co tu priorytety xd jak juz to ja bym chyba wolal dac na lowest zeby lepiej sprawdzalo czy event zostal juz zcancelowany, zeby kazdy inny listener w innych pluginach poszedl predzej bo moga cos zmieniac itd(chyba że to na odwrót było to uj) a tak to jak najbardziej to co napisal Ixidi, szczegolow takich jak logika w getterach itd. juz nie bede wymienial bo to chyba nie ma sensu ale jednego nie rozumiem xd - obiekt guild jest w utilsach, public void addMember(final String member) { String members = getInfo("members"); String members_list = getInfo("members_list"); MySQL mysql = PropertyGuilds.getInstance().getMySQL(); try { PreparedStatement ps = mysql.getConnection().prepareStatement( "UPDATE `guilds` SET `members`=?, `members_list`=? WHERE `tag`='" + this.tag + "'" ); ps.setInt(1, Integer.parseInt(members) + 1); ps.setString(2, members_list + ";" + member); ps.executeUpdate(); ps.close(); } catch (SQLException e) { e.printStackTrace(); } } public String getInfo(final String info) { MySQL mysql = PropertyGuilds.getInstance().getMySQL(); try { PreparedStatement checkStatement = mysql.getConnection().prepareStatement( "SELECT * FROM `guilds` WHERE tag=?" ); checkStatement.setString(1, this.tag); ResultSet result = checkStatement.executeQuery(); String has; if (result.next()) { String str = result.getString(info); if (result.wasNull()) has = null; else has = str; } else return null; checkStatement.close(); result.close(); return has; } catch (SQLException e) { e.printStackTrace(); } return null; } taki obiekt powinien byc budowany tylko raz, np. przy onenable, w ladowaniu wsyzstkich gildii (a np. gracz przy wejsciu, lub tez onenable), a ty za kazdym razem robisz tak: @EventHandler(priority = EventPriority.HIGH) public void playerDeath(final PlayerDeathEvent e) { if (e.getEntity().getKiller() != null) { ConfigUtils config = new ConfigUtils(ConfigMessageType.CONFIG); User user = new User(e.getEntity()); User killer = new User(e.getEntity().getKiller()); if (user.hasGuild()) { killer.updateStats("points", config.getInt("points.kill.player-with-guild")); user.updateStats("points", config.getInt("points.death.player-with-guild")); if (killer.hasGuild()) new Guild(killer.getGuild()).points(config.getInt("points.kill.to-guild")); new Guild(user.getGuild()).points(config.getInt("points.death.to-guild")); } no i do tego config tez budowany caly czas od nowa xd protected String tag, name, leader, members_list, alliances_list, location; zamiast np. member_list sprowadzac z bazy (ze stringa) do listy i pozniej mozesz nawet z tego wyciagnac wielkoscl isty, latwiej loopowac memberow itd. to ty za kazdym razem dodajesz po prostu do stringa ":" + nick, jak dla mnie to bardzo duzo do zmiany. tymbardziej ze te akcje ktore musisz wykonac asynchronicznie - nie wiem jak toz robisz bo masz bardzo dziwnie i przy kazdym getterze wykonujesz nowe zapytanei do bazy zamiast pobierac obecne i tylko przy wylaczeniu pluginu zapisywac/updateowac - i to dopiero po sprawdzaniu chyba 2-4 klas Edytowane 5 lutego 2019 przez yooniks krzysek 1 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205153 Udostępnij na innych stronach Więcej opcji udostępniania...
Kamilkime 24 Opublikowano 5 lutego 2019 Udostępnij Opublikowano 5 lutego 2019 Ciągłe wysyłanie danych do bazy (lub ciągłe pobieranie z niej), brak lokalnego przechowywania danych w np. bazie sqlite, ogromne schodki zagnieżdżeń kodu w komendach, robienie nowych obiektów ciągle (np. w https://github.com/loonypl/PropertyGuilds/blob/master/src/amao/krzysek/propertyguilds/utils/guild/Guild.java#L252), ciągłe pobieranie danych z configu... No, może i ten plugin działa, ale na pewno nie działa wydajnie i zakładam, że przy większej ilości graczy mógłby nieźle lagować Patrząc na kod pluginu - nie polecam używania go, lepiej poszukać innego, który będzie lepiej napisany krzysek, Peridot i Dawon123 3 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205185 Udostępnij na innych stronach Więcej opcji udostępniania...
krzysek 73 Opublikowano 10 lutego 2019 Autor Udostępnij Opublikowano 10 lutego 2019 Update 0.1.1 Usprawniono pobieranie danych z plików konfiguracyjnych; Zmieniono kolejność ładowania pluginu na POSTWORLD; TODO: Usprawnić pobieranie danych z bazy danych MySQL; https://github.com/loonypl/PropertyGuilds Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205498 Udostępnij na innych stronach Więcej opcji udostępniania...
Queito 104 Opublikowano 10 lutego 2019 Udostępnij Opublikowano 10 lutego 2019 16 minut temu, krzysek napisał: Update 0.1.1 Usprawniono pobieranie danych z plików konfiguracyjnych; Zmieniono kolejność ładowania pluginu na POSTWORLD; TODO: Usprawnić pobieranie danych z bazy danych MySQL; https://github.com/loonypl/PropertyGuilds Powinien być update 0.0.0.0.1 Po co tworzysz taki obiekt public class User { protected Player player; public User(final Player player) { this.player = player; } skoro po prostu mozesz uzywac playera? XD nwse 1 Cytuj Odnośnik do komentarza https://skript.pl/temat/31608-propertyguilds-system-gildii-dla-serwera-minecraft-1132/#findComment-205500 Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi
Dołącz do dyskusji
Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.